Skip to main content
A single package, works in Node, Bun, the browser, and edge runtimes.

Create a client

Talk to an agent

result() resolves on the first terminal event. degraded is true if there were retries.

Stream

Multi-turn

Structured output

Use Zod to validate the reply:

Attachments & artifacts

Upload a file (CSV, image, PDF, …) and get back an r2://media/... reference. Download resolves that reference — or any artifact your agent produced — back to bytes.
download() accepts either a full r2://media/... ref or a bare media/... key.

Reconnect to a known session

Resume with replay

Abort

Verify incoming webhooks

Types

See the HTTP reference for the raw wire protocol and Events for the full event vocabulary.