Nous.PromEx.Plugin (nous v0.17.2)

Copy Markdown View Source

PromEx plugin for Nous AI agent metrics.

This plugin captures Prometheus metrics for agent execution, model requests, and tool execution based on Nous's telemetry events.

Prerequisites

This plugin requires PromEx to be available in your project. Add these dependencies to your mix.exs:

{:prom_ex, "~> 1.11"},
{:plug, "~> 1.18"}  # Required by PromEx

Usage

Add this plugin to your PromEx module:

defmodule MyApp.PromEx do
  use PromEx, otp_app: :my_app

  @impl true
  def plugins do
    [
      # ... other plugins
      {Nous.PromEx.Plugin, []}
    ]
  end
end

Configuration Options

  • :otp_app - The OTP application name (optional, defaults to PromEx module setting)
  • :metric_prefix - Custom metric prefix (optional, defaults to [:otp_app, :nous])
  • :duration_unit - Time unit for duration metrics: :second, :millisecond, :microsecond, or :nanosecond (default: :millisecond)

Exposed Metric Groups

  • :nous_agent_event_metrics - Agent execution metrics
  • :nous_model_event_metrics - Model request metrics
  • :nous_tool_event_metrics - Tool execution metrics

Metrics

Agent Metrics

  • nous_agent_run_duration - Distribution of agent run durations
  • nous_agent_run_tokens_total - Distribution of total tokens used
  • nous_agent_run_input_tokens - Distribution of input tokens
  • nous_agent_run_output_tokens - Distribution of output tokens
  • nous_agent_run_tool_calls - Distribution of tool calls per run
  • nous_agent_run_iterations - Distribution of iterations per run
  • nous_agent_run_exceptions_total - Counter of agent exceptions

Model Metrics

  • nous_model_request_duration - Distribution of model request durations
  • nous_model_request_tokens_total - Distribution of total tokens per request
  • nous_model_request_input_tokens - Distribution of input tokens per request
  • nous_model_request_output_tokens - Distribution of output tokens per request
  • nous_model_request_exceptions_total - Counter of model request exceptions
  • nous_model_stream_connect_duration - Distribution of stream connection times
  • nous_model_stream_exceptions_total - Counter of stream exceptions

Tool Metrics

  • nous_tool_execution_duration - Distribution of tool execution durations
  • nous_tool_execution_attempts - Distribution of attempts per execution
  • nous_tool_execution_exceptions_total - Counter of tool exceptions