Skip to content

An open-source, faster Devin alternative

TypeScript

docs: restructure agent-sessions — per-concept pages, additive copy, feature-block overview

Igor Zalutskiba621ed642cf
diff --git a/docs/agent-sessions/agents.mdx b/docs/agent-sessions/agents.mdx
new file mode 100644
index 00000000..3cfbd4d4
--- /dev/null
+++ b/docs/agent-sessions/agents.mdx
@@ -0,0 +1,25 @@
+---
+title: "Agents"
+description: "The reusable definition of what runs"
+---
+
+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). Create one and start many [sessions](/agent-sessions/sessions) from it.
+
+```bash
+curl https://api.opencomputer.dev/v3/agents \
+ -H "Authorization: Bearer $OPENCOMPUTER_API_KEY" \
+ -d '{ "name": "reviewer", "model": "anthropic/claude-opus-4-8",
+ "prompt": "You review code.", "runtime": "claude" }'
+```
+
+For a one-off, skip the agent and inline `prompt` + `model` when you [start a session](/agent-sessions/sessions) — same result, no named record.
+
+## Pinned snapshot
+
+When a session is created it **freezes** the agent's `prompt`, `model`, and `runtime` into the session. 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.
+
+## Model
+
+`model` is a `provider/model` id (e.g. `anthropic/claude-opus-4-8`); the chosen [runtime](/agent-sessions/runtimes) determines which models are valid. Usage is billed to your OpenComputer account, or to [your own provider key](/agent-sessions/authentication#model-credentials-byo-key).
+
+<Note>Additional model providers, and switching a session's model mid-run, are coming soon.</Note>
diff --git a/docs/agent-sessions/api-reference.mdx b/docs/agent-sessions/api-reference.mdx
index ee197f65..98c066f3 100644
--- a/docs/agent-sessions/api-reference.mdx
+++ b/docs/agent-sessions/api-reference.mdx
@@ -30,7 +30,7 @@ Session = { id, status, head, cursor,
| `GET /sessions/:id/events?after=<seq>&level=<lvl>&limit=<n>` | Read events since a cursor. |
| `GET /sessions/:id/events?after=<seq>&level=<lvl>&stream=sse` | Live SSE stream from a cursor. |
-`after` resumes from a `seq`; `level` is the max [level](/agent-sessions/concepts#levels) to receive.
+`after` resumes from a `seq`; `level` is the max [level](/agent-sessions/events#levels) to receive.
```
Event = { id, seq, ts, session, actor, kind, level, body, refs }
diff --git a/docs/agent-sessions/authentication.mdx b/docs/agent-sessions/authentication.mdx
index b4ba5fa1..92825820 100644
--- a/docs/agent-sessions/authentication.mdx
+++ b/docs/agent-sessions/authentication.mdx
@@ -38,7 +38,7 @@ browser ──(client_token)──▶ GET …/events (SSE) · POST …/messages
## Model credentials (BYO key)
-By default, runs are **platform-billed on Anthropic** — zero setup, metered to your org, capped per session. To run on **your own** provider key, add a credential once. It's stored in our secret store (encrypted, write-only, never returned) — you never manage a raw secret store yourself.
+Model usage is **billed to your OpenComputer account** by default — zero setup, metered, capped per session. To run on **your own** provider key instead, add a **credential**. It's stored in our secret store (encrypted, write-only, never returned) — you never manage a raw secret store yourself.
```bash
curl https://api.opencomputer.dev/v3/credentials \
@@ -54,4 +54,4 @@ curl -X PUT https://api.opencomputer.dev/v3/credentials/default \
**Resolution** for each run: the agent's credential → your org default for the model's provider → platform billing.
-<Note>Today only **Anthropic** (the `claude` runtime). Other providers and model hot-swap are [coming soon](/agent-sessions/runtimes) — the credentials shape is the same, so adding them won't break anything.</Note>
+<Note>Additional model providers and model hot-swap are coming soon — the credential shape is identical, so adopting them is additive (nothing you build today changes).</Note>
diff --git a/docs/agent-sessions/concepts.mdx b/docs/agent-sessions/concepts.mdx
deleted file mode 100644
index b58a1430..00000000
--- a/docs/agent-sessions/concepts.mdx
+++ /dev/null
@@ -1,70 +0,0 @@
----
-title: "Concepts"
-description: "Agents, sessions, events, and the run loop"
----
-
-## The run loop
-
-1. You create a **session** from an **agent** (a prompt + model). The run starts.
-2. The **runtime** executes the agent in a sandbox, **appending events** to the session log as it works.
-3. When it has nothing to do, the session goes **idle** and the sandbox **hibernates**.
-4. A **steer** message wakes it; it resumes with full prior context. Repeat.
-
-## Agent
-
-A first-class, reusable definition of *what* runs: `{ name, prompt, model, runtime }`. Create one and start many sessions from it, or inline `{ prompt, model }` at session-create for a one-off.
-
-**Agent snapshot.** At create, the session **freezes** the agent's `{ prompt, model, runtime }`. Editing the named agent later never changes a running or resumed session — its behavior is pinned.
-
-## Session
-
-One durable run: an append-only **event log** plus the pinned snapshot and a lifecycle status.
-
-| Status | Meaning |
-| --- | --- |
-| `running` | A turn is executing. |
-| `idle` | Quiescent and steerable; the sandbox is hibernated. |
-| `failed` | The run errored out. |
-| `archived` | Closed; read-only. |
-
-A session also carries `last_turn = { state: "ok" | "error", result_event_id?, error? }`, so a one-off run tells you whether it finished and what it produced. By convention, the **final result is a `user`-level `message` event**.
-
-## Event
-
-Every step is an event, appended in order:
-
-```json
-{ "id": "evt_…", "seq": 12, "ts": "…", "session": "sess_…",
- "actor": { "id": "agent", "type": "agent" },
- "kind": "message", "level": "user",
- "body": { "text": "3 tests fail in auth.spec.ts" }, "refs": {} }
-```
-
-- **`kind`** — `message` (content), `status` (lifecycle), or `error`.
-- **`actor`** — `{ id, display?, type: "human" | "agent" | "system" }`.
-- **`level`** — see below.
-- **`body` / `refs`** — payload and related ids.
-
-Inbound and outbound messages share one [envelope](/agent-sessions/messaging#the-envelope) shape.
-
-## seq / cursor / head
-
-- **`seq`** — a monotonic id assigned to each event; the cursor space.
-- **`head`** — the highest `seq` in the session.
-- **`cursor`** — how far a reader (or the runtime) has consumed.
-
-Read or stream with `after=<seq>` and you get everything since that point — this is how **resume** works: reconnect with the last `seq` you saw.
-
-## Levels
-
-Every event has a visibility level; filter the stream and webhooks by it.
-
-| Level | For |
-| --- | --- |
-| `internal` | The agent's own reasoning and tool detail. |
-| `progress` | Step-by-step updates. |
-| `user` | What an end user should see (default for delivery). |
-
-## Runtime
-
-The stateless engine that runs the agent loop. **`claude`** today; more [coming soon](/agent-sessions/runtimes). The runtime works in a sandbox that hibernates when idle — durability is the session's job, not the runtime's.
diff --git a/docs/agent-sessions/events.mdx b/docs/agent-sessions/events.mdx
new file mode 100644
index 00000000..2e7e4c8f
--- /dev/null
+++ b/docs/agent-sessions/events.mdx
@@ -0,0 +1,39 @@
+---
+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.
+
+```json
+{ "id": "evt_…", "seq": 12, "ts": "…", "session": "sess_…",
+ "actor": { "id": "agent", "type": "agent" },
+ "kind": "message", "level": "user",
+ "body": { "text": "3 tests fail in auth.spec.ts" }, "refs": {} }
+```
+
+- **`id`** — unique; the idempotency key for appends.
+- **`kind`** — `message` (content), `status` (lifecycle), or `error`.
+- **`actor`** — who produced it: `{ id, display?, type: "human" | "agent" | "system" }`.
+- **`level`** — visibility; see below.
+- **`body` / `refs`** — payload and related ids.
+
+Inbound and outbound messages share one [envelope](/agent-sessions/messaging#the-envelope) shape.
+
+## Levels
+
+Every event has a visibility level; filter the stream and webhooks by it.
+
+| Level | For |
+| --- | --- |
+| `internal` | The agent's own reasoning and tool detail. |
+| `progress` | Step-by-step updates. |
+| `user` | What an end user should see (default for delivery). |
+
+## seq, cursor, head
+
+- **`seq`** — a monotonic id assigned to each event; the cursor space.
+- **`head`** — the highest `seq` in the session.
+- **`cursor`** — how far a reader (or the runtime) has consumed.
+
+Read or stream with `after=<seq>` and you get everything since that point. This is how **resume** works: reconnect with the last `seq` you saw — you miss nothing and get no duplicates.
diff --git a/docs/agent-sessions/overview.mdx b/docs/agent-sessions/overview.mdx
index 61a1ad84..2654e4ec 100644
--- a/docs/agent-sessions/overview.mdx
+++ b/docs/agent-sessions/overview.mdx
@@ -14,40 +14,50 @@ curl https://api.opencomputer.dev/v3/sessions \
# → { "session": { "id": "sess_…", "status": "running" }, "client_token": "…" }
```
-## What you get
+## Start a run
-- **One call to start** — `POST /v3/sessions` with a prompt, model, and task; the run begins immediately.
-- **A durable event log** — every message, action, and status is appended with a monotonic `seq`; nothing is lost.
-- **Live streaming + resume** — tail the log over SSE; reconnect from any cursor and continue.
-- **Hibernate on idle** — the sandbox sleeps between turns and wakes on the next message; you pay storage-only while it's idle.
-- **Steer & notify** — send a follow-up message any time; register a webhook to get results pushed to you, reliably.
-- **Browser-safe tokens** — issue a session-scoped token so a front-end can stream and steer without your API key.
+`POST /v3/sessions` with a `prompt`, `model`, and `input` (or a saved [agent](/agent-sessions/agents)) and the run begins immediately. One call. See the [quickstart](/agent-sessions/quickstart).
-## What "durable" means here
+## Stream & resume
-<Note>
- We're precise about this so you can build on it:
- - The **event log is the source of truth** and is always durable.
- - The **stream resumes** from any cursor — disconnects lose nothing.
- - A **hibernated sandbox resumes** with its state intact.
+Tail the [event log](/agent-sessions/events) over SSE from any cursor. Disconnect and reconnect with the last `seq` you saw — you continue exactly where you left off, nothing missed or duplicated.
- It is **not** byte-exact recovery after arbitrary failure. If a sandbox is *lost* (not hibernated), the session may re-run or re-clone, and only **logged or delivered outputs are guaranteed durable**. Byte-exact resume is [coming soon](/agent-sessions/durability#limits).
-</Note>
+## Steer & get notified
-## When to use it
+Send a follow-up [message](/agent-sessions/messaging) any time; the session wakes and continues with full prior context. Register a **webhook** and the agent's user-facing output is pushed to you.
+
+## Browser-safe access
+
+Every session hands back a scoped [client token](/agent-sessions/authentication#client-tokens) (`read` + `steer`) so a front-end can stream and steer **without** your API key.
+
+## What the platform handles for you
-Reach for sessions when you want a long-running or interactive agent and don't want to build the plumbing — an event store, live streaming, resume, idle hibernation, and reliable delivery — yourself. For a one-shot command in a raw box, use a [sandbox](/sandboxes/overview) directly.
+The non-trivial parts you'd otherwise build — and get subtly wrong — handled:
+
+<CardGroup cols={2}>
+ <Card title="Reliable delivery" icon="paper-plane">
+ Outbound messages are delivered at-least-once, idempotent per destination, retried with backoff, and dead-lettered — no lost or duplicated webhooks.
+ </Card>
+ <Card title="Managed sandbox lifecycle" icon="box">
+ Provision, hibernate on idle (storage-only ≈ free), wake in milliseconds, recover a dead sandbox, tear down — none of it your problem.
+ </Card>
+ <Card title="Isolated model access" icon="shield-halved">
+ The model loop runs in a sandbox separate from your agent's code execution, so a prompt-injected agent can't reach your model key.
+ </Card>
+ <Card title="Durable event log" icon="database">
+ Append + notify in one transaction, idempotent and monotonic — the log is the source of truth, so resume is exact and there's no lost-update window.
+ </Card>
+ <Card title="One driver, crash-safe" icon="lock">
+ A fenced lease guarantees a single active runtime; a crashed or stale run is fenced out and re-woken from its cursor.
+ </Card>
+ <Card title="Budget & safety guards" icon="gauge-high">
+ Per-session spend cap, crash-loop backstop, and SSRF-guarded, signed webhook delivery — runaways and abuse are bounded by default.
+ </Card>
+</CardGroup>
-## Available today vs coming soon
+## When to use it
-| Today | Coming soon |
-| --- | --- |
-| Agents on the `claude` runtime | Other runtimes (`codex`, `opencode`, custom BYO image) |
-| Create / run / stream / resume / hibernate / archive sessions | `ask` (blocking request-for-input) |
-| Steer by session id | Inbound channels (Slack, GitHub, Jira, email) |
-| Outbound webhook delivery (signed, retried, filtered) | Outbound channel delivery (post to Slack, GitHub, …) |
-| Browser client tokens · BYO Anthropic key | Other providers · model hot-swap |
-| Platform-billed Anthropic + per-session cap | Workspaces, scheduled triggers, byte-exact resume |
+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.
## Next steps
@@ -55,7 +65,7 @@ Reach for sessions when you want a long-running or interactive agent and don't w
<Card title="Quickstart" icon="bolt" href="/agent-sessions/quickstart">
Start a session, stream it, and steer it in a few minutes.
</Card>
- <Card title="Concepts" icon="book" href="/agent-sessions/concepts">
- Agents, sessions, events, cursors, and statuses.
+ <Card title="How sessions work" icon="book" href="/agent-sessions/sessions">
+ The run loop, lifecycle, and events.
</Card>
</CardGroup>
diff --git a/docs/agent-sessions/quickstart.mdx b/docs/agent-sessions/quickstart.mdx
index e2c48922..68d697df 100644
--- a/docs/agent-sessions/quickstart.mdx
+++ b/docs/agent-sessions/quickstart.mdx
@@ -34,7 +34,7 @@ curl https://api.opencomputer.dev/v3/sessions \
## 2. Stream it live
-Tail the event log over SSE from a cursor. Use the `client_token` from step 1 — no API key needed in the client. `level=user` shows only what an end user should see (see [levels](/agent-sessions/concepts#levels)).
+Tail the event log over SSE from a cursor. Use the `client_token` from step 1 — no API key needed in the client. `level=user` shows only what an end user should see (see [levels](/agent-sessions/events#levels)).
```js
const res = await fetch(
@@ -76,8 +76,8 @@ See [Messaging & webhooks](/agent-sessions/messaging) to verify the signature.
## Next steps
<CardGroup cols={2}>
- <Card title="Concepts" icon="book" href="/agent-sessions/concepts">
- The session model: events, cursors, statuses.
+ <Card title="Sessions" icon="book" href="/agent-sessions/sessions">
+ The run loop, lifecycle, and events.
</Card>
<Card title="Messaging & webhooks" icon="bell" href="/agent-sessions/messaging">
The envelope, steering, and reliable delivery.
diff --git a/docs/agent-sessions/runtimes.mdx b/docs/agent-sessions/runtimes.mdx
index cffe5c6e..5d17bd03 100644
--- a/docs/agent-sessions/runtimes.mdx
+++ b/docs/agent-sessions/runtimes.mdx
@@ -7,7 +7,7 @@ A **runtime** is the stateless engine that executes the agent loop. You pick one
## `claude` — available today
-The managed Claude agent loop. It works in a sandbox through remote tools, streams its steps into the session as events, and runs on Anthropic models — platform-billed by default, or on your [own key](/agent-sessions/authentication#model-credentials-byo-key).
+The managed Claude agent loop. It works in a sandbox through remote tools, streams its steps into the session as events, and runs Claude models — billed to your OpenComputer account, or on your [own key](/agent-sessions/authentication#model-credentials-byo-key).
```bash
curl https://api.opencomputer.dev/v3/agents \
diff --git a/docs/agent-sessions/sessions.mdx b/docs/agent-sessions/sessions.mdx
new file mode 100644
index 00000000..6e53c793
--- /dev/null
+++ b/docs/agent-sessions/sessions.mdx
@@ -0,0 +1,26 @@
+---
+title: "Sessions"
+description: "A durable, resumable run of an agent"
+---
+
+A **session** is one durable run of an [agent](/agent-sessions/agents): 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.
+
+## The run loop
+
+1. You create a session from an agent (or an inline prompt + model). The run 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.
+3. With nothing left to do, the session goes **idle** and the sandbox **hibernates** (see [durability](/agent-sessions/durability)).
+4. A [steer](/agent-sessions/messaging) message wakes it; it resumes with full prior context. Repeat.
+
+## Lifecycle
+
+| Status | Meaning |
+| --- | --- |
+| `running` | A turn is executing. |
+| `idle` | Quiescent and steerable; the sandbox is hibernated. |
+| `failed` | The run errored out. |
+| `archived` | Closed; read-only. |
+
+A session also carries `last_turn = { state: "ok" | "error", result_event_id?, error? }`, so a one-off run tells you whether it finished and what it produced. By convention the **final result is a `user`-level [`message`](/agent-sessions/events) event**.
+
+<Note>Blocking on input mid-run (`ask` / awaiting-input) is coming soon. Today, steer is fire-and-continue: send a message and the session incorporates it on its next turn.</Note>
diff --git a/docs/docs.json b/docs/docs.json
index 3a9803a8..0e7d9695 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -63,7 +63,9 @@
"pages": [
"agent-sessions/overview",
"agent-sessions/quickstart",
- "agent-sessions/concepts",
+ "agent-sessions/agents",
+ "agent-sessions/sessions",
+ "agent-sessions/events",
"agent-sessions/authentication",
"agent-sessions/durability",
"agent-sessions/messaging",