> ## 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**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/turn_context.md) 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

**model\_ref** `ModelReference`

No description available.

**agent\_runtime** `AgentProtocol`

No description available.

**tools** `Tuple[ToolSchema, ...]`

No description available.

**transcript** `TranscriptWindow`

No description available.

**delivery** `DeliveryChannels`

No description available.

**correlation** `SessionCorrelation`

No description available.

**runtime\_mode** `RuntimeMode`

No description available.

**turn\_metadata** `Mapping[str, Any]`

No description available.

**created\_at** `float`

No description available.

## Methods

> [card] [get\_tool\_by\_name()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/PreparedTurnContext-get_tool_by_name.md)
>
> Get a tool by name from the prepared tools.

> [card] [has\_tools()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/PreparedTurnContext-has_tools.md)
>
> Check if any tools are available for this turn.

> [card] [has\_system\_prompt()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/PreparedTurnContext-has_system_prompt.md)
>
> Check if a system prompt is configured.

> [card] [get\_message\_count()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/PreparedTurnContext-get_message_count.md)
>
> Get the number of messages in the transcript window.

> [accordion] Internal & Generic Methods
>
> * **to\_dict**: Convert to dictionary for logging and debugging.

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/runtime/turn_context.py#L174)
>
> `praisonaiagents/runtime/turn_context.py` at line 174

***

## Related Documentation

> [card] [Context Concept](https://praison.ai/docs/docs/concepts/context)

> [card] [Context Management](https://praison.ai/docs/docs/features/context-management)

> [card] [Context Strategies](https://praison.ai/docs/docs/features/context-strategies)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.