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

AI Agent

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

**session\_id** `str`

No description available.

**worker\_id** `str`

No description available.

**epoch** `int`

No description available.

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L7533)
>
> `praisonaiagents/gateway/protocols.py` at line 7533


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