Event emission and observability: subscribe to session and pipeline events, and configure logging, metrics, and tracing for a running agent.

PubSubPublishConfig

One frame to publish into the room. Passed to Session.publish_to_pubsub.

Fields

str
required
The topic to publish on.
str
default:""
The text body.
Optional[dict]
Structured data alongside it, JSON-encoded on the way out.
dict
default:"…"
Transport options. Only sendOnly — a list of participant ids to deliver to — is carried; anything else is dropped, because the wire has nowhere to put it. Omitted, everyone subscribed to the topic gets the frame.

PubSubSubscribeConfig

One topic to listen on, and what to call for each frame. Passed to Session.subscribe_to_pubsub.

Fields

str
required
The topic to subscribe to.
Any
Called once per frame with the raw frame as a dict — the whole thing as the transport delivered it, since pubsub promises no schema beyond message. Sync or async; a coroutine is awaited. A handler that declares a second parameter is additionally told whether the frame is backlog:: def cb(frame, backlog): if backlog: return # already in the topic before we joined Subscribing replays whatever the topic already held, so a one-argument handler sees that history as ordinary traffic — which is the transport’s own shape, and worth knowing about before replying to it.

Observability

Where this session’s traces, metrics and logs go. Each stream is configured on its own, and a stream left None follows the runtime’s own settings rather than being switched off.

Fields

Optional[Exporter]
Per-turn spans — what the model was asked, what each provider took.
Optional[Exporter]
Latency and usage counters.
Optional[Exporter]
The agent process’s log records.
str
default:"INFO"
Level the agent process logs at. One of DEBUG, INFO, WARNING, ERROR, CRITICAL.

Exporter

Where one stream of telemetry is shipped.

Fields

bool
default:"True"
Set False to turn this stream off while leaving the rest of the configuration in place.
Optional[str]
An OTLP endpoint. None sends it wherever the runtime is configured to send its own.
Dict[str, str]
default:"…"
Sent with each export — the collector’s auth header, usually.