> ## 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.

# Turn Context • AI Agent SDK

> Turn Context and Runtime Protocol for PraisonAI Agents.

# turn\_context

AI Agent

Turn Context and Runtime Protocol for PraisonAI Agents.

This module defines the PreparedTurnContext dataclass and TurnRuntimeProtocol
that standardize runtime preparation across different execution paths in the
PraisonAI agent framework.

Design Goals:

* Single immutable plan object passed into runtime run\_turn
* Standardize tool assembly, transcript building, and delivery channels
* Eliminate duplication between native loop and plugin harnesses
* Enable consistent metrics and tracing across harness types
* Multi-agent safe: context is per-turn, not stored on shared agent globals

## Import

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents.runtime import turn_context
```

## Classes

> [card] [RuntimeMode](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/RuntimeMode.md)
>
> Execution mode for the runtime.

> [card] [ModelReference](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/ModelReference.md)
>
> Immutable reference to a resolved model configuration.

> [card] [ToolSchema](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/ToolSchema.md)
>
> Normalized tool schema for runtime execution.

> [card] [TranscriptWindow](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/TranscriptWindow.md)
>
> Immutable transcript window for a turn.

> [card] [DeliveryChannels](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/DeliveryChannels.md)
>
> Delivery channels for runtime execution results.

> [card] [SessionCorrelation](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/SessionCorrelation.md)
>
> Session correlation identifiers for tracing and debugging.

> [card] [PreparedTurnContext](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/PreparedTurnContext.md)
>
> Immutable turn plan object for standardized runtime execution.

## Functions

> [card] [create\_default\_model\_ref()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/create_default_model_ref.md)
>
> Create a default ModelReference for testing and basic usage.

> [card] [create\_empty\_transcript()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/create_empty_transcript.md)
>
> Create an empty transcript window with optional system prompt.

> [card] [create\_default\_delivery()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/create_default_delivery.md)
>
> Create default delivery channels with no streaming.

> [card] [create\_session\_correlation()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/create_session_correlation.md)
>
> Create session correlation with basic IDs.

***

## 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.