> ## 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 Placement • AI Agent SDK

> TurnPlacement: Which worker owns a session's turns, and at what epoch (Issue #4011).

# TurnPlacement

> Defined in the [**protocols**](../modules/protocols) module.

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

Which worker owns a session's turns, and at what epoch (Issue #4011).

A lifecycle-owned handle returned by :meth:`TurnExecutorProtocol.place`
and passed back to :meth:`~TurnExecutorProtocol.execute_turn` /
:meth:`~TurnExecutorProtocol.teardown`. The gateway revalidates the
placement (worker alive, matching `epoch`) immediately before dispatch
and again after any awaited admission/approval work; a stale placement
(its worker was replaced, so `epoch` no longer matches) **fails closed**
and the session is re-placed rather than executed on a dead worker.

Attributes:
session\_id: The resolved session whose turns this placement serves.
worker\_id: Opaque id of the worker that owns the session's turns. For
the in-process default this is a constant (one loop, one worker);
for isolated executors it identifies the subprocess/container/
remote worker.
epoch: Monotonic generation bumped whenever the worker backing a
session is replaced (e.g. after a wedge teardown). A turn carrying
a stale epoch must not run — the fencing token that stops a
reclaimed worker from executing against a session it no longer owns.

## Properties

<ResponseField name="session_id" type="str">
  No description available.
</ResponseField>

<ResponseField name="worker_id" type="str">
  No description available.
</ResponseField>

<ResponseField name="epoch" type="int">
  No description available.
</ResponseField>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L5643">
  `praisonaiagents/gateway/protocols.py` at line 5643
</Card>
