Skip to main content
Vision Agents provides built-in observability through OpenTelemetry. Collect metrics and traces across all components to monitor performance, latency, and errors in your agents.

Quick Start

To enable metrics collection, configure OpenTelemetry:
Metrics are now available at http://localhost:9464/metrics.

MetricsCollector

The MetricsCollector records metrics via normalized on_*() hooks that plugins call directly. Each Agent creates a root collector and merges child collectors from STT, TTS, LLM, and other components during initialization, so metrics collection is enabled by default. If no OpenTelemetry providers are configured, metrics are no-ops and have no performance impact. For new integrations, prefer the collector’s normalized on_* metric hooks and agent.metrics over provider-specific event classes. Plugins record metrics through hooks such as:
  • LLMon_llm_response, on_tool_call, on_llm_error
  • STTon_stt_transcript, on_stt_error
  • TTSon_tts_synthesis, on_tts_error
  • Turn Detectionon_turn_ended
  • Realtime LLMon_realtime_audio_input/output, on_realtime_user/agent_transcription
  • VLMon_vlm_inference, on_vlm_error
  • Video Processorson_video_detection

Metric Attributes

All metrics include contextual attributes:

Metrics Reference

All metrics use the vision_agents.core meter namespace.

STT Metrics

TTS Metrics

LLM Metrics

Turn Detection Metrics

Realtime LLM Metrics

For speech-to-speech models like OpenAI Realtime:

VLM / Vision Metrics

Video Processor Metrics

AgentMetrics

For in-process metrics without external infrastructure, access aggregated metrics directly from the agent:

Available AgentMetrics

Prometheus Setup

Export metrics to Prometheus for monitoring dashboards and alerting. Step 1 — Install the exporter
Step 2 — Configure OpenTelemetry
Step 3 — Create and run your agent
View metrics at http://localhost:9464/metrics.

Tracing with Jaeger

Trace requests across components for debugging latency issues. Step 1 — Install the exporter
Step 2 — Configure tracing
Step 3 — Run Jaeger
View traces at http://localhost:16686.

Complete Example

Run with:
Metrics available at http://localhost:9464/metrics.

Example Prometheus Queries

OpenTelemetry metric names use dots (e.g., llm.latency.ms). Prometheus converts these to underscores when scraping (e.g., llm_latency_ms).
Average LLM latency over time:
Total tokens used:
Error rate:

Best Practices

Configure OpenTelemetry - Set up providers to enable metric collection. If no providers are configured, metrics are no-ops. MetricsCollector is automatic - Each Agent automatically creates a MetricsCollector internally. If no OpenTelemetry provider is configured, metrics are no-ops with no performance impact. Use AgentMetrics for simple logging - Access agent.metrics directly for in-process metrics without external infrastructure. Add resource attributes - Include service name and environment in your metrics:
Set up alerting on:
  • LLM latency > 2000ms (p95)
  • Error rate > 1%
  • Token usage anomalies

Next Steps