Skip to main content
Version: 1.0.x

Observability Options

ObservabilityOptions is a single, declarative way to enable observability features — recording, traces, metrics, and logs — directly when you start an AgentSession. Instead of toggling each feature in different places, you pass one config object to session.start() and the framework wires everything up.

Quick Start

main.py
from videosdk.agents import (
AgentSession,
ObservabilityOptions,
RecordingOptions,
TracesOptions,
MetricsOptions,
LoggingOptions,
)

session = AgentSession(agent=agent, pipeline=pipeline)

await session.start(
wait_for_participant=True,
run_until_shutdown=True,
observability=ObservabilityOptions(
recording=RecordingOptions(video=True),
traces=TracesOptions(
enabled=True,
export_url="https://otlp.example.com/v1/traces",
),
metrics=MetricsOptions(
enabled=True,
export_url="https://otlp.example.com/v1/metrics",
),
logs=LoggingOptions(enabled=True, level="DEBUG"),
),
)
tip

Each field is optional. Pass only the features you want to enable — omitted fields stay off.

ObservabilityOptions Parameters

ParameterTypeDefaultDescription
recordingOptional[RecordingOptions]NoneConfigure session recording (audio, video, screen share)
tracesOptional[TracesOptions]NoneConfigure OpenTelemetry trace collection and OTLP export
metricsOptional[MetricsOptions]NoneConfigure OpenTelemetry metric collection and OTLP export
logsOptional[LoggingOptions]NoneConfigure log level filtering and optional log export
note

TracesOptions, MetricsOptions, LoggingOptions, and RecordingOptions are the same classes used in RoomOptions. ObservabilityOptions simply lets you pass them at session.start() instead of at room construction — pick whichever entry point suits your code structure.


Recording

Provide a RecordingOptions to capture the session. Audio is recorded by default; pass additional flags to also record video and/or screen share.

RecordingOptions

ParameterTypeDefaultDescription
videoboolFalseRecord the agent's camera video track (composite audio+video participant recording)
screen_shareboolFalseRecord the screen-share track. Requires vision=True in RoomOptions
main.py
from videosdk.agents import ObservabilityOptions, RecordingOptions

await session.start(
observability=ObservabilityOptions(
recording=RecordingOptions(video=True),
),
)
note

For full details on recording behavior, output formats, and the difference between participant, track, and meeting recording, see the Recording doc.


Traces

Stream OpenTelemetry traces (spans for STT, LLM, TTS, EOU, tool calls, etc.) to your own observability backend over OTLP/HTTP — for example Grafana Tempo, Honeycomb, Jaeger, Datadog, or any OTLP-compatible collector.

TracesOptions

ParameterTypeDefaultDescription
enabledboolTrueEnable trace collection
export_urlOptional[str]NoneOTLP/HTTP endpoint that should receive trace spans
export_headersOptional[Dict[str, str]]NoneCustom headers for the export endpoint (e.g., auth tokens)
main.py
from videosdk.agents import ObservabilityOptions, TracesOptions

await session.start(
observability=ObservabilityOptions(
traces=TracesOptions(
enabled=True,
export_url="https://otlp.example.com/v1/traces",
export_headers={"Authorization": "Bearer your-token"},
),
),
)
tip

Traces are also available on the VideoSDK Dashboard without any extra setup. Use TracesOptions when you want to ship traces to an external system in addition to (or instead of) the dashboard.


Metrics

Export pipeline metrics (latency, durations, token usage) to your own OTLP-compatible metrics backend — for example Prometheus (via OTLP), Grafana Mimir, Datadog, or New Relic.

MetricsOptions

ParameterTypeDefaultDescription
enabledboolTrueEnable metrics collection
export_urlOptional[str]NoneOTLP/HTTP endpoint that should receive metric points
export_headersOptional[Dict[str, str]]NoneCustom headers for the export endpoint (e.g., auth tokens)
main.py
from videosdk.agents import ObservabilityOptions, MetricsOptions

await session.start(
observability=ObservabilityOptions(
metrics=MetricsOptions(
enabled=True,
export_url="https://otlp.example.com/v1/metrics",
export_headers={"Authorization": "Bearer your-token"},
),
),
)
tip

For programmatic, in-process access to the same metrics, use Pipeline Observability hooks (@pipeline.metrics.on(...)).


Logs

Filter the session's log output by level, and optionally export logs to an external collector. Useful for cranking up verbosity in development or shipping structured logs to your SIEM in production.

LoggingOptions

ParameterTypeDefaultDescription
enabledboolFalseEnable log export to the configured export_url
levelstr"INFO"Log level filter — one of "DEBUG", "INFO", "WARNING", "ERROR"
export_urlOptional[str]NoneOTLP/HTTP endpoint that should receive log records
export_headersOptional[Dict[str, str]]NoneCustom headers for the export endpoint (e.g., auth tokens)
main.py
from videosdk.agents import ObservabilityOptions, LoggingOptions

# Local: just bump the log level for the session
await session.start(
observability=ObservabilityOptions(
logs=LoggingOptions(level="DEBUG"),
),
)

# Remote: also ship logs to an OTLP collector
await session.start(
observability=ObservabilityOptions(
logs=LoggingOptions(
enabled=True,
level="INFO",
export_url="https://otlp.example.com/v1/logs",
export_headers={"Authorization": "Bearer your-token"},
),
),
)

Complete Example

For a runnable script that turns on recording, traces, metrics, and logs together inside session.start(), see the Observability Hooks example on GitHub.

Got a Question? Ask us on discord