Skip to main content
Access these through the tracing module:

log_turn

Imperatively emit one turn and its child spans to OTel. Use when context managers aren’t viable (stateless containers, callbacks, queue workers). Each child span passed in should have started_at / ended_at set; the emitted OTel span timestamps come from those fields. Falls back to the earliest/latest child timestamp, then now(), when the turn doesn’t supply its own. agent_id / agent_description / agent_version mirror the streaming path. attributes are stamped on every emitted span; the streaming path reads these from the active conversation instead. Use custom, non-semconv keys: a key that collides with a span’s own gen_ai.* / weave.* attribute is unsupported (which value wins is path-dependent). messages records the turn input and output_messages records the terminal agent response on the same invoke_agent span.

log_conversation

Imperatively emit a complete conversation. Each Turn’s .spans attribute provides its children. Auto-generates conversation_id if empty. By default each turn gets its own OTel trace. agent_name / model / agent_id / agent_description / agent_version are conversation-level defaults. A Turn’s own value wins; the conversation value only fills in when the Turn leaves it empty. The conversation’s continue_parent_trace applies to every turn and supersedes the per-Turn value. attributes are stamped on every emitted span. Use custom, non-semconv keys: a key that collides with a span’s own gen_ai.* / weave.* attribute is unsupported (which value wins is path-dependent).

LogResult

Result of a batch log_* call. LogResult is a Pydantic model. Set any field below as a keyword argument when you construct it. Fields
Last modified on September 30, 2026