Build
Streaming & recovery
Follow durable Turn or Conversation state, resume safely, and reconcile previews against authoritative results.
A Turn stream follows one piece of work and closes after it becomes terminal. A Conversation stream follows current and future Turns and may remain open while idle. Both use the same frame vocabulary.
Stream through the facade
const turn = await agent.start("Research the options.", { tenant: "acme" });
for await (const update of turn.updates()) {
render(update.snapshot);
}snapshot.text is a convenient current projection. Treat live deltas and
previews as replaceable UI state; the composed Turn result and canonical
Conversation messages are authoritative.
Recover after a disconnect
Persist the Turn ID and host-selected access coordinates:
const turn = client.turn(savedTurnId, { tenant: "acme", user: "alice" });
const result = await turn.result();Exact SSE consumers can retain the last durable cursor and reconnect through
client.raw() or the low-level stream helpers. A Conversation-bound Turn cursor
can resume on its Conversation stream. A standalone Turn cursor cannot because
there is no public Conversation.
Network disconnect, process exit, and local timeout do not cancel accepted work. Use cancel or interrupt only when the product intentionally wants to stop the Turn.