Skip to main content
A conversation. Groups turns by conversation_id (no span). continue_parent_trace controls trace isolation for the turns this conversation creates. Default False means each turn starts its own OTel trace (the right choice for the standalone Conversations tab view). Set True when the application has an outer trace (for example a fastapi-instrumented request) that should contain the agent invocation. Conversation is a Pydantic model. Set any field below as a keyword argument when you construct it. Conversation is a context manager and can be used in a with statement.

Fields

Methods

start_turn

Create and start a turn. Auto-ends the previous turn if still open. Sets the _current_turn contextvar so the turn is visible via get_current_turn() regardless of whether a context manager is used. Each of agent_name / model / agent_id / agent_description / agent_version falls back to the conversation’s default when left empty; continue_parent_trace is inherited. Override any of them later via turn.record(...). system_instructions (the agent’s system prompt) is carried on the turn’s invoke_agent span; it can also be set later via attribute assignment on the returned Turn, mirroring start_llm.

end

Last modified on September 30, 2026