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

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

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

<CardGroup cols={2}>
  <Card title="RuntimeMode" icon="brackets-curly" href="../classes/RuntimeMode">
    Execution mode for the runtime.
  </Card>

  <Card title="ModelReference" icon="brackets-curly" href="../classes/ModelReference">
    Immutable reference to a resolved model configuration.
  </Card>

  <Card title="ToolSchema" icon="brackets-curly" href="../classes/ToolSchema">
    Normalized tool schema for runtime execution.
  </Card>

  <Card title="TranscriptWindow" icon="brackets-curly" href="../classes/TranscriptWindow">
    Immutable transcript window for a turn.
  </Card>

  <Card title="DeliveryChannels" icon="brackets-curly" href="../classes/DeliveryChannels">
    Delivery channels for runtime execution results.
  </Card>

  <Card title="SessionCorrelation" icon="brackets-curly" href="../classes/SessionCorrelation">
    Session correlation identifiers for tracing and debugging.
  </Card>

  <Card title="PreparedTurnContext" icon="brackets-curly" href="../classes/PreparedTurnContext">
    Immutable turn plan object for standardized runtime execution.
  </Card>
</CardGroup>

## Functions

<CardGroup cols={2}>
  <Card title="create_default_model_ref()" icon="function" href="../functions/create_default_model_ref">
    Create a default ModelReference for testing and basic usage.
  </Card>

  <Card title="create_empty_transcript()" icon="function" href="../functions/create_empty_transcript">
    Create an empty transcript window with optional system prompt.
  </Card>

  <Card title="create_default_delivery()" icon="function" href="../functions/create_default_delivery">
    Create default delivery channels with no streaming.
  </Card>

  <Card title="create_session_correlation()" icon="function" href="../functions/create_session_correlation">
    Create session correlation with basic IDs.
  </Card>
</CardGroup>

***

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