Summary
runTurn() does not appear to support a per-turn timeout or AbortSignal. Consumers that need bounded runtime behavior have to wrap runTurn()/send() in Promise.race() and then close the session manually.
Proposed surface
Support timeout/cancellation at the turn level, for example:
await session.runTurn(message, { timeoutMs: 120_000 })
await session.runTurn(message, { signal })
The same cancellation story should ideally apply to send() plus stream() flows.
Why this matters
Consumers often need to distinguish:
- a turn that is still running,
- a turn that timed out locally,
- a transport/request timeout,
- a runtime failure,
- a user-initiated cancellation.
External Promise.race() wrappers lose that structure and can leave the SDK/session doing work unless the caller remembers to close or abort the session.
Acceptance criteria
runTurn() supports either timeoutMs, AbortSignal, or both.
- Timeout/cancellation produces a typed or at least documented terminal outcome.
- The SDK cleans up stream listeners/session state after timeout/cancellation.
- Examples show the recommended pattern for long-running cloud turns.
Summary
runTurn()does not appear to support a per-turn timeout orAbortSignal. Consumers that need bounded runtime behavior have to wraprunTurn()/send()inPromise.race()and then close the session manually.Proposed surface
Support timeout/cancellation at the turn level, for example:
The same cancellation story should ideally apply to
send()plusstream()flows.Why this matters
Consumers often need to distinguish:
External
Promise.race()wrappers lose that structure and can leave the SDK/session doing work unless the caller remembers to close or abort the session.Acceptance criteria
runTurn()supports eithertimeoutMs,AbortSignal, or both.