Turn Placement • AI Agent SDK

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

TurnPlacement

Defined in the protocols 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

ResponseField str

No description available.

ResponseField str

No description available.

ResponseField int

No description available.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 7533