An open-source, faster Devin alternative
TypeScript
docs: remove stale orphaned agent docs (agent-sessions/, background-agents/, sessions-api/)
Devin AIc801b34286c5
diff --git a/docs/agent-sessions/agent-urls.mdx b/docs/agent-sessions/agent-urls.mdxdeleted file mode 100644index 22395b3e..00000000--- a/docs/agent-sessions/agent-urls.mdx+++ /dev/null@@ -1,140 +0,0 @@-----mode: "wide"-title: "Agent URLs"-description: "Start a durable session from an agent's permanent HTTP address"------Every agent has an `invoke_url`. A trusted backend can `POST` JSON to its exact-root path to start one ordinary durable [session](/agent-sessions/sessions) on-the agent's active revision.--<Warning>- Root invocation requires your OpenComputer org API key. Keep that key on your- backend; do not put it in browser code or an external webhook configuration.- For a pasteable, independently revocable URL, create an [Agent- Hook](/agent-sessions/hooks).-</Warning>--## Invoke an agent--<CodeGroup>--```ts TypeScript-import { OpenComputer, connectSession } from "@opencomputer/sdk";--const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! });-const agent = await oc.agents.get("agt_...");--const response = await fetch(`${agent.invokeUrl}/`, {- method: "POST",- headers: {- Authorization: `Bearer ${process.env.OPENCOMPUTER_API_KEY}`,- "Content-Type": "application/json",- "Idempotency-Key": "alert-018f",- },- body: JSON.stringify({- source: "sentry",- title: "Checkout errors increased",- }),-});-const receipt = await response.json();--const session = await connectSession({- sessionId: receipt.session.id,- clientToken: receipt.client_token,-});-```--```bash oc CLI-oc agent invoke reviewer \- --data '{"source":"sentry","title":"Checkout errors increased"}' \- --idempotency-key alert-018f-```--```bash curl-curl "$AGENT_URL/" \- -H "Authorization: Bearer $OPENCOMPUTER_API_KEY" \- -H "Content-Type: application/json" \- -H "Idempotency-Key: alert-018f" \- -d '{"source":"sentry","title":"Checkout errors increased"}'-```--</CodeGroup>--`POST /` accepts any JSON value. The body is capped at 24 KiB and cannot select-a model, revision, sources, destinations, or limits; those values come from the-agent. The request becomes a structured `http.request` event:--```json-{- "type": "http.request",- "level": "user",- "body": {- "payload": {- "source": "sentry",- "title": "Checkout errors increased"- }- }-}-```--Transport headers and credentials are not included in the event or sent to the-agent.--## Receipt and continuation--Success returns `202 Accepted` after the session, input, and retryable runtime-dispatch are durable. It does not wait for the agent's answer.--```json-{- "request_id": "req_...",- "session": { "id": "ses_...", "status": "queued", "head": 1 },- "client_token": "eyJ...",- "links": {- "events": "https://api.opencomputer.dev/v3/sessions/ses_.../events",- "messages": "https://api.opencomputer.dev/v3/sessions/ses_.../messages"- },- "replayed": false-}-```--The one-hour `client_token` can read, stream, and steer only the returned-session. Use it with `connectSession` or the canonical Sessions API. The agent-hostname does not expose session reads, streams, steering, or arbitrary paths.--## Idempotency and retries--Send an `Idempotency-Key` when a timeout or network failure may leave the-outcome unknown. Reusing the same key and JSON against the same agent returns-the original session, even if the active revision changed after the first-acceptance. Reusing the key with different JSON returns `409`. Without a key,-every accepted request creates a new session.--The CLI generates one key and keeps it stable across its automatic transport-retries. Supply `--idempotency-key` when separate CLI runs must converge.--## Routes and errors--The Agent URL has two application routes:--| Route | Credential | Result |-| --------------------- | ------------------------ | ----------------------------------------- |-| `POST /` | OpenComputer org API key | `202` receipt with a session client token |-| `POST /hooks/<token>` | Hook URL itself | `200` receipt without session access |--Opening the root URL in a browser shows a static usage guide. The page is-derived from the hostname only: it does not look up the agent or prove that the-agent exists.--Queries, redirects, trailing path variants, and every other route are rejected.-Root invocation is server-to-server and does not advertise browser CORS.--Common errors are `400` invalid JSON/query/idempotency key, `401` invalid org-key, `402` insufficient credits, `404` missing or inaccessible agent, `409`-idempotency conflict, `413` oversized input, `415` unsupported media/encoding,-`422` agent/runtime configuration failure, and `429` rate limited. Retry an-ambiguous `5xx` with the same idempotency key.--For richer session creation—model overrides, working repositories,-destinations, or per-session limits—use [`oc.sessions.create()`](/agent-sessions/sessions).diff --git a/docs/agent-sessions/agents.mdx b/docs/agent-sessions/agents.mdxdeleted file mode 100644index 0077e5c5..00000000--- a/docs/agent-sessions/agents.mdx+++ /dev/null@@ -1,113 +0,0 @@-----mode: "wide"-title: "Agents"-description: "Reusable agent configuration"------An **agent** is a reusable identity, runtime, model, and deployed behavior. Every [session](/agent-sessions/sessions) runs on an agent, so create one first, then start as many sessions on it as you like. Every agent also has one permanent [Agent URL](/agent-sessions/agent-urls): a trusted backend can invoke its root with an OpenComputer key, and external systems can use named, revocable [Hook URLs](/agent-sessions/hooks). For the built-in runtimes, behavior is `prompt` plus optional skills and is frozen into independently routable [revisions](/agent-sessions/revisions). A [Flue](/agent-sessions/flue) agent instead carries its instructions, tools, and packaged skills in a compiled Flue app.--<Note>- The [dashboard](https://app.opencomputer.dev) starts with **Import from- GitHub** and keeps **Configure manually** available. Repository import- recognizes both a complete [Flue](/agent-sessions/flue) app and a- prompt-defined Flue root containing `agent.toml`, `prompt.md`, and optional- `skills/`. You can also deploy either local shape with `oc agent deploy`;- prompt-defined roots build in the isolated managed builder, while complete- apps build locally. Both paths produce the same deployment and revision- history.-</Note>--<CodeGroup>--```ts TypeScript SDK-import { OpenComputer } from "@opencomputer/sdk";--const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! });--const agent = await oc.agents.create({- name: "reviewer",- runtime: "claude",- model: "anthropic/claude-opus-4-8",- prompt: "Review the repo. Run tests. Summarize risks.",- key: "sk-ant-...",-});-```--```http REST API-POST https://api.opencomputer.dev/v3/agents-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{- "name": "reviewer",- "runtime": "claude",- "model": "anthropic/claude-opus-4-8",- "prompt": "Review the repo. Run tests. Summarize risks.",- "key": "sk-ant-..."-}-```--</CodeGroup>--Pass your model `key` inline and it's stored as a [credential](/agent-sessions/credentials) and attached to the agent — sessions run the model on it. The provider is taken from `model` (Anthropic for `anthropic/…`, OpenAI for `openai/…`), so the key has to be for that provider. Already have a credential? Reference it with `credential: "cred_…"` instead. Or skip keys entirely with `credential: "managed"` to run the model **via OpenComputer, billed to your credits** (the default for new orgs). Omit both `key` and `credential` to use your org default. Optionally set default [`limits`](/agent-sessions/sessions#usage-and-limits) (`tokens`/`turn_seconds`/`turns`) too; sessions inherit them.--<Tip>- Keep the org key and model key on your backend. Only return session-scoped- client tokens to browsers.-</Tip>--## Start simple, add capability as you go--For a built-in runtime, the only behavior an agent needs is a **model** and a **prompt**. Everything beyond that is additive: reach for a rung only when you need it, and nothing earlier is undone. Flue has a separate [app deployment path](/agent-sessions/flue#add-opencomputer-to-a-flue-app).--| Rung | What you add | What you get |-| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |-| **Default agent** | `name` + `model` (+ a prompt) | a working agent on the default runtime — no setup |-| **+ Skills** | [`SKILL.md` folders](/agent-sessions/skills) (upload a `.zip`, or include in a repo) | reusable procedures the agent loads when relevant — still the default runtime |-| **+ Source-controlled deployment** | link a built-in agent to `prompt.md` + `skills/`, or import a prompt-defined or complete Flue app from GitHub | versioned [deployments and revisions](/agent-sessions/revisions); Flue imports also include durable build logs |-| **+ Custom runtime** _(coming soon)_ | bring your own runtime image | full control of the execution environment |--At every built-in rung the agent is a small directory, at most `agent.toml` + `prompt.md` + `skills/`. You can stop at any rung; most agents never go past skills.--## Create from a repository--Choose **Agents → Create agent → Import from GitHub**, install the OpenComputer GitHub App if needed, and select a repository, production branch, and root. **Review agent** resolves one exact commit without running repository code.--- A prompt-defined or complete Flue root shows its entrypoint, model, Managed model access, and an editable OpenComputer agent name.-- A broken Flue root explains what must be fixed. OpenComputer does not reinterpret it as another agent type.-- An unrecognized root creates nothing. You can choose another folder, fork the Flue starter, or configure a built-in agent manually.-- In a monorepo, OpenComputer may suggest bounded candidate folders. You choose one explicitly and review it before deployment.--Review and import are intentionally separate. Import rechecks the exact source plan; if the repository changed in between, nothing is created and the dashboard asks you to review again. A successful import returns the new agent and its first deployment immediately, then opens guided setup instead of making you wait on a log screen. Connect Slack while the deployment continues in the background; its compact phases and expandable log remain available. When both are ready, setup changes to **Open Slack** without a refresh and invites you to send the first message. Manually configured agents use the same setup journey.--If one of your Slack workspaces already sends messages to another agent, setup-shows that claim before OAuth. Open the connected agent, choose another-workspace, or disconnect it in place after reviewing the routing impact. A-completed first conversation adds direct exits to the agent home, full session,-session history, and Slack.--For a Flue agent, setup also offers **Working repositories** without blocking-Slack or chat. Choose all repositories granted to the OpenComputer GitHub App,-an explicit subset, or an empty subset for chat-only use. The same policy is-available later under **Agent → Settings → Repository access**. This policy is-separate from the repository that deploys the Flue app.--The repository picker marks roots already used by another agent before review.-An exact linked root cannot be reviewed again: open its owning agent, choose a-different monorepo root, or unlink it in place after confirming that-deploy-on-push will stop. Unlinking preserves the existing agent, active-revision, deployment history, and sessions. Guided setup remains available from-the agent page; after the first Slack message creates a session, it shows the-first conversation and links to the complete session view.--## Session-pinned config--For a built-in runtime, creating a session **freezes** the agent's active [revision](/agent-sessions/revisions), including its `prompt`, `model`, `runtime`, and `skills`. It also pins the resolved credential. A one-off [`model`](/agent-sessions/sessions#model) override is pinned in the same way. Editing the named agent does not change a running or resumed session: existing sessions keep what they started with, while new sessions pick up the change. Rotating a credential's **key value** is the exception, so a compromised key can be replaced; see [credentials](/agent-sessions/credentials).--That isolation applies to the built-in runtimes. A Flue session records the selected deployment, but all sessions for that agent execute on its one live Worker. Deploying a new Flue Worker can therefore change existing sessions; see [Flue deployment behavior](/agent-sessions/flue#deployment-and-revision-behavior).--## Model--`model` is a `provider/model` id, and its provider must match the [runtime](/agent-sessions/runtimes): `claude` runs `anthropic/…` (e.g. `anthropic/claude-opus-4-8`), `codex` runs `openai/…` (e.g. `openai/gpt-5-codex`). The model runs either **Managed** (via OpenComputer, billed to your credits — no key) or on [your own key](/agent-sessions/credentials) for that provider, so a key isn't required. The `runtime` / `model` / credential pairing is validated when you **create** the agent. `runtime` is fixed at creation — to switch engines, create a new agent; you can still update `model` later, but keep it within the runtime's provider.--Flue currently uses Managed Anthropic access. Its model is declared in both the compiled app and `agent.toml`; per-session model overrides are not supported.diff --git a/docs/agent-sessions/api-reference.mdx b/docs/agent-sessions/api-reference.mdxdeleted file mode 100644index 6db0c8d3..00000000--- a/docs/agent-sessions/api-reference.mdx+++ /dev/null@@ -1,1141 +0,0 @@-----title: "API / SDK / CLI reference"-description: "Every action in the Durable Agent Sessions API, with its TypeScript SDK call and oc CLI command"------Base URL `https://api.opencomputer.dev/v3`. Management calls authenticate with your **org API key**; stream and steer also accept a **[client token](/agent-sessions/authentication#client-tokens)**.--Each section toggles between the **TypeScript SDK** (`@opencomputer/sdk`), **REST**, and the **`oc` CLI** — pick one and the whole page follows.--```ts-import { OpenComputer, connectSession } from "@opencomputer/sdk";--const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! });-const session = await oc.sessions.get("ses_..."); // server, org key-// or, in a browser: await connectSession({ sessionId, clientToken })-```--```bash-# the oc CLI authenticates with OPENCOMPUTER_API_KEY (or `oc login`); --json on any command-oc whoami-oc agent deploy # deploy the agent directory in the cwd-oc agent build --dir . --check-only --json # validate a Flue app without credentials or deployment-```--<Note>- The SDK uses **camelCase** for fields and params (`last_turn` → `lastTurn`,- `idempotency_key` → `idempotencyKey`); the wire shapes below are raw JSON.- Opaque blobs — session `metadata`, event `refs`/`raw` — pass through- **verbatim**; everything else (incl. event `body`) is camelCased. The CLI- prints a table, or machine-readable JSON with `--json`.-</Note>--## Agent URLs and Hooks--Every `Agent` includes `invoke_url` (SDK: `invokeUrl`), its permanent-application address. The hostname exposes exactly two invocation routes; all-session reads and steering remain on the canonical Sessions API.--| Agent-host route | Authentication | Response |-| --- | --- | --- |-| `POST /` | `Authorization: Bearer <org-key>` | `202` receipt, canonical links, read+steer client token |-| `POST /hooks/<token>` | Hook URL bearer secret; no auth header | `200` receipt without client token or links |--Both use the same durable session-start path. Root requires one JSON value;-Hooks allow either an empty body or one JSON value. Neither returns agent-output synchronously. Queries, redirects, arbitrary paths, session routes, and-browser CORS are absent. See [Agent URLs](/agent-sessions/agent-urls) and-[Hooks](/agent-sessions/hooks) for the complete request contracts.--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| --- | --- |-| `agent.invokeUrl` | Ordinary HTTP URL for trusted-backend `POST /`. |-| `oc.agents.hooks.create(agentId, params)` | Create a named Hook; only this call returns `hookUrl`. |-| `oc.agents.hooks.list(agentId, params)` | List Hook metadata, optionally including revoked rows. |-| `oc.agents.hooks.get(agentId, hookId)` | Fetch Hook metadata without a usable URL. |-| `oc.agents.hooks.delete(agentId, hookId)` | Irreversibly revoke a Hook. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| --- | --- |-| `POST https://<agent-host>/` | Start a session with an org key. |-| `POST https://<agent-host>/hooks/<token>` | Start a session with one invoke-only Hook. |-| `POST /agents/:id/hooks` | Create a Hook (`{ name, expires_at? }`). |-| `GET /agents/:id/hooks` · `GET …/hooks/:hookId` | List / fetch secret-free Hook metadata. |-| `DELETE /agents/:id/hooks/:hookId` | Revoke a Hook. |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| --- | --- |-| `oc agent invoke <id\|name> [--data JSON\|--file PATH\|--stdin]` | Invoke exact root with the configured org key. |-| `oc agent hook create <name> --agent <id\|name>` | Create and print a Hook URL once. |-| `oc agent hooks --agent <id\|name> [--include-revoked]` | List Hook metadata. |-| `oc agent hook get <id\|name> --agent <agent>` | Fetch Hook metadata. |-| `oc agent hook revoke <id\|name> --agent <agent>` | Irreversibly revoke a Hook. |--</Tab>--</Tabs>--Root accepts an optional `Idempotency-Key`. A successful receipt contains-`request_id`, `session { id, status, head }`, `client_token`, canonical-`links { events, messages }`, and `replayed`. Hooks use `Idempotency-Key`, then-`webhook-id` when the first is absent, and return only `request_id`,-`session { id, status }`, and `replayed`.--Hook creation returns `{ hook, hook_url }` once. `Hook` contains `id`,-`agent_id`, `name`, `status` (`active|expired|revoked`), `secret_last4`, nullable-`revoked_reason` (`manual|secret_exposure`), nullable `expires_at`, and-`created_at`.--## Sessions--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| ------------------------------------------- | -------------------------------------------------------------- |-| `oc.sessions.create(params)` | Start a session → a `Session` handle (carries `.clientToken`). |-| `oc.sessions.get(id)` | Fetch a session. |-| `oc.sessions.list(params)` | List sessions (filtered, paginated). |-| `session.archive()` | Cancel any active turn, then close (read-only). |-| `session.cancel()` | Cooperatively stop the active turn (no-op if not running). |-| `session.result()` | `{ lastTurn, result? }` — the resolved final event. |-| `session.turns()` · `session.turn(id)` | Per-turn history: timing, normalized usage, error. |-| `session.sources` · `session.listSources()` | Source checkout status — create snapshot · live poll. |-| `session.mintClientToken(opts)` | Mint a client token. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| ----------------------------------------------------------------- | ------------------------------------------------------------- |-| `POST /sessions` | Start a session → `{ session, client_token }`. |-| `GET /sessions/:id` | Fetch a session. |-| `GET /sessions?status=&agent=&key=&after=&before=&limit=&cursor=` | List sessions (filtered, paginated; `cursor` = `nextCursor`). |-| `POST /sessions/:id/archive` | Cancel any active turn, then close (read-only). |-| `POST /sessions/:id/cancel` | Cooperatively stop the active turn (no-op if not running). |-| `GET /sessions/:id/result` | The result helper — `{ last_turn, result? }`. |-| `GET /sessions/:id/turns` · `…/turns/:turnId` | Per-turn history: timing, normalized usage, error. |-| `GET /sessions/:id/sources` | Source checkout status (`SourceSummary[]`). |-| `POST /sessions/:id/client-tokens` | Mint a client token. |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| --------------------------------------------------------- | ------------------------------------------------ |-| `oc session create --agent <id\|name> [--input <text>]` | Start a session on the agent's active revision. |-| `oc session get <id>` | Fetch a session. |-| `oc session list [--agent <id>] [--status <s>]` | List sessions. |-| `oc session cancel <id>` | Cooperatively stop the active turn. |-| `oc session result <id>` | The resolved final result. |-| `oc session steer <id> <text>` | Send input to a running or waiting session. |-| _(archive · turns · sources · client tokens — REST/SDK only)_ | |--</Tab>--</Tabs>--**Create params** — `agent` is **required**; the model resolves to **Managed** (default) or a [credential](#credentials), else `422 no_credential` / `422 managed_unavailable`.--- `input` — the task (string or [envelope](/agent-sessions/messaging#message-input)). Truncate large inputs; let the agent fetch the rest via [sandbox tools](/agent-sessions/runtime-tools).-- `model?` — run this session on a different model than the agent's (same `provider/model` form; its provider must match the agent's [runtime](/agent-sessions/runtimes), e.g. `anthropic/…` for `claude`). Default = the agent's model. Pinned for the session's life like the rest of the snapshot. Rejected (`400 invalid`) for [flue](/agent-sessions/flue) agents — their model is fixed in the deployed artifact.-- `key?` — get-or-create (one session per key). Keyless: an `Idempotency-Key` header makes create retry-safe.-- `metadata?` — opaque routing state (≤ 16 KB); on get/list + **verbatim in webhooks**; never sent to the model, not indexed.-- `limits?` `{ tokens, turn_seconds, turns }`: non-monetary. On built-in runtimes, `tokens` is checked from committed usage before the next turn and can overshoot by one in-flight turn; `turn_seconds` and `turns` remain separate. These limits are stored but not enforced for Flue sessions.-- `sources?`: working repositories (the token never enters the agent sandbox; see [GitHub](#github-apps-and-repos)). Built-in runtimes prepare them before turn one; Flue materializes them lazily. Each registered `{ repo, ref, sha?, name? }` or inline `{ url, ref, sha, name?, auth }`. `ref` is required; `sha` is required for inline sources but **optional for a registered repo**. For every runtime, `selected` repository access admits only registered repositories allowed by the agent policy and reauthorizes checkout and publishing at use time.-- Client tokens: `scopes?` (`read`/`steer`), `ttl?` 60–86400 s (SDK `ttlSeconds`).--A built-in runtime session pins the agent's active revision for its whole life. A Flue session records its selected deployment but executes on the agent's one live Worker; deploying that Worker can therefore affect an existing session.--**`Session`**--| Field | Type | Notes |-| ----------------------------------- | ---------- | ------------------------------------------------------------------------------------------ |-| `id` `status` `head` `input_cursor` | | id, [lifecycle](/agent-sessions/sessions#lifecycle) status, latest event seq, input cursor |-| `agent_id` `credential_id` | string | resolved + pinned at create |-| `agent_snapshot` | object | `{ prompt_hash, model, runtime, revision }` — `revision` = the pinned revision number |-| `last_turn` | `Turn`-ish | `{ id, state, yield_reason?, result_event_id? }` |-| `usage` | object | terminal-turn rollup: active time, reported/unreported counts, completeness, tokens, optional runtime-reported cost/attribution |-| `limits?` | object | `{ tokens?, turn_seconds?, turns? }` |-| `metadata?` | object | opaque app routing state |-| `key?` `created_at` | | get-or-create key, timestamp |--**`Turn`**--| Field | Notes |-| ----------------------------- | --------------------------------------------------------------------- |-| `id` `state` | turn id, current state |-| `yield_reason?` | why it ended (below) |-| `result_event_id?` | the event carrying the result |-| `error?` | failure detail, if any |-| `started_at?` `completed_at?` | timing |-| `active_seconds` | database-derived active runtime seconds |-| `usage` | `{ reported:true, complete?:false, …tokens, total_cost_usd? }` or `{ reported:false }`; `complete:false` marks a lower bound |--Session usage includes `reported_turns`, `unreported_turns`, and `complete`.-When `complete:false`, any token/cost total present is a lower bound. Missing-`total_cost_usd` means unknown, not zero; historical rows may contain `{}`.-Flue session attribution may be `best_effort`, while its agent/org gateway-remains the spend-enforcement authority. See [usage and limits](/agent-sessions/sessions#usage-and-limits).--A turn's **`yield_reason`** tells you why it stopped:--| Value | Meaning |-| ----------------------------------------------------- | -------------------------------------------------------------- |-| `completed` | finished normally |-| `needs_input` | the agent asked a question — answer it by [steering](#steer) |-| `error` | the turn failed (see `error`) |-| `budget_exceeded` / `deadline_exceeded` / `max_turns` | a [limit](#sessions) tripped — tokens / wall-clock / auto-runs |-| `canceled` | you cancelled it |--**`SessionSource`** — one of two variants:--| Variant | Shape |-| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| registered | `{ repo, ref, sha?, name? }` — `repo` is a `repo_…` id or `"owner/repo"`; App-backed auth. `sha` is **optional** (omit → control plane resolves `ref`→HEAD and pins it at create) |-| inline | `{ url, ref, sha, name?, auth }` — `sha` **required**; `auth = { type:"risky_short_lived_token", token, expires_at }` (can't refresh) |--**`SourceSummary`** (sanitized; on create + `GET …/sources`)--| Field | Notes |-| ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `name` `path` `sha` `resolved_sha?` | local identity + pinned commit + observed commit |-| `repo_id?` `full_name?` `requested_ref?` | stable repository id, current display name, and requested ref |-| `status` | `pending · materializing · resolved · failed · unavailable · auth_required` |-| `error_code?` `error_message?` `retryable?` | on failure — `source.`-prefixed, e.g. `source.auth_required` (App not installed), `source.repo_not_selected` (install doesn't cover the repo), `source.permission_missing`, `source.mint_failed`, `source.ref_not_found`, `source.sha_mismatch`. [Full list](/agent-sessions/repos) |--## Events--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| -------------------------- | ----------------------------------------------------------- |-| `session.listEvents(opts)` | Read events since a cursor. |-| `session.events(opts)` | Live stream from a cursor — a self-resuming async iterator. |-| `session.event(id)` | Fetch one event (resolve `resultEventId`). |-| `session.eventContent(id)` | Fetch a blob-backed body (large outputs). |-| `session.messages(opts)` | User-message history. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| -------------------------------------------------- | ------------------------------ |-| `GET /sessions/:id/events?after=<seq>&level=<lvl>` | Read events since a cursor. |-| `GET /sessions/:id/events?…&stream=sse` | Live SSE stream from a cursor. |-| `GET /sessions/:id/events/:eventId` | Fetch one event. |-| `GET /sessions/:id/events/:eventId/content` | Fetch a blob-backed body. |-| `GET /sessions/:id/messages` | User-message history. |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| -------------------------------------------------------------- | --------------------------- |-| `oc session logs <id> [--follow] [--level <lvl>] [--type <t>]` | Read or live-stream events. |-| _(single event · event content · messages — REST/SDK only)_ | |--</Tab>--</Tabs>--Filter by `type` (exact or `prefix.*`), `turn_id`, `limit`. `after` resumes from a `seq`; `level` is a **visibility threshold** — `user` < `progress` < `internal` (default `internal`; see [visibility levels](/agent-sessions/events#visibility-levels)). Switch on [`type`](/agent-sessions/events#event-shape), don't parse prose. `…/messages` is an alias for `level=user` + `type=*.message`.--**`Event`**--| Field | Notes |-| ---------------------------------------------- | -------------------------------------------------------------------------- |-| `id` `seq` `ts` `session` | id, monotonic seq, timestamp, session id |-| `actor` `type` `level` | source, event [type](/agent-sessions/events#event-shape), visibility level |-| `body` | the payload (camelCased; switch on `type`, don't parse prose) |-| `turn_id?` | the turn it belongs to |-| `content_ref?` `body_truncated?` `body_bytes?` | large bodies are offloaded — fetch via `…/events/:id/content` |--## Steer--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| ----------------------------------------- | ------------------------------------------- |-| `session.steer(text, { idempotencyKey })` | Append an input message; wakes the session. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| ----------------------------- | ------------------------------------------- |-| `POST /sessions/:id/messages` | Append an input message; wakes the session. |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| ------------------------------ | ------------------------------------------- |-| `oc session steer <id> <text>` | Append an input message; wakes the session. |--</Tab>--</Tabs>--Body: `{ text, idempotency_key? }` or `{ envelope }`. Returns `202` (or `200` on idempotent replay) with `{ event: { id, seq }, session: { id, status, head } }`.--## Watches--_Managed with the SDK (`session.watches.create/list/delete`), the CLI (`oc session watch/watches/unwatch`), or REST — authenticate with your **org API key** (server-side). The agent-facing path is the [`watch_pull_request`](/agent-sessions/runtime-tools#github-tools) runtime tool. Full guide: [Watches](/agent-sessions/watches)._--| Method · Path | Purpose |-| --------------------------------------- | ---------------------------------------------------------------------------------------------- |-| `POST /sessions/:id/watches` | Declare a watch → `201 { watch }`. Body: `{ type:"github_pr", repo?, pr?, wake_on, intent? }`. |-| `GET /sessions/:id/watches` | List watches → `{ data: [watch] }`. |-| `DELETE /sessions/:id/watches/:watchId` | Remove a watch → `{ ok: true }`. |--`wake_on` is the wake condition (`checks` default · `review` · `comment` · `merge`); `intent` is the freeform "why," replayed on wake. `repo`/`pr` are optional — omitted, they resolve to the PR this session opened. A watch fires only on PRs the **same session** opened, on Connected-App (`oc_app`) repos. Limits: **10** active watches per session, **30-day** TTL (and never outlives the PR).--**`Watch`**--| Field | Notes |-| --------------------------------------------- | ------------------------------------------------------------------------------------------------------- |-| `id` `type` | `wch_…`; `type` = `github_pr` |-| `repo` `pr` | watched repo · PR number |-| `wake_on` | wake condition: `checks` (default) · `review` (a review decision) · `comment` · `merge` (merged/closed) |-| `intent?` | freeform note ("why"), replayed on wake |-| `status` | `active · closed · revoked · auth_required` |-| `origin` | how it was declared (runtime tool / management API) |-| `last_snapshot_at?` `expires_at` `created_at` | last authoritative PR re-read · 30-day TTL lapse · timestamp |--**Delivered events** — appended into the session log at level `user` with `source: "github"`, carrying a normalized summary (not the raw webhook): `github.pr.checks_completed` · `github.pr.review_submitted` · `github.pr.comment` · `github.pr.merged` · `github.pr.closed`.--## Agents--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| ---------------------------------------------- | ----------------------------------------------------------------------------- |-| `oc.agents.create(params)` | Create a reusable agent. |-| `oc.agents.repository.review(params)` | Resolve and interpret an exact repository source without running it. |-| `oc.agents.repository.import(params)` | Import an exact reviewed source and enqueue its first deployment. |-| `oc.agents.get(id)` · `oc.agents.list()` | Fetch / list. |-| `oc.agents.update(id, params)` | Update bindings (credential / limits) — `prompt`/`model` deploy a revision. |-| `oc.agents.getRepositoryAccess(id)` | Read an agent's GitHub grant, policy, and effective working repositories. |-| `oc.agents.updateRepositoryAccess(id, policy)` | Atomically replace that policy. |-| `oc.agents.delete(id)` | Delete an agent. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| ----------------------------------- | ------------------------------------------------------------------------------------------------- |-| `POST /agents` | Create a reusable agent. |-| `POST /agents/import` | Atomically create an agent from an exact reviewed GitHub source and enqueue its first deployment. |-| `GET /agents/:id` · `GET /agents` | Fetch / list. |-| `PATCH /agents/:id` | Update bindings; `prompt`/`model` deploy a revision. |-| `GET /agents/:id/repository-access` | Read working-repository access for an agent. |-| `PUT /agents/:id/repository-access` | Atomically replace its policy. |-| `DELETE /agents/:id` | Delete an agent. |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| -------------------------------------------------------------- | ------------------------ |-| `oc agent create <name> --model <m> [--runtime claude\|codex]` | Create a reusable agent. |-| `oc agent get <id\|name>` · `oc agent list` | Fetch / list. |-| `oc agent update <id> [--credential <c>] [--limits …]` | Update bindings. |-| `oc agent delete <id>` | Delete an agent. |--</Tab>--</Tabs>--Body: `name`, `prompt`, `model`, `runtime?` (`claude`|`codex`), `key?`, `credential?`, `limits?`. PATCH takes the same **minus `runtime`** (fixed at create). `runtime`/`model` provider must agree (`claude`↔`anthropic/…`, `codex`↔`openai/…`). `credential`: a `cred_…` id (BYO, provider-matched) **or** `"managed"` (via OpenComputer, billed to credits) — mutually exclusive with `key`.--Create, get, and list responses include the permanent computed `invoke_url`-(SDK `invokeUrl`). It has no trailing slash; join `/` or `/hooks/<token>` with-URL semantics. See [Agent URLs and Hooks](#agent-urls-and-hooks).--`POST /agents` is **idempotent by `name`**: fresh → `201`, matching config → `200`, differing → `409`. Editing `prompt`/`model` (here or via [deploy](#deployments-and-revisions)) creates a **revision**; the agent keeps a pointer to its **active revision** (`GET /agents/:id` → `active_revision`) and sessions pin it. The agent row holds only identity + bindings.--`POST /agents/import` is the reviewed repository-import command described below. It deliberately creates-an agent with no active revision; revision #1 appears only after the queued build and live deployment-verify successfully.--### Repository access--Repository access is available for every runtime and is separate from the-repository used to deploy an agent. `selected` bounds session sources, checkout,-and pull-request publishing for all runtimes; `all` preserves the open behavior.--```ts TypeScript SDK-const access = await oc.agents.getRepositoryAccess(agent.id);--await oc.agents.updateRepositoryAccess(agent.id, {- mode: "selected",- repositoryIds: [access.effectiveRepositories![0].id],-});-```--```http REST API-GET /agents/agt_.../repository-access--PUT /agents/agt_.../repository-access-Content-Type: application/json--{ "mode": "selected", "repository_ids": ["repo_..."] }-```--The wire response is:--```json-{- "policy": { "mode": "selected", "repository_ids": ["repo_..."] },- "grant": {- "status": "active",- "account": "acme",- "repository_selection": "selected",- "install_url": "https://github.com/apps/opencomputerdev/installations/new",- "configure_url": "https://github.com/settings/installations/123",- "truncated": false- },- "effective_repositories": [- {- "id": "repo_...",- "full_name": "acme/app",- "default_branch": "main",- "private": true- }- ],- "unavailable_selected_repositories": []-}-```--Use `{ "mode": "all" }` for every repository in the current and future App-grant. An empty selected list disables repository work but not chat. When the-grant is `not_installed`, `effective_repositories` is the known-empty `[]`.-Only a transient `unavailable` grant uses `null`, because no complete set was-read. In `selected` mode, the owner-bound OpenComputer App is the only-repository authority.--## Deployments and revisions--You **deploy** an agent's behavior. A deployment is a time-aware attempt; only a successful attempt-produces an immutable **revision**. Failed attempts and their logs remain in deployment history. See-the [Deployments & revisions guide](/agent-sessions/revisions).--### Review and import a repository agent--Review resolves the moving production branch to one exact commit and interprets bounded metadata-without executing repository code. Repository-first import accepts exact `flue-app-v1` and-`flue-prompt-v1` results.--`GET /github/deploy-app` returns the installed OpenComputer GitHub App and its pickable repositories.-Each repository includes `linked_sources[]` with the owner-scoped `path`, `production_ref`, `status`,-and owning agent `{ id, name }`. Clients should block review when the selected normalized root has a-claim. This is an early user-facing check; import repeats the uniqueness check transactionally.--<CodeGroup>--```ts TypeScript SDK-const review = await oc.agents.repository.review({- repo: "repo_...",- path: "agents/support",- productionRef: "main",-});-```--```http REST API-POST /github/deploy-app/inspect-Authorization: Bearer $OPENCOMPUTER_API_KEY--{- "repo": "repo_...",- "path": "agents/support",- "production_ref": "main"-}-```--</CodeGroup>--The response always includes repository identity, normalized `root`, `production_ref`, exact `sha`,-`review_fingerprint`, and one `interpretation`:--```json Exact Flue review-{- "repository": {- "id": "repo_...",- "full_name": "acme/agents",- "default_branch": "main"- },- "root": "agents/support",- "production_ref": "main",- "sha": "0123456789abcdef0123456789abcdef01234567",- "interpretation": {- "disposition": "exact",- "source_profile": "flue-app-v1",- "source_profile_version": 1,- "summary": "Flue agent detected",- "reason_code": "flue_detected",- "assumptions": [],- "agent": { "runtime": "flue", "model": "anthropic/claude-haiku-4-5" }- },- "profile": {- "source_profile": "flue-app-v1",- "source_profile_version": 1,- "manifest": {- "schema_version": 1,- "entrypoint": "support-triage",- "model": "anthropic/claude-haiku-4-5",- "runtime": { "family": "flue", "type": "default" },- "vars": {}- },- "package": {- "name": "support-agent",- "node_engine": ">=22.19 <23",- "flue_cli": "1.0.0-beta.9"- },- "lockfile": { "version": 3 },- "builder": { "node": "22.19.0" },- "source": { "files": 12, "bytes": 4096 },- "variable_names": [],- "warnings": []- },- "review_fingerprint": "sha256:...",- "candidate_roots": [],- "candidate_roots_truncated": false-}-```--`interpretation.disposition` is `exact`, `invalid`, or `unrecognized`. Invalid and unrecognized are-successful review responses, not service failures: `invalid` includes bounded `issues`; an-unrecognized root can include up to 20 `candidate_roots` and explicitly reports truncation. Only-`exact` includes a deployable `profile` and may proceed to import. No response contains a repository-token or source bytes.--For `flue-prompt-v1`, `profile` keeps the same manifest, source, and builder-projection and additionally returns `prompt: { bytes }`,-`skills: { count, bytes, names }`, and-`builder.synthesis_template`. The profile accepts `agent.toml`, `prompt.md`,-and optional `skills/*/SKILL.md`; the server synthesizes the complete Flue app-during the managed build.--The non-exact variants keep the common repository/root/SHA/fingerprint fields shown above and use-these shapes:--```json Invalid or unrecognized interpretation-{- "interpretation": {- "disposition": "invalid",- "source_profile": "flue-app-v1",- "source_profile_version": 1,- "summary": "This Flue agent needs a fix",- "reason_code": "manifest_invalid",- "issues": [- { "code": "manifest_invalid", "message": "…", "path": "agent.toml" }- ]- },- "profile": null,- "candidate_roots": [],- "candidate_roots_truncated": false-}-```--An unrecognized interpretation has `source_profile: null`, `source_profile_version: null`, and-`reason_code: "unrecognized_source"`. Its optional candidate entries are-`{ path, source_profile: "flue-app-v1" | "flue-prompt-v1" | null, summary, marker }`; selecting one always performs a-new review. `candidate_roots_truncated` means more matches existed than the bounded response could-return, so ask the user to choose a narrower root rather than selecting one automatically.--Import sends the same source coordinates, a human-readable agent name, and the exact review receipt.-The name is independent of the Flue entrypoint in `agent.toml`.--<CodeGroup>--```ts TypeScript SDK-if (review.interpretation.disposition !== "exact") {- throw new Error(review.interpretation.summary);-}--const result = await oc.agents.repository.import({- name: "Support triage",- credential: "managed",- idempotencyKey: "stable-key-for-this-import",- source: {- type: "github",- repo: review.repository.id,- path: review.root,- productionRef: review.productionRef,- },- review: {- sha: review.sha,- sourceProfile: review.interpretation.sourceProfile,- fingerprint: review.reviewFingerprint,- },-});-```--```http REST API-POST /agents/import-Authorization: Bearer $OPENCOMPUTER_API_KEY-Idempotency-Key: <stable-key-for-this-import>--{- "name": "Support triage",- "credential": "managed",- "source": {- "type": "github",- "repo": "repo_...",- "path": "agents/support",- "production_ref": "main"- },- "review": {- "sha": "0123456789abcdef0123456789abcdef01234567",- "source_profile": "flue-app-v1",- "fingerprint": "sha256:..."- }-}-```--</CodeGroup>--The server reauthorizes the repository and re-derives the reviewed plan, then creates-`{ agent, source, deployment }` atomically. If the branch head or relevant source changed, it returns-`409 source_changed_re_review` and creates nothing. Reusing the same idempotency key and command-returns the same import; reusing it with different fields returns `409 idempotency_conflict`. A name-or repository-root conflict also returns `409` and identifies the existing agent when available.--The source remains linked after import. Its `source_profile`, `source_profile_version`, and-`review_fingerprint` describe the reviewed source identity. A later GitHub push that touches the-selected production root automatically creates the next deployment. A `flue-prompt-v1` source may-graduate to `flue-app-v1`. Any other profile change sets the link status to-`source_profile_changed`; no build starts and the current active revision remains unchanged.--### Deploy--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| ------------------------------------------------------------------------- | --------------------------------------------- |-| `oc.agents.deployments.create(id, { input, activate?, idempotencyKey? })` | Deploy (`input.type: "inline" \| "github"`). |-| `oc.agents.deployments.list(id)` · `.get(id, depId)` | Deployment history · one deployment. |-| `oc.agents.deploy(dir)` _(Node)_ | Bundle a local directory → inline deployment. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |-| `POST /agents/:id/deployments` | Deploy → `{ deployment }`. Body: `{ input, activate?=true, idempotency_key?, client_context? }`. |-| `GET /agents/:id/deployments?before=&limit=` | Newest-first history with an opaque `next_cursor`. |-| `GET /agents/:id/deployments/:deploymentId` | One attempt; poll asynchronous states until terminal. |-| `GET /agents/:id/deployments/:deploymentId/logs?after=&limit=` | Ordered durable log chunks with opaque resume cursors. |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |-| `oc agent deploy [dir] [--agent <id\|name>] [--no-activate] [--verbose]` | Deploy a local built-in, prompt-defined Flue, or complete Flue directory; `--verbose` streams a local complete-app build. |-| `oc agent build --dir <dir> [--check-only] [--target cloudflare] [--output <dir>]` | Validate or build a Flue artifact without fetching, installing, authenticating, or deploying. |-| `oc agent deployments [--agent <id>]` · `oc agent deployments get <id>` | History · one deployment. |--</Tab>--</Tabs>--`input`: `{ type:"inline", prompt, model?, skills?, runtime? }` (the **complete** built-in-behavior — omitted `skills` = none) **or** `{ type:"github", ref?, sha? }` (deploys an already-linked-repository; `repo`/`path` come from the server-owned link). The CLI's local prompt-defined Flue path-uses a separately uploaded, digest-bound `source` reference; use `oc agent deploy` rather than constructing-that transport manually. `activate:false` stages an inline built-in-deployment. Built-in GitHub links remain branch-driven. A new Flue repository agent instead starts-with [`POST /agents/import`](#review-and-import-a-repository-agent); import deploys the reviewed production head,-and subsequent production-branch pushes deploy automatically. Flue has no preview/staged Worker.-`POST …/revisions` is inline-only sugar.--**`Deployment`**--| Field | Notes |-| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `id` `created_at` `updated_at` | Attempt identity and timestamps. |-| `state` `phase` `terminal` | Internal state plus stable UI phase. Repository states: `accepted`, `queued`, `fetching`, `validating`, `installing`, `building`, `uploading`, `deploying`, `verifying`; terminals: `ready`, `failed`, `canceled`, `superseded`, `skipped`. |-| `result` `error_class` `error?` | Terminal outcome and bounded, redacted failure detail. |-| `revision_id` `revision?` `active` | Successful revision relation; absent for an unsuccessful attempt. |-| `source_relation?` | Repository id/name, path, production ref, exact SHA, and commit URL. |-| `build?` `configuration?` | Safe builder/artifact metadata and non-secret runtime configuration; variables are names only. |-| `timing` | Accepted/started/finished coordinates plus queue/run/total durations. |-| `log_bytes` `log_truncated` | Bounded log accounting. |-| `live_touched` `agent_live?` | Whether deployment crossed the live Worker boundary and the current guarded/verified state. |-| `allowed_actions` | Server-derived actions such as `view_commit`, `deploy_latest`, `open_agent`, or `start_session`. |--List returns `{ data, next_cursor }`. Log reads return-`{ data: [{ seq, cursor, recorded_at, phase, stream, chunk }], next_cursor, has_more }`; treat `seq`-and both cursors as opaque strings. Continue with `after=next_cursor` until `has_more` is false, then-poll again while the deployment is nonterminal. Source archives, bundles, credentials, raw provider-responses, and operator telemetry are never projected through these APIs.--### Revisions, rollback & promote--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| ---------------------------------------------- | -------------------------------------------------- |-| `oc.agents.revisions.list(id)` · `.get(id, n)` | History · one revision (+ skill manifest). |-| `oc.agents.revisions.activate(id, n)` | Set the active revision (rollback **or** promote). |-| `oc.agents.activations.list(id)` | Active-pointer audit log. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| ------------------------------------------ | --------------------------------------------- |-| `GET /agents/:id/revisions` · `…/:rev` | History · one revision (+ skill manifest). |-| `POST /agents/:id/revisions/:rev/activate` | Set the active revision (rollback / promote). |-| `GET /agents/:id/activations` | Active-pointer audit log. |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| ------------------------------------------------------------------ | --------------------------------------------- |-| `oc agent revisions [--agent <id>]` · `oc agent revisions get <n>` | History · one revision. |-| `oc agent rollback <n\|rev_…>` | Set the active revision (rollback / promote). |-| `oc agent activations` | Active-pointer audit log. |--</Tab>--</Tabs>--Revisions are **linear** (numbered, immutable). `:rev` is a `number` or `rev_…` id. Activate moves the active pointer instantly (no rebuild); rollback (earlier) and promote (a staged one) are the same call.--**`Revision`**--| Field | Notes |-| ----------------------------------- | -------------------------------------------------------------------- |-| `id` `number` `created_at` `active` | id, monotonic number, timestamp, is-active flag |-| `prompt` `model` | the behavior |-| `skill_bundle_digest?` | content-addressed skills bundle (`null` = no skills) |-| `digest` | behavior content hash (change detection) |-| `runtime_ref` | `floating` (latest shared runtime) — `pinned` later (custom runtime) |-| `files?` | `[{ path, mode, size }]` — only on `GET …/revisions/:rev` |--### Skills--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| ------------------------------- | ------------------------------------------------------------- |-| `oc.agents.skills.get(id)` | List the active revision's skills (name, description, files). |-| `oc.agents.skills.put(id, zip)` | Replace skills from a `.zip` → new revision. |-| `oc.agents.skills.delete(id)` | Remove all skills → new revision. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| --------------------------- | ------------------------------------------------------------------------------ |-| `GET /agents/:id/skills` | List the active revision's skills. |-| `PUT /agents/:id/skills` | Replace skills from a `.zip` (`Content-Type: application/zip`) → new revision. |-| `DELETE /agents/:id/skills` | Remove all skills → new revision. |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| ----------------------- | -------------------------------------------------------------------------------- |-| `oc agent deploy <dir>` | Deploy a directory; a `skills/` folder inside it ships as skills → new revision. |--Skills have no dedicated CLI verb yet — deploy a directory that contains a `skills/` folder, or use the REST endpoints / dashboard.--</Tab>--</Tabs>--A skill is a folder with a `SKILL.md`; PUT/DELETE are **deployments** (versioned, rollback-able). Limits: 64 files, 256 KiB total, UTF-8, modes `0644`/`0755`. Full guide: [Skills](/agent-sessions/skills).--### Deploy from a repo--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| --------------------------------------------- | ----------------------------------------------- |-| `oc.agents.deploymentSource.link(id, params)` | Link a repo directory → push-to-deploy. |-| `oc.agents.deploymentSource.get(id)` | The link + status. |-| `oc.agents.deploymentSource.unlink(id)` | Remove the link (shared App webhook untouched). |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| -------------------------------------- | --------------------------------------------------------------------------------- |-| `POST /agents/:id/deployment-source` | Link a repo directory. Body: `{ repo, path, production_ref?, deploy_now?=true }`. |-| `GET /agents/:id/deployment-source` | The link + status. |-| `DELETE /agents/:id/deployment-source` | Remove the link. |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| ---------------------------------------------------------------------- | ------------------------------------------ |-| `oc agent link <owner/repo> --path <p> [--branch <ref>] [--no-deploy]` | Link a repo directory. |-| `oc agent status [id\|name]` | The agent's active revision + link status. |-| `oc agent unlink` | Remove the link. |--</Tab>--</Tabs>--Linking deploys the current production HEAD immediately (unless `deploy_now: false` / `--no-deploy`).-The link is unique by owner, repository, and normalized root. Unlinking stops deploy-on-push but does-not delete the agent, revisions, deployment history, or sessions.-For built-in runtimes, a push to the production branch activates while other branches stage. For-Flue, only the production branch deploys. **Scopes:** `deploy_now: false` needs `agents:link`; the-default (with an initial deploy) needs `agents:link` + `agents:deploy`, plus `agents:activate` when-that deploy auto-activates. Repo/path are server-anchored to the link. Deployment sources use the-**OpenComputer App** (no BYO). Full flow + guarantees:-[Deploy from a repo](/agent-sessions/revisions#deploy-from-a-repo).--**`DeploymentSource`**--| Field | Notes |-| ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `agent_id` `repo_id` `path` | the linked agent · repo · directory within it |-| `production_ref` | branch that auto-activates on push |-| `status` | `active`, or a problem: `source_profile_changed`, `path_missing`, `ref_missing` (production branch deleted), `auth_required`, `repo_not_selected`, `app_suspended`, `error` |-| `latest_seen_sha?` `active_deployed_sha?` | newest sha observed · sha behind the active revision |-| `source_profile?` `source_profile_version?` | server-selected repository interpretation pinned for this link (`flue-app-v1` or `flue-prompt-v1`, version `1`) |-| `review_fingerprint?` | digest of the latest accepted, exact-SHA reviewed plan; never source bytes or a credential |--## Schedules--_Run an agent on a cron — each firing starts a session. Managed with the SDK, the `oc` CLI, or REST (org key). Full guide: [Schedules](/agent-sessions/schedules)._--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| -------------------------------------------------------- | ----------------------------------------------------------- |-| `oc.agents.schedules.create(id, params)` | Create a schedule (`{ name, cron, tz?, input, overlap? }`). |-| `oc.agents.schedules.list(id)` · `.get(id, sid)` | List / fetch. |-| `oc.agents.schedules.update(id, sid, params)` | Edit `cron`/`tz`/`input`/`overlap`, or `{ paused }`. |-| `oc.agents.schedules.delete(id, sid)` | Delete (run history kept). |-| `oc.agents.schedules.fire(id, sid)` | Fire now → a run; doesn't advance the cron. |-| `oc.agents.schedules.runs(id, sid, { cursor?, limit? })` | Run history (each carries `sessionId`). |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| ---------------------------------------------------- | ------------------------------------------------------------------------- |-| `POST /agents/:id/schedules` | Create → `201 { schedule }`. Body `{ name, cron, tz?, input, overlap? }`. |-| `GET /agents/:id/schedules` · `…/:sid` | List / fetch. |-| `PATCH /agents/:id/schedules/:sid` | Edit `cron`/`tz`/`input`/`overlap`, or `{ paused }`. |-| `DELETE /agents/:id/schedules/:sid` | Delete → `204` (runs kept). |-| `POST /agents/:id/schedules/:sid/fire` | Fire now → `201 { run }`; doesn't advance the cron. |-| `GET /agents/:id/schedules/:sid/runs?cursor=&limit=` | Run history → `{ runs, next_cursor }`. |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| -------------------------------------------------------------------------------- | ------------------------------ |-| `oc agent schedule create <name> --agent <id> --cron <c> [--tz <z>] --input <s>` | Create a schedule. |-| `oc agent schedules [--agent <id>]` · `oc agent schedule get <name>` | List / fetch. |-| `oc agent schedule pause\|resume <name>` | Pause / resume. |-| `oc agent schedule delete <name>` | Delete. |-| `oc agent schedule fire <name>` | Fire now (prints the `ses_…`). |-| `oc agent schedule runs <name>` | Run history. |--</Tab>--</Tabs>--`cron` is a 5-field expression (**1-minute** floor); `tz` is an IANA name (UTC if omitted); `input` (**≤ 32 KiB**) is the first message of every run; `overlap` is `skip` (default) or `allow`. Schedules are also **synced from [`agent.toml`](/agent-sessions/schedules#agent-toml)** on deploy — a repo-driven agent rejects edits other than pause/resume (`409`). Max **20** per agent.--**`Schedule`**--| Field | Notes |-| ------------------------------------ | ------------------------------------------------------------------------------------ |-| `id` `agent_id` | `sch_…` · the owning agent |-| `name` `cron` `tz?` `input` | handle (unique per agent) · 5-field cron · IANA tz · first message |-| `overlap` | `skip` (default) · `allow` |-| `state` | `active · paused · auto_paused` (five straight scheduled-firing failures auto-pause) |-| `next_fire_at` `last_fired_at?` | next occurrence · last fire |-| `consecutive_failures` `last_error?` | in-a-row enactment failures · last error (cleared on success) |--**`Run`** — one per firing decision, newest-first: `srn_…` with `outcome` (`enacted` · `skipped` · `failed`), `scheduled_for?` (`null` for a manual fire), `fired_at`, `session_id?` (when enacted), `error?`. Chain `session_id` into `GET /sessions/:id`.--## Slack--Managed Slack uses the OpenComputer-operated app. Starting authorization-returns a browser-safe Slack OAuth URL, or the current active connection when-the agent is already connected. The optional deployment id is validated return-context, not a redirect URL. Status responses never contain credentials.--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| -------------------------------------------------------------- | -------------------------------------------------------------------------- |-| `oc.agents.authorizeManagedSlack(id, { returnDeploymentId? })` | Start managed-app OAuth. |-| `oc.agents.getManagedSlack(id)` | Read workspace, app identity, state, and `openUrl`. |-| `oc.agents.listManagedSlackConnections()` | List this owner's current workspace claims and owning agents before OAuth. |-| `oc.agents.disconnectManagedSlack(id)` | Stop routing this agent without uninstalling the workspace app. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| ------------------------------------------ | ------------------------------------------------------------------------------- |-| `POST /agents/:id/slack/managed/authorize` | Start managed-app OAuth; accepts `return_deployment_id?`. |-| `GET /agents/:id/slack/managed` | Read the managed connection. |-| `DELETE /agents/:id/slack/managed` | Disconnect the agent from the shared app. |-| `GET /slack/managed/connections` | List current owner-scoped workspace claims with safe agent id/name projections. |--</Tab>--</Tabs>--The managed status is `active`, `disconnected`, `error`, or `revoked`. An active-response includes `workspace`, `app`, `open_url`, and `connected_at`; error-states expose only a stable `error_code`.-The connection list returns `{ data }`; each item has the same public status-shape plus `agent: { id, name }`. It contains no Slack token, signing secret, or-credential reference. Treat it as a preflight convenience: authorization still-enforces the one-workspace-to-one-agent claim transactionally.--Builder-owned Slack apps remain a separate resource and can overlap during an-explicit handoff:--| TypeScript SDK | REST API |-| ------------------------------------ | --------------------------------- |-| `oc.agents.slackManifest(id)` | `POST /agents/:id/slack/manifest` |-| `oc.agents.connectSlack(id, values)` | `POST /agents/:id/slack` |-| `oc.agents.getSlack(id)` | `GET /agents/:id/slack` |-| `oc.agents.disconnectSlack(id)` | `DELETE /agents/:id/slack` |--See [Slack](/agent-sessions/slack) for installation, trust boundaries, and-conversation behavior.--## Destinations--_Webhooks are configured via SDK/REST (no `oc` command)._--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| ------------------------------------------- | ------------------------------------------------------------------ |-| `session.destinations.create(params)` | Register a webhook destination. |-| `session.destinations.list()` · `.get(did)` | List / fetch. |-| `session.destinations.update(did, params)` | Pause/resume (`enabled`), retune `level`/`types`, rotate `secret`. |-| `session.destinations.delete(did)` | Remove. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| ------------------------------------------- | ------------------------------- |-| `POST /sessions/:id/destinations` | Register a webhook destination. |-| `GET /sessions/:id/destinations` · `…/:did` | List / fetch. |-| `PATCH /sessions/:id/destinations/:did` | Pause/resume, retune, rotate. |-| `DELETE /sessions/:id/destinations/:did` | Remove. |--</Tab>--</Tabs>--Destination body: `url`, `secret?`, `level?` (`user`), `types?[]`, `include_raw?` (`false`, SDK: `includeRaw`), `enabled?` (`true`). `types` accepts exact types or `prefix.*`.--## Deliveries--_Delivery records are read via SDK/REST (no `oc` command)._--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| ---------------------------------- | -------------------------------------------------------- |-| `session.deliveries.list(opts)` | List deliveries — status, attempts, last response/error. |-| `session.deliveries.get(id)` | One delivery, in detail. |-| `session.deliveries.redeliver(id)` | Re-send any delivery. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| ----------------------------------------------------------------- | --------------------- |-| `GET /sessions/:id/deliveries?destination=&status=&after=&limit=` | List deliveries. |-| `GET /sessions/:id/deliveries/:id` | One delivery. |-| `POST /sessions/:id/deliveries/:id/redeliver` | Re-send any delivery. |--</Tab>--</Tabs>--See [Webhooks](/agent-sessions/webhooks#signing-retries-and-dedupe) for signing, retries, dedupe.--**`Destination`**--| Field | Notes |-| ----------------------------------------------- | -------------------------------------------------------------------- |-| `id` `session` `kind` `created_at` `updated_at` | |-| `url` | webhook target |-| `level` `types` | visibility threshold · event-type filter |-| `include_raw` `enabled` `has_secret` | include raw bodies · paused/active · whether a signing secret is set |-| `created_after_seq` | only events after this seq are delivered |--**`Delivery`**--| Field | Notes |-| ------------------------------------------------------ | ------------------------------------- |-| `id` `session` `destination` `created_at` `updated_at` | |-| `event_id` `event_seq` | the event delivered |-| `status` `attempts` `last_attempt_at` | delivery state, retry count, last try |-| `response_code?` `error?` | last response · failure detail |--## GitHub Apps and Repos--A GitHub App lets OpenComputer mint short-lived, repo-scoped tokens; a **Repo** is a stable handle resolving to your configured App (the OpenComputer App by default). Used for session [sources](#sessions) (work repos) and [deploy-from-a-repo](#deploy-from-a-repo) (the agent's definition repo). Install the [OpenComputer App](https://github.com/apps/opencomputerdev/installations/new). In `selected` repository-access mode, every runtime uses the owner-bound OpenComputer App. In `all` mode, configured **bring-your-own** Apps may continue to back built-in-runtime session sources and PR publishing. Hosted Flue repository tools and deployment sources always use the owner-bound OpenComputer App.--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| -------------------------------------------------------------------------- | --------------------------------------------------------------------- |-| `oc.repos.create(params)` · `.get(id)` · `.list()` · `.update(id, params)` | Register / fetch / list / rename a repo. |-| `oc.github.apps.list()` | List GitHub Apps available to your org. |-| `oc.github.apps.register(params)` | Register your own App (`byo_stored_key` / `byo_broker`). |-| `oc.github.apps.createManifestUrl(params)` | One-click: a link to open; OpenComputer hosts the flow + key capture. |-| `oc.github.apps.createManifest/completeManifest(params)` | Developer-driven manifest flow. |-| `oc.github.apps.update(id, params)` · `delete(id)` | Update / rotate / remove an App. |-| `oc.github.installations.list()` | List installations visible to OpenComputer. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| ---------------------------------------------------------------------------------- | ------------------------------------------- |-| `POST /repos` · `GET /repos/:id` · `GET /repos` · `PATCH /repos/:id` | Register / fetch / list / rename a repo. |-| `GET /github/apps` · `POST /github/apps` | List · register your own App. |-| `PATCH /github/apps/:id` · `DELETE /github/apps/:id` | Update / rotate / remove. |-| `POST /github/apps/manifest` · `…/manifest/start` · `…/callback` · `…/conversions` | Manifest flow (hosted or developer-driven). |-| `GET /github/installations` | List installations visible to OpenComputer. |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| ---------------------------------------------------------------------------------- | ------------------------------- |-| `oc repo add <owner/repo>` · `oc repo list` · `oc repo get <id>` | Register / list / fetch a repo. |-| _(App install + manifest — browser flow; manage in the dashboard or via SDK/REST)_ | |--</Tab>--</Tabs>--Repo body: `owner`, `repo`, `provider?` (`github`), `name?` — **no `auth`** (resolves via your App); **idempotent by `(provider, owner, repo)`**. Registering is **optional** under the OpenComputer App (reference `"owner/repo"` directly). Responses **never** carry a token/secret; App responses have `id, mode, status, github_app_id?, app_name?, is_default?`. [Guide](/agent-sessions/repos).--```-Repo = { id, provider, owner, repo, name?, created_at, updated_at }-```--## Credentials--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| ----------------------------------------------------- | -------------------- |-| `oc.credentials.create(params)` | Add a provider key. |-| `oc.credentials.list()` · `oc.credentials.delete(id)` | List / remove. |-| `oc.credentials.setDefault(params)` | Set the org default. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| ---------------------------------------------- | --------------------------------------- |-| `POST /credentials` | Add a provider key. |-| `GET /credentials` · `DELETE /credentials/:id` | List / remove. |-| `PUT /credentials/default` | Set the org default (provider derived). |--</Tab>--<Tab title="oc CLI">--| Command | Purpose |-| -------------------------------------------------------- | -------------------- |-| `oc credential add --provider <p> --key <k> [--default]` | Add a provider key. |-| `oc credential list` · `oc credential remove <id>` | List / remove. |-| `oc credential set-default <id>` | Set the org default. |--</Tab>--</Tabs>--Credential body: `provider` (`anthropic` | `openai`), `key`, `name?`, `is_default?`. Keys are write-only. A BYO credential is optional — agents can run **Managed** (`credential: "managed"`, the default). See [Credentials](/agent-sessions/credentials).--```-Credential = { id, provider, name?, last4, is_default, created_at }-ClientToken = { token, scopes, expires_at }-```--## Errors & rate limits--One envelope: `{ "error": { "type", "message" } }`; the SDK throws typed `OpenComputerError` subclasses (`AuthError`, `NotFoundError`, `ConflictError`, `ValidationError`, `RateLimitError`); the CLI exits non-zero and prints the message (the JSON with `--json`). Cross-owner resources return `404` (not `403`). Rate/concurrency limits aren't enforced at launch (a `429` with `Retry-After` may come later; the SDK retries it).diff --git a/docs/agent-sessions/artifacts.mdx b/docs/agent-sessions/artifacts.mdxdeleted file mode 100644index cd23e509..00000000--- a/docs/agent-sessions/artifacts.mdx+++ /dev/null@@ -1,38 +0,0 @@-----mode: "wide"-title: "Artifacts & previews"-description: "Session files, links, and preview URLs"------<Note>**Labs preview.** Artifacts are not part of the stable Durable Sessions API. Large event bodies can already spill to a [`content_ref`](/agent-sessions/events).</Note>--**Artifacts** are session outputs your UI can load later: files, links, reports, and preview URLs. A **preview** points to a process running in the session machine, such as a dev server or built app.--## Artifact kinds--- **`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`).--## Publish from the runtime--The runtime publishes artifacts through 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.--## Read artifacts in your app--Use the same snapshot-plus-stream pattern as [events](/agent-sessions/events): list on load, subscribe for changes.--```-GET /v3/sessions/:id/artifacts-GET /v3/sessions/:id/artifacts/:key/content-events: artifact.published | artifact.updated | artifact.removed--Artifact = { key, kind: "preview" | "file" | "link", title?, status?, url?,- content_type?, bytes?, created_at, updated_at }-```--A preview URL is a public capability — the browser loads it directly; a [client token](/agent-sessions/authentication#client-tokens) only gates *learning* the URL (via the user-level event), so you can stream the whole build *and* embed the running app from the same front-end.diff --git a/docs/agent-sessions/authentication.mdx b/docs/agent-sessions/authentication.mdxdeleted file mode 100644index 657f1347..00000000--- a/docs/agent-sessions/authentication.mdx+++ /dev/null@@ -1,101 +0,0 @@-----mode: "wide"-title: "Authentication"-description: "Org keys, browser-safe client tokens, and bring-your-own model keys"------Durable Agent Sessions use four credential types.--## Org API key--Your account key. Use it server-side for all **management** calls — creating agents, starting sessions, registering webhooks, managing credentials.--<CodeGroup>--```ts TypeScript SDK-import { OpenComputer } from "@opencomputer/sdk";--const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! }); // org key, server-side only--const session = await oc.sessions.create({- agent: "agt_...",- input: "Run the tests and summarize failures.",-});-```--```http REST API-POST https://api.opencomputer.dev/v3/sessions-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{ "agent": "agt_...", "input": "Run the tests and summarize failures." }-```--</CodeGroup>--<Warning>Never ship the org API key to a browser or mobile client — it can do anything on your account. Use a client token instead.</Warning>--## Client tokens--A **session-scoped, short-lived** token with `read` + `steer` scope — safe to hand to a front-end. It can stream and steer **one** session and nothing else.--You get one back from `POST /v3/sessions`, and can mint more:--<CodeGroup>--```ts TypeScript SDK-const session = await oc.sessions.get("ses_...");--const clientToken = await session.mintClientToken({- scopes: ["read", "steer"],- ttlSeconds: 3600,-});-```--```http REST API-POST https://api.opencomputer.dev/v3/sessions/ses_.../client-tokens-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{ "scopes": ["read", "steer"], "ttl": 3600 }-```--</CodeGroup>--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 model usage for the session it's scoped to. Mint short-lived tokens and set [session limits](/agent-sessions/sessions#usage-and-limits). The token threshold is checked between turns on built-in runtimes and may overshoot by one in-flight turn; it is not a currency or aggregate spend cap.</Warning>--```-browser -> your backend: create task-backend -> OpenComputer: POST /v3/sessions (org key)-backend -> browser: client_token-browser -> OpenComputer: stream + steer (client_token)-```--For the SSE stream the browser passes the client token as `?token=` (native `EventSource` can't set an `Authorization` header); other calls use the `Authorization` header normally.--## Hook URLs--A [Hook URL](/agent-sessions/hooks) is a bearer credential embedded in one-agent's `/hooks/<token>` path. It grants only the ability to start a fresh-session on that agent. It cannot read or steer the created session, invoke-another agent, or call management routes. The sender supplies no Authorization-header.--The complete URL is returned once on creation and stored only as a hash. Create-one per external system so you can revoke it independently. Do not put Hook-URLs in source control, logs, analytics, browser URLs, or public documentation.--| Surface | Credential | Capability |-| --- | --- | --- |-| Agent URL `POST /` | org API key | create a session; receive a scoped client token |-| Agent URL `POST /hooks/<token>` | Hook URL | create a session only |-| Sessions API read/stream/steer | client token or org API key | one scoped session, or full org authority |-| Management API | org API key | agents, sessions, Hooks, credentials, and other account resources |--## Model credentials--Sessions run the model either **Managed** — via OpenComputer, billed to your **credits**, with no key (the default for new orgs) — or on **your own provider key** (Anthropic for the `claude` [runtime](/agent-sessions/runtimes), OpenAI for `codex`). A bring-your-own key is stored at rest in a dedicated secrets vault ([Infisical](https://infisical.com)), write-only, and **never returned** by the API. The real key never enters a sandbox: the runtime gets an opaque placeholder, and a [secret-store egress proxy](https://01m3nj5m1bxzfrqggfrk59t95j-site.holocron.so/sandboxes/secrets) swaps in the real value in flight, only on the outbound HTTPS call to the provider. A key isn't required — Managed needs none; a session fails to start (`422 no_credential`) only when it resolves to neither Managed nor a usable key.--For Managed, set an agent's `credential` to `"managed"` (or rely on the org default) — nothing to add. For BYO, the quickest way to add a key is inline when you [create an agent](/agent-sessions/agents) (`"key": "…"`). To reuse a key across agents, set an org default, or rotate/remove keys, see the dedicated **[Credentials](/agent-sessions/credentials)** page.diff --git a/docs/agent-sessions/channels.mdx b/docs/agent-sessions/channels.mdxdeleted file mode 100644index 0fdde5f6..00000000--- a/docs/agent-sessions/channels.mdx+++ /dev/null@@ -1,15 +0,0 @@-----mode: "wide"-title: "Channels"-description: "Bind sessions to external threads"------<Note>**Labs preview.** Channels are not part of the stable Durable Sessions API. For stable API access, use [Messaging](/agent-sessions/messaging) for input and [Webhooks](/agent-sessions/webhooks) for output.</Note>--A **channel** binds a session to an external thread, such as Slack or GitHub. To connect an agent to Slack, see [Slack](/agent-sessions/slack).--- **Inbound.** A Slack `@mention` 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 delivers the session's `user`-level [events](/agent-sessions/events#visibility-levels) back to the thread. The agent never calls Slack itself.-- **Bindings.** A session can have multiple bindings. A Slack-started session that opens a PR can also bind to that PR. Routing follows event level: conversation events go to conversation bindings, work output goes to delivery targets.--A channel uses the same primitives as a custom UI: append messages and render the [event stream](/agent-sessions/events).diff --git a/docs/agent-sessions/credentials.mdx b/docs/agent-sessions/credentials.mdxdeleted file mode 100644index 9de7f4d2..00000000--- a/docs/agent-sessions/credentials.mdx+++ /dev/null@@ -1,157 +0,0 @@-----mode: "wide"-title: "Credentials"-description: "Run models Managed (billed to your credits) or on your own provider keys"------A session runs a model one of two ways:--- **Managed** — run it **through OpenComputer**, billed to your **credits**, with **no key to manage**. The default for new orgs, and selectable per agent. Nothing to store, rotate, or protect.-- **Bring your own key (BYO)** — your own provider key (Anthropic for the `claude` [runtime](/agent-sessions/runtimes), OpenAI for `codex`), stored once as a **credential** and reused across [agents](/agent-sessions/agents). It's treated as a hard secret end to end: **encrypted at rest, never returned by the API, and never present inside a sandbox.**--You don't strictly need a credential: an agent set to Managed needs no key. A session only fails to start (`422 no_credential`) when it resolves to **neither** Managed **nor** a usable key. The rest of this page is about BYO credentials; for Managed, just select it per agent (below).--## Managed vs BYO--| | **Managed** | **BYO credential** |-|---|---|---|-| Key | none — run via OpenComputer | your Anthropic / OpenAI key |-| Billing | your OpenComputer **credits** | your provider invoice |-| Setup | select it per agent (`credential: "managed"`) | add a credential (below) |-| Models | same `provider/model` ids, per [runtime](/agent-sessions/runtimes) | same |--Pick per agent: `credential: "managed"` runs Managed; a `cred_…` id (or an inline `key`) runs BYO; omit it to inherit the org default. New orgs default to Managed, so you can start with **no key at all** and switch to BYO whenever you want. The rest of this page covers BYO.--## How your keys are protected--Two independent layers — at rest and in use:--- **At rest: a dedicated secrets vault.** Your key is stored in [Infisical](https://infisical.com), a battle-tested, purpose-built secrets platform — encrypted at rest and isolated from OpenComputer's own database. It's **write-only**: once submitted it's never returned by the API (reads expose only a `last4` display hint).-- **In use: never handed to the agent.** The real key never enters the sandbox. The runtime runs with an opaque placeholder, and OpenComputer's [secret-store egress proxy](https://01m3nj5m1bxzfrqggfrk59t95j-site.holocron.so/sandboxes/secrets) swaps in the real value **in flight** — only on the outbound HTTPS call to the model provider (`api.anthropic.com` / `api.openai.com`), enforced by an egress allowlist, and nowhere else.--Rotating a key's value reaches **running** sessions too, so a compromised key retires without restarting work ([rotation](#rotation)).--<Warning>Keep your **org API key** (which manages credentials) on your backend, and hand browsers only session-scoped [client tokens](/agent-sessions/authentication#client-tokens) — never a model key or the org key.</Warning>--## Add a credential--<Tip>Skip this entirely with **Managed** — set an agent's `credential` to `"managed"` (or rely on the org default) to run via OpenComputer billed to your credits, no key required. See [Managed vs BYO](#managed-vs-byo) below.</Tip>--Set `provider` to `anthropic` or `openai`. `name` is an optional label; `is_default` makes it your org default for that provider (see [resolution](#resolution)). The response is the credential's **metadata only** — the key is never echoed back.--<CodeGroup>--```ts TypeScript SDK-const cred = await oc.credentials.create({- provider: "anthropic",- key: "sk-ant-...",- name: "prod",- isDefault: true,-});-// → { id: "cred_…", provider: "anthropic", name: "prod", last4: "AB12", isDefault: true, createdAt: "…" }-```--```http REST API-POST https://api.opencomputer.dev/v3/credentials-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{ "provider": "anthropic", "key": "sk-ant-...", "name": "prod", "is_default": true }-```--</CodeGroup>--Attach it to an agent by id, so the agent runs on it:--```ts TypeScript SDK-await oc.agents.create({ name: "reviewer", runtime: "claude", model: "anthropic/claude-opus-4-8", prompt: "…", credential: cred.id });-// …or run Managed (billed to credits, no key):-await oc.agents.create({ name: "reviewer", runtime: "claude", model: "anthropic/claude-opus-4-8", prompt: "…", credential: "managed" });-```--<Tip>Prefer not to touch the API? Add and manage credentials from the [dashboard](https://app.opencomputer.dev) under **Agents → Credentials** — and pick one (or add a new one inline) right in the create-agent dialog.</Tip>--## List, default, and remove--<CodeGroup>--```ts TypeScript SDK-const creds = await oc.credentials.list(); // metadata only (last4, never the key)-await oc.credentials.setDefault({ credential: "cred_..." });-await oc.credentials.delete("cred_...");-```--```http REST API-GET https://api.opencomputer.dev/v3/credentials-PUT https://api.opencomputer.dev/v3/credentials/default { "credential": "cred_..." }-DELETE https://api.opencomputer.dev/v3/credentials/:id-```--</CodeGroup>--The credential object: `{ id, provider, name?, last4, is_default, created_at }`. `last4` is the last four characters, for display — the key itself is never returned.--<Warning>Deleting a credential breaks agents pinned to it and sessions that fall back to it, until you point them at another credential, at **Managed** (`credential: "managed"`), or set a new default. If your org has no other default, they fall back to Managed automatically.</Warning>--## Resolution--When a session is created, its model source is resolved (and **pinned** for the session's life) in this order:--1. The agent's **`credential: "managed"`** → run Managed, billed to your credits.-2. The **agent's** BYO credential, if it has one and it matches the runtime's provider.-3. Your **org default** BYO credential for that provider.-4. **Managed**, if your org has no BYO default — so a new org runs Managed out of the box.--Only if **none** resolves does the session fail to start: `422 no_credential` (no Managed and no usable key), or `422 managed_unavailable` (Managed selected/defaulted but not yet active for your org).--## Rotation--Rotating the **key value** behind a credential flows to **running** sessions too — the one exception to a session's otherwise [pinned config](/agent-sessions/agents#session-pinned-config), so a compromised key can be swapped without restarting work. Rotate the credential:--<CodeGroup>--```ts TypeScript SDK-await oc.credentials.rotate("cred_...", "sk-ant-NEW...");-```--```http REST API-PATCH https://api.opencomputer.dev/v3/credentials/cred_...-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{ "key": "sk-ant-NEW..." }-```--</CodeGroup>--Passing a new `key` to [`oc.agents.update`](/agent-sessions/agents) still works as a shortcut — it rotates the agent's attached credential.--Changing **which** credential an agent uses (a different `credential` id) affects only **future** sessions — existing sessions keep the one they pinned.--## Shortcut: add a key inline--For the true **no-key** path, use [Managed](#managed-vs-byo) (`credential: "managed"`) — nothing to store. If you're going BYO, you rarely call the credentials API directly: the common path is to pass the key **inline** when you [create an agent](/agent-sessions/agents) — it's stored as a credential (with all of the protections above) and attached to the agent in one call. The provider is inferred from the agent's `model` (`anthropic/…` → Anthropic, `openai/…` → OpenAI).--<CodeGroup>--```ts TypeScript SDK-await oc.agents.create({- name: "reviewer",- runtime: "claude",- model: "anthropic/claude-opus-4-8",- prompt: "Review the repo. Run tests. Summarize risks.",- key: "sk-ant-...",-});-```--```http REST API-POST https://api.opencomputer.dev/v3/agents-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{ "name": "reviewer", "runtime": "claude", "model": "anthropic/claude-opus-4-8", "prompt": "…", "key": "sk-ant-..." }-```--</CodeGroup>--Reach for the standalone resource above when you want to reuse one key across agents, set an org default, or rotate / remove keys.diff --git a/docs/agent-sessions/custom-runtimes.mdx b/docs/agent-sessions/custom-runtimes.mdxdeleted file mode 100644index 2524b397..00000000--- a/docs/agent-sessions/custom-runtimes.mdx+++ /dev/null@@ -1,138 +0,0 @@-----mode: "wide"-title: "Custom runtimes"-description: "Package your own agent implementation as a runtime"------<Note>**Labs preview.** Custom runtimes are not part of the stable Durable Sessions API. Production sessions use the built-in [runtimes](/agent-sessions/runtimes): `claude`, `codex`, and `pi`.</Note>--Building on the [Flue framework](https://flueframework.com)? Use the supported [Flue runtime](/agent-sessions/flue) instead. It deploys Flue's Cloudflare target as an agent Worker with one Durable Object per session, so it does not use the custom brain-box contract described here. Custom runtimes remain the general escape hatch for other agent implementations.--A custom runtime lets you run your own agent implementation on Durable Agent Sessions. Once registered, select it on an agent with `runtime: "<name>"`; sessions, events, steering, webhooks, recovery, and sandbox tools use the same public API as built-in runtimes.--The runtime image contains a **brain server**: a resident process around your agent SDK. OpenComputer supplies the platform adapter that reads the session log, owns fencing and idempotency, exposes tools, calls your brain over localhost, and commits the brain's stream as durable events.--You implement the brain. You do **not** implement OpenComputer's event API, session cursors, turn-token auth, sandbox HTTP calls, or webhook delivery.--See [example runtimes](https://github.com/diggerhq/oc-runtime-examples) for minimal `claude` and `codex` brain servers.--## Runtime contract--Your image starts an HTTP server on `127.0.0.1:$OC_BRAIN_PORT` (`8080` by default). The server stays warm across turns and handles one turn at a time.--```http-GET /healthz-```--```json-{- "status": "ready",- "contract_version": "1",- "busy": false-}-```--Return `busy: true` while a turn is running. A second turn should return `409`; OpenComputer already serializes real turns, so this is a safety check.--<Note>`contract_version` (`"1"`) is the runtime↔adapter contract version. Treat this Labs contract as unstable until it is promoted out of Labs.</Note>--## Turn request--For each turn, the adapter sends the new input and run config:--```http-POST /turn-Content-Type: application/json-```--```json-{- "contract_version": "1",- "turn_id": "turn_...",- "input": [- { "role": "user", "content": "Review this repository." }- ],- "config": {- "model": "anthropic/claude-opus-4-8",- "system_prompt": "Run tests and explain risks.",- "mcp_endpoint": "http://127.0.0.1:8765/mcp",- "state_dir": "/home/sandbox/.oc/runtime-state",- "resume": false,- "max_turns": 24- }-}-```--The adapter has already read the event log. Your brain receives the new turn input, not a session cursor.--Everything in `config` is turn-invariant for the life of the box, so a resident brain may cache values like `mcp_endpoint`, `state_dir`, and the ports across turns. When something has to change — for example the session's skills — the platform restarts the brain rather than handing it a changed `config` mid-life.--## Step stream--`POST /turn` responds with newline-delimited JSON. The brain streams its SDK's **native** events verbatim, one per line, then a terminal `done`:--```jsonl-{"seq":0,"kind":"assistant","msg":{ "...native SDK message..." }}-{"seq":1,"kind":"user","msg":{ "...native SDK message, e.g. a tool result..." }}-{"kind":"done","reason":"quiescent"}-```--- `kind` is the SDK's message/event type; `msg` is the native object, unchanged.-- `done.reason` is `quiescent` (nothing left to do), `awaiting_input` (the agent called `ask` and is paused for a reply), or `error` (with an `error`).--The platform ships a **per-SDK adapter** that maps native SDK events to [session events](/agent-sessions/events) with stable idempotency keys, and flushes committed output before ending the turn. Custom runtimes target an SDK the platform has an adapter for.--Tool calls, including user-visible `say` and `ask`, are made through MCP, not by emitting HTTP requests to OpenComputer.--## Deadlines--A turn runs under nested deadlines. Each inner clock expires before the one outside it, and the layer that enforces a deadline also cleans up the one below it.--| Clock | Value | Enforced by |-| --- | --- | --- |-| Health check | 2s per probe | adapter → your `/healthz` |-| Brain start | 30s to first `ready` | adapter (fails the turn if exceeded) |-| Step cap | `config.max_turns` (24) per `/turn` | your SDK — end the stream cleanly when hit |-| Model call | provider-dependent | your SDK |-| Turn deadline | `min(agent turnSeconds, 1800s)` | platform — the turn is killed at the deadline |-| Fence / cancel grace | 5s after the request is aborted | adapter — a brain still busy is killed; the next turn restarts it |--If your brain runs past the turn deadline the turn ends `deadline_exceeded`; the session can be steered to continue. Aim to yield often — fresh config and input arrive on the next turn.--## Tools--The adapter exposes tools at `config.mcp_endpoint`. Your brain connects through your SDK's MCP support.--| Tool | What it does |-| --- | --- |-| `bash` | Run a shell command in the hands sandbox. |-| `read` | Read a file from the hands sandbox. |-| `write` | Write a file in the hands sandbox. |-| `ls` | List a directory in the hands sandbox. |-| `say` | Emit a user-visible message. |-| `ask` | Ask for input and end the turn awaiting a reply. |--The brain sandbox is for the model loop. The hands sandbox is where files and commands run.--The MCP endpoint is live only during an in-flight `/turn`. Don't call tools from a background timer or a deferred flush between turns — the endpoint is gone once the turn ends. The adapter always provides `config.mcp_endpoint`; connect to it — a brain that skips tools silently degrades to a chat-only agent.--## State and recovery--Store resumable state under `config.state_dir`. OpenComputer checkpoints that directory at turn boundaries and restores it after recovery.--Examples:--- Claude writes a local journal and continues from it.-- Codex persists a server-side thread id and resumes that thread.--Design your brain so replay is safe. If a crash happens after a step is emitted but before the turn finishes, the adapter may replay from durable state and dedupe already committed events.--## Register runtimes--Registration command:--```bash-oc runtime push-```--Runtimes are versioned. Each session pins the runtime build it starts with, so publishing a new build affects new sessions only.diff --git a/docs/agent-sessions/events.mdx b/docs/agent-sessions/events.mdxdeleted file mode 100644index 498a7d8b..00000000--- a/docs/agent-sessions/events.mdx+++ /dev/null@@ -1,97 +0,0 @@-----title: "Events"-description: "The append-only log: read, stream, filter by level, and resume"------A session is an **append-only event log**. Read it, stream it, filter it by visibility (`level`), and resume from any `seq`. Switch on event **`type`**, not prose.--## Events in a turn--When a turn runs it appends events in order — here, the agent runs the tests, sees them fail, and replies:--```text-turn.started- tool.call npm test- exec.completed exit 1- agent.message "3 tests fail" (level: user)-turn.completed needs_input-```--Everything between `turn.started` and `turn.completed` is that turn's work. **`turn.completed` is the done signal, so await it.** New neutral completions report `outcome`; existing built-in runtime events may report the equivalent `yield_reason`. The `body` each type carries is in the table below.--Each event is one envelope:--```json-{ "id": "evt_…", "seq": 12, "ts": "…", "session": "ses_…",- "actor": { "id": "agent", "type": "agent" },- "type": "agent.message", "level": "user",- "body": { "text": "3 tests fail in auth.spec.ts" } }-```--The two fields you act on are **`type`** (what happened — the discriminator) and **`level`** (who should see it). `seq` orders and resumes the log, `body` is the payload, and `actor` is who produced it (`{ id, display?, type: "human" | "agent" | "system" }`). The full field reference lives in the [API reference](/agent-sessions/api-reference); for messages, see how input fields map onto an event in [Messaging](/agent-sessions/messaging#message-input).--## Event types--Treat **`type`** as the stable discriminator. Unknown types should render from their `text` or `summary`, so new types do not break your UI. Match a prefix like `turn.*` or `agent.*` for coarse buckets.--| `type` | `body` shape | Use it for |-| --- | --- | --- |-| `agent.message` | `{ text }` | agent output (the result is whichever one `turn.completed` points to) |-| `user.message` | `{ text }` | a steer you sent |-| `turn.started` | `{ turn_id, input_from_seq, input_to_seq }` | a turn began, consuming input events in `[from,to]` |-| `turn.completed` | `{ turn_id, outcome?, yield_reason?, result_event_id?, usage? }` | the done signal; normalize `outcome` and legacy `yield_reason` as the terminal reason |-| `tool.call` | `{ tool, args_summary }` | the agent invoked a tool |-| `exec.completed` | `{ command, exit_code, summary, content_ref?, bytes? }` | a finished command |-| `error.runtime` · `error.model` · `error.task` | `{ code, message, retriable? }` | a failure |--### GitHub PR events--When a session [watches](/agent-sessions/watches) a PR it opened, OpenComputer wakes it with a normalized event — level `user`, `source: "github"`, `body` a summary (author, text, url), never the raw webhook.--| `type` | Fires on |-| --- | --- |-| `github.pr.checks_completed` | GitHub check runs/suites for the head commit finished (coalesced) |-| `github.pr.review_submitted` | a review decision landed (approved / changes requested) |-| `github.pr.comment` | a comment landed on the PR — issue-style or review (diff) comment |-| `github.pr.merged` | the PR merged |-| `github.pr.closed` | the PR closed without merging |--## Visibility levels--Every event carries a `level`; use it to choose how much detail each client receives.--| Level | Contains | Use for |-| --- | --- | --- |-| `user` | Answers, results, and questions. | Chat, final results, notifications. |-| `progress` | Plain-language work updates. | Activity feeds and status lines. |-| `internal` | Tool calls and runtime detail. | Debug consoles and audit trails. |--Filtering is **cumulative** — `user` is the narrowest, `internal` is everything:--- `?level=user` → just `user`-- `?level=progress` → `progress` + `user`-- `?level=internal` → everything--Use `user` for customer-facing chat, `progress` for activity views, and `internal` for debugging. The model's private reasoning is never surfaced; webhooks default to `user`.--## Cursors and resume--- **`seq`** — a monotonic id assigned to each event.-- **`head`** — the highest `seq` in the session.-- **`input_cursor`** — how far the *runtime* has consumed (a session field). As a **reader** you ignore it and just pass `after=<seq>`.--Read or stream with `after=<seq>` to get everything since that point — this is how **resume** works: reconnect with the last `seq` you saw and you miss nothing and get no duplicates. In the browser, native `EventSource` does this for you — each event's `seq` is the SSE `id`, so it resumes via `Last-Event-ID` on reconnect (see the [quickstart](/agent-sessions/quickstart)).--## Details--<AccordionGroup>- <Accordion title="Correlate a steer to its turn">- [`POST /messages`](/agent-sessions/messaging) returns the input event `seq`, not a turn id. Built-in runtimes may consume several queued inputs in one turn; Flue allocates one ordered turn for each accepted input. In both cases, `turn.started` reports the consumed `input_from_seq` and `input_to_seq`. Await its matching `turn.completed`, then use `GET …/events?turn_id=` for the turn's output.- </Accordion>- <Accordion title="Large output and artifacts">- 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). For named files, diffs, screenshots, reports, and previews, see [Artifacts & previews](/agent-sessions/artifacts) in Labs.- </Accordion>- <Accordion title="id, turn_id, and idempotency keys">- **`id`** is the event's own unique id (`evt_…`). **`turn_id`** is the turn that produced the event, when applicable — filter a turn's output with `?turn_id=`. The client idempotency key for steering is separate from both (deduped per session — see [steering](/agent-sessions/messaging)).- </Accordion>-</AccordionGroup>diff --git a/docs/agent-sessions/flue.mdx b/docs/agent-sessions/flue.mdxdeleted file mode 100644index c081d79d..00000000--- a/docs/agent-sessions/flue.mdx+++ /dev/null@@ -1,520 +0,0 @@-----mode: "wide"-title: "Flue"-description: "Deploy a Flue app as an OpenComputer agent"------<Note>- **Experimental.** The supported profile is intentionally narrow. It currently- covers direct text sessions on managed Anthropic models, with an optional- OpenComputer sandbox. Flue is pre-1.0, and each deployment includes the exact- Flue version installed in your app.-</Note>--[Flue](https://flueframework.com) is a TypeScript framework for durable agents. OpenComputer runs the-application Flue builds and connects it to OpenComputer agents, sessions, events, steering, model-billing, and optional sandboxes.--Starter: [`diggerhq/oc-flue-starter`](https://github.com/diggerhq/oc-flue-starter) · [Fork on GitHub](https://github.com/diggerhq/oc-flue-starter/fork)--## How Flue differs from the built-in runtimes--The built-in runtimes run Claude Code, Codex, or pi as a managed coding agent. A Flue agent is-different: **your application is the runtime**. OpenComputer deploys and operates that app.--| Concern | Built-in runtimes | Flue |-| ------------------ | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |-| Agent loop | OpenComputer runs Claude Code, Codex, or pi | Your compiled Flue app contains the loop |-| Session compute | Managed per-session brain and workspace sandboxes | One deployed app, with one Durable Object instance per session |-| Conversation state | Checkpointed runtime files plus the OpenComputer event log | Flue stores its conversation in Durable Object SQLite; OpenComputer projects public milestones into its event log |-| Tools and skills | Platform tools plus uploaded `prompt.md` and `skills/` | `defineTool` code and packaged skill imports compiled into the Worker |-| Linux workspace | Part of the normal runtime | Absent by default; `ocSandbox` creates one only when an operation needs it |-| Deployment | Upload prompt, model, and skill configuration | Build and deploy the compiled app |--Under the hood, OpenComputer runs Flue's Cloudflare target as an agent Worker and gives each session-its own Durable Object. This architecture lets a Flue session start without provisioning a virtual-machine. A model-only agent, or one whose custom tools use bundled data, never needs a sandbox.--## How a turn runs--```mermaid-sequenceDiagram- participant Client as Dashboard or API client- participant OC as OpenComputer sessions API- participant Worker as Deployed agent Worker- participant DO as Session Durable Object- participant Gateway as OpenComputer model gateway- participant Model as Model provider- participant Sandbox as Optional sandbox-- Client->>OC: Create session or send message- OC->>OC: Store input and allocate turn- OC-->>Client: Accepted- OC->>Worker: Dispatch accepted input- Worker->>DO: Admit the turn- DO->>Gateway: Model request- Gateway->>Model: Metered provider request- Model-->>DO: Response- opt First real shell or file operation- DO->>Sandbox: Resolve or create session sandbox- Sandbox-->>DO: Operation result- end- DO-->>OC: Durable conversation updates- OC->>OC: Append messages, tools, errors, and completion- OC-->>Client: Event stream update-```--OpenComputer returns after it has durably accepted the input. It does not wait for dispatch, the-Durable Object, a model call, or sandbox creation. Flue executes one turn at a time for each session;-messages sent while a turn is working remain queued and run in order.--Flue's Durable Object is the runtime's conversation store. The OpenComputer event log is the stable-consumer view used by the dashboard, API, and webhooks. OpenComputer resumes projection from a saved-cursor after an interruption, so clients do not need to understand Flue submission ids or stream-offsets.--## Start with a prompt--You do not need to write a Flue application to use its edge runtime. A-prompt-defined Flue repository has this shape:--```text-agent.toml-prompt.md-skills/- triage/- SKILL.md-```--Scaffold it with `oc agent init ./support --runtime flue`, or create the files-directly:--```toml agent.toml-name = "support-triage"-model = "anthropic/claude-haiku-4-5"--[runtime]-family = "flue"-```--Run `oc agent deploy` from the directory, or import it from GitHub.-OpenComputer compiles `prompt.md` and up to 32 packaged skills into a pinned-Flue application inside the isolated managed builder. The prompt may be at most-256 KiB; each `SKILL.md` may be at most 256 KiB, with a 2 MiB combined limit.-Skill directory names use lowercase letters, numbers, and hyphens. `mcp.json`-is not supported by this profile.--Add `package.json` and a `flue.config.*` file when you need custom tools or-application code. Those full-app markers take precedence over `prompt.md`, and-the next production push graduates the existing agent to the complete Flue app-without replacing its identity or history. Changing the `name` in `agent.toml`-still requires a new agent because it changes the Durable Object lineage.--## Deploy from GitHub--The shortest path for a prompt-defined or complete Flue app is the dashboard:--1. Push a prompt-defined root to GitHub, fork the [Flue starter](https://github.com/diggerhq/oc-flue-starter/fork), or push your own app.-2. Open **Agents → Create agent → Import from GitHub**.-3. Install the OpenComputer GitHub App on the repository, then select the repository, production branch, and root directory.-4. Choose **Review agent**. OpenComputer resolves one exact commit and checks the root without running repository code.-5. Review the detected Flue entrypoint and model. Give the OpenComputer agent a human-readable name; it may differ from the `agent.toml` Flue entrypoint.-6. Choose **Deploy agent**. A guided setup page opens immediately and keeps the deployment running in the background. It shows compact **Prepare**, **Build**, and **Deploy** progress; expand the build log only when you need it.-7. Choose **Connect Slack** as the next step. Slack authorization returns to setup, which changes to **Open Slack** as soon as both the agent and connection are ready and prompts you to send your first message.-8. Send the message in Slack. Setup detects the real managed-Slack session, previews the first exchange, and links to the full session in OpenComputer. If you leave early, use **Continue setup** from the agent page.--If the chosen repository root is already a deployment source for another agent,-the picker marks it before review and disables the review action. Open the-owning agent, choose another monorepo root, or confirm an inline unlink. The-unlink stops future push deployments for the old agent; it does not delete the-agent, active revision, deployment history, or sessions.--The selected root is its own build context. A prompt-defined root needs-`agent.toml`, `prompt.md`, and optional `skills/`. A complete app also needs-`package.json` and a committed `package-lock.json`; its package must declare a-Node engine compatible with the exact managed builder version and a semver-dependency on the Flue CLI. npm workspaces, files above the selected root,-private registries, submodules, Git LFS, custom install/build commands, and-build-time secrets are not supported.--`agent.toml` is authoritative. If it is malformed, declares an unsupported runtime, or is missing-from a root that otherwise has strong Flue markers, review returns **This Flue agent needs a fix**.-OpenComputer does not fall back to another runtime. A folder containing-`prompt.md` or skills but no `agent.toml` is unrecognized; add the explicit-Flue manifest, choose another folder, fork the starter, or create a built-in-agent manually.--For a monorepo, reviewing an unrecognized parent can suggest bounded candidate roots. Selecting a-candidate changes the root and performs a fresh review—it never deploys the suggestion automatically.--OpenComputer resolves the selected branch to one commit, fetches only that tracked tree in a-short-lived Git sandbox, and transfers tokenless source to a separate build sandbox. The build runs-fixed `npm ci --no-audit --no-fund` and offline `oc agent build` commands in an ordinary disposable-OpenComputer sandbox. The build request carries no GitHub token, OpenComputer key, model-credential, Workers credential, or secret store.--<Note>- Repository import creates the initial deployment from the selected production- branch. Each later push to that branch that touches the selected root- automatically creates another deployment for the new exact commit. Flue- ignores pushes to other branches because it has one live Worker and no- preview/staged Worker in the current profile.-</Note>--The review step returns a receipt for the exact source plan. Import re-resolves GitHub authority and-checks that receipt before creating anything. If the branch or a relevant file changed, the dashboard-shows **Repository changed since review** and asks you to review again.--If install or build fails, the agent remains visible but undeployed: it has no usable revision and-cannot start a session. Open the failed deployment for its persisted error summary and bounded log,-fix the repository, and push the linked production branch. The first successful deployment creates-revision **#1**. **Deploy latest** can manually rebuild its current head after a transient platform-failure.--If a later production push removes or replaces the Flue definition, the deployment stops before-build with `source_profile_changed`; the active revision stays live. A prompt-defined root may-graduate to a complete Flue app, but not in the opposite direction. Otherwise restore the previous-profile, or unlink the source and import the repository as a new agent. Unlinking does not delete-the existing agent, its active revision, or its sessions.--## Deploy from your machine--Requirements: the `oc` CLI and an OpenComputer organization with Managed model-access. A prompt-defined root needs no local Node installation: the CLI uploads-its bounded behavior files and the isolated managed builder performs synthesis,-dependency installation, and the Flue build.--```sh-oc agent init ./support --runtime flue-cd support-$EDITOR prompt.md--# Upload source, build in isolation, verify the live Worker, and print its URL.-oc agent deploy-```--A complete Flue app builds on your machine and therefore also requires Node-22.19 or newer and installed dependencies:--```sh-git clone https://github.com/diggerhq/oc-flue-starter-cd oc-flue-starter-npm install--# Builds the Cloudflare target locally, deploys it, verifies the live Worker, and activates a revision.-# The agent is created from agent.toml when it does not exist yet.-oc agent deploy--# The deploy result prints the permanent Agent URL and this next command.-oc agent invoke support-triage \- --data '{"message":"Order 2203 arrived with a torn shoulder strap. What happens next?"}'-```--Continue the session with `oc session steer <session-id> "..."`, inspect it with-`oc session logs <session-id>`, or open it in the-[dashboard](https://app.opencomputer.dev).--### Validate or build without deploying--The CLI exposes the same credential-free artifact builder used by managed repository builds:--```sh-# Reads and validates source without installing dependencies or running repository code.-oc agent build --dir . --check-only --json--npm ci-oc agent build \- --dir . \- --target cloudflare \- --output /tmp/flue-build \- --json-```--The full command writes `bundle.tgz` and `deployment.json`. It does not fetch source, install-dependencies, authenticate, upload, or deploy; `npm ci` is intentionally a separate step.--## Add OpenComputer to a Flue app--Install the integration alongside Flue:--```sh-npm install @opencomputer/flue-```--Export the OpenComputer route and register the managed model gateway inside your agent initializer:--```ts src/agents/support-triage.ts-import { defineAgent, defineAgentProfile } from "@flue/runtime";-import { DEFAULT_MODEL, route, useOcGateway } from "@opencomputer/flue";--export { route };--export default defineAgent((ctx) => {- useOcGateway(ctx);-- return {- profile: defineAgentProfile({- instructions:- "Triage customer requests and give the next concrete action.",- }),- model: DEFAULT_MODEL,- };-});-```--Use the default hosting app, which mounts Flue's routes, the deployment health endpoint, and-OpenComputer telemetry:--```ts src/app.ts-export { default } from "@opencomputer/flue/app";-```--Declare the deployment target:--```toml agent.toml-name = "support-triage"-model = "anthropic/claude-haiku-4-5"--[runtime]-family = "flue"-```--The manifest name must identify the exported Flue agent, and its model must match the model returned-by `defineAgent`. `DEFAULT_MODEL` currently resolves to `anthropic/claude-haiku-4-5`.--If your project owns a custom `app.ts`, keep Flue's routes, import `@opencomputer/flue/wire` for-telemetry, and expose a `GET /health` route that returns success. The default app is the simpler-choice when you do not need additional routes.--## What `@opencomputer/flue` supplies--| Export | Purpose |-| ------------------------- | -------------------------------------------------------------------- |-| `useOcGateway(ctx)` | Registers the managed Anthropic endpoint inside the Flue initializer |-| `route` | Opts an agent into the HTTP transport used by managed dispatch |-| `DEFAULT_MODEL` | Selects the supported prompt-caching-safe default model |-| `@opencomputer/flue/app` | Provides Flue routes, `GET /health`, and telemetry wiring |-| `@opencomputer/flue/wire` | Adds telemetry when your project owns its hosting app |-| `ocSandbox(ctx.env)` | Adds an optional, demand-driven Linux shell and filesystem |--OpenComputer binds a platform-managed credential for its gateway during deployment. Your provider-key is not compiled into the app or exposed to the Worker.--## Custom tools and packaged skills--Custom `defineTool` handlers run inside the Worker. Import any data or templates they need so the-Cloudflare build includes those files:--```ts src/tools/lookup-order.ts-import { defineTool } from "@flue/runtime";-import * as v from "valibot";-import orders from "../data/orders.json" with { type: "json" };--export const lookupOrder = defineTool({- name: "lookup_order",- description: "Look up an order by id.",- input: v.object({ order_id: v.string() }),- run({ input }) {- return (- (orders as Record<string, unknown>)[input.order_id] ?? { found: false }- );- },-});-```--Package an agent-owned skill through Flue's supported import mechanism, then add it to the agent:--```ts-import triage from '../skills/triage/SKILL.md' with { type: 'skill' };--// Inside the object returned by defineAgent:-{- tools: [lookupOrder],- skills: [triage],-}-```--The skill is part of the Worker module graph. It is not copied into a workspace, and loading it does-not require a sandbox. Changing a tool, imported data file, or packaged skill requires another-deployment.--Custom tools in the Worker can currently reach only platform-managed outbound hosts. Arbitrary-external `fetch` destinations are not part of the supported profile. Commands run through an-optional OpenComputer sandbox follow the sandbox's separate network policy.--## Optional sandbox and working repositories--Add `ocSandbox` only when the agent needs a Linux shell or durable files:--```ts-import { defineAgent, defineAgentProfile } from "@flue/runtime";-import {- DEFAULT_MODEL,- ocRepoTools,- ocSandbox,- route,- useOcGateway,-} from "@opencomputer/flue";--export { route };--export default defineAgent((ctx) => {- useOcGateway(ctx);-- return {- profile: defineAgentProfile({- instructions:- "Work in the sandbox only when a shell or file operation is needed.",- }),- model: DEFAULT_MODEL,- sandbox: ocSandbox(ctx.env),- tools: [...ocRepoTools(ctx)],- };-});-```--Declaring `ocSandbox` performs no provisioning during Worker startup or Flue runtime initialization.-The first real shell or file operation resolves one sandbox for the session; later operations and-turns reuse it.--The workspace starts empty. Add a [working repository](/agent-sessions/repos#choose-working-repositories-for-a-flue-agent)-at session creation or with `add_source`. Flue pins the requested ref immediately but creates the-session sandbox and materializes files only when the app first uses a repository tool. The agent may-edit those files and call `github_publish_pull_request`; OpenComputer performs authenticated Git-operations outside the tenant Worker and session sandbox.--`ocRepoTools` adds `list_working_repos`, `add_source`, and-`github_publish_pull_request`. Tell the agent to list first, state the exact-`owner/repo` it resolved, and ask when the user's target is ambiguous. Repository-names do not need to be embedded in the prompt.--## Variables and secrets--Non-secret Worker variables belong in `agent.toml`:--```toml agent.toml-[vars]-SUPPORT_REGION = "eu-west"-```--Pipe secret values over standard input. Values are write-only and never returned by the API:--```sh-printf '%s' "$SUPPORT_API_KEY" | oc agent secret set SUPPORT_API_KEY --from-stdin-oc agent secret list--# A configuration change takes effect on the next deployment.-oc agent deploy-```--Deleting a secret also requires a deployment before the Worker changes:--```sh-oc agent secret delete SUPPORT_API_KEY-oc agent deploy-```--Binding names use uppercase letters, digits, and underscores. Names beginning with `OC_` or `FLUE_`-are reserved for the platform. Never put a secret in `agent.toml` or source code.--## Deployment and revision behavior--A **deployment** is one time-aware attempt and can fail. A **revision** exists only after that-attempt verifies successfully. Managed repository deployments persist one chronological log across-the `queued`, `fetching`, `validating`, `installing`, `building`, `uploading`, `deploying`, and-`verifying` states. Refreshing the dashboard does not lose that log.--`oc agent deploy` performs these operations:--1. Scans the source tree for credential-shaped values.-2. Runs the app's installed `flue build --target cloudflare`.-3. Uploads only the generated JavaScript modules and a restricted deployment descriptor.-4. Applies platform-owned bindings, variables, secrets, and Durable Object migrations, then uploads- the agent Worker.-5. Keeps the deployment in `verifying` until the exact live Worker returns two consecutive healthy- responses. Only then does the CLI report the revision as ready.--Successful framework build output stays quiet so the deployment result remains-scannable. Pass `--verbose` to stream it; if the build fails, the CLI replays-the captured output automatically.--<Warning>-Flue currently has one live Worker per agent. Uploading a deployment changes the code used by new and-existing sessions before revision verification finishes. There is no isolated staged Worker, canary-route, or automatic Worker rollback. `--no-activate` and a pointer-only-`oc agent rollback` do not restore older Worker code.--From the live-upload guard until verification finishes, new session creation and new input return the-retryable `503 flue_deployment_updating`; retry after the deployment becomes terminal. If an upload-cannot be verified, the live state becomes `unverified` and those paths remain blocked until a later-deployment restores verified code (`503 flue_deployment_unverified`). Work already running inside a-Durable Object is not version-pinned and can also be affected by the Worker change.--To restore a known-good build, check out that source and run `oc agent deploy` again. Flue and Durable-Object schema changes are forward-only, so do not downgrade across an incompatible Flue storage-version.--</Warning>--## Session behavior--Flue uses the same session ids, text input, event stream, steering, cancellation, result endpoint,-and dashboard as the other runtimes. The important differences are:--- Session creation and steering return after durable acceptance. Model execution continues- asynchronously.-- Each accepted input receives an OpenComputer `trn_...` id. Flue's internal submission identity is- not part of the public API.-- Follow-up messages queue behind the working turn and run in order.-- The model is compiled into the deployed app. Per-session model overrides are rejected.-- Durable model-call usage is folded into turn and session usage with- `attribution: "best_effort"`. Use it for visibility; the agent/org gateway is- the hard spend-enforcement authority.-- Generic `tokens`, `turn_seconds`, and `turns` limits are not yet enforced on the Flue execution- path. Do not use them as a safety boundary for this runtime.-- Archiving makes the OpenComputer session read-only but retains the Flue conversation in Durable- Object storage. Each session is subject to Cloudflare's- [10 GB Durable Object storage limit](https://developers.cloudflare.com/durable-objects/platform/limits/).--## Current limitations--- Dashboard sessions and the OpenComputer-managed Slack app deliver direct text through the hosted- session wire. Native Flue channel bindings and workflows are not exposed by this hosting path.-- Working-repository checkout and pull-request publishing are available through the owner-bound- OpenComputer GitHub App. Pull-request watches are not part of the current Flue profile.-- Repository deployment accepts one self-contained npm root with a committed npm lockfile. Pushes- to its linked production branch deploy automatically; preview branches and staged Flue Workers are- not supported.-- Each production push is re-inspected at its exact commit. Valid Flue changes—including the- entrypoint, model, variables, package, and app source—deploy within the pinned `flue-app-v1`- profile; removing or replacing that profile stops before build and leaves the active revision- unchanged.-- File and image attachments are not supported.-- The managed gateway currently supports Anthropic models and requires Managed model access for the- organization. Per-session model selection is not supported.-- Worker code has a platform-managed outbound allowlist. Tenant-configurable egress is not available.-- Platform turn deadlines, maximum-turn enforcement, automatic conversation compaction, and- automatic tenant-Worker rollback are not available yet.-- Subagents may execute inside Flue, but their event projection and lifecycle are outside the tested- profile.--## Troubleshooting--- **Repository inspection fails**: confirm the GitHub App can read the repository, the selected- branch and root exist, and the root contains `agent.toml`, `package.json`, and `package-lock.json`.-- **Managed install or build fails**: open the deployment detail page. The safe error summary remains- available even if log output was truncated; fix the source and push the production branch again.--- **`flue build` is unavailable**: run `npm install` with Node 22.19 or newer. `oc agent deploy` never- downloads a missing build tool for you.-- **Credential scan refuses the deploy**: remove the reported key from source and store application- secrets with `oc agent secret set ... --from-stdin`.-- **Deployment fails while verifying**: the uploaded Worker did not reach a stable healthy response.- Inspect the deployment error, correct the import-time or health-route failure, and deploy again.-- **Provider authentication fails on the first turn**: confirm that Managed model access is active for- the organization and that the agent uses an `anthropic/...` model.-- **A skill is missing**: import its `SKILL.md` with `with { type: 'skill' }` and include it in the- agent's `skills` array.-- **A session shows an error or stops advancing**: inspect the dashboard's **All events** view or run- `oc session logs <session-id>`. Runtime failures are recorded without requiring a diagnostic- redeployment.diff --git a/docs/agent-sessions/hooks.mdx b/docs/agent-sessions/hooks.mdxdeleted file mode 100644index 4a81ed77..00000000--- a/docs/agent-sessions/hooks.mdx+++ /dev/null@@ -1,181 +0,0 @@-----mode: "wide"-title: "Hooks (inbound)"-description: "Pasteable, scoped URLs that send external events to an agent"------Hooks send external events **to your agent**. Create a named Hook URL for each-external system, then paste it into that system's HTTP or webhook destination.-Each accepted `POST` starts one ordinary durable session on the agent's active-revision.--<Warning>- The complete URL is a secret. Anyone with it can run this agent. It cannot- read sessions, manage your account, or invoke another agent. Copy it when it- is created—the complete URL cannot be retrieved again.-</Warning>--## Create a Hook URL--<CodeGroup>--```ts TypeScript SDK-const created = await oc.agents.hooks.create("agt_...", {- name: "grafana-prod",- expiresAt: null,-});--console.log(created.hookUrl); // shown once-```--```bash oc CLI-oc agent hook create grafana-prod --agent reviewer-```--```http REST API-POST https://api.opencomputer.dev/v3/agents/agt_.../hooks-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{ "name": "grafana-prod", "expires_at": null }-```--</CodeGroup>--Names match `^[a-z0-9][a-z0-9-]{0,63}$`. Expiry is optional and must be a-future RFC 3339 timestamp. An agent may have up to 20 non-revoked Hooks; expired-Hooks keep a slot until revoked. Hook lifecycle is operational credential state,-not agent revision state, so deploys and rollbacks do not copy or replace Hooks.--Hook creation is deliberately not idempotent because the secret is stored only-as a hash. If the creation response is lost, list by name, revoke the-inaccessible Hook, and create a replacement.--## Send an event--```bash-curl "$HOOK_URL" \- -H "Content-Type: application/json" \- -H "Idempotency-Key: alert-018f" \- -d '{"status":"firing","service":"checkout","summary":"error rate above 5%"}'-```--The URL authenticates the request; do not add an OpenComputer API key. The-contract is exact `POST`, no query string, and either an empty body or one JSON-value. Non-empty bodies require a JSON content type and are capped at 24 KiB.-The Hook name and parsed payload become a structured `http.request` event; the-secret URL and transport headers never do.--```json-{- "type": "http.request",- "actor": { "type": "trigger", "display": "grafana-prod" },- "body": {- "payload": {- "status": "firing",- "service": "checkout",- "summary": "error rate above 5%"- }- }-}-```--Success returns `200 OK` only after session admission is durable:--```json-{- "request_id": "req_...",- "session": { "id": "ses_...", "status": "queued" },- "replayed": false-}-```--This is an asynchronous receipt, not the agent's output. It contains no client-token and grants no session read or steer access. Watch the session in the-dashboard or configure an outbound [webhook](/agent-sessions/webhooks) for-results.--## Common senders--Create a separate named Hook for each sender so it can be rotated or revoked-without interrupting the others.--- **Grafana:** Add a [Webhook contact point](https://grafana.com/docs/grafana/latest/alerting/configure-notifications/manage-contact-points/integrations/webhook-notifier/), use the Hook URL, and keep the method as `POST`. Grafana sends its alert JSON directly. Its standard webhook does not provide a supported delivery-id header; see [Retries and duplicates](#retries-and-duplicates).-- **Zapier:** Add a [Webhooks by Zapier](https://help.zapier.com/hc/en-us/articles/8496326446989-Send-webhooks-in-Zap-workflows) `POST` action, paste the Hook URL, select a JSON payload, and map fields from earlier steps. No separate authentication field is needed because the secret is already in the URL.-- **Supabase:** Create a [Database Webhook](https://supabase.com/docs/guides/database/webhooks), select the table and `INSERT`, `UPDATE`, or `DELETE` events, choose `POST`, and paste the Hook URL. Supabase sends the row-change JSON as the payload.-- **CI:** Store the complete Hook URL as a secret and send one JSON request. Use a stable delivery id for retries of the same run:--```yaml GitHub Actions-- name: Notify agent- env:- HOOK_URL: ${{ secrets.OC_AGENT_HOOK_URL }}- run: |- curl --fail-with-body "$HOOK_URL" \- -H "Content-Type: application/json" \- -H "Idempotency-Key: ci-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT" \- -d "{\"repository\":\"$GITHUB_REPOSITORY\",\"sha\":\"$GITHUB_SHA\"}"-```--## Retries and duplicates--For retry-safe delivery, send `Idempotency-Key`; when absent, OpenComputer uses-the Standard Webhooks `webhook-id` header if present. A repeated identifier and-payload returns the same session. Reusing it with different JSON returns `409`.-Without either header, identical requests are separate events and create-separate sessions—OpenComputer does not guess duplicates from the body.--Grafana's standard webhook does not provide either supported delivery-id-header. Do not configure one constant idempotency key for all Grafana alerts;-later alerts would conflict or replay. Accept possible redelivery duplicates,-deduplicate their side effects, or use a provider-verified connector when that-is unacceptable.--## List, replace, and revoke--<CodeGroup>--```ts TypeScript SDK-const page = await oc.agents.hooks.list("agt_...", {- includeRevoked: true,-});--await oc.agents.hooks.delete("agt_...", "hk_...");-```--```bash oc CLI-oc agent hooks --agent reviewer --include-revoked-oc agent hook get grafana-prod --agent reviewer-oc agent hook revoke grafana-prod --agent reviewer-```--```http REST API-GET /v3/agents/agt_.../hooks?include_revoked=true-GET /v3/agents/agt_.../hooks/hk_...-DELETE /v3/agents/agt_.../hooks/hk_...-```--</CodeGroup>--Lists contain the name, public Hook id, status, expiry, creation time, secret-last four, and revoke reason—never the usable URL. To rotate, create a new Hook,-update the external system, then revoke the old one. Revocation is irreversible-and does not affect sessions the Hook already created.--## Security, usage, and limits--Hook names record intended custody; they do not prove that a named provider sent-the request. A Hook does not validate provider signatures, challenge requests,-or raw-body semantics. Use a provider connector for those guarantees, and do-not send payloads the agent is not allowed to receive.--Rate limits reduce bursts; they are not a spend cap. Every accepted POST creates-a fresh session, so all per-session limits reset on every call. On built-in-runtimes, `limits.tokens` is checked between turns from reported usage and can-overshoot by one in-flight turn; it does not interrupt a model request. It is-not a currency limit or an aggregate Hook quota. Set agent turn/time/token-limits, monitor session usage, and revoke unexpected activity. Your-organization's credit halt is the aggregate fuse.--Flue sessions expose best-effort per-session token attribution; the agent/org-gateway remains their spend-enforcement authority. See [session usage and-limits](/agent-sessions/sessions#usage-and-limits).diff --git a/docs/agent-sessions/messaging.mdx b/docs/agent-sessions/messaging.mdxdeleted file mode 100644index d9d38947..00000000--- a/docs/agent-sessions/messaging.mdx+++ /dev/null@@ -1,66 +0,0 @@-----mode: "wide"-title: "Messaging"-description: "Append user input to a session"------**Steer** appends a user message to a session. Message envelopes are channel-agnostic, so API input and channel input use the same shape. Outbound delivery has its own page: [Webhooks](/agent-sessions/webhooks).--## Steer (inbound)--Send a message to a running or idle session; it wakes and continues with its prior context. Minimal form is just text:--<CodeGroup>--```ts TypeScript SDK-import { connectSession } from "@opencomputer/sdk";--const live = await connectSession({ sessionId, clientToken });-await live.steer("also check the CI config", { idempotencyKey: "msg_01" });-```--```http REST API-POST https://api.opencomputer.dev/v3/sessions/ses_.../messages-Authorization: Bearer $CLIENT_TOKEN-Content-Type: application/json--{- "text": "also check the CI config",- "idempotency_key": "msg_01"-}-```--</CodeGroup>--Pass `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.--## Message input--Steer with `{ text, idempotency_key? }`, or a fuller **envelope** when you need a source or a threading anchor:--```json-{- "envelope": {- "id": "client:abc123",- "source": "client",- "conversation": { "source": "client", "ref": "thread-42" },- "text": "also check the CI config",- "refs": {},- "raw": {}- }-}-```--These fields don't all land in one place — the appended [event](/agent-sessions/events) splits them:--| You send | Lands on the event as |-| --- | --- |-| `text` | `body.text` — the content the agent reads |-| `raw` | `body.raw` — untouched original payload (optional; never interpreted) |-| `id` (or top-level `idempotency_key`) | the idempotency key, deduped **per session** |-| `source`, `conversation`, `refs` | merged into the event's top-level `refs` — opaque routing/threading anchors |-| (the sender) | the event's `actor` — `human` \| `agent` \| `system`, namespaced |--So a `*.message` event's `body` is just `{ text, raw? }` — `source`/`conversation`/`refs` live under the event's top-level `refs`, and the sender under `actor` (not inside `body`). Outbound `agent.message` bodies are likewise `{ text }`.--To deliver a session's output, register a webhook destination. Deliveries carry the full [Event](/agent-sessions/events); see [Webhooks](/agent-sessions/webhooks). The same envelope also underpins [Channels](/agent-sessions/channels) in Labs.diff --git a/docs/agent-sessions/overview.mdx b/docs/agent-sessions/overview.mdxdeleted file mode 100644index 43dc8586..00000000--- a/docs/agent-sessions/overview.mdx+++ /dev/null@@ -1,85 +0,0 @@-----mode: "wide"-title: "Durable Agent Sessions"-description: "Define an agent, then run resumable, steerable sessions"------Create an agent, start a session, stream its event log, steer it with messages, and receive results by webhook.--<Note>Prefer a console? The [dashboard](https://app.opencomputer.dev) does all of this in a UI — create [agents](/agent-sessions/agents) and [credentials](/agent-sessions/credentials), watch and steer sessions live, and inspect webhook deliveries. The API and SDK below are the same surface, scripted.</Note>--## Core behavior--<CardGroup cols={2}>- <Card title="Built-in runtime supervision" icon="heart-pulse">- - Runtime crashes restart automatically- - Idle sessions hibernate and wake on the next message- - Hung runs stop cleanly instead of staying stuck- </Card>- <Card title="Built-in brain / hands sandboxing" icon="shield-halved">- - **Brain**: agent loop. **Hands**: files and commands.- - Untrusted work stays contained in the hands sandbox- - Your model key stays in the [secret store](https://01m3nj5m1bxzfrqggfrk59t95j-site.holocron.so/sandboxes/secrets), never in a sandbox- </Card>- <Card title="Live streaming and steering" icon="radio">- - Stream events directly from the browser with a session token- - Reconnect from any `seq` without gaps- - Send follow-up messages without exposing your org key- </Card>- <Card title="Webhook delivery" icon="paper-plane">- - Deliver user-level events to your webhook- - Signed with [Standard Webhooks](https://www.standardwebhooks.com)- - Retried, dead-lettered, inspectable, and redeliverable- </Card>-</CardGroup>--<Note>[Flue](/agent-sessions/flue) uses the same session, event, steering, and webhook APIs on a different execution substrate. Your compiled Flue app is the runtime, each session gets its own Durable Object, and no Linux sandbox is created unless the app explicitly uses `ocSandbox`.</Note>--## Get started--<Steps>- <Step title="Define an agent">- Create a reusable `{ name, model, prompt, runtime }` from your backend, using `runtime: "claude"` for Anthropic models or `"codex"` for OpenAI models. Run **Managed** (`credential: "managed"`, billed to your OpenComputer credits) or pass your own model key. Built-in runtime deployments support isolated revisions, skills, repo push-to-deploy, and pointer rollback. To deploy your own Flue app instead, use the [Flue guide](/agent-sessions/flue). ([Agents](/agent-sessions/agents))- </Step>- <Step title="Start a session">- Start a session with `{ agent, input }`. The agent starts immediately and returns a browser-safe `client_token`.- </Step>- <Step title="Watch, steer, get notified">- Stream events with `EventSource`, [steer](/agent-sessions/messaging) with the client token, and register a [webhook](/agent-sessions/webhooks) when your backend needs push delivery.- </Step>-</Steps>--## 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 managed runtime adapter commits events while the brain drives the agent loop and acts through the hands sandbox; 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 consumer record. Your app starts sessions, streams events, and steers with messages. Built-in runtimes drive the agent loop through brain and hands sandboxes. Flue executes in its Worker and Durable Object, then projects the same public milestone events. Managed model credentials stay outside both execution substrates.--## When to use sessions--Use sessions for long-running or interactive agents. For a one-shot command, use a [sandbox](https://01m3nj5m1bxzfrqggfrk59t95j-site.holocron.so/sandboxes/overview) directly.--## Next steps--<CardGroup cols={2}>- <Card title="Quickstart" icon="bolt" href="/agent-sessions/quickstart">- Start a session, stream events, and steer it with concise REST examples.- </Card>- <Card title="Events" icon="timeline" href="/agent-sessions/events">- Event shape, visibility levels, cursors, and resume behavior.- </Card>- <Card title="Session lifecycle" icon="book" href="/agent-sessions/sessions">- Statuses, events, results, and limits.- </Card>- <Card title="HTTP invocation" icon="link" href="/agent-sessions/agent-urls">- Invoke an agent from your backend or create a scoped Hook URL for an external system.- </Card>- <Card title="Repos & GitHub" icon="github" href="/agent-sessions/repos">- Private repo checkout with GitHub access kept outside the agent sandbox.- </Card>- <Card title="Example apps" icon="github" href="https://github.com/diggerhq/oc-sessions-demos">- A repo of examples built on this API.- </Card>-</CardGroup>diff --git a/docs/agent-sessions/quickstart.mdx b/docs/agent-sessions/quickstart.mdxdeleted file mode 100644index 79e38b66..00000000--- a/docs/agent-sessions/quickstart.mdx+++ /dev/null@@ -1,246 +0,0 @@-----mode: "wide"-title: "Quickstart"-description: "Start a session, stream it live, and steer it"------This quickstart defines an agent, starts a session, streams its event log, and sends a follow-up message with a scoped client token.--For the finished version, see the [example app](https://github.com/diggerhq/oc-sessions-demos); for every endpoint, the [API / SDK reference](/agent-sessions/api-reference).--<Tip>Want to click through it first? The [dashboard](https://app.opencomputer.dev) creates agents and credentials, then streams and steers the session live — a fast way to see the flow before wiring it into code.</Tip>--## Prerequisites--You need an OpenComputer API key and an Anthropic key:--```bash-OPENCOMPUTER_API_KEY=osb_...-ANTHROPIC_API_KEY=sk-ant-...-```--<Tip>Grab your OpenComputer API key from [app.opencomputer.dev](https://app.opencomputer.dev). Sessions run **Managed** (billed to your OpenComputer credits, no key — the default) or on your own provider key (Anthropic for the default `claude` runtime). This quickstart uses a key; for Managed, drop the `key` and pass `credential: "managed"`.</Tip>--## 1. Create an agent--An agent stores reusable configuration: name, runtime, model, prompt, and model credential.--<CodeGroup>--```ts TypeScript SDK-import { OpenComputer } from "@opencomputer/sdk";--const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! });--const agent = await oc.agents.create({- name: "quickstart-coder",- runtime: "claude",- model: "anthropic/claude-opus-4-8",- prompt: "Work in /workspace. Say progress. Ask only when blocked.",- key: process.env.ANTHROPIC_API_KEY,- limits: { turns: 4, turnSeconds: 600 },-});-```--```http REST API-POST https://api.opencomputer.dev/v3/agents-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{- "name": "quickstart-coder",- "runtime": "claude",- "model": "anthropic/claude-opus-4-8",- "prompt": "Work in /workspace. Say progress. Ask only when blocked.",- "key": "sk-ant-...",- "limits": { "turns": 4, "turn_seconds": 600 }-}-```--</CodeGroup>--Response:--```json-{ "id": "agt_...", "name": "quickstart-coder", "active_revision": { "number": 1 } }-```--<Note>Your model `key` is held in OpenComputer's [secret store](https://01m3nj5m1bxzfrqggfrk59t95j-site.holocron.so/sandboxes/secrets) (encrypted, write-only) and **never enters the sandbox**. The agent runs with a placeholder; an **egress proxy substitutes the real key in-flight** on the outbound model-provider call. Reuse one key across agents via a [credential](/agent-sessions/credentials).</Note>--<Tip>`POST /agents` is idempotent by agent name, so it is fine to call this during application startup.</Tip>--<Tip>Prefer OpenAI? Set `runtime: "codex"` and `model: "openai/gpt-5-codex"` with an OpenAI `key` — every other step in this guide is identical. See [Runtimes](/agent-sessions/runtimes).</Tip>--## 2. Start a session--A session starts work immediately and returns a browser-safe `client_token` for that one session.--<CodeGroup>--```ts TypeScript SDK-const session = await oc.sessions.create({- agent: agent.id,- input: "Create a todo app with local storage and a clean dark UI.",-});--// session.id + session.clientToken — hand the token to your frontend-```--```http REST API-POST https://api.opencomputer.dev/v3/sessions-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{- "agent": "agt_...",- "input": "Create a todo app with local storage and a clean dark UI."-}-```--</CodeGroup>--Response:--```json-{- "session": { "id": "ses_...", "status": "queued", "head": 1 },- "client_token": "eyJ..."-}-```--<Tip>**Working on a repo?** Pass [`sources`](/agent-sessions/repos) to check code out before turn 1 — the GitHub token never enters the sandbox. For a registered repo, `sha` is optional (OpenComputer resolves `ref`→HEAD and pins it):</Tip>--<CodeGroup>--```ts TypeScript SDK-const session = await oc.sessions.create({- agent: agent.id,- input: "Fix the failing test on this branch, then open a PR.",- sources: [{ repo: "acme/web", ref: "main" }],-});-```--```http REST API-POST https://api.opencomputer.dev/v3/sessions-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{- "agent": "agt_...",- "input": "Fix the failing test on this branch, then open a PR.",- "sources": [{ "repo": "acme/web", "ref": "main" }]-}-```--</CodeGroup>--The agent can then open a PR with `github_publish_pull_request` and [watch](/agent-sessions/watches) it — it wakes when checks finish or a reviewer comments.--## 3. Stream events--Use the `client_token` in the browser. Ask for `progress` for a good activity feed, or `internal` for an operator/debug view.--<CodeGroup>--```ts TypeScript SDK-import { connectSession } from "@opencomputer/sdk";--// in your frontend, with the session's client token-const live = await connectSession({ sessionId, clientToken });--for await (const event of live.events({ level: "progress" })) {- render(event); // reconnects from the last seq automatically-}-```--```js EventSource-const url = new URL(`${OC}/v3/sessions/${sessionId}/events`);-url.search = new URLSearchParams({ stream: "sse", level: "progress", token: clientToken });--const events = new EventSource(url.toString());-events.onmessage = (message) => render(JSON.parse(message.data));-```--</CodeGroup>--Each event's `seq` is sent as the SSE `id`, so `EventSource` resumes automatically with `Last-Event-ID` after a dropped connection.--## 4. Render by `type`--Switch on the event `type`. Do not parse prose to decide whether work finished or failed.--```json-[- { "type": "agent.message", "body": { "text": "Done." } },- { "type": "tool.call", "body": { "args_summary": "npm test" } },- { "type": "exec.completed", "body": { "exit_code": 0 } },- { "type": "turn.completed", "body": { "yield_reason": "completed" } }-]-```--Handle `turn.completed.body.yield_reason` explicitly:--| `yield_reason` | UI behavior |-| --- | --- |-| `completed` | Show the final result. |-| `needs_input` | Show the agent's question and enable reply. |-| `deadline_exceeded`, `budget_exceeded`, `max_turns` | Explain which limit stopped the turn. |-| `error`, `canceled` | Show a stopped/error state. |--## 5. Steer the session--Post follow-up messages with the same `client_token`. An idle session wakes and continues with its prior context.--<CodeGroup>--```ts TypeScript SDK-await live.steer("Add a filter for completed tasks.", { idempotencyKey: "msg_01" });-```--```http REST API-POST https://api.opencomputer.dev/v3/sessions/ses_.../messages-Authorization: Bearer $CLIENT_TOKEN-Content-Type: application/json--{- "text": "Add a filter for completed tasks.",- "idempotency_key": "msg_01"-}-```--</CodeGroup>--Response:--```json-{- "event": { "id": "evt_...", "seq": 14 },- "session": { "id": "ses_...", "status": "queued", "head": 14 }-}-```--## Production checklist--- Keep the org API key and your model key server-side.-- Add app auth before minting or returning a `client_token`.-- Set `limits` on the agent or session.-- Use `idempotency_key` for every user action you might retry.-- Use `level=user` for customer-facing chat, `level=progress` for activity feeds, and `level=internal` only for debugging.-- Register a [webhook](/agent-sessions/webhooks) when your backend needs push delivery after the tab closes.--## Next steps--<CardGroup cols={2}>- <Card title="Events" icon="timeline" href="/agent-sessions/events">- Event shape, levels, cursors, and resume behavior.- </Card>- <Card title="Repos & GitHub" icon="github" href="/agent-sessions/repos">- Check out private repositories without putting GitHub tokens in the sandbox.- </Card>- <Card title="Example app" icon="github" href="https://github.com/diggerhq/oc-sessions-demos">- Fork a complete app-builder implementation.- </Card>- <Card title="API reference" icon="code" href="/agent-sessions/api-reference">- Endpoint details and response shapes.- </Card>-</CardGroup>diff --git a/docs/agent-sessions/repos.mdx b/docs/agent-sessions/repos.mdxdeleted file mode 100644index 645fe0f7..00000000--- a/docs/agent-sessions/repos.mdx+++ /dev/null@@ -1,499 +0,0 @@-----title: "Repos & GitHub"-description: "Give sessions private code without giving agents GitHub credentials"------Use Repos when a session needs private code. Giving an agent a GitHub token,-authenticated remote, or `gh` session gives it whatever that token can do; hiding the-token behind a proxy does not narrow that authority.--Repos make GitHub access operation-scoped. A **Repo** is a stable `repo_…` handle-with a current `owner/repo` display name that resolves to your configured GitHub App;-a **Source** pins `ref` and `sha`.-OpenComputer checks out the exact commit in a short-lived **Git operations sandbox**,-copies only files into `/workspace/sources/<name>`, and destroys the token. For writes, the-agent edits files and calls the-[`github_publish_pull_request`](/agent-sessions/runtime-tools#github-tools) runtime tool;-OpenComputer commits and opens the PR outside the agent sandbox with a fresh, write-scoped-token.--The same repository identity also powers [Flue repository deployment](/agent-sessions/flue#deploy-from-github),-but the destination is different. Session sources copy code into a running agent's hands sandbox;-a Flue deployment resolves one production commit, hands tokenless source to a separate build-sandbox, and deploys the resulting artifact. Repository credentials reach neither destination.--<Note>**Preview** — APIs may change before general availability.</Note>--## Concepts--| Concept | Role | Boundary |-| ---------------------- | ------------------------------------------------------ | --------------------------------------------------------------------------------------- |-| GitHub App | Mints operation-scoped GitHub tokens. | Not session refs. |-| Installation | GitHub account and repo selection. | The repos the App may work in. |-| Repo | A stable owner/repo handle. | No tokens, private keys, or session refs. |-| Source | `ref`, `sha`, and local name for one session. | Auth comes from your configured GitHub App (OpenComputer App by default) unless inline. |-| Git operations sandbox | Runs authenticated clone/fetch/publish work. | Separate from the agent; token lives only for one operation. |-| Deployment source | Repository, root, and production branch for one agent. | Resolves one exact commit; source auth is discarded before build code runs. |--<Note>- `Repo` and `Source` are provider-neutral: `provider`, `owner`, `repo`, `ref`,- `sha`. GitHub uses GitHub Apps as its auth surface. Other providers can add- their own auth surface while sessions continue to reference repos and sources- the same way.-</Note>--## Choose working repositories for an agent--An agent's **repository access policy** limits which repositories it may use for-session sources, checkout, and pull-request publishing. It is independent of a-[deployment source](#use-a-repo-to-deploy-a-flue-agent): the deployment source-supplies the agent definition, while working repositories supply code for a-session task.--In guided setup or **Agent → Settings → Repository access**, choose:--- **All granted repositories** — every repository currently granted to the- owner-bound OpenComputer GitHub App, including repositories added later.-- **Only selected repositories** — an explicit set stored by stable `repo_…`- id. An empty set disables repository work without disabling chat.--The effective set is the intersection of that policy and the App installation's-current grant. Removing a repository from GitHub takes effect on the next-checkout or publish. OpenComputer preserves selected ids that are hidden by a-truncated GitHub listing and shows unavailable selections separately instead of-calling them revoked.--Choose a working repository when starting a dashboard session, pass it in-`sources`, or let the running agent call `add_source`. A ref is pinned to one-commit. OpenComputer checks files out into the session sandbox and keeps the-GitHub token in a separate, short-lived Git operations sandbox.--To publish, the agent calls `github_publish_pull_request`. OpenComputer pushes a-new `oc/…` branch and opens a PR; it never writes directly to the default branch.-With `selected` access, the owner-bound OpenComputer App is the only authority.-`all` preserves the existing open behavior, including configured App resolution.--## How it works--Every authenticated Git operation runs in its own **Git operations sandbox** — a minimal-box with `git` and nothing else, provisioned for that one operation and destroyed when it-finishes. Checkout and publish get _different_ boxes. Your agent's own sandboxes — the-**brain** that runs the loop and the **hands** sandbox that holds the files — are never one-of these: they hold no token and never run authenticated `git` or `gh`. Files and patches-move between them through object storage, never next to a credential.--```mermaid-sequenceDiagram- participant Brain as Brain (agent loop)- participant Hands as Hands (agent sandbox)- participant CP as Control plane- participant GitR as Git box (checkout)- participant GitW as Git box (publish)- participant Store as Object storage- participant GH as GitHub-- Note over GitR: Checkout — before the first turn- CP->>GitR: Provision (git only, ephemeral)- CP->>GH: Mint just-in-time token (read-only, one repo)- GH-->>CP: Scoped token- CP->>GitR: Inject token into this box's env only- GitR->>GH: Clone at the pinned sha- GitR->>Store: Write files (tokenless .git, no remote)- Note over GitR: Destroyed- Store->>Hands: Extract into /workspace/sources-- Note over Brain: Reason- Note over Brain: Plan- Brain->>Hands: Read, edit, run commands- Note over Hands: Edit files- Note over Hands: Run tests- Note over Hands: Run tools- Hands-->>Brain: Results- Note over Brain: Decide next step-- Note over GitW: Publish — on github_publish_pull_request- Brain->>CP: github_publish_pull_request(source, title)- CP->>Hands: Diff the edits- Hands->>Store: Write a patch (no token)- CP->>GitW: Provision a separate box (git only)- CP->>GH: Mint just-in-time token (write-scoped, one repo)- GH-->>CP: Scoped token- CP->>GitW: Inject token into this box's env only- GitW->>Store: Read the patch- GitW->>GH: Push an oc/ branch, open the PR- Note over GitW: Destroyed- CP-->>Brain: PR URL-```--**Checkout (read), before the first turn:**--1. OpenComputer provisions a fresh Git operations sandbox for the checkout.-2. The control plane mints a **just-in-time token**: the GitHub App requests an installation- token scoped to that one repo with read-only contents permission, and it is injected into- the sandbox's environment only — never `.git/config`, the command line, or any log.-3. The sandbox clones the exact `sha`, then writes the **files** to dedicated object storage —- with a shallow, **tokenless** `.git` (the token rode in via an in-memory header, never- `.git/config`, and the remote is removed), so no credential travels with the bytes.-4. The sandbox is destroyed; the token dies with it.-5. The **hands** sandbox extracts those bytes into `/workspace/sources/<name>`.--**Publish (write), when the agent calls `github_publish_pull_request`:**--1. The **hands** sandbox turns its edits into a patch and writes it to object storage. The- agent still has no token.-2. OpenComputer provisions a **new** Git operations sandbox and mints a fresh,- **write-scoped** token for that one repo.-3. The sandbox applies the patch on an `oc/<session>/<source>-<id>` branch, pushes, and- opens the PR.-4. The sandbox is destroyed; the token dies with it. The PR URL is returned to the agent.--The token is minted per operation, scoped to a single repo, lives only inside a box that-does nothing but Git, and is gone before the next turn.--## Use a repo to deploy a Flue agent--Choose **Agents → Create agent → Import from GitHub** when the repository is the agent-implementation itself. Repository-first creation recognizes either a complete Flue application or-an explicit prompt-defined Flue root (`agent.toml` + `prompt.md` + optional `skills/`).-The dashboard uses the OpenComputer App to:--1. resolve the selected branch and root at one exact commit without running repository code;-2. explain whether it found a valid Flue app, a Flue app that needs a fix, or no supported agent definition;-3. let you review the Flue entrypoint, model, and independent agent name; and-4. revalidate that reviewed source before creating an undeployed agent and its first deployment.--After import, the dashboard opens guided setup rather than making the deployment log the next task.-Choose **Connect Slack** while the deployment runs in the background. Compact phases remain visible,-the build log expands on demand, and setup promotes **Open Slack** plus the first-message prompt when-both resources are ready. It then watches ordinary session history: before the first message it says-that it is waiting, and after managed Slack creates the session it previews the user message and-agent response with links to the full session and all sessions for that agent. Until then, the agent-page keeps **Continue setup** available.--The picker also shows existing deployment-source claims before it inspects repository content. The-uniqueness boundary is one OpenComputer agent per repository root, not one per whole repository, so a-linked `agents/support` does not block `agents/sales`. Selecting the exact linked root disables review,-names and links the owning agent, and offers an inline confirmed unlink. Unlinking stops deploy-on-push-for the old agent but preserves that agent, its active revision, deployment history, and sessions.--Recognition is deterministic. A root-level `agent.toml` is authoritative: if it is malformed or-unsupported, the result is a fixable error rather than a guess. With `runtime.family = "flue"`,-`prompt.md` selects the prompt-defined profile unless a `package.json` or `flue.config.*` marker-selects the complete-app profile. Without a manifest, Flue configuration or a Flue package-dependency reports the missing manifest. A bare prompt, skills folder, README, or unrelated package-is not converted automatically.--If the selected root is unrecognized, the review can scan the same bounded tree of at most 25,000-entries and return up to 20 candidate roots no more than six folders deep. Results follow fixed-marker precedence, then shallower depth, then repository-relative byte order. Candidates are-suggestions, never an automatic selection; choose one and review it separately. When the result is-truncated, select a narrower root. Candidate roots that are already linked are marked and cannot be-selected until opened or unlinked.--The Git box writes a bounded, digest-checked source archive to object storage and is destroyed.-A different sandbox receives that archive without `.git` or GitHub auth, runs the fixed install and-build commands as an ordinary disposable OpenComputer sandbox, and emits an artifact. The Workers-deployment credential belongs to another trusted service and is never present during source or-build work.--Flue repository deployment supports one selected root: either the prompt-defined shape above or a-self-contained npm root with `agent.toml`, `package.json`, and `package-lock.json`. The initial import-links that root to its production branch; each later push touching the root automatically deploys the-branch's new exact head. Other branches do not create Flue preview deployments. **Deploy latest**-remains available for manually rebuilding the current production head after a transient failure. See-[Flue deployment](/agent-sessions/flue#deploy-from-github) for the full build contract and failure-journey.--The review receipt binds the repository, root, branch, exact commit, detected agent profile, and-relevant files. If any of those change before import, OpenComputer returns a source-changed conflict-and creates nothing. Review the current commit again rather than assuming the old confirmation still-applies.--The source link also remembers the selected Flue profile. Normal changes keep deploying on push, and-a prompt-defined profile may graduate to a complete Flue app. Other profile changes fail before-build while the active revision stays live. Restore the previous definition, or unlink the source-and import it as a new agent. Unlinking stops push-to-deploy; it does not delete or convert the-existing agent, revision, or sessions.--Manage this link from the agent's **Overview → Repository** panel. **Configure GitHub** changes-which repositories the OpenComputer App can access. **Unlink repository** releases this root for a-different agent while preserving the current agent and its history, then offers to review and import-the repository again.--<Note>- The deployment repository is not a session working repository. Importing it- does not mount its files into later sessions or grant the running agent GitHub- access. Choose session [sources](#how-it-works) separately when an agent needs- code to work on.-</Note>--## Connecting GitHub--Pick one. Either way, OpenComputer mints a fresh, repo-scoped token **per operation** (read-only-for checkout, write only to publish) — the agent never holds one.--<CardGroup cols={2}>- <Card- title="Install the OpenComputer App"- icon="github"- href="https://github.com/apps/opencomputerdev/installations/new"- >- Zero setup. Choose the repos and go — OpenComputer owns the key and mints- per operation.- </Card>- <Card- title="Create your own App"- icon="wand-magic-sparkles"- href="#bring-your-own-app"- >- GitHub creates it in a few clicks; OpenComputer federates it, so PRs come- from your identity.- </Card>-</CardGroup>--### Bring your own App--Use your own GitHub App so PRs, comments, and statuses come from **your** identity. OpenComputer-stores the key encrypted and signs the same per-operation tokens with it.--<Note>- [Watches](/agent-sessions/watches) currently require PRs opened through the- **OpenComputer** App — a PR published with a bring-your-own App isn't- watchable yet.-</Note>--**Create one** — `createManifestUrl` returns a link; open it and GitHub walks you through-creating the App, then OpenComputer captures the key and registers it. (Creating an App is a-GitHub-UI flow, so it's a link to open, not a pure API call.)--<CodeGroup>--```ts TypeScript SDK-const { startUrl } = await oc.github.apps.createManifestUrl({- name: "Your Agents",-});-// open startUrl → click "Create" on GitHub → done-```--```http REST API-POST /v3/github/apps/manifest-Authorization: Bearer $OPENCOMPUTER_API_KEY--{ "name": "Your Agents" }-// → { "start_url": "…", "expires_at": "…" } — open start_url in a browser-```--</CodeGroup>--**Already have one** — register it with its App id + private key:--<CodeGroup>--```ts TypeScript SDK-await oc.github.apps.register({- mode: "byo_stored_key",- githubAppId: "123456",- privateKey: pem,-});-```--```http REST API-POST /v3/github/apps-Authorization: Bearer $OPENCOMPUTER_API_KEY--{ "mode": "byo_stored_key", "github_app_id": "123456", "private_key": "-----BEGIN…" }-```--</CodeGroup>--Then **install your App on the repos** and reference them in `sources` as usual. List / rotate /-remove with `oc.github.apps.list()` · `update(id, …)` · `delete(id)`. Building this into your own-product with your own redirect? Use `createManifest` + `completeManifest`. (`byo_broker` can be-registered but isn't used for minting yet.)--### Inline short-lived token--The no-setup path is to pass a real short-lived token inline on the source, using the-deliberately-named `risky_short_lived_token` auth. An inline token is **checkout-only**:-it is used once to check the repo out and then purged, so it **cannot publish or open-PRs**. Publishing requires a configured GitHub App — [install the OpenComputer App](https://github.com/apps/opencomputerdev/installations/new).--<CodeGroup>--```ts TypeScript SDK-sources: [- {- url: "https://github.com/acme/web.git",- ref: "refs/pull/42/head",- sha: "abc123…",- auth: {- type: "risky_short_lived_token",- token: "ghs_…",- expiresAt: "…",- },- },-];-```--```json REST API-"sources": [{- "url": "https://github.com/acme/web.git",- "ref": "refs/pull/42/head",- "sha": "abc123...",- "auth": {- "type": "risky_short_lived_token",- "token": "ghs_...",- "expires_at": "..."- }-}]-```--</CodeGroup>--<Warning>- The inline token is **checkout-only** — it checks the repo out once and is- then purged, so it **cannot publish or open PRs** (publishing requires a- configured GitHub App). It also **can't refresh**, so use it only for sessions- that finish within the token's life. OpenComputer rejects a far-future or- missing expiry and holds the token encrypted only until the first checkout,- then purges it. Use this only when a GitHub App is not configured.-</Warning>--## Register a repo--Once the [OpenComputer GitHub App](https://github.com/apps/opencomputerdev/installations/new)-is installed on a repo, register a repo — optional: any installed repo can-be used in a session directly; a Repo gives you a stable handle to reference.--<CodeGroup>--```ts TypeScript SDK-const repo = await oc.repos.create({- owner: "acme",- repo: "web",-});-```--```http REST API-POST /v3/repos-Authorization: Bearer $OPENCOMPUTER_API_KEY--{ "provider": "github", "owner": "acme", "repo": "web" }-```--</CodeGroup>--Get-or-create, owner-scoped, idempotent by `(provider, owner, repo)`. **No credential is-passed** — auth resolves through your configured GitHub App (the OpenComputer App by default).-(Pinning a repo to a specific App is coming later.)--## Use it in a session--<CodeGroup>--```ts TypeScript SDK-const session = await oc.sessions.create({- agent: agent.id,- input: "Review this pull request.",- sources: [- {- repo: repo.id,- ref: "refs/pull/42/head",- sha: "abc123…",- name: "head",- },- ],-});-// checked out at /workspace/sources/head before the first turn-```--```http REST API-POST /v3/sessions-Authorization: Bearer $OPENCOMPUTER_API_KEY--{- "agent": "agt_...",- "input": "Review this pull request.",- "sources": [{- "repo": "repo_...",- "ref": "refs/pull/42/head",- "sha": "abc123...",- "name": "head"- }]-}-```--```bash CLI-# --source owner/repo[@ref] — repeatable; ref defaults to HEAD (the repo's default branch)-oc session create --agent issue-fixer \- --input "Review this pull request." \- --source acme/agents@refs/pull/42/head-```--</CodeGroup>--- **`ref`** (required) — the fetch ref (a branch or `refs/pull/N/head`); a private SHA- can't be fetched directly.-- **`sha`** — the exact commit, pinned and verified after fetch. **Optional for a- registered repo** (omit it and the control plane resolves `ref`→HEAD and pins that commit- at create); **required for inline sources**.--You can also reference `"owner/repo"` directly instead of a registered id. A session can-list several immutable sources, such as a PR's base and head. On the CLI, repeat-`--source owner/repo[@ref]` for each — a missing `@ref` resolves to the repo's default branch.--## Check source status--The create response includes a sanitized source snapshot. Poll `session.listSources()` for-live materialization status:--```ts-const sources = await session.listSources();--for (const source of sources) {- if (source.status === "auth_required" || source.status === "failed") {- showSourceError(source.errorCode, source.errorMessage);- }-}-```--Common `errorCode` values: `source.auth_required`, `source.auth_ambiguous`,-`source.repo_not_selected`, `source.permission_missing`, `source.sha_mismatch`, and-`source.timeout`.--## What the agent can do--After checkout, the agent works with ordinary files. It can inspect, edit, test, diff, and-make local commits. Anything needing GitHub credentials runs outside the agent sandbox, so-the agent never runs authenticated `git`/`gh` and never sees a token.--To open a pull request, the agent calls the-[`github_publish_pull_request`](/agent-sessions/runtime-tools#github-tools) runtime tool —-it is **not** an SDK method; the agent invokes it from inside the sandbox. It takes the-source's local `name` as `source`, a `title`, and optional `body`, `base` (defaults to the-source's checked-out ref), and `draft`, and returns the PR URL. OpenComputer commits the-agent's edits to an `oc/<session>/<source>-<id>` branch and opens the PR with a-just-in-time, write-scoped token. This requires a **configured GitHub App** — the inline-`risky_short_lived_token` path is checkout-only and **cannot** open PRs.--**More repos mid-session.**-[`add_source(repo, ref, name?)`](/agent-sessions/runtime-tools#github-tools) checks out an-additional Connected-App repo into `/workspace/sources/<name>` after the first turn — same-zero-credential model as the initial checkout.--**React to PR events.** After opening a PR, the agent can-[watch](/agent-sessions/watches) it with `watch_pull_request`; OpenComputer wakes the session-when checks finish, a review or comment lands, or it merges, so the agent can respond (e.g.-push a fix). Own-PR only, Connected-App repos only.--## Guarantees--- **GitHub App-backed tokens are never stored** — OpenComputer obtains short-lived,- repo-scoped tokens just in time and destroys them. None reaches the agent's prompt,- shell, files, env, the event log, or telemetry. (The one exception is inline-token auth,- held encrypted only until the first checkout, then purged.)-- The OpenComputer App's private key lives only in OpenComputer's **control plane**, never- in a sandbox.-- Platform-mediated pushes use an `oc/<session>/…` branch namespace — **no- protected-branch push, no force-push.**-- Submodules and Git LFS are not part of the checkout contract.diff --git a/docs/agent-sessions/revisions.mdx b/docs/agent-sessions/revisions.mdxdeleted file mode 100644index 4c5ad927..00000000--- a/docs/agent-sessions/revisions.mdx+++ /dev/null@@ -1,253 +0,0 @@-----title: "Deployments & revisions"-description: "Deploy and version agent behavior"------For the built-in runtimes, what you deploy is a small directory:--```-my-agent/-├─ agent.toml # name, model, runtime family-├─ prompt.md # the system prompt-├─ skills/ # optional — folders the agent loads when it needs them-└─ runtime/ # optional — a custom runtime image (coming soon)-```--`agent.toml` + `prompt.md` are all a built-in agent needs; `skills/` and `runtime/` are additive. A **deployment** is one attempt to turn source or uploaded behavior into a live agent. A successful attempt creates an immutable [**revision**](#revisions); failed, canceled, superseded, and skipped attempts remain deployment history but do not create one.--<Note>A [Flue](/agent-sessions/flue) deployment packages a compiled Cloudflare app instead. It records revisions in the same API, but currently has one live Worker per agent rather than independently routable revision artifacts. Its staging and rollback behavior is therefore different.</Note>--Built-in runtime behavior can be deployed through the **API/SDK**, the **`oc` CLI**, or a [**repo push**](#deploy-from-a-repo). A Flue app can be imported and built from GitHub in the dashboard, or deployed from a local checkout with `oc agent deploy`.--## Revisions--A **revision** is an immutable, numbered record of one successful deployment. For a built-in runtime, it freezes the `prompt`, `model`, and skills used by new sessions. For Flue, it records the app deployment and Worker version that passed verification. An imported Flue agent begins undeployed, with no active revision; its first successful build and verification creates revision #1.--Revisions are **linear** (the number only goes up) and never rewritten. Built-in runtime sessions keep the revision they started on; only new sessions pick up a change. Flue sessions share the agent's live Worker, so a Worker deployment also changes the code used by existing sessions.--| Field | |-|---|---|-| `number` | Monotonic per agent (`1, 2, 3, …`). |-| `prompt` / `model` | The behavior at deployment time. |-| `skill_bundle_digest` | The skill files (a content-addressed bundle); `null` when there are no skills. |-| `digest` | A content hash of the behavior (used for change detection). |--The agent itself holds only **identity + bindings** (`name`, `runtime`, `credential`, `limits`) plus a pointer to the active revision; `prompt`/`model` are served from that revision.--## Deploy--`POST /agents/:id/deployments` is the common post-creation command. `input.type: "inline"` sends behavior directly (API / CLI / dashboard); `input.type: "github"` deploys an already-linked repo — see [Deploy from a repo](#deploy-from-a-repo). The CLI uses a bounded `source` upload for a local prompt-defined Flue root. Creating a new Flue agent from GitHub uses the atomic [`POST /agents/import`](#import-a-flue-repository) command instead.--An inline payload is the **complete** behavior — omitted fields aren't inherited (`prompt` is required; omitted `skills` means *no skills*).--<CodeGroup>--```ts TypeScript SDK-const deployment = await oc.agents.deployments.create("agt_123", {- input: {- type: "inline",- prompt: "You triage pull requests.",- model: "anthropic/claude-opus-4-8",- skills: [{ path: "triage/SKILL.md", content: "---\nname: triage\ndescription: Triage a PR\n---\nSummarize the diff…" }],- },-});-```--```http REST API-POST https://api.opencomputer.dev/v3/agents/agt_123/deployments-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{- "input": {- "type": "inline",- "prompt": "You triage pull requests.",- "model": "anthropic/claude-opus-4-8",- "skills": [{ "path": "triage/SKILL.md", "content": "---\nname: triage\ndescription: Triage a PR\n---\nSummarize the diff…" }]- }-}-```--```bash CLI-# from a directory holding agent.toml + prompt.md + skills/-oc agent deploy-```--</CodeGroup>--The response is a **deployment**:--```json-{ "deployment": { "id": "dep_…", "state": "ready", "revision_id": "rev_…", "active": true } }-```--Inline deployments finish synchronously (`state: "ready"` with a `revision_id`) for the built-in runtimes. A [Flue](/agent-sessions/flue) deploy returns `state: "verifying"` while the managed deploy runner uploads the agent Worker and waits for two consecutive healthy responses from that exact live Worker. Poll it like an asynchronous deployment (`verifying` to `ready` or `failed`). Repository deployments start at `accepted`; poll `GET /agents/:id/deployments/:deployment_id` and its durable log until terminal.--### Staging vs activating--<Warning>Isolated staging is not available for Flue. A Flue upload changes the one live Worker even when deployment metadata requests `activate: false`. Do not use `--no-activate` as a Flue canary. See [Flue deployment behavior](/agent-sessions/flue#deployment-and-revision-behavior).</Warning>--By default a ready deployment is **activated** — its revision becomes what new sessions use. Pass **`activate: false`** to **stage** instead: the revision is created but not made active.--```ts-// Stage a revision (not activated).-const { deployment } = await oc.agents.deployments.create("agt_123", { input: { type: "inline", prompt: "…" }, activate: false });--// After reviewing it, promote it to make it active.-await oc.agents.revisions.activate("agt_123", deployment.revision_id);-```--A session always starts on the agent's active revision. A staged built-in revision cannot be invoked directly today; activate it when you are ready for new sessions to use it.--For built-in [repo deployments](#deploy-from-a-repo), the **branch decides** and `activate` is ignored:-a push to the production branch activates, while another branch stages. Flue repository deployment-accepts only its linked production branch because the current runtime has one live Worker and no-isolated preview Worker.--<Tip>Editing `prompt`/`model` via [`PATCH /agents/:id`](/agent-sessions/agents) also deploys a revision — a shorthand for small edits.</Tip>--## Deploy from a repo--### Import a Flue repository--Choose **Agents → Create agent → Import from GitHub** in the dashboard. OpenComputer inspects the-selected branch and root without executing code, then creates the agent, source link, and first-deployment as one retry-safe command. The OpenComputer agent's editable display name is separate-from `agent.toml.name`, which identifies the exported Flue entrypoint inside the built app.--The managed path is deliberately narrow: one self-contained npm root, a committed-`package-lock.json`, a compatible `engines.node`, and a local `@flue/cli` dependency. OpenComputer-fetches the exact commit with a repository-scoped GitHub App token in a source sandbox, removes Git-metadata and auth, then runs `npm ci` and the offline builder in a separate tokenless sandbox. npm-lifecycle scripts do run in that ordinary disposable OpenComputer sandbox, but its request carries-no source, platform, model, or deployment credential.--The deployment detail page keeps one persisted chronological log and summarizes the attempt as-**Prepare**, **Build**, and **Deploy**. An install/build failure leaves the imported agent visible-and undeployed; it creates no revision and cannot start a session. Fix the source and push the-production branch again.--<Note>Each later push that touches the linked root on the production branch automatically creates a Flue deployment. Non-production pushes do not create preview/staged Flue Workers. **Deploy latest** manually rebuilds the current production head when needed.</Note>--### Link a built-in agent directory--Keep the agent directory (above) in Git and **push to deploy**. [Install the OpenComputer GitHub App](/agent-sessions/repos#connecting-github) on the repo, then connect it to an agent:--<CodeGroup>--```ts TypeScript SDK-await oc.agents.deploymentSource.link("agt_123", { repo: "acme/agents", path: "issue-fixer", productionRef: "main" });-```--```http REST API-POST https://api.opencomputer.dev/v3/agents/agt_123/deployment-source-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{ "repo": "acme/agents", "path": "issue-fixer", "production_ref": "main" }-```--```bash CLI-oc agent link acme/agents --path issue-fixer --branch main-```--</CodeGroup>--Linking deploys the current `main` HEAD right away (`deploy_now: false` / `--no-deploy` to skip). Then every push that touches the directory deploys:--- push to **`main`** (production) → a new revision, **activated**.-- push to **another branch** → a revision **staged** (review, then [promote](#roll-back-and-promote)).-- a push not touching the directory → **no-op**; identical directory content → **skipped** (no churn).--OpenComputer posts a **commit status** (queued → ready / failed) so a deployment's result shows in GitHub.--For built-in behavior, your **GitHub token never reaches the agent's sandbox** — OpenComputer pulls only the linked directory at the exact commit in an isolated worker, and no repository code runs. A managed Flue build uses the same short-lived source-token boundary, then runs repository code only after the tokenless handoff described above.--## Deploy from your machine--No repo needed — the CLI bundles a local agent directory and deploys it:--```bash CLI-oc agent deploy # deploy ./ (the agent named in agent.toml)-oc agent deploy ./agents/issue-fixer # a specific directory-oc agent deploy --no-activate # stage a built-in runtime revision-```--Same as a repo push — handy for CI that isn't GitHub, or trying a change before you commit.--### Flue framework agents--A prompt-defined [Flue](/agent-sessions/flue) agent contains `agent.toml`,-`prompt.md`, and optional `skills/`. The CLI uploads those bounded files and-waits while OpenComputer synthesizes and builds the app in the isolated managed-builder:--```bash CLI-oc agent deploy # upload source, managed build, verify live Worker-```--A complete Flue app instead carries its behavior in code. The CLI runs its-locally installed framework build and uploads the generated modules:--```bash CLI-oc agent deploy # flue build --target cloudflare, upload, verify live Worker-```--Both paths create the agent from `agent.toml` when needed and wait for the exact-live Worker to become stable. See [Run Flue agents](/agent-sessions/flue) for-the two source shapes and current deployment constraints.--## Roll back and promote--Rollback and promote are the **same primitive** — set the active revision. Re-activate any earlier revision (rollback) or a staged one (promote):--<CodeGroup>--```ts TypeScript SDK-await oc.agents.revisions.activate("agt_123", 3);-```--```http REST API-POST https://api.opencomputer.dev/v3/agents/agt_123/revisions/3/activate-Authorization: Bearer $OPENCOMPUTER_API_KEY-```--```bash CLI-oc agent rollback 3-```--</CodeGroup>--Instant — no rebuild. Running sessions are unaffected; new sessions use the newly-active revision.--<Warning>The pointer-only rollback above applies to the built-in runtimes. It does not replace a Flue agent's live Worker bytes. To restore a Flue build, check out the known-good source and run `oc agent deploy` again. Do not downgrade across an incompatible Flue Durable Object schema version.</Warning>--## Inspect--```http REST API-GET /v3/agents/agt_123/deployments?limit=50 # deployment history + opaque next_cursor-GET /v3/agents/agt_123/deployments/dep_123 # one attempt, timing, source, build, result-GET /v3/agents/agt_123/deployments/dep_123/logs # durable chunks; resume with ?after=<cursor>-GET /v3/agents/agt_123/revisions # revision history (newest first; active flagged)-GET /v3/agents/agt_123/revisions/5 # one revision + its skill file manifest-GET /v3/agents/agt_123/activations # active-pointer audit log-```--`GET /agents/:id` also includes an `active_revision` summary (`id`, `number`, `digest`).--## Skills--Skills — reusable instruction folders the agent loads when relevant — are **part of a revision**, so they're deployed, versioned, and rolled back exactly like the prompt and model. Include them inline in a deployment (`skills:[…]`, above), upload a `.zip` (`PUT …/skills`), or ship a `skills/` directory [from a repo](#deploy-from-a-repo).--See the **[Skills](/agent-sessions/skills)** page for the `SKILL.md` format, how skills are invoked, all three ways to add them, and limits.--## Not yet supported--These are **coming soon** — a deployment that includes them is rejected today:-- **MCP servers** (`mcp.json`)-- **Custom runtimes** (a `runtime/` directory)-- **Skills on `codex` agents** — skills are `claude`-runtime only for now--## Dashboard--The agent page in the [dashboard](https://app.opencomputer.dev) keeps **Deployments** as the operational attempt history and **Revisions** as successful immutable results. Repository deployment detail includes its exact commit, phase, timing, build metadata, safe error summary, and persisted log.diff --git a/docs/agent-sessions/runtime-tools.mdx b/docs/agent-sessions/runtime-tools.mdxdeleted file mode 100644index 8f97ec6f..00000000--- a/docs/agent-sessions/runtime-tools.mdx+++ /dev/null@@ -1,125 +0,0 @@-----mode: "wide"-title: "Runtime tools"-description: "The tools a runtime can use — what to rely on when you write prompts"------When you write a prompt for a built-in [runtime](/agent-sessions/runtimes) (`claude` or `codex`), it's useful to know exactly what the agent can do. Both runtimes act through the same fixed set of tools against the session's **sandbox** — the agent has no direct filesystem, shell, or network of its own. A hosted [Flue](/agent-sessions/flue) app defines its own tool surface; OpenComputer adds exactly `list_working_repos`, `add_source`, and `github_publish_pull_request` for repository work.--## Sandbox tools--| Tool | What it does |-| ------- | ----------------------------------- |-| `bash` | Run a shell command in the sandbox. |-| `read` | Read a file from the sandbox. |-| `write` | Write a file to the sandbox. |-| `ls` | List a directory in the sandbox. |--`bash` is the only place commands run. Each call is a fresh shell, so use absolute paths or `cd /workspace && ...`. A run surfaces as an [`exec.completed`](/agent-sessions/events#event-shape) event (`{ command, exit_code, summary }`), with large output available via `content_ref`.--To work on a **public** repo, the agent `git clone`s it via `bash` — the sandbox has open outbound internet (below). For **private** repos, register a [Repo](/agent-sessions/repos) and reference it in the session's `sources`: it's checked out before the first turn and the GitHub credential never enters the sandbox.--<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.-</Note>--## User-facing tools--| Tool | What it does |-| ----- | ---------------------------------- |-| `say` | Emit a `user`-level message. |-| `ask` | Ask a question and pause the turn. |--The agent's final `say` is the session result. `ask` ends the turn with `yield_reason: "needs_input"`; answer by [steering](/agent-sessions/messaging) a reply, which wakes the session.--## GitHub tools--| Tool | Availability | What it does |-| ----------------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |-| `list_working_repos` | Hosted Flue | List the repositories currently effective under the agent's policy and GitHub grant. |-| `github_publish_pull_request` | Built-in + hosted Flue | Open a pull request from a checked-out [Repo](/agent-sessions/repos) source. |-| `add_source` | Built-in + hosted Flue | Check out an additional repo into `/workspace/sources/<name>` mid-session. |-| `watch_pull_request` | Built-in | Subscribe to events on a PR the session opened — the session is woken when checks finish, a review or comment lands, or it merges. |-| `unwatch_pull_request` | Built-in | Stop watching a PR. |--`list_working_repos()` is the hosted Flue discovery surface. It returns exact-stable ids, current `owner/repo` names, and default branches; the model chooses-from that structured result instead of relying on repository names embedded in-a prompt.--`github_publish_pull_request` lets the agent open a PR **without ever holding a GitHub-credential**. The agent edits files in `/workspace/sources/<source>` and makes local-commits as usual; calling the tool hands the requested outcome to the platform, which-commits the agent's edits to an `oc/<session>/<source>-<id>` branch and opens the PR with a-just-in-time, write-scoped token — outside the agent sandbox. It returns the PR URL.--| Argument | Required | What it is |-| -------- | ------------------------ | --------------------------------------------------------------------------------------------------------------- |-| `source` | yes | The checked-out source's local name (its directory under `/workspace/sources`). |-| `title` | yes | PR title. |-| `body` | no | PR description. |-| `base` | built-in: no · Flue: yes | PR base branch. Built-in runtimes default to the checked-out ref; hosted Flue requires the exact target branch. |-| `draft` | no | Open the PR as a draft. |--Hosted Flue uses an object input:-`github_publish_pull_request({ source, title, body?, base, draft? })`. `base` is-required. Built-in runtimes keep their existing tool input and may omit `base`.--<Note>- `github_publish_pull_request` requires a **configured GitHub App** (the- OpenComputer App or a [bring-your-own- App](/agent-sessions/repos#bring-your-own-app)). It does **not** work with- inline (`risky_short_lived_token`) auth, which is **checkout-only** — see- [Repos & GitHub](/agent-sessions/repos#inline-short-lived-token). Built-in- sessions may resolve through the configured OpenComputer or bring-your-own- App. Hosted Flue repository tools always use the agent owner's OpenComputer- App; they never fall back to a bring-your-own App.-</Note>--`add_source` checks out an **additional** repo into-`/workspace/sources/<name>` mid-session. Built-in runtimes use-`add_source(repo, ref, name?)`. Hosted Flue uses the object input-`add_source({ repository, ref, name? })`. `repo`/`repository` is exact-`"owner/repo"` coordinates (or a `repo_…` id), `ref` is a branch, tag, commit,-or `refs/pull/N/head`, and `name` defaults to the repo name. The Git operations-sandbox mints a just-in-time read token; the agent never sees it.-**Connected-App (`oc_app`) repos only.**--For Flue, `repository` must be within the agent's current-[repository access policy](/agent-sessions/repos#choose-working-repositories-for-a-flue-agent).-Checkout is lazy and uses the session's shared hands sandbox. Publishing always-creates an `oc/…` branch and pull request; it never pushes directly to the-default branch.--`watch_pull_request(wake_on?, repo?, pr?, intent?)` subscribes the session to a PR it opened;-OpenComputer wakes the session when the wake condition is met. It does **not** block — call it,-then finish the turn.--| Argument | Required | What it is |-| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------- |-| `wake_on` | no | The wake condition: `checks` (default), `review` (a review decision), `comment` (a new comment), `merge` (merged/closed). |-| `repo` | no | The watched repo. Defaults to the most recent PR the session opened. |-| `pr` | no | The PR number. Defaults with `repo`. |-| `intent` | no | Freeform note (the _why_), replayed on wake. |--Watches cover PRs the **same session** opened, on **Connected-App (`oc_app`) repos only**.-`unwatch_pull_request(repo?, pr?)` stops watching; both args default to the session's only-active watch. Full flow, statuses, and delivered events: [Watches](/agent-sessions/watches).--## External systems--These tools never hand the agent raw credentials for GitHub, Slack, Jira, or other external-systems — the agent opens PRs through `github_publish_pull_request` above (platform-mediated,-no token in the sandbox), and other actions go through the platform too. To move a session's-output into your product, register a [webhook destination](/agent-sessions/webhooks) and-handle the delivered events in your backend.--## Prompt guidance--- Tell the agent to do all work in the sandbox via `bash`/`read`/`write` — it can't touch your machine.-- **Public repo:** include the URL + branch/commit in the task text and have the agent `git clone` it with `bash`. **Private repo:** register a [Repo](/agent-sessions/repos) and list it in the session's `sources` — checked out before the first turn, no credential in the sandbox.-- **Opening a PR:** have the agent edit a source under `/workspace/sources/<name>` and call `github_publish_pull_request` with that `source` and a `title` — the platform commits and opens the PR (requires a configured GitHub App; inline tokens are checkout-only).-- Have it `say` a clear final result — that's what `GET /sessions/:id/result` returns.-- Have it `ask` only when it genuinely needs a decision; otherwise it should proceed.diff --git a/docs/agent-sessions/runtimes.mdx b/docs/agent-sessions/runtimes.mdxdeleted file mode 100644index 7c8fb6a3..00000000--- a/docs/agent-sessions/runtimes.mdx+++ /dev/null@@ -1,157 +0,0 @@-----mode: "wide"-title: "Runtimes"-description: "Runtime engine selected per agent"------A **runtime** executes the agent loop: provider SDK, model calls, and tool use. You pick one per agent with `runtime`; it defaults to `claude`. The model is separate configuration, so an agent is a runtime, a `provider/model`, and a model source — **Managed** (billed to your OpenComputer credits, no key) or a matching [credential](/agent-sessions/credentials).--| Runtime | Models | Credential |-| --- | --- | --- |-| `claude` | `anthropic/…` (e.g. `anthropic/claude-opus-4-8`) | Managed, or an Anthropic key |-| `codex` | `openai/…` (e.g. `openai/gpt-5-codex`) | Managed, or an OpenAI key |-| `pi` | `anthropic/…` today — the runtime is provider-agnostic by construction; more providers land next | Managed, or an Anthropic key |-| `flue` <sup>experimental</sup> | `anthropic/…` today, declared by your [Flue](/agent-sessions/flue) app | Managed |--For the built-in runtimes, `model` is passed straight through to the provider. The **`provider/` prefix** is validated against the runtime; an unknown provider model fails on the first turn. A [session](/agent-sessions/sessions#model) can override the model for one run. Flue instead declares its model in the app and `agent.toml`, and rejects per-session overrides. Common choices:--- **`claude`:** `anthropic/claude-sonnet-5` (default, balanced), `anthropic/claude-opus-4-8` (most capable), `anthropic/claude-fable-5`, `anthropic/claude-haiku-4-5` (fastest/cheapest).-- **`codex`:** `openai/gpt-5-codex`.-- **`pi`:** the `anthropic/…` catalog above. The runtime itself is provider-agnostic; additional providers are next.-- **`flue`** (experimental): an `anthropic/…` model declared in your app and routed through Managed access. See [Run Flue agents](/agent-sessions/flue).--Sessions, [events](/agent-sessions/events), [steering](/agent-sessions/messaging), and [webhooks](/agent-sessions/webhooks) share the same consumer API across runtimes. Execution, tools, persistence, and recovery depend on the runtime. `runtime` is fixed once the agent exists; to switch engines, create a new agent.--## `claude`--The managed Claude agent loop (Claude Agent SDK / Claude Code). It works in a sandbox through remote tools, streams its steps into the session as events, and runs Claude models on your [Anthropic key](/agent-sessions/credentials).--```http-POST https://api.opencomputer.dev/v3/agents-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{- "name": "reviewer",- "runtime": "claude",- "model": "anthropic/claude-opus-4-8",- "prompt": "Review code in the sandbox. Run tests. Explain risks.",- "key": "sk-ant-..."-}-```--## `codex`--The managed Codex agent loop (OpenAI Codex SDK). It runs OpenAI models on your [OpenAI key](/agent-sessions/credentials), and drives the same sandbox tools and event stream as `claude` — only the engine and the provider change.--```http-POST https://api.opencomputer.dev/v3/agents-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{- "name": "reviewer",- "runtime": "codex",- "model": "anthropic/claude-sonnet-5",- "prompt": "Review code in the sandbox. Run tests. Explain risks.",- "key": "sk-..."-}-```--## `pi`--The [pi](https://github.com/earendil-works/pi) coding agent (MIT). `pi` is provider-independent by design: it drives whatever provider the model's `provider/` prefix names. Today it ships with `anthropic/…` models, on Managed billing or your Anthropic key; additional providers land next. Sandbox tools, the event stream, steering, and recovery are the same as the other built-in runtimes.--```http-POST https://api.opencomputer.dev/v3/agents-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{- "name": "reviewer",- "runtime": "pi",- "model": "anthropic/claude-sonnet-5",- "prompt": "Review code in the sandbox. Run tests. Explain risks.",- "credential": "managed"-}-```--The provider is taken from the model's `provider/` prefix — so as more providers land, switching provider is just a different `model` on the same `pi` agent, not a separate runtime.--## `flue` <sup>experimental</sup>--Unlike the runtimes above, `flue` does not run a platform-provided coding agent. It-runs **your compiled Flue app** as an agent Worker, with one Durable Object-instance holding each session's conversation. OpenComputer durably accepts-input, dispatches turns, routes managed model calls, and projects Flue's-durable updates into the shared event log.--A Flue agent has no Linux sandbox by default. Add `ocSandbox` only when the-agent needs shell or file operations; the first real operation creates it.-This different hosting and recovery model is explained in-[How Flue differs from the built-in runtimes](/agent-sessions/flue#how-flue-differs-from-the-built-in-runtimes).--The runtime, model, and credential have to agree. `claude` needs an `anthropic/…` model and an Anthropic key; `codex` needs an `openai/…` model and an OpenAI key; `pi` runs `anthropic/…` models today and needs an Anthropic key (or Managed). A mismatch is rejected when you create the agent, with a clear error — so a session never starts on a broken pairing. See [model credentials](/agent-sessions/credentials).--## Built-in runtime architecture--The remainder of this page describes `claude`, `codex`, and `pi`. Flue uses the-Worker and Durable Object architecture described on the [Flue page](/agent-sessions/flue).--The model is configuration, not part of the runtime image. The provider is always taken from the model's `provider/` prefix, never from the runtime — a runtime only declares which providers it can drive: `claude` and `pi` drive Anthropic today (`pi` is built to drive any provider — more land next), `codex` drives OpenAI. You choose the exact `provider/model` and key.--A runtime has two components:--- the **brain**, a resident server around the provider's agent SDK;-- the **adapter**, managed by OpenComputer, which connects that brain to the durable session log.--The brain knows the SDK, the model, the prompt, its resumable state directory, and the sandbox tools exposed to it. It does **not** write OpenComputer events directly and does not call the sandbox API itself. The adapter reads new input from the [event log](/agent-sessions/events), sends a bounded turn to the brain, translates the brain's stream into session events, handles fencing/idempotency, and only declares the turn done after committed output is durable.--The built-in runtimes are built this way. See [example runtimes](https://github.com/diggerhq/oc-runtime-examples) for `claude` and `codex` brain servers side by side, and [custom runtimes](/agent-sessions/custom-runtimes) in Labs for the same brain/adapter contract applied to your own runtime implementation.--A runtime also **starts fast**: the engine is prepared ahead of time and baked into the image, so a new or recreated session doesn't wait on a per-session download before its first step.--### Brain and hands--The 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*) exposed to the brain through tools, so commands and file edits stay isolated from the model loop. The brain carries the [sealed model key](/agent-sessions/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.--### Each turn is bounded--A turn is one bounded request from the adapter to the brain:--1. the adapter reads new input from the [event log](/agent-sessions/events);-2. it sends that input, the model, prompt, tool endpoint, and state directory to the brain;-3. the brain drives the provider SDK and acts only through [runtime tools](/agent-sessions/runtime-tools);-4. the adapter commits the brain's stream as session events with stable ids;-5. the turn ends when the brain returns `done`, asks for input, hits a deadline, or crashes.--Across turns the brain keeps provider-specific state under a checkpointed state directory — for example a local Claude journal or a Codex thread id. The durable record is the event log plus that state directory, which the platform checkpoints at each boundary and restores on recovery.--### Pinned per session--When a session starts it pins the runtime and version it began on (alongside the rest of the [agent snapshot](/agent-sessions/agents#session-pinned-config)). `runtime` is fixed at agent creation — to run a different engine, create a new agent. Other agent edits (`model`, `prompt`, `limits`) never affect a running or resumed session: new sessions pick up the change, in-flight ones keep what they started with.--## Built-in supervision and recovery--OpenComputer supervises runtime execution:--- **One writer at a time.** Only one adapter advances a session at any moment; a stale or slow writer is rejected, so the log never forks.-- **The brain is supervised.** If the resident brain crashes or stops answering health checks, it is restarted and the turn is retried from durable state.-- **Hangs are bounded.** A turn has a deadline; a stuck model or tool path ends `deadline_exceeded` instead of staying stuck.-- **A lost machine is restored.** If the brain sandbox is lost, OpenComputer recreates it, restores the checkpointed state directory, and replays from the durable log.-- **A turn that can't start fails cleanly.** If the model key can't be resolved or the runtime image can't start, the turn ends with an **`error` event carrying the reason** and the session returns to idle — it doesn't hang.-- **Safety sweep.** A periodic sweep picks up sessions whose work was missed or left mid-flight.-- **Lifecycle events.** Turn and sandbox transitions are logged, so you can see where a session is and why a turn ended.--### Failure behavior--| Failure | What happens |-| --- | --- |-| Client disconnects | Reconnect from your cursor ([events](/agent-sessions/events)); nothing lost. |-| Session idles | Sandbox hibernates; resumes intact on the next message. |-| Brain **crashes** | Restarted; the turn resumes from committed events and checkpointed state. |-| Brain **hangs** | Bounded by the turn deadline; the turn ends `deadline_exceeded` — steer to continue. |-| Sandbox lost **while idle** | Recreated from the last checkpoint before the next turn. |-| Sandbox lost **mid-turn** | Recreated, restored from checkpointed state, and replayed from the durable log. |--Work since the last committed step may repeat, so **make side effects idempotent** and treat the event log (and delivered webhooks) as the durable record. Recovery resumes from committed steps and checkpointed runtime state, not from arbitrary CPU instruction state. Uncommitted hands-sandbox files are not restored after sandbox loss — commit or push to keep them.diff --git a/docs/agent-sessions/schedules.mdx b/docs/agent-sessions/schedules.mdxdeleted file mode 100644index e6e56154..00000000--- a/docs/agent-sessions/schedules.mdx+++ /dev/null@@ -1,259 +0,0 @@-----mode: "wide"-title: "Schedules"-description: "Run an agent on a cron — each firing starts a new session"------A **schedule** fires an agent on a cron: each firing starts one [session](/agent-sessions/sessions) with a fixed first message, so a recurring job needs no scheduler of your own. The session is ordinary — same runtime, streaming, and [destinations](/agent-sessions/webhooks) as any other.--<Note>**Preview** — APIs may change before general availability.</Note>--Declare schedules in the agent's [`agent.toml`](#agent-toml), or manage them over the [SDK, CLI, or REST](#management-api). They live on the **agent**, not a session.--## How it works--A platform tick runs every minute: it claims schedules whose `next_fire_at` has passed, enacts each, and advances `next_fire_at` to the next occurrence. Enacting starts a session on the agent's **active [revision](/agent-sessions/revisions) at fire time** with `input` as the first message; everything downstream — boot, events, SSE, destinations — is the normal session path.--| Mechanic | Behavior |-| --- | --- |-| **Cron** | 5 fields, 1-minute resolution (a seconds field is rejected). `tz` is an IANA name; omit for UTC. DST follows the cron library — a match in a skipped hour fires at the next real occurrence; a repeated hour fires once. |-| **Attribution** | The first `user.message` carries `actor { kind: "schedule", id, display }`; the session carries `metadata.schedule = { id, run_id, scheduled_for }`. |-| **Idempotency** | One session per slot, keyed `sch_<id>:<slot>`. A tick that crashes and retries converges on the same session. |-| **Overlap** | `skip` (default): if the previous run's session is still `queued`/`running`, record `skipped` and advance. `allow`: fire regardless. |-| **Catch-up** | After downtime, a schedule fires **once** — the run's `scheduled_for` is the slot that was due — then advances past now. It never replays a backlog. |-| **Failure** | Five consecutive scheduled-firing *enactment* failures (missing credential, no credit) → `auto_paused` with `last_error`. Session outcomes never change schedule state; neither do manual fires. |--**Common crons** (`minute hour day-of-month month day-of-week`):--| Cron | Fires |-| --- | --- |-| `*/15 * * * *` | every 15 minutes |-| `0 9 * * 1-5` | 09:00 on weekdays |-| `0 0 * * 0` | Sundays at midnight |-| `0 0 1 * *` | first of the month |--## agent.toml--An agent can carry several schedules — the same behavior on different cadences and inputs — each a `[[schedules]]` entry keyed by a `name` unique to the agent.--```toml-[[schedules]]-name = "docs-sweep"-cron = "0 9 * * 1-5" # weekdays 09:00-tz = "Europe/London" # optional; UTC if omitted-input = "Reconcile docs/ against changes since yesterday; open a draft PR if anything drifted."--[[schedules]]-name = "dep-audit"-cron = "0 0 * * 0" # Sundays 00:00 UTC-input = "Audit dependencies for CVEs; file an issue per finding."-```--`input` is the entire first message and no human is in the loop, so write it as a self-contained instruction.--Each deploy (`git push` or `oc agent deploy`) syncs the table: upsert by `name`, drop schedules no longer declared, preserve `paused`. Omitting the `[[schedules]]` table syncs nothing — existing schedules are left alone.--A schedule is a binding, not behavior: it sits outside the [revision](/agent-sessions/revisions) digest, so editing one doesn't cut a revision and a rollback doesn't touch it.--<Note>For a [repo-linked](/agent-sessions/revisions#deploy-from-a-repo) agent the `agent.toml` owns the schedules — the API and dashboard can pause/resume but reject other edits (`409`), same as `prompt`/`model`.</Note>--## Management API--Org-key authenticated, server-side. Schedules are addressed under the agent.--**Create:**--<CodeGroup>--```ts TypeScript SDK-const schedule = await oc.agents.schedules.create("agt_...", {- name: "morning-docs-sweep",- cron: "0 9 * * 1-5",- tz: "Europe/London", // optional — UTC if omitted- input: "Reconcile docs/ against changes since yesterday; open a draft PR if anything drifted.",- overlap: "skip", // skip (default) · allow-});-// → { id: "sch_...", state: "active", nextFireAt: "2026-07-07T08:00:00Z", ... }-```--```bash oc CLI-oc agent schedule create morning-docs-sweep --agent agt_... \- --cron "0 9 * * 1-5" --tz Europe/London \- --input "Reconcile docs/ against changes since yesterday; open a draft PR if anything drifted."-```--```http REST-POST https://api.opencomputer.dev/v3/agents/agt_.../schedules-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{ "name": "morning-docs-sweep", "cron": "0 9 * * 1-5", "tz": "Europe/London",- "input": "Reconcile docs/ against changes since yesterday; open a draft PR if anything drifted." }-// → 201 { "schedule": { … } }-```--</CodeGroup>--**List and fetch:**--<CodeGroup>--```ts TypeScript SDK-const schedules = await oc.agents.schedules.list("agt_...");-const schedule = await oc.agents.schedules.get("agt_...", "sch_...");-```--```bash oc CLI-oc agent schedules --agent agt_...-oc agent schedule get morning-docs-sweep --agent agt_...-```--```http REST-GET https://api.opencomputer.dev/v3/agents/agt_.../schedules-GET https://api.opencomputer.dev/v3/agents/agt_.../schedules/sch_...-Authorization: Bearer $OPENCOMPUTER_API_KEY-```--</CodeGroup>--**Update, pause, resume.** `PATCH` accepts `cron`, `tz`, `input`, `overlap`, and `paused`. A `cron`/`tz` change recomputes `next_fire_at` from now; resume recomputes from now and resets the failure counter — the paused window never back-fires.--<CodeGroup>--```ts TypeScript SDK-await oc.agents.schedules.update("agt_...", "sch_...", { cron: "0 7 * * *" });-await oc.agents.schedules.update("agt_...", "sch_...", { paused: true }); // pause-await oc.agents.schedules.update("agt_...", "sch_...", { paused: false }); // resume-```--```bash oc CLI-oc agent schedule pause morning-docs-sweep --agent agt_...-oc agent schedule resume morning-docs-sweep --agent agt_...-```--```http REST-PATCH https://api.opencomputer.dev/v3/agents/agt_.../schedules/sch_...-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{ "cron": "0 7 * * *" } // or { "paused": true } / { "paused": false }-```--</CodeGroup>--**Delete** — removes the schedule; run history is retained.--<CodeGroup>--```ts TypeScript SDK-await oc.agents.schedules.delete("agt_...", "sch_...");-```--```bash oc CLI-oc agent schedule delete morning-docs-sweep --agent agt_...-```--```http REST-DELETE https://api.opencomputer.dev/v3/agents/agt_.../schedules/sch_...-Authorization: Bearer $OPENCOMPUTER_API_KEY-// → 204-```--</CodeGroup>--**Fire now** — enacts immediately in any state (paused included) and doesn't advance the cron. The test loop is `create` then `fire`. A failed manual fire returns the run with `outcome: "failed"` and updates `last_error`, but never changes the schedule's state or failure counter.--<CodeGroup>--```ts TypeScript SDK-const run = await oc.agents.schedules.fire("agt_...", "sch_...");-// → { id: "srn_...", outcome: "enacted", sessionId: "ses_..." }-```--```bash oc CLI-oc agent schedule fire morning-docs-sweep --agent agt_...-# prints the ses_… → oc session logs ses_…-```--```http REST-POST https://api.opencomputer.dev/v3/agents/agt_.../schedules/sch_.../fire-Authorization: Bearer $OPENCOMPUTER_API_KEY-// → 201 { "run": { … } }-```--</CodeGroup>--**Runs** — newest-first; each row carries `session_id` to chain into [`GET /sessions/:id`](/agent-sessions/api-reference#sessions).--<CodeGroup>--```ts TypeScript SDK-const { runs, nextCursor } = await oc.agents.schedules.runs("agt_...", "sch_...", { limit: 50 });-```--```bash oc CLI-oc agent schedule runs morning-docs-sweep --agent agt_...-```--```http REST-GET https://api.opencomputer.dev/v3/agents/agt_.../schedules/sch_.../runs?limit=50&cursor=…-Authorization: Bearer $OPENCOMPUTER_API_KEY-// → { "runs": [ … ], "next_cursor": … }-```--</CodeGroup>--## The schedule object--| Field | Notes |-| --- | --- |-| `id` `agent_id` | `sch_…` · the agent whose active revision each run uses |-| `name` | `^[a-z0-9][a-z0-9-]{0,63}$`, unique per agent — the `agent.toml` / CLI handle |-| `cron` `tz?` | 5-field cron · IANA name, or `null` for UTC |-| `input` | first user message of every run (≤ 32 KiB) |-| `overlap` | `skip` (default) · `allow` |-| `state` | `active · paused · auto_paused` |-| `next_fire_at` `last_fired_at?` | next occurrence, UTC (derived) · last fire |-| `consecutive_failures` `last_error?` | in-a-row enactment failures (`≥ 5` → `auto_paused`) · last error, cleared on success |-| `created_at` `updated_at` | timestamps |--### States--| State | Meaning |-| --- | --- |-| `active` | Firing on schedule. |-| `paused` | You paused it; the cron is ignored until resume. |-| `auto_paused` | Five straight enactment failures paused it; `last_error` says why. |--## Runs--Each firing decision appends a `srn_…` run, so the history shows why a slot did or didn't produce a session.--| `outcome` | When |-| --- | --- |-| `enacted` | A session was created — `session_id` is set. |-| `skipped` | The previous run was still going and `overlap` is `skip`. |-| `failed` | Enactment errored; `error` is set. Scheduled firings count toward auto-pause; manual fires don't. |--Fields: `id` (`srn_…`), `scheduled_for?` (the slot; `null` for a manual fire), `fired_at`, `outcome`, `session_id?`, `error?`.--## Limits--- **≤ 20** schedules per agent.-- `input` **≤ 32 KiB**.-- Cron floor **1 minute**.--<Warning>-Scheduled sessions run unattended—set agent [`limits`](/agent-sessions/sessions#usage-and-limits), which every run inherits. On built-in runtimes, `limits.tokens` is an observed inter-turn threshold and may overshoot by one turn; it is not a currency or cross-session spend cap. The current Flue execution path does not enforce the generic session limits.-</Warning>--## Dashboard--The agent's **Schedules** tab lists each schedule with its next fire and state, plus controls (pause/resume, test-fire, edit, delete) and per-schedule run history. The create form takes a cron — with quick presets and a plain-English gloss for common expressions — and a message; schedules created here run in **UTC** (a zone set via the API/CLI still displays). Repo-linked schedules are read-only except pause/resume; `auto_paused` shows the last error.--## Example--1. `agent.toml` declares `[[schedules]] name = "morning-docs-sweep", cron = "0 9 * * 1-5"`. `git push` deploys the agent and the schedule goes `active`.-2. Weekday 09:00 → a session starts on the active revision, first message = `input`, `actor.kind = "schedule"`.-3. The agent reconciles `docs/` and opens a draft PR — an ordinary session on the dashboard and your destinations.-4. Next 09:00, if the prior run is still `running` (`overlap: "skip"`) → the firing records `skipped` and the schedule advances.diff --git a/docs/agent-sessions/sessions.mdx b/docs/agent-sessions/sessions.mdxdeleted file mode 100644index b79b8a0d..00000000--- a/docs/agent-sessions/sessions.mdx+++ /dev/null@@ -1,199 +0,0 @@-----mode: "wide"-title: "Sessions"-description: "Durable, resumable agent execution"------A **session** is an [agent](/agent-sessions/agents) run with an append-only [event log](/agent-sessions/events), a pinned configuration snapshot, and a lifecycle status. The execution substrate depends on the [runtime](/agent-sessions/runtimes): built-in runtimes use managed sandboxes, while [Flue](/agent-sessions/flue) uses a deployed Worker and one Durable Object per session.--<Note>- The [dashboard](https://app.opencomputer.dev) lists your sessions and opens- each with a live event stream you can watch and steer — handy for following or- debugging a run without building UI.-</Note>--## Session flow--1. You create a session from an [agent](/agent-sessions/agents). Built-in runtimes pin the active [revision](/agent-sessions/revisions), including its prompt, model, and skills. Flue records the selected deployment, but all of an agent's Flue sessions execute on its one live Worker; see [Flue deployment behavior](/agent-sessions/flue#deployment-and-revision-behavior).-2. OpenComputer stores the input, allocates a turn, and returns. Runtime execution continues asynchronously. Pass `model` to override a built-in runtime's model for this session; Flue rejects model overrides because its model is part of the deployed app.-3. The runtime appends [events](/agent-sessions/events) as it works. Built-in runtimes execute in managed sandboxes. Flue executes in its Worker and Durable Object, with no sandbox unless the app explicitly uses `ocSandbox`.-4. With nothing left to do, the session becomes **idle**. A [steer](/agent-sessions/messaging) message starts the next ordered turn with the same conversation context.--Pass [`sources`](/agent-sessions/repos) to give a session working repositories. Built-in runtimes prepare them before turn one. Flue keeps the same pinned source contract but materializes a repository lazily, when its app first uses the repository tools.--<Note>- The built-in runtimes restart from checkpointed state, enforce a turn- deadline, and survive sandbox reclaim. Flue relies on Durable Object recovery- and event projection instead; its current limit and recovery differences are- listed on the [Flue page](/agent-sessions/flue#session-behavior).-</Note>--## Lifecycle--| Status | Meaning |-| ---------------- | ------------------------------------------------------------------ |-| `queued` | Scheduled; no turn is running. |-| `running` | A turn is executing. |-| `awaiting_input` | A turn ended asking you a question — steerable; reply to continue. |-| `idle` | No turn running; steerable; runtime state is retained. |-| `failed` | The session errored out. |-| `archived` | Closed; read-only. |--A session also carries `last_turn = { id, state, yield_reason?, result_event_id? }`; the fuller turn record (`started_at`, `completed_at`, `active_seconds`, `usage`, `error`) 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 and the session is now `awaiting_input`), `budget_exceeded`, `deadline_exceeded`, `max_turns`, or `canceled`. Limit outcomes require runtime enforcement; the current Flue path does not enforce the generic session limits below.--## Fetch the result--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:--<CodeGroup>--```ts TypeScript SDK-import { OpenComputer } from "@opencomputer/sdk";--const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! });-const session = await oc.sessions.get("ses_...");-const { lastTurn, result } = await session.result();-```--```http REST API-GET https://api.opencomputer.dev/v3/sessions/ses_.../result-Authorization: Bearer $OPENCOMPUTER_API_KEY-```--</CodeGroup>--Response:--```json-{- "last_turn": {- "id": "trn_...",- "state": "ok",- "yield_reason": "completed",- "result_event_id": "evt_..."- },- "result": {- "type": "agent.message",- "level": "user",- "body": { "text": "Done. I found..." }- }-}-```--<Tip>- **For background jobs, register a [destination](/agent-sessions/webhooks).**- Polling `GET /…/result` ties up a request and doesn't survive your process- restarting. Create the session with `metadata` and a `destination`; handle- `turn.completed` in your webhook, then fetch the result. Reserve `result()`- polling for synchronous or interactive flows.-</Tip>--## Idempotency & routing--Three independent knobs — don't overload one for another:--- **`key`** — _get-or-create_. One session per natural key (e.g. one per PR). A second create with the same `key` returns the same session; reusing a `key` with a **different** request body is rejected (`create key already used with a different request`).-- **`Idempotency-Key`** (header) — _retry-safe create_. Makes a keyless create safe to retry (e.g. on a webhook redelivery) without spawning duplicates.-- **`metadata`** — _routing / app state_. Opaque JSON (≤ 16 KB) echoed back on get/list and **verbatim in webhooks**, so your callback can route to the right record. Never use `key` for routing — that's what `metadata` is for.--## Usage and limits--Terminal turns expose `active_seconds` and normalized `usage`. A reported turn-contains four disjoint token components, their `tokens` sum, and optional-`total_cost_usd`. Missing cost means unknown, not zero. If only some runtime-observations were trustworthy, the turn keeps that lower bound and adds-`complete: false`; a turn with no trustworthy observation returns-`reported: false` instead of inventing a zero.--The session `usage` rollup contains:--```json-{- "active_seconds": 42,- "reported_turns": 2,- "unreported_turns": 0,- "complete": true,- "input_tokens": 8200,- "output_tokens": 640,- "cache_creation_input_tokens": 0,- "cache_read_input_tokens": 1200,- "tokens": 10040,- "total_cost_usd": 0.0231,- "attribution": "exact"-}-```--If `complete` is false, any token or cost total present is a **lower bound**.-Historical sessions created before usage reporting may return an empty object;-clients should show that as unknown. `total_cost_usd` is runtime/provider--reported visibility, not the billing ledger.--Cap a session at create (or default it on the [agent](/agent-sessions/agents))-with `limits: { tokens, turn_seconds, turns }`: an observed token threshold,-per-turn wall-clock limit, and auto-run count. These are runtime limits, not-currency or aggregate spend controls.--On built-in runtimes, `limits.tokens` is evaluated from committed usage before-the next model turn. It does not interrupt an in-flight request and can-overshoot by one turn. `turn_seconds` and the organization's credit halt are-separate controls. A [Hook](/agent-sessions/hooks) starts a fresh session, so-all three limits reset on every accepted Hook POST.--<Warning>- [Flue](/agent-sessions/flue) exposes best-effort per-session usage- attribution; its agent/org gateway remains the spend-enforcement authority.- The generic session limits are not enforced on the current Flue execution- path, so do not use them as its deadline, turn-count, or token safety- boundary.-</Warning>--## Model--A session runs the model pinned in its agent snapshot. Pass `model` at create to run **this one session** on a different model — omit it and the session inherits the agent's model (the default). The override is the same `provider/model` form as the agent's model, and its provider must match the agent's [runtime](/agent-sessions/runtimes) (e.g. `anthropic/…` for a `claude` agent — a mismatched prefix is rejected at create, a model the provider doesn't recognize fails on the [first turn](/agent-sessions/runtimes)). Like the rest of the snapshot it's **pinned for the session's life** — there's no mid-session model switch; start another session to run another model.--Not available for [Flue](/agent-sessions/flue) agents: their model is fixed in the deployed app, so a `model` on a Flue session is rejected.--<CodeGroup>--```ts TypeScript SDK-const session = await oc.sessions.create({- agent: "agt_...",- input: "Summarize the incident channel and draft a postmortem.",- model: "anthropic/claude-sonnet-5", // this session only; omit to use the agent's model-});-```--```http REST API-POST https://api.opencomputer.dev/v3/sessions-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{- "agent": "agt_...",- "input": "Summarize the incident channel and draft a postmortem.",- "model": "anthropic/claude-sonnet-5"-}-```--</CodeGroup>--## Stop a session--`POST /sessions/:id/cancel` **requests** a cooperative stop: the turn ends at its next checkpoint with a `turn.completed` (`yield_reason: "canceled"`), so an in-flight model call may run to its timeout — billing for that turn stops when it actually exits, not the instant you call. `POST /sessions/:id/archive` cancels any active turn, then closes the session read-only.--**`archive` is not delete** — the session's log is retained, just read-only.--For Flue, archive also retains the conversation in the session's Durable Object storage. See-[Flue session behavior](/agent-sessions/flue#session-behavior).--<Note>- When the agent needs input, the turn ends with `yield_reason: "needs_input"`- and the session status becomes `awaiting_input`; reply by- [steering](/agent-sessions/messaging).-</Note>--<Note>- **No cross-session memory.** Each session starts from the agent's prompt +- that session's `input` — a durable log is *session history*, not memory the- agent carries between sessions.-</Note>diff --git a/docs/agent-sessions/skills.mdx b/docs/agent-sessions/skills.mdxdeleted file mode 100644index edfa9eaf..00000000--- a/docs/agent-sessions/skills.mdx+++ /dev/null@@ -1,123 +0,0 @@-----mode: "wide"-title: "Skills"-description: "Reusable instructions an agent loads when it needs them"------A **skill** is a folder of instructions (plus optional helper files) an agent loads **when the task calls for it** — a playbook it reaches for, without bloating every prompt. Skills are the most common way to grow an agent past its base prompt ([the second rung](/agent-sessions/agents#start-simple-add-capability-as-you-go)).--## What a skill is--A folder with a `SKILL.md`:--```-triage/- SKILL.md- checklist.md # optional helper the SKILL.md can reference-```--`SKILL.md` is YAML frontmatter followed by instructions:--```markdown-----name: triage-description: Triage an incoming pull request-----1. Read the diff and the linked issue.-2. Label by area, flag risky changes, run the tests.-3. Summarize in three bullets.-```--- **`name`** + **`description`** are always visible to the agent; the **body** is loaded only when the agent decides the skill is relevant — progressive disclosure that keeps context lean.-- Helper files alongside `SKILL.md` (checklists, scripts, references) are available when the skill runs.--## How it works--When a session starts, the agent's skills are **materialized into its runtime**. The model sees each skill's `name` + `description` and **invokes** one when the task matches, then follows its instructions (and can read its helper files). Skills don't run on their own — the agent uses them like tools.--Skills are part of the agent's [revision](/agent-sessions/revisions): they're versioned, rolled back, and activated together with the prompt and model. Changing skills is a [deployment](/agent-sessions/revisions#deploy).--## Add skills--Three ways. Each is a **[deployment](/agent-sessions/revisions)** that creates a new immutable **revision** (your new skills + the agent's current prompt & model) and activates it — so changing skills is **versioned and instantly [reversible](/agent-sessions/revisions#roll-back-and-promote)**, never a destructive edit.--<Tabs>-<Tab title="Upload a .zip">-One folder per skill (a top-level `skills/` wrapper is fine — it's stripped):--```-triage/- SKILL.md-pr-review/- SKILL.md- checklist.md-```--<CodeGroup>--```bash CLI-# Skills ship as part of a deploy — put them in a skills/ folder:-oc agent deploy ./agent-```--```http REST API-PUT https://api.opencomputer.dev/v3/agents/agt_123/skills-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/zip--<binary .zip>-```--</CodeGroup>--In the [dashboard](https://app.opencomputer.dev), the agent's **Skills** panel uploads the same `.zip`. This is a **deployment**: it creates a new **revision** (keeping the current prompt + model, replacing the skills) and activates it. The previous skills aren't lost — **roll back** anytime by re-activating the earlier revision (one click in the Revisions panel, or `oc agent rollback <n>`).-</Tab>--<Tab title="Inline in a deployment">-Include `skills` in a [deployment](/agent-sessions/revisions#deploy) payload — the complete behavior in one call:--```ts TypeScript SDK-await oc.agents.deployments.create("agt_123", {- input: {- type: "inline",- prompt: "You triage pull requests.",- skills: [{ path: "triage/SKILL.md", content: "---\nname: triage\ndescription: Triage a PR\n---\n…" }],- },-});-```-</Tab>--<Tab title="From a repo / CLI">-Put a `skills/` directory in your agent directory and [deploy from a repo](/agent-sessions/revisions#deploy-from-a-repo) (push to deploy) or `oc agent deploy` from a local checkout:--```-issue-fixer/- agent.toml- prompt.md- skills/- triage/SKILL.md-```--Every push that changes `skills/` deploys a new revision.-</Tab>-</Tabs>--## List & remove--```http REST API-GET /v3/agents/agt_123/skills # enumerated: name, description, files-DELETE /v3/agents/agt_123/skills # remove all skills (deploys a revision with none)-```--`GET` returns each skill with its parsed `name`/`description` and file list — handy for showing what an agent currently knows.--## Authoring tips--- **One skill, one job.** A sharp `description` is what tells the agent *when* to use it.-- Keep `SKILL.md` instructions concrete and ordered; move long reference material into helper files the body points to.-- Skills are instructions, not code — they shape *how* the agent works, using the runtime's own tools.--## Limits & availability--- Up to **64 files**, **256 KiB** total, UTF-8 text, file modes `0644`/`0755`.-- **`claude` runtime only** today; skills on `codex` agents are [coming soon](/agent-sessions/revisions#not-yet-supported).diff --git a/docs/agent-sessions/slack.mdx b/docs/agent-sessions/slack.mdxdeleted file mode 100644index 5e71b69d..00000000--- a/docs/agent-sessions/slack.mdx+++ /dev/null@@ -1,158 +0,0 @@-----mode: "wide"-title: "Slack"-description: "Message an agent from Slack"------Connect an [agent](/agent-sessions/agents) to Slack, then start and continue-[sessions](/agent-sessions/sessions) from direct messages or channel mentions.-OpenComputer records the same session and event history you see in the-dashboard.--## Connect the OpenComputer app--The quickest path uses the OpenComputer-operated Slack app. Creating an agent-opens guided setup; choose **Connect Slack**, approve the workspace-installation, and return to the same setup page. You can also connect or manage-Slack later from the agent overview.--Before sending you to Slack, the dashboard lists any workspace in your account-that already sends messages to another agent. You can open that agent, connect a-different workspace, or disconnect the workspace in place. The confirmation-names the affected agent and explains that new Slack messages stop routing to-it; the agent, existing sessions, and installed OpenComputer app remain. OAuth-still checks the claim again in case another tab connects the workspace after-this preflight.--You can connect Slack while a repository deployment is still running. The-connection remains in place if that deployment fails, but the app cannot run a-message until the agent has a ready deployment. A message sent too early gets a-short deploying response and is not queued. Setup follows deployment progress-without a manual refresh. Wait for it to show **Send your first message** and-**Open Slack**, then send the message again. While setup is unfinished, the-agent page keeps **Continue setup** visible. After Slack creates the first real-session, setup changes automatically from “waiting for a message” to a compact-conversation preview with links to the full session and the agent's session-history.--For Flue agents, setup may also offer working-repository access and a concrete-first task such as opening a pull request. GitHub access is optional: Slack chat-continues to work when repository access is empty or disconnected.--<Warning>- Anyone in the connected Slack workspace who can message the app can use this- agent. Use the shared app for evaluation with an agent whose tools and spend- are appropriately bounded.-</Warning>--<Note>- A workspace can connect the managed app to one agent at a time. Managed Slack- accepts text direct messages and mentions in ordinary workspace channels.- Files and Slack Connect DMs or mentions are not supported yet.-</Note>--The same flow is available over the API:--<CodeGroup>--```ts TypeScript SDK-const authorization = await oc.agents.authorizeManagedSlack(agentId, {- returnDeploymentId: deploymentId, // optional validated return context-});--if ("authorizeUrl" in authorization) {- // Return this from your authenticated server route, then navigate the user's- // browser to it. Never expose the OpenComputer org key to the browser.- return authorization.authorizeUrl;-}-// Otherwise the agent was already connected; `authorization` is its current-// public connection state.--const connection = await oc.agents.getManagedSlack(agentId);-// { mode: "managed", status: "active", workspace, app, openUrl, ... }--const { data: workspaceClaims } = await oc.agents.listManagedSlackConnections();-// [{ workspace, app, agent: { id, name }, status, ... }]--await oc.agents.disconnectManagedSlack(agentId);-```--```http REST API-POST https://api.opencomputer.dev/v3/agents/{agent_id}/slack/managed/authorize-GET https://api.opencomputer.dev/v3/agents/{agent_id}/slack/managed-DELETE https://api.opencomputer.dev/v3/agents/{agent_id}/slack/managed-GET https://api.opencomputer.dev/v3/slack/managed/connections-Authorization: Bearer $OPENCOMPUTER_API_KEY--// optional authorize body-{ "return_deployment_id": "dep_..." }-```--</CodeGroup>--Disconnecting an agent stops its managed Slack routing. It does not uninstall-the shared app from the workspace or remove existing OpenComputer sessions.--## Conversations and sessions--A new root direct message creates a session. Replies in its Slack thread steer-the same session; another root message creates a new one. In a channel, invite-`@OpenComputer` and mention it to start or continue a thread. The app does not-read unmentioned channel messages.--Slack deliveries are signature-verified and deduplicated before they enter the-session. A transient **Working…** status may appear for a direct message or-mention. The final assistant response is posted to the same thread, while-diagnostics and the full event history remain in OpenComputer.--## Use your own Slack app--For a permanent bot identity, connect an app you operate. On the agent page,-choose **Use your own Slack app**, copy the generated manifest into Slack, then-enter the App ID, Signing Secret, and Bot User OAuth Token. Credentials are-write-only and are never returned by the API.--<CodeGroup>--```ts TypeScript SDK-const { manifest, createUrl } = await oc.agents.slackManifest(agentId);--const slack = await oc.agents.connectSlack(agentId, {- appId: "A0…",- signingSecret: "…",- botToken: "xoxb-…",-});--await oc.agents.getSlack(agentId); // public status only-await oc.agents.disconnectSlack(agentId); // purge credentials and stop routing-```--```http REST API-POST https://api.opencomputer.dev/v3/agents/{agent_id}/slack/manifest-POST https://api.opencomputer.dev/v3/agents/{agent_id}/slack-GET https://api.opencomputer.dev/v3/agents/{agent_id}/slack-DELETE https://api.opencomputer.dev/v3/agents/{agent_id}/slack-Authorization: Bearer $OPENCOMPUTER_API_KEY--// finalize body-{ "app_id": "A0…", "signing_secret": "…", "bot_token": "xoxb-…" }-```--</CodeGroup>--The managed and builder-owned apps may overlap while you test the handoff. They-keep separate conversations and sessions. Once your app is working, disconnect-the OpenComputer app explicitly.--## Delivery behavior--- A duplicate Slack event creates at most one agent turn.-- Direct-message thread replies continue their existing session.-- Channel replies require another mention.-- The OpenComputer app replies to a message containing a file with a text-only- notice; resend the content as a text message.-- Responses longer than Slack's message limit include a link to the full- authenticated session in OpenComputer.-- Slack delivery can retry independently of agent execution, so a provider- timeout may rarely produce a duplicate Slack post rather than lose the only- answer.diff --git a/docs/agent-sessions/triggers.mdx b/docs/agent-sessions/triggers.mdxdeleted file mode 100644index 761b9609..00000000--- a/docs/agent-sessions/triggers.mdx+++ /dev/null@@ -1,36 +0,0 @@-----mode: "wide"-title: "Triggers"-description: "Start and resume sessions from external events"------<Note>**Labs preview.** Triggers are not part of the stable Durable Sessions API. For stable API access, use [`POST /sessions`](/agent-sessions/api-reference) to start work and [`POST /messages`](/agent-sessions/messaging) to steer it.</Note>--Triggers let external events start or resume sessions. You declare them on an [agent](/agent-sessions/agents); OpenComputer receives events, de-duplicates them, and routes them to a session.--```toml-[[triggers]]-type = "github"-on = "issue.labeled:agent"-```--- **Sources:** GitHub (issue labeled, PR/issue comment) and Slack `@mention`.-- **Routing:** a routing key groups events into sessions — by default one session per issue; a comment on a PR the agent opened resumes the session that opened it.-- **Who can trigger:** restricted to members of your organization by default, configurable per agent.--To fire an agent on a **cron** rather than an external event, use [Schedules](/agent-sessions/schedules) — a time-based trigger with its own stable API.--## Integrations--Triggers and outbound deliveries run through platform integrations, so the agent holds no-GitHub or Slack tokens. [Installing the OpenComputer GitHub App](https://github.com/apps/opencomputerdev/installations/new) configures GitHub access;-Slack channels use a Slack integration.--## Deliveries--To open or update a draft PR, post a comment, or take another external action, the agent-requests a **delivery** and OpenComputer performs it as the org or as the triggering user,-depending on the configured grant. For generic outbound delivery, use-[webhooks](/agent-sessions/webhooks).--See [Channels](/agent-sessions/channels) for the two-way conversation model and [Workspaces](/agent-sessions/workspaces) for the repo a triggered session works in.diff --git a/docs/agent-sessions/watches.mdx b/docs/agent-sessions/watches.mdxdeleted file mode 100644index 77a6526e..00000000--- a/docs/agent-sessions/watches.mdx+++ /dev/null@@ -1,188 +0,0 @@-----mode: "wide"-title: "Watches"-description: "Wake a session when a PR it opened gets checks, reviews, comments, or merges"------A **watch** wakes a session when a PR it opened changes. The agent opens a PR, declares a watch, and ends the turn; when checks finish, a review or comment lands, or the PR merges, OpenComputer appends a normalized event and wakes the session to react. This is the open-a-PR-then-respond-to-CI loop without polling GitHub.--<Note>**Preview** — APIs may change before general availability.</Note>--Declare a watch from inside the sandbox with the [`watch_pull_request`](/agent-sessions/runtime-tools#github-tools) runtime tool, or from your backend with the REST endpoints [below](#management-api).--## How it works--Declaring a watch doesn't change session state — the session goes **idle** after the turn like any other. On a PR transition, OpenComputer appends an event and wakes the session, the same path as a [steer](/agent-sessions/messaging).--- **Authoritative re-read.** A webhook is a hint. Before waking, OpenComputer re-reads PR state from GitHub and wakes with that snapshot, so late, duplicate, or out-of-order webhooks converge.-- **Coalesced.** One wake per transition — a burst of check events for a commit is a single `checks_completed` wake.-- **Loop-suppressed.** The session's own comments and pushes don't wake it; only third-party changes do.-- **Delivered as `user` events.** The event is appended at level `user` (`source: "github"`) and the session resumes with prior context.--<Warning>-A watch lets the agent react; it doesn't grant a GitHub write path. There is no comment-write tool — the agent reads the event and responds by [pushing a fix](/agent-sessions/repos#what-the-agent-can-do) to the branch or opening a follow-up PR. It cannot post a reply comment to GitHub.-</Warning>--## What you can watch--A session can only watch a PR it opened itself via [`github_publish_pull_request`](/agent-sessions/runtime-tools#github-tools). The PR must have been opened through the **OpenComputer GitHub App** (`oc_app` sources) — that App's webhook and read token are what drive the watch. Inline `risky_short_lived_token` sources aren't watchable (the token is checkout-only and purged).--<Note>-**Owner-side prerequisite.** The OpenComputer GitHub App needs **Pull requests: Read**, **Checks: Read**, and **Issues: Read**, plus event subscriptions to **`pull_request`**, **`pull_request_review`**, **`pull_request_review_comment`**, **`check_suite`**, **`check_run`**, and **`issue_comment`**. Existing installs must **re-accept the new permissions**. Until they do, a watch is created but declares as `auth_required` and won't deliver events.-</Note>--## Wake conditions--`wake_on` is the **wake condition** — the PR state change that wakes the session. It's *what* the watch waits for; the *why* is [`intent`](#intent-why), replayed on wake.--| `wake_on` | Wakes when |-| --- | --- |-| `checks` | GitHub **check runs/suites** for the head commit finish (**default**). Legacy commit *statuses* aren't watched. |-| `review` | A review **decision** lands — approved or changes-requested (not plain comments). |-| `comment` | A new comment on the PR (review comment or issue comment). |-| `merge` | The PR reaches a terminal state — merged, or closed without merging. |--`events` is **derived** from `wake_on`; it is not part of the create request.--### intent (why)--`intent` is a freeform note — *why* the agent is watching (e.g. "Fix CI if it fails"). It doesn't affect *when* the session wakes; it's replayed back to the agent on wake so it knows what to do.--## Runtime tools--The agent declares and clears watches from inside the sandbox. Full signatures: [Runtime tools](/agent-sessions/runtime-tools#github-tools).--| Tool | What it does |-| --- | --- |-| `watch_pull_request(wake_on?, repo?, pr?, intent?)` | Subscribe to a PR the session opened. Does **not** block — call it, then finish the turn. Defaults to the most recent PR the session opened; `wake_on` defaults to `checks`. `intent` is a freeform note replayed on wake. |-| `unwatch_pull_request(repo?, pr?)` | Stop watching. Defaults to the only active watch. |--## Management API--Manage watches from your backend with the SDK, the `oc` CLI, or REST — authenticated with your **org API key** (server-side). `repo`/`pr` are optional; omitted, they resolve to the PR this session opened.--**Create a watch:**--<CodeGroup>--```ts TypeScript SDK-const session = await oc.sessions.get("ses_...");-const watch = await session.watches.create({- repo: "acme/web", // optional — defaults to the PR this session opened- pr: 42, // optional- wakeOn: "review", // checks (default) · review · comment · merge- intent: "Address review feedback on the auth refactor.",-});-// → { id: "wch_...", status: "active", ... }-```--```bash oc CLI-oc session watch ses_... \- --repo acme/web --pr 42 \- --wake-on review \- --intent "Address review feedback on the auth refactor."-```--```http REST-POST https://api.opencomputer.dev/v3/sessions/ses_.../watches-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{ "type": "github_pr", "repo": "acme/web", "pr": 42,- "wake_on": "review", "intent": "Address review feedback on the auth refactor." }-// → 201 { "watch": { … } }-```--</CodeGroup>--**List watches:**--<CodeGroup>--```ts TypeScript SDK-const watches = await session.watches.list();-```--```bash oc CLI-oc session watches ses_...-```--```http REST-GET https://api.opencomputer.dev/v3/sessions/ses_.../watches-Authorization: Bearer $OPENCOMPUTER_API_KEY-// → { "data": [ { … } ] }-```--</CodeGroup>--**Delete a watch:**--<CodeGroup>--```ts TypeScript SDK-await session.watches.delete("wch_...");-```--```bash oc CLI-oc session unwatch ses_... wch_...-```--```http REST-DELETE https://api.opencomputer.dev/v3/sessions/ses_.../watches/wch_...-Authorization: Bearer $OPENCOMPUTER_API_KEY-// → { "ok": true }-```--</CodeGroup>--## The watch object--| Field | Notes |-| --- | --- |-| `id` | `wch_…` |-| `type` | `github_pr` |-| `repo` `pr` | the watched repo and PR number |-| `wake_on` | the wake condition (table above) |-| `intent?` | freeform note, replayed on wake |-| `status` | lifecycle status (below) |-| `origin` | how it was declared (runtime tool or management API) |-| `last_snapshot_at?` | last authoritative PR re-read |-| `expires_at` | when the 30-day TTL lapses; past this the watch stops firing (status stays `active`) |-| `created_at` | timestamp |--### Statuses--| Status | Meaning |-| --- | --- |-| `active` | Watching; delivering events. |-| `closed` | The PR merged or closed, so the watch ended with it. |-| `revoked` | Removed via `unwatch_pull_request` or `DELETE`. |-| `auth_required` | The App lacks the required permissions or event subscriptions — [re-accept them](#what-you-can-watch). Re-declare the watch once fixed. |--A watch that hits its 30-day TTL simply stops firing (its `expires_at` passes) — re-declare to renew it.--### Delivered events--One event per transition, appended at level `user` with `source: "github"`. The `body` is a normalized summary (a comment event carries author, text, and URL), never the raw webhook.--| `type` | Fires on |-| --- | --- |-| `github.pr.checks_completed` | Check suites for the head commit finished (coalesced). |-| `github.pr.review_submitted` | A review decision was submitted (approved / changes requested). |-| `github.pr.comment` | A comment landed on the PR — issue-style **or** review (diff) comment. |-| `github.pr.merged` | The PR merged. |-| `github.pr.closed` | The PR closed without merging. |--These join the standard session [event types](/agent-sessions/events#event-types) — switch on `type`, don't parse prose.--## Limits--- Max **10** active watches per session.-- **30-day** TTL, and never outlives the PR — the watch ends when the PR closes or merges.--## Example--1. Agent calls `github_publish_pull_request("web", "Refactor auth")` → PR opened on branch `oc/<session>/web-<id>`.-2. Agent calls `watch_pull_request(wake_on: "review", intent: "Address review feedback")`, `say`s, ends the turn. Session goes idle.-3. Reviewer comments. OpenComputer re-reads the PR, appends `github.pr.comment` (author, text, URL) at level `user`, and wakes the session.-4. Agent edits the source and calls `github_publish_pull_request` again to push onto the same branch. Its own push is loop-suppressed. The watch runs until the PR merges or the TTL expires.diff --git a/docs/agent-sessions/webhooks.mdx b/docs/agent-sessions/webhooks.mdxdeleted file mode 100644index 66ecae79..00000000--- a/docs/agent-sessions/webhooks.mdx+++ /dev/null@@ -1,167 +0,0 @@-----mode: "wide"-title: "Webhooks"-description: "Deliver session events to your backend"------Register a **destination** to receive a session's [events](/agent-sessions/events) as a **delivery envelope**. Deliveries are at-least-once, signed when a secret is set, and retried. The envelope carries routing fields, session [`metadata`](/agent-sessions/api-reference#sessions), and the full event under `event`:--<Note>- Webhooks send your agent's events **to your application**. To send external- events **to an agent**, use an inbound [Hook URL](/agent-sessions/hooks).-</Note>--```json-{- "type": "turn.completed", // the event type (route on this)- "sessionId": "ses_…",- "eventId": "evt_…", // == webhook-id (dedupe on it)- "metadata": { "owner": "acme", "repo": "widgets", "pullNumber": 42 },- "event": { "id": "evt_…", "seq": 12, "type": "turn.completed",- "level": "user", "actor": {…}, "body": {…}, "ts": "…" }-}-```--`event` is the full [Event](/agent-sessions/events) — the same shape the [SSE stream](/agent-sessions/events) emits (the SSE stream delivers that bare Event; webhooks wrap it in this envelope). `metadata` is the opaque routing state you set at [create](/agent-sessions/api-reference#sessions), delivered **verbatim on every send and redelivery** (so a handler can route the callback without a lookup); it's `null` if unset. (Webhooks carry every event `type` — `turn.completed`, `exec.completed`, messages, … — not just messages.) Filter what you receive to avoid internal runtime detail.--## Destinations--<CodeGroup>--```ts TypeScript SDK-import { OpenComputer } from "@opencomputer/sdk";--const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! });-const session = await oc.sessions.get(sessionId);--await session.destinations.create({- url: "https://your.app/oc-webhook",- secret: "whsec_...",- level: "user",- includeRaw: false,-});-```--```http REST API-POST https://api.opencomputer.dev/v3/sessions/ses_.../destinations-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{- "url": "https://your.app/oc-webhook",- "secret": "whsec_...",- "level": "user",- "include_raw": false-}-```--</CodeGroup>--`level` is the visibility threshold (`user` default, or `progress`); `types` is an optional event-type allow-list (default: all — which **includes the terminal `turn.completed`**); `include_raw: false` strips `body.raw` from the delivered event (the envelope's `event.body.raw`). To get only completions, set `types: ["turn.completed"]`.--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| --- | --- |-| `session.destinations.create(params)` | Register a destination. |-| `session.destinations.list()` | List destinations. |-| `session.destinations.get(did)` | Fetch one. |-| `session.destinations.update(did, params)` | Pause or resume (`enabled`), retune `level`/`types`, or rotate `secret`. |-| `session.destinations.delete(did)` | Remove. |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| --- | --- |-| `POST /sessions/:id/destinations` | Register a destination. |-| `GET /sessions/:id/destinations` | List destinations. |-| `GET /sessions/:id/destinations/:did` | Fetch one. |-| `PATCH /sessions/:id/destinations/:did` | Pause or resume (`enabled`), retune `level`/`types`, or rotate `secret`. |-| `DELETE /sessions/:id/destinations/:did` | Remove. |--</Tab>--</Tabs>--A destination receives events appended **after** it's created. To capture a whole session, pass `webhook` in `POST /v3/sessions` so it's registered before the agent produces output. Destinations are not retroactive.--## Deliveries--Each send is recorded with status, attempts, and the latest response or error.--<Tabs>--<Tab title="TypeScript SDK">--| Call | Purpose |-| --- | --- |-| `session.deliveries.list(opts)` | List deliveries — status, attempts, last response/error. |-| `session.deliveries.get(id)` | One delivery, in detail. |-| `session.deliveries.redeliver(id)` | Re-send any delivery (not just dead-lettered). |--</Tab>--<Tab title="REST API">--| Method · Path | Purpose |-| --- | --- |-| `GET /sessions/:id/deliveries?destination=&status=` | List deliveries — status, attempts, last response/error. |-| `GET /sessions/:id/deliveries/:id` | One delivery, in detail. |-| `POST /sessions/:id/deliveries/:id/redeliver` | Re-send any delivery (not just dead-lettered). |--</Tab>--</Tabs>--A delivery moves `pending → delivering → delivered`, or `failed` (retrying) → `dead_letter` after the max attempts.--```-Delivery = {- id, session, destination, event_id, event_seq, status, attempts,- last_attempt_at, response_code?, error?, created_at, updated_at-}-```--## 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 delivery interrupted after it reached you, or a replayed turn — so **dedupe on `webhook-id`** (it equals the event id).-- **Signed with [Standard Webhooks](https://www.standardwebhooks.com) — when the destination has a `secret`.** Every request carries `webhook-id` and `webhook-timestamp`; if the destination was created with a `secret`, it also carries `webhook-signature` (= `v1,<base64(HMAC-SHA256(secret, "{webhook-id}.{webhook-timestamp}.{rawBody}"))>`). **Set a `secret` to get signed deliveries** — without one, requests are unsigned. Verify against the **raw request body, before parsing it**; `webhook-timestamp` guards replay; your `secret` (`whsec_…`) is write-only — set once, never returned. Plus `X-OC-Delivery-ID` and `X-OC-Session-ID` for correlation.-- A delivery succeeds on HTTP `2xx`.--### Verify a webhook--The SDK ships a verifier — no extra dependency, runs in Node / Cloudflare Workers / browsers — that checks the signature and returns the parsed envelope:--```ts-import { verifyWebhook } from "@opencomputer/sdk";--// rawBody = the RAW request body string, read BEFORE JSON.parse.-// Throws on a missing / expired / invalid signature.-const delivery = await verifyWebhook(rawBody, request.headers, process.env.OC_WEBHOOK_SECRET!);-if (delivery.type === "turn.completed") {- // route on delivery.metadata, then fetch the result-}-```--Or verify with any [Standard Webhooks](https://www.standardwebhooks.com) library directly:--```js-import { Webhook } from "standardwebhooks";--// rawBody = the RAW request body string, read BEFORE JSON.parse-function verify(headers, rawBody, secret) {- // throws on a missing/expired/invalid signature- return new Webhook(secret).verify(rawBody, {- "webhook-id": headers["webhook-id"],- "webhook-timestamp": headers["webhook-timestamp"],- "webhook-signature": headers["webhook-signature"],- });-}-```--<Note>These deliver a **session's** events (turns, messages, results). To react to **sandbox lifecycle** — boot, hibernate, stop, scale — see [Sandbox webhooks](https://01m3nj5m1bxzfrqggfrk59t95j-site.holocron.so/sandboxes/webhooks): the **same** Standard Webhooks `verifyWebhook` helper, but a different header dialect and delivery ownership. Sessions use `webhook-*` headers (where `webhook-id` is the *event id*) with the delivery-row id in `X-OC-Delivery-ID`, and signing is opt-in. Sandbox webhooks are delivered by Svix, always signed, under `svix-*` headers where `svix-id` is the delivery/dedupe id, with per-destination metadata as custom headers.</Note>diff --git a/docs/agent-sessions/workspaces.mdx b/docs/agent-sessions/workspaces.mdxdeleted file mode 100644index 239e1c62..00000000--- a/docs/agent-sessions/workspaces.mdx+++ /dev/null@@ -1,22 +0,0 @@-----mode: "wide"-title: "Workspaces"-description: "Prepared repo environments, rebuilt on push"------<Note>**Labs preview.** Workspaces are not part of the stable Durable Sessions API. A session can already work in its [sandbox](/agent-sessions/runtime-tools); private repos are checked out before the first turn through [Repos & GitHub](/agent-sessions/repos).</Note>--A **workspace** runs clone, install, and build steps ahead of time, then snapshots the result. Sessions can start from the latest successful workspace build instead of rebuilding from scratch.--```bash-oc workspace create web \- --repo github.com/acme/web \- --setup "pnpm i && pnpm build" \- --pool 1-```--- **Recipe.** One or more repos (each at an optional ref), a `setup` step, and an optional `warm` step to heat caches.-- **Builds.** Rebuilt on every push (or on an interval) into an immutable lineage; a session starts from the latest successful build and pins it. `--pool N` keeps machines pre-booted.-- **Resolution.** A session is not bound to a repo — it resolves which to work in from the triggering event, the conversation, an agent default, or by asking. Resolution is lazy and re-resolvable: switch repos mid-session, or open several at once.--Pairs with the scoped, tokenless private-repo access noted in [Runtime tools](/agent-sessions/runtime-tools).diff --git a/docs/background-agents/agents.mdx b/docs/background-agents/agents.mdxdeleted file mode 100644index c653a5b9..00000000--- a/docs/background-agents/agents.mdx+++ /dev/null@@ -1,103 +0,0 @@-----title: "Agents"-description: "From a single prompt to a versioned agent defined as code"------<Note>**Preview** — see the [overview](/background-agents/overview); some-capabilities below are still rolling out.</Note>--An agent is configuration, not compute: what it knows (prompt, skills), what-drives it (runtime, model), what wakes it (triggers), what it may do-(policies), and a connection scoping which repos it acts on. Sessions-reference an agent; the agent itself never runs.--An agent is **not bound to a repo or a workspace**. Its connection defines the-*candidate set* of repos it may act on; each session-[resolves](/background-agents/workspaces#resolution-and-sharing) which one(s) to-work in at runtime — from the trigger, the conversation, an optional `repo`-default on the agent, or by asking. This is why one agent can serve issues in-several repos, or hold a chat where it picks the repo from what you ask.--## Start as a prompt--```bash-oc agent create fixer \- --model anthropic/claude-opus-4-8 \- --prompt "You fix bugs labeled 'agent' in acme/web." \- --trigger github:issue.labeled:agent-```--```bash-curl -X POST https://api.opencomputer.dev/v2/agents \- -H "Authorization: Bearer $OC_API_KEY" \- -d '{- "name": "fixer",- "runtime": { "image": "claude", "model": "anthropic/claude-opus-4-8" },- "prompt": "You fix bugs labeled agent in acme/web.",- "triggers": [{ "type": "github", "on": "issue.labeled:agent" }]- }'-```--## Grow into a repo--When one prompt isn't enough, the agent becomes a directory:--```-my-agent/- opencomputer.toml # name, runtime, model, triggers, policies, connection- prompt.md- skills/- testing.md # conventions the agent loads when relevant- deploys.md- mcp.json # MCP servers the agent may use-```--```bash-oc agent deploy-```--Keep it in git, review changes as PRs, deploy from CI. The directory and the-API are two views of the same object; GitHub is not required.--```toml-# opencomputer.toml-name = "fixer"--[runtime]-image = "claude"-model = "anthropic/claude-opus-4-8"--[[triggers]]-type = "github"-on = "issue.labeled:agent"--[policies]-budget.per_session_usd = 5-```--## Versions--Every change — config update, deploy, model switch — is a new immutable-version:--```bash-oc agent versions fixer-oc agent diff fixer v3 v4-oc agent rollback fixer v3-```--Sessions pin the version they started with; updates apply to new sessions-only.--## Policies--- **Deliveries** — draft PRs only by default; protected branches are never- pushed; target repos can be restricted.-- **Actors** — who can trigger work and wake sessions; your organization's- members by default.-- **Budget** — per-session and per-month caps.-- **Models** — restrict allowed providers.-- **Network** — sandbox egress is allowlist-based.--Organization policies are ceilings: an agent can be stricter, not looser.-Policies live in the versioned config, so every change is a visible diff.diff --git a/docs/background-agents/api.mdx b/docs/background-agents/api.mdxdeleted file mode 100644index fb1f245d..00000000--- a/docs/background-agents/api.mdx+++ /dev/null@@ -1,145 +0,0 @@-----title: "API Reference"-description: "The Background Agents REST surface"------<Note>**Preview** — see the [overview](/background-agents/overview); some-endpoints below are still rolling out.</Note>--Base URL `https://api.opencomputer.dev`; authenticate with-`Authorization: Bearer $OC_API_KEY`. The CLI is a wrapper over these calls.--## Agents--```http-POST /v2/agents # create — can be as little as {name, connection, runtime, prompt}-GET /v2/agents # list-GET /v2/agents/:id-PATCH /v2/agents/:id # any config change creates a new version-GET /v2/agents/:id/versions-POST /v2/agents/:id/versions # deploy a bundle (what `oc agent deploy` calls)-```--```json-{- "name": "fixer",- "connection": "github:acme",- "runtime": { "image": "claude", "model": "anthropic/claude-opus-4-8" },- "prompt": "You fix bugs labeled 'agent' in acme/web.",- "triggers": [- { "type": "github", "on": "issue.labeled:agent",- "route": { "key": "issue.{number}", "mode": "reuse" } }- ],- "policies": { "budget": { "per_session_usd": 5 } }-}-```--## Workspaces--Keyed by the repo(s) they prepare, not by agent — a session-[resolves](/background-agents/workspaces#resolution-and-sharing) which repo(s)-to work in (from the trigger, the conversation, a default, or by asking) and-matches a workspace covering that repo and ref.--```http-POST /v2/workspaces # { name, recipe: {repos: [{repo, ref?}], setup[], warm[]}, refresh, pool }-GET /v2/workspaces?repo=&ref= # list / resolve by repo and ref-GET /v2/workspaces/:id # recipe, pool status, latest build-GET /v2/workspaces/:id/builds # immutable lineage-POST /v2/workspaces/:id/builds # build now-```--## Sessions--```http-POST /v2/sessions # { agent, input?, key? } — start explicitly-GET /v2/sessions?agent=&status= # list / filter-GET /v2/sessions/:id # status, pins, sandbox info, usage-PATCH /v2/sessions/:id # { model_override } — this session only, audited-GET /v2/sessions/:id/events # ?after=<cursor>&stream=sse&level=user-POST /v2/sessions/:id/events # raw append (low-level): [{ kind: "message", body: "..." }]-POST /v2/sessions/:id/archive-```--`status` is `active | dormant | awaiting_input | archived` (`awaiting_input` =-the agent emitted an `ask` and yielded).--Session object (abridged):--```json-{- "id": "s_8f2…",- "status": "dormant",- "pins": {- "agent_version": 4,- "workspace_build": 14,- "runtime": "claude@sha256:…",- "model": { "requested": "anthropic/claude-opus-4-8", "served": "anthropic/claude-opus-4-8" }- },- "sandbox": { "state": "hibernated", "preview_urls": [] },- "usage": { "active_seconds": 672, "tokens": { "in": 184211, "out": 9302 }, "usd": 0.47 }-}-```--Event envelope — every event carries a `level`-([visibility class](/background-agents/observability#levels)):--```json-{- "id": "evt_01…",- "ts": "2026-06-12T09:31:04Z",- "actor": "platform",- "kind": "delivery",- "level": "user",- "target": "chan_…",- "body": { "type": "pr.open", "repo": "acme/web", "number": 413, "as": "maria" },- "refs": [{ "type": "github_pr", "number": 413 }]-}-```--Kinds: `message`, `say`, `action`, `ask`, `delivery`, `status`, `timer`,-`exec.completed`, `error`. Levels: `internal | progress | user`, derived at-append from `(actor, kind)` with an optional override. `target` (optional) names-a [channel binding](#messaging) to deliver an event to a specific thread.--## Messaging--The two-way surface a chat UI is built on — send messages in, render the stream-out, bind external threads (see [Channels](/background-agents/channels)):--```http-POST /v2/sessions/:id/messages # a steer (in): { text, actor?, idem_key? }-GET /v2/sessions/:id/messages?after=… # conversation history (replay a UI)-POST /v2/sessions/:id/channels # bind a thread: { provider, thread_ref, role[] }-GET /v2/sessions/:id/channels # list bindings-```--`POST /messages` is the ergonomic steer (one inbound message); `POST /events`-is the low-level raw append underneath it. Channel `role[]` is-`conversation | delivery`.--<Note>**Preview** — `POST /v2/sessions/:id/interrupt` (mid-turn interrupt-steering) is designed but not built in v0. Steers are consumed at the next turn-boundary; see [Sessions](/background-agents/sessions#preview-mid-turn-interrupt).</Note>--## Connections & models--```http-POST /v2/connections # { type: "github" | "github_user" | "slack" | "anthropic" | "openai", ... }-GET /v2/connections-GET /v2/models # aggregated catalog from connected providers-```--The `slack` connection (per-workspace OAuth, token held platform-side) powers-the [Slack channel](/background-agents/channels). In v0 it is-platform-configured for a single workspace; self-serve `oc connect slack` is-Preview.--## Observability--```http-GET /v2/sessions/:id/turns-GET /v2/sessions/:id/turns/:tid/trace-GET /v2/sessions/:id/logs?turn=-GET /v2/sessions/:id/model-calls?turn=-```diff --git a/docs/background-agents/channels.mdx b/docs/background-agents/channels.mdxdeleted file mode 100644index a8ee3716..00000000--- a/docs/background-agents/channels.mdx+++ /dev/null@@ -1,111 +0,0 @@-----title: "Channels"-description: "Two-way conversation — talk to an agent in Slack, watch it work, steer it"------<Note>**Preview** — see the [overview](/background-agents/overview); some-capabilities below are still rolling out. Slack is the first channel and is-live in v0 (single, platform-configured workspace — see [State](#state)).</Note>--A session is not just a record you read after the fact — it is a two-way-thread you can talk to. A **channel** connects that thread to a place people-already work: a Slack thread, a GitHub PR. The same session can be reached-from several places at once; you never have to declare it "a Slack agent" or-"a GitHub agent."--Target experience: *"@agent the build's failing — take a look"* in a Slack-thread. The agent replies in-thread, narrates what it's doing, asks when it-needs a decision, opens a draft PR — and a comment on that PR is just another-message into the **same** session.--## Slack as a channel--A Slack-triggered agent declares one trigger — that is the whole thing. The-agent that declares the Slack trigger *is* the Slack agent:--```toml-# opencomputer.toml-name = "slack-helper"--[runtime]-image = "claude"-model = "anthropic/claude-opus-4-8"--[[triggers]]-type = "slack" # an @mention starts or continues a thread-session-on = "mention"--[connection]-github = "diggerhq" # the repos it may act on (it resolves which from the chat)-```--`@mention` it in a channel and it starts a session bound to that Slack thread;-replies in the thread continue the same session. The agent resolves which repo-to work in from the conversation (see [Workspaces](/background-agents/workspaces#resolution-and-sharing)),-investigates in a sandbox, and opens a draft PR — reporting back in the thread-throughout. The full example is [`slack-helper`](/background-agents/quickstart).--## How it flows--- **Ingress.** Slack delivers the mention/reply to the platform's `/gw/slack`- endpoint; it is verified, de-duplicated by Slack's event id, and appended to- the session's timeline as a **steer** (an inbound message — see- [Conversation](/background-agents/sessions#conversation)).-- **Routing.** A **channel binding** ties the session to the Slack- `channel + thread_ts`. The platform finds the session by that binding (or- creates one), so every later reply lands on the same thread.-- **Projection.** The platform's **outbox** posts the agent's outbound events- back to the thread — durably and idempotently, retrying through any provider- blip. What gets shown is controlled by event- [level](/background-agents/observability#levels): `user` messages and `ask`- questions post as replies; `progress` narration can be coalesced into a- single live "working…" message.--The agent never calls Slack itself. It only appends events; the platform-projects them. The same machinery serves any provider — GitHub is the other-instance of this contract today.--## Bindings are additive — no forced surface--A session has a *set* of bindings, added over its life — never a fixed type:--- A Slack-born session that opens a PR gains a **delivery** binding to that PR;- the PR links back to the same session.-- A session can be surfaced in more than one place — the model does not force a- choice between "Slack" and "GitHub."--Routing follows event level: conversation (`user`/`progress`) goes to-conversation bindings, work product (`delivery`) goes to delivery targets. An-event may name a specific binding to override (e.g. answer on the PR rather-than in Slack).--<Note>**Preview** — a GitHub PR comment flowing back into a chat-born session-as *conversation* is designed but not built in v0: today PR comments wake the-session that opened the PR (delivery), and Slack is the conversation channel.-The binding model above is built so this is a later addition, not a redesign.</Note>--## Build your own surface--Slack is one consumer of a small public API — the same surface a custom UI is-built on (see the [API](/background-agents/api#messaging)):--```http-POST /v2/sessions/:id/messages # send a message in (a steer)-GET /v2/sessions/:id/events?stream=sse&level=user # render the thread out-POST /v2/sessions/:id/channels # bind a thread { provider, thread_ref, role[] }-```--Post messages in, render the event stream at the level you want, optionally-bind a thread so the platform projects for you. Building a chat UI on a session-is an afternoon.--## State--- **v0 (live):** Slack ingress + projection, additive bindings, the outbox,- `ask`/answer, and cheap-visible resilience (kill the sandbox mid-thread and- the conversation resumes, nothing dropped). Single workspace,- **platform-configured** for the demo.-- **Preview / planned:** `oc connect slack` self-serve OAuth and multiple Slack- workspaces; PR-comment-as-conversation into a chat-born session; channels- beyond Slack (Discord, email, web); recovering messages sent while the- platform was down by reconciling against channel history.diff --git a/docs/background-agents/how-it-works.mdx b/docs/background-agents/how-it-works.mdxdeleted file mode 100644index 452bfc12..00000000--- a/docs/background-agents/how-it-works.mdx+++ /dev/null@@ -1,86 +0,0 @@-----title: "How it works"-description: "The moving parts, how they interact, and why they're split this way"------<Note>**Preview** — see the [overview](/background-agents/overview); some-capabilities below are still rolling out.</Note>--<Frame>- <img src="/images/background-agents-architecture.svg" alt="Background Agents architecture: triggers feed a durable session timeline; a disposable runtime reads and appends to it, calls models through the gateway, and acts in a disposable sandbox; deliveries carry results back to GitHub" />-</Frame>--## The moving parts--| Part | What it is | Durability | Responsibility |-|---|---|---|---|-| Session timeline | Append-only event record in the platform | **Durable** — it *is* the session | Holds everything that happened; wakes the runtime when new events arrive |-| Runtime | A VM running the agent loop | Disposable | Read timeline → call model → decide → act. Holds no state, no credentials |-| Model gateway *(Preview)* | Proxy between runtimes and providers | **Durable** (its records) | As designed: applies the configured model per call, holds provider keys, meters tokens, records every request and response as they stream — encrypted, used only to resume the session, never exposed unless capture is opted in. Not built in v0 |-| Sandbox | A VM booted from the workspace's latest build | Disposable (snapshotted periodically) | Where the agent acts: commands, edits, tests. One per session, never shared |-| Connectors & outbox | Platform-side GitHub/Slack integration | **Durable** (delivery state) | Carry events out — open PRs and post comments, project the agent's messages into Slack/PR threads — at-least-once and idempotent, attributed to the requesting user. Also bring inbound messages in as steers |--## How a task flows--1. Someone labels an issue. The trigger event is stored on a session's- timeline (new session, or the existing one for that issue).-2. The platform starts a runtime and attaches the session's sandbox.-3. The runtime reads the timeline from where it left off and calls the- model — through the gateway, which substitutes the configured model and- records the exchange.-4. The agent acts in the sandbox; each action is appended to the timeline- as it happens.-5. To open a PR, the runtime appends a delivery request; a connector- performs it and records the PR number.-6. Nothing left to do: the runtime exits, the sandbox sleeps. The session is- dormant — just the record, no machines; storage only.-7. A comment on the PR routes back to this session (step 5 recorded the PR),- and the cycle repeats with full context.--## Two-way flow--The timeline is a bus in both directions, not just an output log:--- **In.** Any inbound message — a Slack reply, a PR comment, an API call — is a- **steer**: appended to the timeline (de-duplicated by the provider's event id)- and consumed at the next turn. A **channel binding** ties the session to an- external thread (a Slack `thread_ts`, a PR number) so follow-ups land on the- same session. Bindings are additive — a session is never typed by surface.-- **Out.** The agent speaks with `say` (a message) and `ask` (a question that- pauses the turn until answered). The **outbox** projects these — and- deliveries — to the bound channels, at-least-once and idempotent, so a- replayed turn after a crash never double-posts and a provider blip never drops- a message. The agent only appends events; it never calls Slack or GitHub- itself.--See [Channels](/background-agents/channels) and the-[conversation model](/background-agents/sessions#conversation).--## Why it's split this way--Both machines are disposable because no state lives in them — it has already-left by the time it could be lost:--- events are stored as they are produced (step 4);-- the conversation is recorded at the gateway (step 3) — provider APIs carry- the full context on every call, so the latest recorded exchange is the- agent's complete working memory *(gateway recording is Preview; see the- note above)*;-- sandbox files are snapshotted periodically while work is in progress.--What this buys (gateway-dependent points are Preview, not built in v0):--- **Crash-proof.** Kill either machine mid-task and the session resumes where- it was on fresh machines. As designed, even a kill mid-model-call recovers:- the in-flight response is still recorded at the gateway, and not re-billed.-- **Free dormancy.** Waiting detaches both machines; a session can sleep for- months for ~storage cost and wake in seconds.-- **Model switching as configuration.** As designed, the gateway applies- model config on each request — no restart. Within a provider, a change is- effective on the next call; switching providers is effective on the next- turn, when the runtime reconnects. Keys never enter the machines.-- **Risk isolation.** The sandbox runs arbitrary code, so it's per-session- and replaceable; the loop carries neither that risk nor that lifecycle. A- one-hour build in the sandbox doesn't keep a loop machine running.-- **Safe upgrades.** Sessions pin their agent version, workspace build, and- runtime at start; changes apply to new sessions.diff --git a/docs/background-agents/models.mdx b/docs/background-agents/models.mdxdeleted file mode 100644index cbb33c25..00000000--- a/docs/background-agents/models.mdx+++ /dev/null@@ -1,66 +0,0 @@-----title: "Models"-description: "Provider-prefixed IDs, switched as configuration"------<Note>**Preview** — see the [overview](/background-agents/overview); some-capabilities below are still rolling out.</Note>--The model is configuration on the agent — not part of code or a runtime-image. A change takes effect on the next model call — the next turn, when-switching providers; nothing restarts.--<Note>**Preview** — the hot-swap and metering behavior on this page runs through-the model gateway, which is **not enabled in v0** (see the-[overview](/background-agents/overview)). Today the `claude` runtime calls the-provider directly with a configured key; model addressing and per-agent-configuration are real, but live rewrite, cross-provider flips, and gateway-metering are the designed behavior.</Note>--## Addressing--Provider-prefixed, provider-native IDs:--```-anthropic/claude-opus-4-8-openai/gpt-5.x-```--OpenComputer adds no model names of its own. Bare IDs are accepted when-unambiguous.--```bash-oc model list # every model available through your connected providers-```--## Switching--```bash-oc agent update fixer --model openai/gpt-5.x # new agent version-oc session set <id> --model openai/gpt-5.x # one session, in flight-```--Agent-level changes are versions; session-level overrides appear as `status`-events on the timeline; usage records the model that served each call.-Switching to a different provider requires a [runtime](/background-agents/runtimes)-that drives it (the planned `opencode` drives all — Preview).--## Provider keys--```bash-oc connect anthropic --api-key sk-ant-...-oc connect openai --api-key sk-...-```--Bring your own keys per provider, or run **Managed** (billed to your OpenComputer credits) where available.--As designed, keys never enter agent machines: model traffic flows through-OpenComputer's model gateway, which holds the keys, enforces the configured-model, and meters tokens per session. The gateway is a Preview capability —-see the [overview](/background-agents/overview).--## Restricting--Organizations can restrict allowed providers-([policies](/background-agents/agents#policies)); agent data goes only to-providers you allow.diff --git a/docs/background-agents/observability.mdx b/docs/background-agents/observability.mdxdeleted file mode 100644index 2e5a343b..00000000--- a/docs/background-agents/observability.mdx+++ /dev/null@@ -1,98 +0,0 @@-----title: "Observability"-description: "Timeline, turns, model calls, machine output — all correlated"------<Note>**Preview** — see the [overview](/background-agents/overview); some-capabilities below are still rolling out.</Note>--Background agents work unattended; everything they do is recorded and-correlated. From any point on a session's timeline you can drill down to the-model calls and commands behind it.--## Timeline--The durable record: [events](/background-agents/sessions#events) for every-message, action, question, delivery, and error.--```bash-oc session attach <id> # live-oc session events <id> --after <cursor> # history, paginated-```--```bash-curl "https://api.opencomputer.dev/v2/sessions/$ID/events?stream=sse" \- -H "Authorization: Bearer $OC_API_KEY"-```--## Levels--Every event carries a **level** — a visibility class — and the stream carries-**everything**, full fidelity. You filter; the platform never decides for you-what to show your users.--| Level | What | Example |-|---|---|---|-| `internal` | Platform/runtime mechanics, raw tool I/O | `action` (a tool call), model-call marks |-| `progress` | The play-by-play — "watch it work" | agent narration, `status` ("cloned repo", "running tests") |-| `user` | What an end-user sees by default | the agent's `say`, `ask`, and `delivery` ("opened PR #42") |--The stream filters by a **minimum** level — `?level=user` is just the-conversation; `?level=progress` adds narration; `?level=internal` is everything-(the debug view). Default is full fidelity.--```bash-oc session attach <id> --level user-```--```bash-curl "https://api.opencomputer.dev/v2/sessions/$ID/events?stream=sse&level=progress" \- -H "Authorization: Bearer $OC_API_KEY"-```--This is how a [channel](/background-agents/channels) decides what to surface: a-Slack thread renders `user`/`progress`, a debugging view renders `internal`-too — from the one stream.--## Turns--A turn is one stretch of activity (wake → work → sleep):--```bash-oc session turns <id>-# t_7 2m41s anthropic/claude-opus-4-8 31.2k tok $0.41 yielded: delivered PR #413-oc session trace <id> t_7 # spans: model calls, commands, deliveries, timings-oc session logs <id> --turn t_7 # raw runtime output-oc session model-calls <id> # per call: provider, model served, tokens, latency-```--Command output appears on the timeline as `action` events, truncated inline-with full output downloadable.--## Cost--```bash-oc session get <id> # usage: active_seconds, tokens, usd-```--Metered per session and per turn. Dormant time is absent because it isn't-billed.--## Model traffic privacy--By default, model-call metadata (model, tokens, latency, cost) is recorded;-prompt and response contents are not exposed. Payload capture is opt-in per-agent (`capture_model_io`) and surfaces in `oc session model-calls --full`.--<Note>**Preview** — payload capture runs through the model gateway, which is not-enabled in v0 (see the [overview](/background-agents/overview)). Until then,-only metadata is available; the `capture_model_io` opt-in and `--full` payloads-are the designed behavior.</Note>--## Debugging--1. `oc session attach` — what did it do and say?-2. `oc session trace` — where did time and tokens go?-3. `oc session shell` — open the machine.-4. `oc session state download` — export the working context to reproduce- the run locally in the same harness.diff --git a/docs/background-agents/overview.mdx b/docs/background-agents/overview.mdxdeleted file mode 100644index a3e6155b..00000000--- a/docs/background-agents/overview.mdx+++ /dev/null@@ -1,69 +0,0 @@-----title: "Background Agents"-description: "Event-triggered agents with durable sessions, on managed compute"------<Note>-**Preview.** Background Agents is in active development. This section-describes the product as designed; capabilities are rolling out in stages and-not all are generally available yet. Commands are shown in the target grammar-`oc agent …`; today they ship under the `oc-agents` CLI (e.g. `oc-agents agent-deploy`), because the `oc agent …` namespace currently belongs to-[Hosted Agents](/agent-sessions/overview). The runtime that ships today is-`claude`; the gateway-dependent capabilities (model hot-swap, payload capture)-and prepared workspaces are flagged Preview where they appear.-</Note>--A background agent works unattended: an issue gets labeled, the agent fixes-it in a fresh machine and opens a draft PR. A comment on that PR a day later-wakes the same agent with full context. You pay for the minutes it worked.--Background Agents runs everything around the agent loop: event ingestion,-session state, machine preparation, delivery back to GitHub, metering. The-model — or the entire harness — is a configuration change.--## Concepts--| Concept | What it is |-|---|---|-| [Agent](/background-agents/agents) | Definition: prompt, skills, model, triggers, policies, and a connection. Versioned. Not bound to a repo or workspace; via its connection it acts across many repos. |-| [Session](/background-agents/sessions) | One thread of work: a durable event timeline. Active while working, dormant otherwise; dormant holds no compute. |-| [Workspace](/background-agents/workspaces) | A prepared environment for one or more repos, rebuilt on every push — dependencies installed, build warm. Not tied to an agent. |-| [Trigger](/background-agents/triggers) | GitHub events or a Slack @mention, routed to the right session. |-| [Channel](/background-agents/channels) | A two-way thread the session talks in — Slack today, a GitHub PR. Bindings are additive; a session is never typed by surface. |-| [Connection](/background-agents/triggers#connections) | The GitHub App install, Slack workspace, and model provider keys. |-| [Runtime](/background-agents/runtimes) | The loop that drives a session. Its model is separate configuration. |--## How it works--A session is a durable timeline of events. While there is work, two machines-attach: a **runtime** (the loop) and a **sandbox** (the machine it acts in);-they detach when the work pauses. All state — events, the model-conversation, files — leaves the machines as it is produced, so either can-die at any point and the session resumes where it was. Details:-[How it works](/background-agents/how-it-works).--## Relation to sandboxes--Sessions work inside ordinary [sandboxes](https://01m3nj5m1bxzfrqggfrk59t95j-site.holocron.so/sandboxes/overview), booted from-the workspace's latest build and managed for you. `oc session shell <id>`-opens the actual machine. For full control of the loop and the machine, use-the [Agent SDK](/agent-sessions/overview) instead. [Hosted-Agents](/agent-sessions/overview) remains the surface for chat-style agents on-managed cores and channels; Background Agents is for event-triggered,-unattended work.--## Properties--- Sessions start in seconds, because the workspace rebuilt itself on the- last push.-- Models are addressed `provider/model` and switched with one command —- effective on the next call within a provider, on the next turn across- providers. Bring your own keys, or run Managed (billed to your credits).-- Agents hold no tokens. The platform opens PRs and posts comments on their- behalf, attributed to the requesting user.-- Sessions are two-way. Talk to an agent in a Slack thread, watch it work, and- steer it; it asks when it needs a decision. See- [Channels](/background-agents/channels).--[Quickstart →](/background-agents/quickstart)diff --git a/docs/background-agents/quickstart.mdx b/docs/background-agents/quickstart.mdxdeleted file mode 100644index 36dae9f0..00000000--- a/docs/background-agents/quickstart.mdx+++ /dev/null@@ -1,122 +0,0 @@-----title: "Quickstart"-description: "A working background agent in three commands"------After this page, labeling a GitHub issue `agent` produces a draft PR, and-commenting on that PR wakes the same agent to follow up.--<Note>**Preview** — see the [overview](/background-agents/overview); some steps-below are still rolling out.</Note>--## 1. Connect GitHub--```bash-oc connect github-```--Installs the OpenComputer GitHub App on your org. No app registration,-webhook setup, or secrets. To have PRs open **as you** rather than as the App-on your behalf, also run `oc connect github --as-user`.--## 2. Create a workspace (optional, Preview)--```bash-oc workspace create web \- --repo github.com/acme/web \- --setup "pnpm i && pnpm build"-```--A workspace prepares a repo ahead of time: the first build clones it, runs-setup, and snapshots the result, then rebuilds on every push so sessions-start from a ready machine matching the latest code. `oc workspace builds-web` lists the builds. **In v0 this step is not built yet** — skip it and the-session clones the repo on demand.--## 3. Create the agent--```bash-oc agent create fixer \- --model anthropic/claude-opus-4-8 \- --prompt "You fix bugs labeled 'agent' in acme/web. Keep diffs minimal. Run the affected tests before pushing." \- --trigger github:issue.labeled:agent-```--## Use it--Label an issue `agent`. A session starts within seconds:--```bash-oc session list --agent fixer-oc session attach <session-id> # live events; Ctrl-C detaches, the agent keeps working-```--A draft PR opens, attributed to the person who labeled the issue — as them if-they ran `oc connect github --as-user`, otherwise opened by the App on their-behalf. The session goes dormant; `oc session get <id>` shows `usage.active_seconds` — dormant time-uses no compute.--Comment on the PR: *"also update the changelog."* The session wakes with its-full context, pushes a commit, and sleeps again. The thread persists; a-comment weeks later wakes the same context.--## Change the model--```bash-oc agent update fixer --model openai/gpt-5.x-```--Effective when the agent next wakes — switching providers means the runtime-reconnects; a change within the same provider applies on the very next model-call. Same prompt and triggers. Each change is a new agent-version — `oc agent rollback fixer v1` reverts.--## Or: talk to it in Slack--An agent can be conversational instead of (or as well as) issue-triggered.-Declare a Slack trigger and it becomes a teammate you @mention in a thread:--```toml-# opencomputer.toml-name = "slack-helper"--[runtime]-image = "claude"-model = "anthropic/claude-opus-4-8"--[[triggers]]-type = "slack"-on = "mention"--[connection]-github = "diggerhq" # the repos it may act on; it resolves which from the chat-```--```bash-oc connect slack # install the OpenComputer Slack app (Preview — see below)-oc agent deploy ./slack-helper-```--`/invite` it to a channel and @mention it:--```-you @slack-helper parseDuration in oc-agent-demo-target mis-parses "1.5h" — fix it?-bot On it — pulling oc-agent-demo-target…-bot Found it: the regex silently drops "1.". Throw on bad input, or support fractions?-you throw-bot Done — tests pass. 📦 Opened PR #42-```--It works out *which* repo from the conversation, investigates in a sandbox,-**asks** when it needs a decision (and pauses, free, until you reply), and opens-a draft PR — narrating in-thread the whole time. Full walkthrough:-[Channels](/background-agents/channels).--<Note>**Preview** — in v0 the Slack app is platform-configured for a single demo-workspace; self-serve `oc connect slack` is planned.</Note>--## Next--- [Agents as code](/background-agents/agents)-- [Sessions and dormancy](/background-agents/sessions)-- [Workspace freshness and warm pools](/background-agents/workspaces)diff --git a/docs/background-agents/runtimes.mdx b/docs/background-agents/runtimes.mdxdeleted file mode 100644index 5ea01dde..00000000--- a/docs/background-agents/runtimes.mdx+++ /dev/null@@ -1,68 +0,0 @@-----title: "Runtimes"-description: "The loop that drives a session, selected like a base image"------<Note>**Preview** — see the [overview](/background-agents/overview); some-capabilities below are still rolling out.</Note>--The runtime is the agent loop: it reads the session, calls the model, and-acts in the session's machine. You select it; OpenComputer operates it.--```toml-[runtime]-image = "claude"-model = "anthropic/claude-opus-4-8"-```--```bash-oc runtime list-# claude Claude Code / Agent SDK harness (default)-# codex Preview — not built yet-# opencode Preview — multi-provider harness, not built yet-```--## Semantics--- **Versioned like a deployment.** Tags move, digests pin; each session- records the digest it runs, so runtime upgrades never affect in-flight- sessions.-- **The model is not part of the runtime** — it's- [configuration](/background-agents/models). Runtimes declare which- providers they can drive; switching *across* providers needs an image that- drives the target (the planned `opencode` drives all — Preview).-- **Stateless and disposable.** Session state — conversation, timeline,- sandbox files — lives outside the runtime. If a runtime's machine dies- mid-task, the session continues on a fresh one; the timeline shows an- `error` event and a short pause.-- **No credentials.** By design, model keys stay in the gateway (a Preview- capability) and delivery tokens in the platform.--## Behavior--- **No busy-waiting.** Waiting — on a person, a long build, the clock —- makes the session dormant instead of burning compute.-- **Asks yield.** When the agent needs a decision it emits an `ask` and the- turn yields; the session goes `awaiting_input` and holds no compute until a- reply arrives (`oc session send`).-- **Budget-aware.** Runtimes wind down near the session's budget cap; the- platform enforces the cap regardless.--## Tools the runtime provides--The agent works through a small set of platform tools — building an agent is-mostly a prompt that uses them well:--- **`say`** / **`ask`** — speak to the human; the agent's raw reasoning is never- shown, only `say`/`ask`. `ask` pauses the turn until answered (see- [Conversation](/background-agents/sessions#conversation)).-- **`use_repo`** — pick a repo to work in from the ones the connection covers,- and switch or open more- ([resolution](/background-agents/workspaces#resolution-and-sharing)).-- **`deliver`** — open or update a draft PR; the platform pushes it as the- human, so no git tokens enter the sandbox.-- **`bash` / `read` / `write` / `ls`** — the session's sandbox.--<Note>**Preview** — additional platform images (`codex`, `opencode`) and-publishing your own loop (`oc runtime push`) use the same registry and contract,-but are not built in v0; `claude` is the runtime that ships today.</Note>diff --git a/docs/background-agents/sessions.mdx b/docs/background-agents/sessions.mdxdeleted file mode 100644index 8e0f349e..00000000--- a/docs/background-agents/sessions.mdx+++ /dev/null@@ -1,125 +0,0 @@-----title: "Sessions"-description: "Durable threads of work; dormant sessions hold no compute"------<Note>**Preview** — see the [overview](/background-agents/overview); some-capabilities below are still rolling out.</Note>--A session is one thread of an agent's work: one issue, one PR, one ongoing-conversation. It is an append-only **event timeline**, durable independently-of any machine. Compute attaches when there is work and detaches when there-isn't.--## Lifecycle--```-active ◄──► dormant ──► archived (retention policy)- │- └──► awaiting_input (waiting on a human answer)-```--- **active** — a runtime is working; billing runs.-- **dormant** — nothing to do. No compute attached; storage only. A- session can stay dormant for months and wake in seconds.-- **awaiting_input** — the agent asked a question (`ask`) and is waiting. The- turn has yielded, so no compute is attached; a reply wakes it.-- Sessions are never forcibly ended; archival is a retention policy you set.--Machine failures, deploys, and restarts do not lose session state. Kill the-sandbox mid-thread and the session resumes — a dead-but-connectable machine is-recreated and re-cloned, and the pushed branch plus the event timeline are the-durable copy of the work; nothing in the conversation is dropped. *(As-designed, the conversation also resumes byte-exact from the gateway's recorded-exchange — a [Preview](/background-agents/overview) capability, not built in v0;-the cheap-visible resume above is what ships today.)*--## Starting and routing--Sessions start from triggers, or explicitly:--```bash-oc session start fixer "migrate the date helpers to Temporal"-```--Triggers route by **routing key** — by default one session per GitHub-issue. Follow-ups find their session: a comment on a PR resumes the session-that opened it. One agent runs many concurrent sessions.--## Conversation--A session is two-way. The agent has two ways to reach a human, and only these-two are shown — its raw internal reasoning is never surfaced:--- **`say`** — a deliberate message to the human: progress, a finding, an- answer. The frontend chooses how much to surface (see- [levels](/background-agents/observability#levels)).-- **`ask`** — a question that **pauses the turn**. The agent appends the- question and yields; the session goes **`awaiting_input`** and holds no- compute while it waits. A reply wakes it with the answer already in context,- and it continues. This is what makes it a conversation, not a fire-and-forget- command.--Any inbound message — a Slack reply, a PR comment, a direct API call — is a-**steer**: it is appended to the timeline and picked up at the next turn. (A-steer adjusts the *next* turn; mid-turn interruption is-[Preview](#preview-mid-turn-interrupt).) Channels project `say`/`ask` and-progress out to where people are watching — see-[Channels](/background-agents/channels).--## Events--Every event carries an actor, a `kind`, and a **`level`** —-`internal | progress | user` — a visibility class so a consumer can show as-much or as little as it wants (see-[Observability](/background-agents/observability#levels)).--| Kind | Level | Meaning |-|---|---|---|-| `message` | progress | A human or trigger said something; or agent narration |-| `say` | user | The agent's deliberate user-facing message |-| `action` | internal | The agent ran a command or edited files in its sandbox |-| `ask` | user | The agent needs a human decision; the session goes `awaiting_input` until answered |-| `delivery` | user | An outward action performed for the agent — PR opened, comment posted |-| `status` | progress | Lifecycle and configuration changes |-| `timer` | — | A scheduled wake fired |-| `exec.completed` | — | A long-running command the agent was waiting on finished |-| `error` | user | A failure, with retry context |--```bash-oc session attach <id> # live stream; detaching doesn't stop the agent-oc session send <id> "use the staging DB for repro" # a steer, in-```--```bash-curl "https://api.opencomputer.dev/v2/sessions/$ID/events?stream=sse" \- -H "Authorization: Bearer $OC_API_KEY"-```--## The sandbox underneath--Each session works in its own [sandbox](https://01m3nj5m1bxzfrqggfrk59t95j-site.holocron.so/sandboxes/overview), booted from-the workspace's latest build, managed for you:--```bash-oc session get <id> # status, pins, sandbox state, preview URLs, usage-oc session shell <id> # open the actual machine-```--`pins` records what the session runs on — agent version, workspace build,-runtime — so in-flight work is unaffected by updates and runs are-reproducible.--## Cost--You pay for attached compute and model tokens while the session is active-(`usage.active_seconds`). A session that worked 11 minutes across two days-bills 11 minutes of compute; dormant time costs only the storage of the-timeline and snapshots.--## Preview: mid-turn interrupt--A steer is consumed at the next turn boundary — it adjusts the *next* turn, not-the one in flight. Interrupting a turn already running (a steer that redirects-work mid-task) is designed but not built in v0. To steer in v0, send the-message; it is applied when the current turn yields.diff --git a/docs/background-agents/triggers.mdx b/docs/background-agents/triggers.mdxdeleted file mode 100644index bf86a5d9..00000000--- a/docs/background-agents/triggers.mdx+++ /dev/null@@ -1,86 +0,0 @@-----title: "Triggers & Connections"-description: "Events in, results out"------<Note>**Preview** — see the [overview](/background-agents/overview); some-capabilities below are still rolling out.</Note>--Triggers bring events to your agent; deliveries carry its work back out.-Both run through **connections** — integrations OpenComputer operates.--## Connections--```bash-oc connect github # install the OpenComputer GitHub App on your org-oc connect github --as-user # optional personal grant: deliveries act as you-```--Installing the App is the entire GitHub integration — no app registration,-webhook configuration, or secrets. Model provider keys are also connections;-see [Models](/background-agents/models).--A **Slack** connection (per-workspace OAuth, token held platform-side) powers-the Slack conversation [channel](/background-agents/channels).--```bash-oc connect slack # install the OpenComputer Slack app to your workspace-```--<Note>**Preview** — in v0 the Slack app is **platform-configured** for a single-demo workspace; self-serve `oc connect slack` and multiple workspaces are-planned. See the [overview](/background-agents/overview).</Note>--## Triggers--Declared on the agent:--```toml-[[triggers]]-type = "github"-on = "issue.labeled:agent"-```--Supported GitHub events include issue labels and PR/issue comments. Events are-acknowledged instantly, then routed:--- **Routing keys** group events into sessions — by default one session per- issue.-- A comment on a PR the agent opened resumes the session that opened it.--Only members of your organization can trigger an agent or wake a session —-labels and comments from anyone else are ignored. Configurable per agent-([policies](/background-agents/agents#policies)).--### Slack--A `slack` trigger makes the agent conversational — an `@mention` starts or-continues a thread-session:--```toml-[[triggers]]-type = "slack"-on = "mention"-```--The agent that declares this trigger *is* the Slack agent: mentions and thread-replies route to it as steers, and it talks back in the thread. See-[Channels](/background-agents/channels) for the full two-way model and-[`slack-helper`](/background-agents/quickstart) for a complete example.--<Note>**Preview** — `cron` and `http`/email triggers are planned, not built in-v0.</Note>--## Deliveries--Agents hold no GitHub tokens. To open a PR or post a comment, the agent-requests a **delivery** and the platform performs it:--- With a personal grant, the PR is opened **as the person who triggered the- work** — review attribution and permissions behave as if they pushed it.-- Without a grant, the App opens it with *"on behalf of @user"* attribution.-- Defaults: draft PRs only, never to protected branches- ([policies](/background-agents/agents#policies)).--Every delivery appears on the session timeline, and the PR links back to its-session.diff --git a/docs/background-agents/workspaces.mdx b/docs/background-agents/workspaces.mdxdeleted file mode 100644index aa82a977..00000000--- a/docs/background-agents/workspaces.mdx+++ /dev/null@@ -1,99 +0,0 @@-----title: "Workspaces"-description: "Prepared environments for one or more repos, rebuilt on every push"------<Note>**Preview** — workspaces are not built in v0 yet. Today a session clones-its repo on demand; the prepared-environment model below describes the-designed behavior. See the [overview](/background-agents/overview).</Note>--Cloning, installing, and building take minutes. A workspace does that work-ahead of time — on every push — and snapshots the result, so sessions boot-into a ready machine in seconds.--A workspace is a first-class resource, not an agent attribute: it prepares-**one or more repos** (each at an optional ref or branch) and is shared by-every agent and session that lands on those repos.--```bash-oc workspace create web \- --repo github.com/acme/web \- --setup "pnpm i && pnpm build" \- --warm "pnpm test --filter smoke" \- --pool 1-```--## Recipe--- **repo** — one or more repos, cloned via your GitHub connection (read- access). Each may pin an optional ref or branch; pass `--repo` again to- span several repos in one environment.-- **setup** — install, build, generate.-- **warm** *(optional)* — run once to heat caches, e.g. a smoke test.--## Builds--The workspace rebuilds on every push to the default branch — clone, setup,-warm, snapshot — so the latest build matches the latest code. `--refresh-30m` switches to interval rebuilds instead: useful at commit volumes where-per-push builds would pile up, or to pick up floating dependencies on a-quiet repo. Builds form an immutable lineage:--```bash-oc workspace builds web-# #14 4 minutes ago main@9f3c21 ok 6m12s-# #13 34 minutes ago main@8e1d09 ok 6m05s-```--Sessions boot from the latest successful build and pin it. A failed build-never becomes latest.--Builds run on ordinary sandboxes and bill as build minutes. On-push refresh-costs nothing while the repo is quiet; `--refresh 30m` runs ~48 builds a day-whether or not anything changed.--`--pool N` keeps N machines pre-booted from the latest build, removing even-the boot seconds for busy agents.--## Resolution and sharing--A session is **not bound to a repo** — it *resolves* which repo(s) to work in,-from one of several sources:--- the **triggering event** (a labeled issue's repo) — one source, not the only- one;-- the **conversation** — a chat-born session has no triggering repo, so the- agent picks one from the repos its connection covers (see below);-- a **configured default** on the agent;-- or it **asks** the human.--Resolution can be **lazy** (deferred until first needed) and **re-resolvable**:-a session can switch repos mid-thread, or open several at once — each is checked-out as its own directory inside the session's single sandbox.--The agent drives this at runtime with a **`use_repo`** tool: it lists the repos-its [connection](/background-agents/triggers#connections) scopes, checks one-out, and calls again to switch or to add a second checkout. Where a prepared-workspace covers the resolved repo/ref, the session boots from its latest build-(fast); otherwise it **clones on demand**.--Workspaces are not 1:1 with a repo: a repo can have more than one (e.g. per-branch), and a single workspace can span multiple repos. Any workspace covering-a session's repo/ref is shared by every agent and session that lands there,-independent of which agent runs.--## During a session--The workspace defines the machine at session start; after that the session's-sandbox evolves freely. Work in progress is protected independently — if a-session's machine is lost, it is restored with its recent state, not rebuilt-from the workspace (see [Sessions](/background-agents/sessions)).--## API--```bash-POST /v2/workspaces # create (recipe, refresh, pool)-GET /v2/workspaces/:id # recipe, pool status, latest build-GET /v2/workspaces/:id/builds # lineage-POST /v2/workspaces/:id/builds # build now-```diff --git a/docs/sessions-api/events.mdx b/docs/sessions-api/events.mdxdeleted file mode 100644index 737ed4a9..00000000--- a/docs/sessions-api/events.mdx+++ /dev/null@@ -1,62 +0,0 @@-----title: "Events"-description: "Stream real-time agent activity via Server-Sent Events"------<Warning>The Sessions API is experimental. Endpoints and behavior may change without notice.</Warning>--## Stream events--```-GET /v1/sessions/{sessionId}/events-```--Server-Sent Events (SSE) stream of real-time agent activity. On connect, replays all past events from the session, then streams live events as the agent works.--<ParamField query="api_key" type="string" required>- OpenComputer API key (since `EventSource` can't set headers)-</ParamField>--<ParamField query="user_id" type="string">- Filter by user ownership-</ParamField>--### Example--```javascript-const es = new EventSource(- "https://api.opencomputer.dev/v1/sessions/session_abc123/events?api_key=osb_your_api_key"-);--es.onmessage = (event) => {- const data = JSON.parse(event.data);- console.log(data.type, data);-};-```--## Event types--| Type | Description |-|------|-------------|-| `assistant` | Agent response with `message.content` blocks (text, tool_use) |-| `tool_use_summary` | Summary of a tool call (`tool` field) |-| `turn_complete` | Agent finished processing the current message |-| `result` | Final result of a turn |-| `error` | Something went wrong |-| `ready` | Agent process initialized |-| `configured` | Agent configured with tools/prompt |--## Example `assistant` event--```json-{- "type": "assistant",- "message": {- "content": [- { "type": "text", "text": "I'll create a Next.js app with a todo list..." },- { "type": "tool_use", "name": "bash", "input": { "command": "npx create-next-app@latest . --ts --tailwind --yes" } }- ]- },- "session_id": "claude_session_xxx"-}-```diff --git a/docs/sessions-api/messages.mdx b/docs/sessions-api/messages.mdxdeleted file mode 100644index fc534348..00000000--- a/docs/sessions-api/messages.mdx+++ /dev/null@@ -1,70 +0,0 @@-----title: "Messages"-description: "Send follow-up messages to an agent session"------<Warning>The Sessions API is experimental. Endpoints and behavior may change without notice.</Warning>--## Send a message--```-POST /v1/sessions/{sessionId}/messages-```--Send a follow-up message to the agent. The agent receives the message in the same sandbox with full conversation context. Returns immediately — the agent works asynchronously and emits events via the [SSE stream](/sessions-api/events).--<ParamField body="message" type="string" required>- The user's message-</ParamField>--<ParamField body="user_id" type="string" required>- Must match the session owner-</ParamField>--### Example--```bash-curl -X POST https://api.opencomputer.dev/v1/sessions/session_abc123/messages \- -H "Content-Type: application/json" \- -H "X-API-Key: osb_your_api_key" \- -d '{- "message": "Add a dark mode toggle to the header",- "user_id": "user_123"- }'-```--### Response `200`--Returns the full session object (same shape as [create](/sessions-api/sessions#create-a-session)).--```json-{- "id": "session_abc123",- "status": "running",- "sandboxId": "sb-31317626",- "previewUrl": "https://sb-31317626-p3000.workers.opencomputer.dev",- "project": {- "title": "Build a todo app",- "framework": "nextjs",- "artifacts": []- },- "messages": [- {- "id": "msg_xxx",- "role": "user",- "content": "Build a todo app with Next.js and Tailwind",- "createdAt": "2026-03-18T17:00:00.000Z"- },- {- "id": "msg_yyy",- "role": "user",- "content": "Add a dark mode toggle to the header",- "createdAt": "2026-03-18T17:05:00.000Z"- }- ],- "events": [],- "userId": "user_123",- "createdAt": "2026-03-18T17:00:00.000Z",- "updatedAt": "2026-03-18T17:05:00.000Z"-}-```diff --git a/docs/sessions-api/overview.mdx b/docs/sessions-api/overview.mdxdeleted file mode 100644index ac53c8f0..00000000--- a/docs/sessions-api/overview.mdx+++ /dev/null@@ -1,77 +0,0 @@-----title: "Sessions API Overview"-description: "Interactive AI agent sessions on OpenComputer — create a session, send messages, stream real-time events, and get a live preview URL"------<Warning>The Sessions API is experimental. Endpoints and behavior may change without notice.</Warning>--The Sessions API lets you create cloud sandboxes with AI agents that build and modify apps in real time. Each session gives you a live preview URL, an SSE event stream, and multi-turn conversation support — all through a simple REST + SSE API.--## Base URL--```-https://api.opencomputer.dev-```--## Authentication--All requests require an OpenComputer API key via the `X-API-Key` header:--```-X-API-Key: osb_your_api_key-```--Get your API key from the [OpenComputer dashboard](https://app.opencomputer.dev).--## Session object--All endpoints that return sessions use this shape:--```typescript-{- id: string; // "session_abc123"- status: "ready" | "running" | "error";- sandboxId: string | null; // "sb-31317626"- previewUrl: string; // "https://sb-xxx-p3000.workers.opencomputer.dev"- userId: string;- project: {- title: string;- framework: string;- artifacts: { path: string; summary: string }[];- };- messages: {- id: string;- role: "user" | "assistant" | "system";- content: string;- createdAt: string; // ISO 8601- }[];- events: {- id: string;- type: string;- level: "info" | "warning" | "error";- message: string;- createdAt: string;- }[];- createdAt: string;- updatedAt: string;-}-```--## Preview URL--The `previewUrl` field points to a live dev server running inside the sandbox. Embed it in an iframe or open it directly — it updates in real-time as the agent edits files via HMR.--The URL is available once the agent starts a dev server on port 3000. If the agent hasn't started one yet, `previewUrl` will be empty.--## Errors--All errors return:--```json-{- "error": {- "type": "invalid_request | not_found | internal_error",- "message": "Human-readable description"- }-}-```diff --git a/docs/sessions-api/sessions.mdx b/docs/sessions-api/sessions.mdxdeleted file mode 100644index 48d562b2..00000000--- a/docs/sessions-api/sessions.mdx+++ /dev/null@@ -1,159 +0,0 @@-----title: "Sessions"-description: "Create, retrieve, and delete agent sessions"------<Warning>The Sessions API is experimental. Endpoints and behavior may change without notice.</Warning>--## Create a session--```-POST /v1/sessions-```--Creates a cloud sandbox, starts an AI agent with your prompt, and returns a session with a live preview URL. The agent begins working immediately — stream events to follow its progress.--### Request body--<ParamField body="prompt" type="string" required>- What the agent should build or do-</ParamField>--<ParamField body="user_id" type="string" required>- Your user's ID (for session ownership)-</ParamField>--<ParamField body="user_email" type="string">- User email (stored for reference)-</ParamField>--<ParamField body="user_name" type="string">- User name (stored for reference)-</ParamField>--<ParamField body="agent_config" type="object">- Agent configuration-- <Expandable title="agent_config fields">- <ParamField body="agent_config.system_prompt" type="string">- System prompt for the AI agent- </ParamField>-- <ParamField body="agent_config.skills" type="object">- Map of `path → content` — files synced into the sandbox at `/workspace/agent/`- </ParamField>-- <ParamField body="agent_config.allowed_tools" type="string[]">- Tools the agent can use. Default: `["bash", "read", "write", "edit", "glob", "grep"]`- </ParamField>-- <ParamField body="agent_config.cwd" type="string">- Agent working directory. Default: `/workspace/app`- </ParamField>- </Expandable>-</ParamField>--### Example--```bash-curl -X POST https://api.opencomputer.dev/v1/sessions \- -H "Content-Type: application/json" \- -H "X-API-Key: osb_your_api_key" \- -d '{- "prompt": "Build a todo app with Next.js and Tailwind",- "user_id": "user_123",- "agent_config": {- "system_prompt": "You are a web app builder. Work in /workspace/app.",- "skills": {- ".claude/skills/build-app/SKILL.md": "# Build App\n\nScaffold, install, edit, verify."- }- }- }'-```--### Response `201`--```json-{- "id": "session_abc123",- "status": "running",- "sandboxId": "sb-31317626",- "previewUrl": "https://sb-31317626-p3000.workers.opencomputer.dev",- "project": {- "title": "Build a todo app",- "framework": "nextjs",- "artifacts": []- },- "messages": [- {- "id": "msg_xxx",- "role": "user",- "content": "Build a todo app with Next.js and Tailwind",- "createdAt": "2026-03-18T17:00:00.000Z"- }- ],- "events": [- {- "id": "evt_xxx",- "type": "session_started",- "level": "info",- "message": "Bootstrapping sandbox...",- "createdAt": "2026-03-18T17:00:00.000Z"- }- ],- "userId": "user_123",- "createdAt": "2026-03-18T17:00:00.000Z",- "updatedAt": "2026-03-18T17:00:02.000Z"-}-```-------## Get a session--```-GET /v1/sessions/{sessionId}-```--Returns the full session state including messages, events, and preview URL.--<ParamField query="user_id" type="string">- Filter by user ownership-</ParamField>--### Example--```bash-curl https://api.opencomputer.dev/v1/sessions/session_abc123?user_id=user_123 \- -H "X-API-Key: osb_your_api_key"-```-------## Delete a session--```-DELETE /v1/sessions/{sessionId}-```--Kills the sandbox and ends the session.--<ParamField query="user_id" type="string">- Filter by user ownership-</ParamField>--### Example--```bash-curl -X DELETE https://api.opencomputer.dev/v1/sessions/session_abc123?user_id=user_123 \- -H "X-API-Key: osb_your_api_key"-```--### Response `200`--```json-{- "id": "session_abc123",- "status": "ended"-}-```