Prepared Turn Context • AI Agent SDK

PreparedTurnContext: Immutable turn plan object for standardized runtime execution.

PreparedTurnContext

Defined in the Turn Context module.

AI Agent

Immutable turn plan object for standardized runtime execution.

This dataclass captures all the context needed for a single agent turn, prepared in a preflight step before run_attempt. It eliminates the scattered tool assembly and message building across different execution paths.

The context is read-only during execution – mutations must go through defined hooks only. This ensures consistent behavior across different runtime harnesses (native, plugin, managed, etc.).

Attributes: model_ref: Resolved model configuration and capabilities agent_runtime: The runtime protocol instance to execute with tools: Normalized tool schemas for the turn transcript: Prepared conversation window for the turn delivery: Streaming and output delivery configuration correlation: Session and tracing identifiers runtime_mode: Execution mode (sync/async/stream) turn_metadata: Additional turn-specific metadata created_at: Timestamp when context was prepared

Properties

ResponseField ModelReference

No description available.

ResponseField AgentProtocol

No description available.

ResponseField Tuple[ToolSchema, ...]

No description available.

ResponseField TranscriptWindow

No description available.

ResponseField DeliveryChannels

No description available.

ResponseField SessionCorrelation

No description available.

ResponseField RuntimeMode

No description available.

ResponseField Mapping[str, Any]

No description available.

ResponseField float

No description available.

Methods

Internal & Generic Methods
  • to_dict: Convert to dictionary for logging and debugging.

Source

View on GitHub

praisonaiagents/runtime/turn_context.py at line 174


Related Documentation