NylorunDocsBeta
BuildRunDeployReferenceMore

Control

Cancel a turn cooperatively and understand what waits can and cannot do today.

Cancel the active turn from a trusted backend or Studio:

await session.cancel({ idempotencyKey, reason: "user stopped" });

Studio exposes the same cancel. Cancellation is cooperative: forward context.signal from tools so in-flight HTTP work can stop.

On the explicit engine path, pass signal into run(). Abort settles as cancelled — a result, not a throw.

Cancelled in-flight customer tool work can become uncertain. Runtime does not automatically repeat it. An expired hook claim is offered again.

Cancellation ends the current turn; a later message can start another turn from the state preceding the cancelled turn.

Approvals and responses

The session client can approve or respond to a correlated interaction. Tools can request those pauses through approval, ask, or approve on the execution context.

Studio does not ship an approvals UI in this release. Drive those commands from a trusted backend if you use them. A delegated agent's tools cannot declare approval, and ctx.ask, ctx.approve, ctx.sleep, or ctx.waitFor inside it fail with delegation.interaction-unsupported. Keep those pauses on the parent. See Subagents.

Sleep, events, and steps

Durable wait helpers exist on the tool context:

HelperCurrent behavior
ask / approvePause for a correlated response or approval.
sleep / waitForReturn an inspectable deferred outcome. Automatic timer and event wakeups are not implemented.
stepMemoize a value after a persisted action outcome. Interrupted actions stay uncertain.

Do not document these helpers as a working scheduler, cron, or exactly-once external-effects system. Recorded progress does not guarantee that every interrupted external operation can be safely repeated.

See Storage.

Next step

On this page