AgentTurn represents one live execution of an Agent.
Create one with agent.turn(...). Do not instantiate AgentTurn directly unless you are extending the framework.
Import
Constructor
Properties
str
Unique turn ID.
str
ID of the owning agent.
Agent[Any]
Owning agent instance.
Message
Initial user message for the turn.
TurnOptions
Per-turn options.
bool
True after the turn has started.bool
True after the turn finishes, fails, or is aborted.events
Returns:
AsyncIterator[TurnEvent]
Stream of turn events. The iterator ends after
turn.finished or turn.failed.text_stream
events() that yields only text.delta text.
result
TurnResult
Final structured result.
Exception
Raised if the turn is aborted.
Exception
Propagates provider, tool, or runtime failures.
wait
result().
send
Content
required
Message content to inject into the active turn.
Literal['user', 'system']
Role for the injected message. Defaults to
"user".send()does not mutate a provider request already in flight.- queued messages are injected before the next model call.
- queued messages are scoped to this turn.
steer
send().
abort
str | None
Optional abort reason.
TurnOptions
ToolSet | None
Per-turn tools. Defaults to the agent’s tools.
StopCondition | list[StopCondition] | None
Per-turn stop conditions. Defaults to the agent’s
stop_when.ReasoningConfig | None
Per-turn reasoning controls. Defaults to the agent’s
reasoning.ProviderOptions | None
Per-turn provider options. Defaults to the agent’s
provider_options.RetryPolicy | None
Per-turn provider-call retry policy. Defaults to the agent’s
retry.AbortSignal | None
External abort signal that also aborts the turn.
AgentHooks | None
Per-turn hook overrides. These merge over agent-level default hooks.
dict[str, Any]
Application metadata. Not sent to the provider by default.
TurnResult
TurnEvent
TurnStarted
TextDelta
ReasoningDelta
StepStarted
StepFinished
usage is the provider-reported usage for this step.
StepRetrying
Tool lifecycle events
AgentTurn forwards the same ToolCallStartedEvent, ToolCallDeltaEvent,
ToolCallReadyEvent,
ToolExecutionStartedEvent, ToolExecutionFinishedEvent, and ToolResultEvent
objects exposed by stream_text().event_stream. This preserves tool call IDs,
provider indexes, execution completion order, and normalized results across core
and agent APIs.