An open-source, faster Devin alternative
TypeScript
docs: tighten agent sessions copy
Igor Zalutski8a1436a2235a
diff --git a/docs/agent-sessions/agents.mdx b/docs/agent-sessions/agents.mdxindex e760478d..32ebed5a 100644--- a/docs/agent-sessions/agents.mdx+++ b/docs/agent-sessions/agents.mdx@@ -1,9 +1,9 @@---title: "Agents"-description: "The reusable definition of what runs"+description: "Reusable agent configuration"----An **agent** is a first-class, reusable definition of *what* runs — a `name`, a `prompt` (its instructions), a `model`, and a [`runtime`](/agent-sessions/runtimes). Every [session](/agent-sessions/sessions) runs on an agent, so create one first, then start as many sessions on it as you like.+An **agent** is reusable configuration: `name`, `prompt`, `model`, and [`runtime`](/agent-sessions/runtimes). Every [session](/agent-sessions/sessions) runs on an agent, so create one first, then start as many sessions on it as you like.```httpPOST https://api.opencomputer.dev/v3/agents@@ -23,7 +23,7 @@ Pass your Anthropic `key` inline and it's stored as a [credential](/agent-sessio<Tip>Keep the org key and model key on your backend. Only return session-scoped client tokens to browsers.</Tip>-## Pinned snapshot+## Session-pinned configWhen a session is created it **freezes** the agent's `prompt`, `model`, `runtime`, and `revision` (a number that bumps on every edit) into the session — and pins the resolved credential too. Editing the named agent afterwards never changes a running or resumed session — its behavior is pinned for its whole life. Update an agent freely: existing sessions keep what they started with, new sessions pick up the change. (Rotating a credential's **key value** is the exception — that flows to running sessions, so a compromised key can be replaced; see [authentication](/agent-sessions/authentication#model-credentials).)diff --git a/docs/agent-sessions/api-reference.mdx b/docs/agent-sessions/api-reference.mdxindex 776ff625..c74a169d 100644--- a/docs/agent-sessions/api-reference.mdx+++ b/docs/agent-sessions/api-reference.mdx@@ -18,7 +18,7 @@ Base URL `https://api.opencomputer.dev/v3`. Management calls authenticate with y| `GET /sessions/:id/turns` · `GET …/turns/:turnId` | Per-turn history: timing, usage, error. || `POST /sessions/:id/client-tokens` | Mint a client token. |-`agent` is **required** (create a saved [agent](#agents) first); a resolvable Anthropic [credential](#credentials) is also required (`422 no_credential` otherwise). `key` gives get-or-create (one session per key); a request-level `Idempotency-Key` header makes a keyless create retry-safe. `input` is the task — a string or a full [envelope](/agent-sessions/messaging#the-envelope) (structured context rides `input.refs`: `repo`/`branch`/`commit`/`issue`/…). `limits` `{ tokens, turn_seconds, turns }` are **non-monetary** — token budget, per-turn wall-clock, auto-run count; hitting one ends the turn with a matching `last_turn.yield_reason`. Destinations on an idempotent create-replay are ignored — manage them via the [destinations API](#destinations).+`agent` is **required** (create a saved [agent](#agents) first); a resolvable Anthropic [credential](#credentials) is also required (`422 no_credential` otherwise). `key` gives get-or-create (one session per key); a request-level `Idempotency-Key` header makes a keyless create retry-safe. `input` is the task — a string or a full [envelope](/agent-sessions/messaging#message-envelope) (structured context rides `input.refs`: `repo`/`branch`/`commit`/`issue`/…). `limits` `{ tokens, turn_seconds, turns }` are **non-monetary** — token budget, per-turn wall-clock, auto-run count; hitting one ends the turn with a matching `last_turn.yield_reason`. Destinations on an idempotent create-replay are ignored — manage them via the [destinations API](#destinations).Client tokens accept `scopes?` (subset of `read`, `steer`) and `ttl?` seconds, clamped to 60–86400.@@ -49,7 +49,7 @@ Turn = {Filter events by `type` (exact or `prefix.*`), `turn_id`, and `limit`. `GET …/messages` is an alias for `level=user` + `type=*.message`.-`after` resumes from a `seq`; `level` is a **visibility threshold** — `user` returns only user-facing events, `progress` adds work updates, `internal` adds everything (see [levels](/agent-sessions/events#levels)). Omitting `level` defaults to `internal` (you get everything). Switch on [`type`](/agent-sessions/events#event-shape), don't parse prose.+`after` resumes from a `seq`; `level` is a **visibility threshold** — `user` returns only user-facing events, `progress` adds work updates, `internal` adds everything (see [visibility levels](/agent-sessions/events#visibility-levels)). Omitting `level` defaults to `internal` (you get everything). Switch on [`type`](/agent-sessions/events#event-shape), don't parse prose.```Event = {@@ -85,7 +85,7 @@ Destination body: `url`, `secret?`, `level?` (`user`), `types?[]`, `include_raw?| `GET /sessions/:id/deliveries/:id` | One delivery, in detail. || `POST /sessions/:id/deliveries/:id/redeliver` | Re-send any delivery (not just dead-lettered). |-See [Webhooks](/agent-sessions/webhooks#delivery-contract) for the signing and delivery contract.+See [Webhooks](/agent-sessions/webhooks#signing-retries-and-dedupe) for signing, retries, and dedupe.```Destination = {diff --git a/docs/agent-sessions/artifacts.mdx b/docs/agent-sessions/artifacts.mdxindex 8f1984d4..7e3422ba 100644--- a/docs/agent-sessions/artifacts.mdx+++ b/docs/agent-sessions/artifacts.mdx@@ -3,29 +3,27 @@ title: "Artifacts & previews"description: "A session's published outputs — live previews and durable files (coming soon)"----<Note>**Coming soon.** This page is our current thinking, not a shipped contract — names and shapes may change. What works *today*: large event bodies already spill to a [`content_ref`](/agent-sessions/events) you can fetch, and events can carry forward [`refs.artifacts[]`](/agent-sessions/events). The first-class collection below is what comes next.</Note>+<Note>**Coming soon.** This page is design direction, not a shipped API. Today, large event bodies can spill to a [`content_ref`](/agent-sessions/events), and events can carry [`refs.artifacts[]`](/agent-sessions/events).</Note>-A session does its work in a private scratch sandbox. **Artifacts** are the subset it deliberately *publishes* for your UI to consume — a durable, session-scoped collection you can fetch on load and stream for updates, so a preview or outputs panel survives reconnects and reloads. A **preview** is one kind of artifact: a live URL to something the agent is running (a dev server, a built app).+**Artifacts** are session outputs your UI can load later: files, links, reports, and live previews. A **preview** is a URL to something the agent is running, such as a dev server or built app.-## Durable vs live+## Artifact kinds-The split is what lets a panel survive a refresh:+- **`file` / `link`**: snapshotted to storage at publish; fetchable after the machine is gone.+- **`preview`**: a durable entry for a live URL into the session machine. The served app depends on machine state, so it carries a `status` (`live` / `cold`).-- **`file` / `link` — durable.** Snapshotted to storage at publish; fetchable forever, even after the session's machine is gone. (Reports, build outputs, screenshots, diffs.)-- **`preview` — live.** A URL into the running session machine. The *entry* is durable (you always get it back on reload), but the served app is bound to a warm machine, so it carries a `status` (`live` / `cold`) and can be resumed.+## Publish from the runtime-## How the agent publishes--The runtime would get two tools alongside `bash`/`read`/`write`:+The runtime would get two tools:- `oc.preview(port)` — expose a port of the session's machine as a preview URL.- `oc.publish(path)` — snapshot a file as a durable artifact.Each publish appends a `user`-level event and upserts the artifact, so it reaches your UI as soon as it's produced.-## How your app would consume it+## Read artifacts in your app-The same snapshot-plus-stream pattern as [events](/agent-sessions/events): list on load, subscribe for changes.+Use the same snapshot-plus-stream pattern as [events](/agent-sessions/events): list on load, subscribe for changes.```GET /v3/sessions/:id/artifactsdiff --git a/docs/agent-sessions/authentication.mdx b/docs/agent-sessions/authentication.mdxindex b26e9412..4e3a94e7 100644--- a/docs/agent-sessions/authentication.mdx+++ b/docs/agent-sessions/authentication.mdx@@ -3,7 +3,7 @@ title: "Authentication"description: "Org keys, browser-safe client tokens, and bring-your-own model keys"----Three credentials, each with a job.+Durable Agent Sessions use three credential types.## Org API key@@ -33,7 +33,7 @@ Content-Type: application/json{ "scopes": ["read", "steer"], "ttl": 3600 }```-The pattern: your backend creates the session with the org key, then hands the `client_token` to the browser, which uses it directly for the SSE stream and steer calls.+Browser pattern: your backend creates the session with the org key, then hands the `client_token` to the browser, which uses it directly for the SSE stream and steer calls.<Warning>A client token isn't free to hand out: each `steer` starts a turn, which **consumes tokens on your Anthropic key** for the session it's scoped to. Mint short-lived tokens, and rely on the session's [limits](/agent-sessions/sessions#limits) (`tokens`/`turn_seconds`/`turns`) to cap exposure.</Warning>diff --git a/docs/agent-sessions/channels.mdx b/docs/agent-sessions/channels.mdxindex efbaf083..468268eb 100644--- a/docs/agent-sessions/channels.mdx+++ b/docs/agent-sessions/channels.mdx@@ -3,12 +3,12 @@ title: "Channels"description: "Talk to a session where people already work — Slack, GitHub (coming soon)"----<Note>**Coming soon.** Current thinking, not a shipped contract. Today you converse with a session over the [API](/agent-sessions/messaging) — stream events out, post messages in — and deliver events out via [webhooks](/agent-sessions/webhooks). Channels connect that same session to a Slack thread or a GitHub PR.</Note>+<Note>**Planned.** This page describes planned API shape, not shipped behavior. Today you converse with a session over the [API](/agent-sessions/messaging) — stream events out, post messages in — and deliver events out via [webhooks](/agent-sessions/webhooks).</Note>A **channel** binds a session's thread to a place people already work, so the same session is reachable from there. Slack is the first channel.- **Inbound.** A Slack `@mention` or thread reply is verified, de-duplicated, and appended to the session as a [steer](/agent-sessions/messaging) — the same inbound message you can post over the API.-- **Outbound.** The platform projects the session's `user` and `progress` [events](/agent-sessions/events#levels) back to the thread. The agent never calls Slack itself — it appends events; the platform delivers them, durably and idempotently.+- **Outbound.** The platform projects the session's `user` and `progress` [events](/agent-sessions/events#visibility-levels) back to the thread. The agent never calls Slack itself — it appends events; the platform delivers them, durably and idempotently.- **Additive bindings.** A session has a set of bindings added over its life; it is never typed as "a Slack session" or "a GitHub session." A chat-born session that opens a PR gains a binding to that PR. Routing follows event level — conversation goes to conversation bindings, work product to delivery targets.A channel is one consumer of the same public API a custom UI uses: post messages in, render the [event stream](/agent-sessions/events) at the level you want, and optionally bind a thread so the platform projects for you.diff --git a/docs/agent-sessions/custom-runtimes.mdx b/docs/agent-sessions/custom-runtimes.mdxindex 6266dc45..601b4548 100644--- a/docs/agent-sessions/custom-runtimes.mdx+++ b/docs/agent-sessions/custom-runtimes.mdx@@ -3,28 +3,30 @@ title: "Custom runtimes"description: "Package any agent harness as a runtime (coming soon)"----<Note>**Coming soon.** Current thinking, not a shipped contract. Today the only [runtime](/agent-sessions/runtimes) is `claude`; custom runtimes are the extensibility seam — `claude` itself is just the first runtime built on this contract.</Note>+<Note>**Planned.** This page describes planned API shape, not shipped behavior. Today the only callable [runtime](/agent-sessions/runtimes) is `claude`.</Note>-A runtime is a container image that implements the **runtime contract**. Any agent harness — your own, or a lab's — becomes a runtime by meeting it; you then select it per agent with `runtime: "<name>"`, and nothing else about the session changes.+A custom runtime is a container image for your agent harness. Once registered, select it per agent with `runtime: "<name>"`; sessions, events, steering, and webhooks work the same way.-## The contract+## Runtime invocation-The platform invokes your image once per turn and passes it (via env) the session id, the read cursor, the events API URL, and a fenced **turn token**. Per turn the image:+For each turn, the platform starts your image with the session id, read cursor, events API URL, and a fenced **turn token**. The image must:-1. reads the new input from the [event log](/agent-sessions/events) at the cursor;-2. drives its own agent loop;-3. **streams events back** to the session over the authenticated events API — the turn token is fenced, so if the platform has superseded this instance its writes are rejected and a stale machine can't corrupt the log;-4. performs all side effects through the **remote [sandbox tools](/agent-sessions/runtime-tools)** — it has no local disk or network of its own; the sandbox is the boundary;-5. **exits 0 when it has nothing left to do** (yield, don't block). A non-zero exit is treated as a crash, and the platform restarts the turn in place.+1. read the new input from the [event log](/agent-sessions/events) at the cursor;+2. drive its own agent loop;+3. stream events back over the authenticated events API;+4. perform side effects through the remote [sandbox tools](/agent-sessions/runtime-tools);+5. exit 0 when it has nothing left to do.-## State and recovery+The turn token is fenced: writes from a superseded runtime instance are rejected. Non-zero exit is treated as a crash and the platform restarts the turn in place.-The image carries no durable state. The durable record is the event log plus the runtime's on-box **journal**. Keep your resumable state in the journal directory the platform provides and you inherit the same [durability](/agent-sessions/durability) as `claude`: a crash restarts from the journal, an idle session hibernates and is checkpointed, and a lost machine is recreated and restored.+## Journal and recovery-## Models+The image should be stateless. Store resumable state in the provided journal directory. The durable record is the event log plus that journal, so crashes, idle hibernation, and machine restore follow the same [durability](/agent-sessions/durability) behavior as `claude`.-The model is configuration, not part of the image. A runtime declares which providers it can drive; switching across providers needs an image that drives the target (the planned `opencode` aims to drive all).+## Model configuration-## Distribution+The model is configuration, not part of the image. A runtime declares which providers it can drive; switching providers requires a runtime image that supports the target provider.-You register a runtime with `oc runtime push <image>` and select it with `runtime: "<name>"`. Runtimes are versioned and a session pins the version it runs, so pushing a new build never affects in-flight sessions — the same mechanism behind the prebuilt `claude`, `codex`, and `opencode` images.+## Register runtimes++Register a runtime with `oc runtime push <image>` and select it with `runtime: "<name>"`. Runtimes are versioned; each session pins the version it starts with, so pushing a new build never changes in-flight sessions.diff --git a/docs/agent-sessions/durability.mdx b/docs/agent-sessions/durability.mdxindex 8e249581..eaecd223 100644--- a/docs/agent-sessions/durability.mdx+++ b/docs/agent-sessions/durability.mdx@@ -11,11 +11,11 @@ A Durable Agent Session is **never lost and always resumable**:- The runtime **hangs** → a turn deadline bounds it; the turn ends and you steer to continue.- The session **idles** → it hibernates (≈ free) and the session **survives even if its sandbox is reclaimed**.-Narrow edges, all on the roadmap (see [Limits](#limits)): a sandbox lost **mid-turn** re-runs that turn; a hung turn ends at its deadline rather than auto-continuing; **uncommitted files** don't survive sandbox loss (commit/push to keep them).+Narrow edges, all on the roadmap (see [Failure behavior](#failure-behavior)): a sandbox lost **mid-turn** re-runs that turn; a hung turn ends at its deadline rather than auto-continuing; **uncommitted files** don't survive sandbox loss (commit/push to keep them).-## The event log is the source of truth+## Durable event log-Every step is appended to the session's log with a monotonic `seq`. The log is durable and ordered; reads and the live stream are served from it. Anything the agent has logged or delivered is safe.+Every step is appended with a monotonic `seq`. Reads and live streams are served from that ordered log, so anything logged or delivered is recoverable.## Stream resume@@ -44,7 +44,7 @@ You don't restart anything — the platform does. The runtime keeps its working- **Runtime hangs** → bounded by a **turn deadline**; the turn ends with `deadline_exceeded` and you steer to continue. (Faster heartbeat-based restart is on the roadmap.)- **Sandbox reclaimed while idle** → we recreate it and **restore the last checkpoint**, resuming the conversation from the last completed turn. (The brain state is restored; commit/push to keep file changes — see below.)-## Limits+## Failure behaviorWhat's guaranteed today, and what isn't:diff --git a/docs/agent-sessions/events.mdx b/docs/agent-sessions/events.mdxindex 24a1352f..310b394d 100644--- a/docs/agent-sessions/events.mdx+++ b/docs/agent-sessions/events.mdx@@ -3,7 +3,7 @@ title: "Events"description: "The append-only log: envelope, levels, cursors, and resume"----Every step a session takes is an **event**, appended to the log in order. The log is the source of truth — you read it, stream it, and resume from any point. Everything you build on top — a chat UI, a live "what's it doing" feed, notifications, an audit trail — comes from reading or streaming these events and filtering them by **level**.+Every session step is an **event** appended in order. Read events, stream them live, or resume from any `seq`. Use the same stream for chat, activity feeds, notifications, and audit trails by filtering on **level**.```json{ "id": "evt_…", "seq": 12, "ts": "…", "session": "sess_…",@@ -20,11 +20,11 @@ Every step a session takes is an **event**, appended to the log in order. The lo- **`level`** — visibility; see below.- **`body` / `refs`** — payload and related ids.-Inbound and outbound messages share one [envelope](/agent-sessions/messaging#the-envelope) shape.+Inbound and outbound messages share one [envelope](/agent-sessions/messaging#message-envelope) shape.## Event shape-The stable contract is the top-level **`type`** — **switch on it, don't parse prose.** Unknown types render fine from their `text`/`summary`, so new ones are additive. (There's no separate `kind`; coarse buckets are just `type` prefixes like `turn.*` or `agent.*`.)+Treat the top-level **`type`** as the stable discriminator — **switch on it, don't parse prose.** Unknown types render fine from their `text`/`summary`, so new ones are additive. (There's no separate `kind`; coarse buckets are just `type` prefixes like `turn.*` or `agent.*`.)| `type` | `body` shape | Use it for || --- | --- | --- |@@ -42,9 +42,9 @@ The stable contract is the top-level **`type`** — **switch on it, don't parse**Large output.** A large `body` is offloaded to a `content_ref`; fetch the bytes with `GET /sessions/:id/events/:eventId/content` (e.g. full `exec.completed` output). Richer **artifacts** (named files, diffs, screenshots, reports) ride a forward `refs.artifacts[]`, with a first-class [artifacts & previews API](/agent-sessions/artifacts) **coming soon**. `refs` also carries optional correlation/evidence keys (`trace_id`, `sources[]`).-## Levels+## Visibility levels-Every event carries a `level` saying **who it's for**. You filter the stream (and webhook deliveries) by it, so each surface shows the right amount of detail.+Every event carries a `level`. Use it to choose how much detail each surface receives.| Level | Contains | Use for || --- | --- | --- |@@ -62,7 +62,7 @@ Filtering is **cumulative** — `user` is the narrowest, `internal` is everythinSo a customer-facing chat asks for `user`; an agent-activity view asks for `progress`; debugging your agent asks for `internal`.-## seq, head, input_cursor+## Cursors- **`seq`** — a monotonic id assigned to each event.- **`head`** — the highest `seq` in the session.diff --git a/docs/agent-sessions/messaging.mdx b/docs/agent-sessions/messaging.mdxindex ed5b0c63..66a7aedc 100644--- a/docs/agent-sessions/messaging.mdx+++ b/docs/agent-sessions/messaging.mdx@@ -22,7 +22,7 @@ Content-Type: application/jsonPass `idempotency_key` so retries (flaky network, double-click) are de-duplicated — applied at most once **per session**, so the same key is safe to reuse across different sessions.-## The envelope+## Message envelopeEvery inbound and outbound message normalizes to this shape. The core fields are fixed; anything source-specific lives under `raw`, which the platform never interprets.@@ -47,6 +47,6 @@ Every inbound and outbound message normalizes to this shape. The core fields are- **`refs`** — structured context the agent shouldn't have to infer from prose. Blessed keys: `repo`, `branch`, `commit`, `ref`, `issue`, `pr` (plus your own). Pass them on the initial `input` so a coding agent knows its target.- **`raw`** — untouched original payload; optional, never read by the core.-To get a session's output **out**, register a webhook destination. Deliveries carry the full [Event](/agent-sessions/events) (a message event's `body` is this envelope) — see [Webhooks](/agent-sessions/webhooks).+To deliver a session's output, register a webhook destination. Deliveries carry the full [Event](/agent-sessions/events) (a message event's `body` is this envelope) — see [Webhooks](/agent-sessions/webhooks).<Note>[Inbound channels](/agent-sessions/channels) (Slack, GitHub, Jira, email) are coming soon — they map onto this same envelope; today you steer in via the API.</Note>diff --git a/docs/agent-sessions/overview.mdx b/docs/agent-sessions/overview.mdxindex c2494513..e1731f96 100644--- a/docs/agent-sessions/overview.mdx+++ b/docs/agent-sessions/overview.mdx@@ -5,7 +5,7 @@ description: "Define an agent, then run resumable, steerable sessions"Give an agent a prompt and a task; OpenComputer runs it on a managed runtime and records every step as a **durable, streamable, resumable session** — stream it live, steer it with a message, and get results by webhook.-## What the platform handles for you+## Managed pieces<CardGroup cols={2}><Card title="Self-healing, managed runtime" icon="heart-pulse">@@ -42,17 +42,17 @@ Give an agent a prompt and a task; OpenComputer runs it on a managed runtime and</Step></Steps>-## How it works+## Architecture<Frame><img src="/images/durable-agent-sessions-architecture.svg" alt="Durable Agent Sessions architecture: your app starts/steers and streams a durable event-log session; a runtime (the brain) reads and appends to it and acts in a sandbox (the hands); the model runs on your key from the secret store, which never enters a sandbox; user-level events are delivered out via your webhook." /></Frame>-The **event log** is the durable spine: you start and steer against it, stream from it, and it drives the runtime. The **brain** (agent loop) is isolated from the **hands** sandbox (where commands and file edits run), your key lives in the secret store — never in a sandbox — and user-level events are delivered out to your webhook.+The event log is the durable record. Your app starts sessions, streams events, and steers with messages. The runtime reads and appends to the log, drives the hands sandbox for file and command work, and delivers user-level events to your webhook. Your model key stays in the secret store.-## When to use it+## Use cases-Reach for sessions when you want a long-running or interactive agent and don't want to build the plumbing above yourself. For a one-shot command in a raw box, use a [sandbox](/sandboxes/overview) directly.+Use sessions for long-running or interactive agents. For a one-shot command in a raw box, use a [sandbox](/sandboxes/overview) directly.## Next steps@@ -63,7 +63,7 @@ Reach for sessions when you want a long-running or interactive agent and don't w<Card title="Prompting" icon="file-lines" href="/agent-sessions/prompting">Start from a prompt template designed for useful event streams and final results.</Card>- <Card title="How sessions work" icon="book" href="/agent-sessions/sessions">- How a session works — lifecycle and events.+ <Card title="Session lifecycle" icon="book" href="/agent-sessions/sessions">+ Statuses, events, results, and limits.</Card></CardGroup>diff --git a/docs/agent-sessions/prompting.mdx b/docs/agent-sessions/prompting.mdxindex 95efb10f..09271dd8 100644--- a/docs/agent-sessions/prompting.mdx+++ b/docs/agent-sessions/prompting.mdx@@ -3,11 +3,11 @@ title: "Prompting agents"description: "Write Claude runtime prompts that produce reliable sessions"----In Durable Agent Sessions, the prompt is part of your application contract. It shapes the event stream your UI renders, when the agent asks for help, what it treats as done, and how easy failures are to debug.+In Durable Agent Sessions, the prompt shapes the event stream your UI renders, when the agent asks for help, what it treats as done, and how easy failures are to debug.Use a prompt that tells the agent how to work in the sandbox, how to communicate progress, and how to end each turn.-## A good starting prompt+## Coding-agent promptThis is a production-minded baseline for coding agents. Adapt the product-specific section, but keep the operating rules explicit.@@ -92,7 +92,7 @@ Treat refs.repo, refs.branch, refs.commit, refs.issue, and refs.pras authoritative task context. Do not infer those values from prose.```-## Make outputs easy to render+## Renderable outputsDesign your prompt around the UI you want:@@ -114,13 +114,13 @@ Your renderer should still switch on [event `type`](/agent-sessions/events#event- Do not rely on unstructured final prose as your only completion signal. Await `turn.completed`.- Do not assume side effects run once. Use idempotency keys in your app and ask the agent to make external actions idempotent.-## Where to go next+## Next steps<CardGroup cols={2}><Card title="Runtime tools" icon="toolbox" href="/agent-sessions/runtime-tools">The exact tools the Claude runtime can use.</Card><Card title="Events" icon="timeline" href="/agent-sessions/events">- How progress updates, tool calls, results, and errors appear in the log.+ Progress updates, tool calls, results, and errors in the log.</Card></CardGroup>diff --git a/docs/agent-sessions/quickstart.mdx b/docs/agent-sessions/quickstart.mdxindex 0c814753..a783e153 100644--- a/docs/agent-sessions/quickstart.mdx+++ b/docs/agent-sessions/quickstart.mdx@@ -27,7 +27,7 @@ ANTHROPIC_API_KEY=sk-ant-...## 1. Create an agent-An agent is the reusable definition of what runs: name, runtime, model, prompt, and model credential.+An agent stores reusable configuration: name, runtime, model, prompt, and model credential.```httpPOST https://api.opencomputer.dev/v3/agentsdiff --git a/docs/agent-sessions/runtime-tools.mdx b/docs/agent-sessions/runtime-tools.mdxindex c6aed53c..afc9d8a6 100644--- a/docs/agent-sessions/runtime-tools.mdx+++ b/docs/agent-sessions/runtime-tools.mdx@@ -5,7 +5,7 @@ description: "The tools the claude runtime can use — what to rely on when youWhen you write a prompt for the `claude` [runtime](/agent-sessions/runtimes), it's useful to know exactly what the agent can do. Every side effect runs through a fixed set of tools against the session's **sandbox** — the agent has no direct filesystem, shell, or network of its own. The built-in local tools are disabled; only these remote tools are available.-## Working in the sandbox+## Sandbox tools| Tool | What it does || --- | --- |@@ -21,7 +21,7 @@ For launch, `use_repo` works with public repos. Private-repo access and prepared<Note>**Network:** the sandbox has **open outbound internet** by default (so `git clone`, package installs, and API calls just work), with private, loopback, link-local, and cloud-metadata addresses blocked. Per-agent egress allowlists are coming.</Note>-## Talking to the user+## User-facing tools| Tool | What it does || --- | --- |@@ -32,11 +32,11 @@ The agent's final `say` is the session result. `ask` ends the turn with `yield_r<Note>The formal blocking `ask` state is coming soon. Today the turn yields rather than blocking.</Note>-## Delivering work to external systems+## External delivery tools`deliver` (open/update a pull request or post a comment) and `reconcile` (declare the desired end state and let the platform converge to it) are how an agent acts **outside** the sandbox. They land with the channel launches (GitHub, etc.); until then, get a session's output out via [webhooks](/agent-sessions/webhooks) — the agent's `user`-level messages and results are delivered there.-## Writing good prompts+## Prompt guidance- Tell the agent to do all work in the sandbox via `bash`/`read`/`write` — it can't touch your machine.- To work on a repo, point it at a **public** one (`use_repo`, or `bash` + `git clone`); pass the target in [`input.refs`](/agent-sessions/messaging) (`repo`, `branch`, `commit`) rather than burying it in prose. (Private-repo connections are coming soon.)diff --git a/docs/agent-sessions/runtimes.mdx b/docs/agent-sessions/runtimes.mdxindex 1729542e..29450090 100644--- a/docs/agent-sessions/runtimes.mdx+++ b/docs/agent-sessions/runtimes.mdx@@ -23,7 +23,7 @@ Content-Type: application/json}```-### How it's structured+### Brain and hands sandboxesThe runtime runs the agent loop in its **own per-session sandbox** (the *brain*). The agent's file and shell tools don't run there — they run in a **separate sandbox** (the *hands*) that the brain drives through remote tools, so the model has no local disk or network of its own: the sandbox is the only surface it can act through. The brain carries the [sealed model key](/agent-sessions/authentication#model-credentials) (egress-allowlisted to the model API, swapped in by a host proxy so the key never enters the VM); the hands sandbox holds no secrets at all.@@ -37,20 +37,20 @@ Each **turn is one bounded run**, invoke-style — it:Across turns it continues an on-box **journal**; the durable record is the event log *plus* that journal, which the platform checkpoints at each boundary and restores on recovery ([durability](/agent-sessions/durability)).-### Reliability & supervision+### Supervision and recoveryA regional **supervisor** owns each running session and keeps the runtime healthy — you never restart anything:- **One driver at a time.** The supervisor holds a **fenced lease** on the session: exactly one runtime instance can write at a time, and the fence rejects writes from a stale instance (e.g. a slow machine that returns after it was given up), so a session never has two concurrent writers.- **Liveness.** The lease is renewed while a turn runs. If the runtime's machine dies, the lease lapses and the supervisor **re-claims the turn and continues it** from the journal.-- **Crash / hang / lost machine.** A bad exit restarts the turn in place (bounded attempts, with crash-loop backoff); a hung turn is bounded by a **deadline** and ends `deadline_exceeded`; a lost machine is recreated and **restored from the last checkpoint**. Full matrix in [durability](/agent-sessions/durability#limits).+- **Crash / hang / lost machine.** A bad exit restarts the turn in place (bounded attempts, with crash-loop backoff); a hung turn is bounded by a **deadline** and ends `deadline_exceeded`; a lost machine is recreated and **restored from the last checkpoint**. Full matrix in [durability](/agent-sessions/durability#failure-behavior).- **A turn that can't start fails cleanly.** If the model key can't be resolved or the runtime image can't be fetched, the turn ends with an **`error` event carrying the reason** and the session returns to idle, rather than hanging.- **Backstop reconciler.** A periodic sweep re-dispatches work whose wake-up was missed, re-claims turns whose lease expired, and resets sessions left `running` after a crash, so stranded work is picked up.- **Observable.** Every turn and machine transition — turn start / complete / error, sandbox create / provision / hibernate, lease renew / fence — is recorded, so the platform can show exactly where a session is and why a turn ended the way it did.-## Coming soon+## Planned runtimes<Note>The runtimes below are not yet callable. When one is available, you select it by setting `runtime` to its name — nothing else changes.</Note>- **`codex`, `opencode`** — prebuilt, multi-provider runtimes.-- **Custom (bring your own image)** — package any agent harness as a runtime. See [Custom runtimes](/agent-sessions/custom-runtimes) for the contract and our current thinking.+- **Custom (bring your own image)** — package any agent harness as a runtime. See [Custom runtimes](/agent-sessions/custom-runtimes) for the planned API shape.diff --git a/docs/agent-sessions/sessions.mdx b/docs/agent-sessions/sessions.mdxindex 5614fec7..fc3fb6ec 100644--- a/docs/agent-sessions/sessions.mdx+++ b/docs/agent-sessions/sessions.mdx@@ -5,7 +5,7 @@ description: "The durable, resumable unit of an agent's work"A **session** is the durable unit of an [agent](/agent-sessions/agents) at work: an append-only [event log](/agent-sessions/events), the pinned agent snapshot, and a lifecycle status. Compute attaches to it, detaches when idle, and reattaches on the next message — the log is what persists.-## How a session works+## Session flow1. You create a session from an [agent](/agent-sessions/agents) (and an [Anthropic credential](/agent-sessions/authentication#model-credentials) — both required). The session starts immediately.2. The [runtime](/agent-sessions/runtimes) executes the agent in a sandbox, appending [events](/agent-sessions/events) to the log as it works.@@ -27,9 +27,9 @@ A **session** is the durable unit of an [agent](/agent-sessions/agents) at work:A session also carries `last_turn = { id, state, yield_reason?, result_event_id? }` and `usage`; the fuller turn record (`started_at`, `completed_at`, `error`, `active_seconds`, `usage`) comes from [`GET …/result`](/agent-sessions/api-reference) and `…/turns`. The **`yield_reason`** tells you *why* the last turn ended — `completed`, `needs_input` (the agent asked a question — the session is now `awaiting_input`; answer by [steering](/agent-sessions/messaging)), `budget_exceeded` / `deadline_exceeded` / `max_turns` (a [limit](#limits) tripped), or `canceled`.-## Get the result+## Fetch the result-Don't sniff prose for "is it done." Await the **`turn.completed`** event (on the [stream](/agent-sessions/events) or a [webhook](/agent-sessions/webhooks)), then fetch the answer:+Do not infer completion from prose. Await the **`turn.completed`** event (on the [stream](/agent-sessions/events) or a [webhook](/agent-sessions/webhooks)), then fetch the answer:```httpGET https://api.opencomputer.dev/v3/sessions/sess_.../resultdiff --git a/docs/agent-sessions/triggers.mdx b/docs/agent-sessions/triggers.mdxindex 4fcede79..84357741 100644--- a/docs/agent-sessions/triggers.mdx+++ b/docs/agent-sessions/triggers.mdx@@ -3,7 +3,7 @@ title: "Triggers"description: "Start and resume sessions from external events (coming soon)"----<Note>**Coming soon.** Current thinking, not a shipped contract. Today you start a session with [`POST /sessions`](/agent-sessions/api-reference) and steer it with [`POST /messages`](/agent-sessions/messaging); triggers add an event-driven way to do the same.</Note>+<Note>**Planned.** This page describes planned API shape, not shipped behavior. Today you start a session with [`POST /sessions`](/agent-sessions/api-reference) and steer it with [`POST /messages`](/agent-sessions/messaging).</Note>Triggers let external events start and resume sessions without an API call. You declare them on an [agent](/agent-sessions/agents); the platform receives the events and routes them to the right session.diff --git a/docs/agent-sessions/webhooks.mdx b/docs/agent-sessions/webhooks.mdxindex fb9d590c..9a55700d 100644--- a/docs/agent-sessions/webhooks.mdx+++ b/docs/agent-sessions/webhooks.mdx@@ -3,7 +3,7 @@ title: "Webhooks"description: "Deliver a session's output, and control deliveries"----Register a **destination** and a session's [events](/agent-sessions/events) are delivered to it as **`Event` objects — the same shape the [SSE stream](/agent-sessions/events) emits** — at-least-once, signed, and retried. (Webhooks carry every event `type` — `turn.completed`, `exec.completed`, messages, … — not just messages.) Filter what you receive so you're not spammed with internal chatter.+Register a **destination** and a session's [events](/agent-sessions/events) are delivered to it as **`Event` objects — the same shape the [SSE stream](/agent-sessions/events) emits** — at-least-once, signed, and retried. (Webhooks carry every event `type` — `turn.completed`, `exec.completed`, messages, … — not just messages.) Filter what you receive to avoid internal runtime detail.## Destinations@@ -52,7 +52,7 @@ Delivery = {<Note>Coming soon: full request/response **body** capture in delivery detail (today records status, attempts, response code, and error); a **test-ping** for a destination; and **org/agent-scoped** destinations that persist across sessions.</Note>-## Delivery contract+## Signing, retries, and dedupe- **HTTPS only.** Private, loopback, link-local, and cloud-metadata addresses are refused.- **At-least-once.** Retried with exponential backoff; after the max attempts a delivery is **dead-lettered** (inspect and redeliver it above). A duplicate can still arrive — a send that succeeds as the worker dies, or a replayed turn — so **dedupe on `webhook-id`** (it equals the event id).@@ -77,4 +77,4 @@ function verify(headers, rawBody, secret) {}```-<Note>Today, delivery is over **generic webhooks**. Slack, GitHub comments, Jira, and email are coming soon — all on this same envelope and delivery contract.</Note>+<Note>Today, delivery is over **generic webhooks**. Slack, GitHub comments, Jira, and email are coming soon — all on this same event and delivery model.</Note>diff --git a/docs/agent-sessions/workspaces.mdx b/docs/agent-sessions/workspaces.mdxindex 6c72ed03..9536c9f2 100644--- a/docs/agent-sessions/workspaces.mdx+++ b/docs/agent-sessions/workspaces.mdx@@ -3,7 +3,7 @@ title: "Workspaces"description: "Prepared repo environments, rebuilt on push (coming soon)"----<Note>**Coming soon.** Current thinking, not a shipped contract. Today a session works in its [sandbox](/agent-sessions/runtime-tools) and clones a repo on demand; workspaces prepare that environment ahead of time.</Note>+<Note>**Planned.** This page describes planned API shape, not shipped behavior. Today a session works in its [sandbox](/agent-sessions/runtime-tools) and clones a repo on demand.</Note>Cloning, installing, and building take minutes. A **workspace** does that work ahead of time — on every push — and snapshots the result, so a session boots into a ready machine in seconds. It is a first-class resource (not an agent attribute), shared by every session that lands on its repo(s).