Skip to content
Developer Preview

Turn

A turn, as a CONSUMER sees it — the protocol turn surface and nothing else.

Class in muse_code

Session.turn() and send_user_turn() advertise THIS rather than the concrete TurnHandle so the “fed by Session” mutators (settle_completed, push_item, fail, …) are not part of the consumer contract: an embedder calling one would fabricate a terminal the server never authored. Python cannot hide them at runtime the way the TS Turn interface does, so the seal is the return annotation plus this documented surface — the same convention the fold’s read views use.

Property Type Description
turn_id str The wire turn id.
observed_start bool Did THIS session observe a turn/started? Not a launch marker.
completed Awaitable[TurnOutcome] The protocol turn-wait; settles on a server-authored fact.
Method Signature Description
items items() -> AsyncIterator[FoldedItem] This turn’s items: folded backlog, then the live tail.
deltas deltas() -> AsyncIterator[ItemDeltaParams] This turn’s item/delta frames, live only.
cancel async cancel() -> TurnCancelResult Cancel this turn on the normal command lane (turn/cancel).
interrupt async interrupt(*, retract: bool | None = None) -> TurnInterruptResult Stop this turn on the priority lane (turn/interrupt).
steer async steer(options: SteerTurnOptions[_I]) -> TurnSteerResult Add input to this running turn (turn/steer).
unqueue async unqueue() -> TurnUnqueueOutcome[_I] Take this queued turn back before it launches (turn/unqueue).
Source

clients/sdk-py/src/muse_code/facade/turn_handle.py:505