> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Prepared Turn Context • AI Agent SDK

> PreparedTurnContext: Immutable turn plan object for standardized runtime execution.

# PreparedTurnContext

> Defined in the [**Turn Context**](../modules/turn_context) module.

<Badge color="blue">AI Agent</Badge>

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 name="model_ref" type="ModelReference">
  No description available.
</ResponseField>

<ResponseField name="agent_runtime" type="AgentProtocol">
  No description available.
</ResponseField>

<ResponseField name="tools" type="Tuple[ToolSchema, ...]">
  No description available.
</ResponseField>

<ResponseField name="transcript" type="TranscriptWindow">
  No description available.
</ResponseField>

<ResponseField name="delivery" type="DeliveryChannels">
  No description available.
</ResponseField>

<ResponseField name="correlation" type="SessionCorrelation">
  No description available.
</ResponseField>

<ResponseField name="runtime_mode" type="RuntimeMode">
  No description available.
</ResponseField>

<ResponseField name="turn_metadata" type="Mapping[str, Any]">
  No description available.
</ResponseField>

<ResponseField name="created_at" type="float">
  No description available.
</ResponseField>

## Methods

<CardGroup cols={2}>
  <Card title="get_tool_by_name()" icon="function" href="../functions/PreparedTurnContext-get_tool_by_name">
    Get a tool by name from the prepared tools.
  </Card>

  <Card title="has_tools()" icon="function" href="../functions/PreparedTurnContext-has_tools">
    Check if any tools are available for this turn.
  </Card>

  <Card title="has_system_prompt()" icon="function" href="../functions/PreparedTurnContext-has_system_prompt">
    Check if a system prompt is configured.
  </Card>

  <Card title="get_message_count()" icon="function" href="../functions/PreparedTurnContext-get_message_count">
    Get the number of messages in the transcript window.
  </Card>
</CardGroup>

<Accordion title="Internal & Generic Methods">
  * **to\_dict**: Convert to dictionary for logging and debugging.
</Accordion>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/runtime/turn_context.py#L174">
  `praisonaiagents/runtime/turn_context.py` at line 174
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Context Concept" icon="layer-group" href="/docs/docs/concepts/context" />

  <Card title="Context Management" icon="sliders" href="/docs/docs/features/context-management" />

  <Card title="Context Strategies" icon="diagram-project" href="/docs/docs/features/context-strategies" />
</CardGroup>
