Skip to content

An open-source, faster Devin alternative

TypeScript

Write Band C pages, update guide, delete 23 old pages

Igor Zalutskiebabee1a02ba
diff --git a/docs/agents.mdx b/docs/agents.mdx
deleted file mode 100644
index e7577632..00000000
--- a/docs/agents.mdx
+++ /dev/null
@@ -1,166 +0,0 @@
----
-title: "Agents"
-description: "Run Claude Agent SDK sessions inside a sandbox"
----
-
-The `Agent` module lets you start and manage Claude Agent SDK sessions that run inside the sandbox. The agent has full access to the sandbox filesystem and shell. Access it via `sandbox.agent`.
-
-## Starting an agent session
-
-```typescript
-const session = await sandbox.agent.start({
- prompt: "Set up a React project with TypeScript and Tailwind CSS",
- onEvent: (event) => {
- switch (event.type) {
- case "assistant":
- console.log(event.content);
- break;
- case "tool_use_summary":
- console.log(`Tool: ${event.tool} — ${event.summary}`);
- break;
- case "result":
- console.log("Done:", event.result);
- break;
- case "error":
- console.error("Error:", event.error);
- break;
- }
- },
-});
-
-const exitCode = await session.done;
-```
-
-### `sandbox.agent.start(opts?)`
-
-Starts a new agent session inside the sandbox.
-
-<ParamField body="prompt" type="string" optional>
- The task for the agent to perform.
-</ParamField>
-<ParamField body="model" type="string" optional>
- Claude model to use (e.g. `"claude-sonnet-4-20250514"`).
-</ParamField>
-<ParamField body="systemPrompt" type="string" optional>
- Custom system prompt for the agent.
-</ParamField>
-<ParamField body="allowedTools" type="string[]" optional>
- List of tools the agent is allowed to use.
-</ParamField>
-<ParamField body="permissionMode" type="string" optional>
- Permission mode for the agent session.
-</ParamField>
-<ParamField body="maxTurns" type="number" optional>
- Maximum number of turns before the agent stops.
-</ParamField>
-<ParamField body="cwd" type="string" optional>
- Working directory for the agent.
-</ParamField>
-<ParamField body="mcpServers" type="Record&lt;string, McpServerConfig&gt;" optional>
- MCP servers to make available to the agent.
-</ParamField>
-<ParamField body="onEvent" type="(event: AgentEvent) => void" optional>
- Callback for agent events (assistant messages, tool use, results, errors).
-</ParamField>
-<ParamField body="onError" type="(data: string) => void" optional>
- Callback for stderr output from the agent process.
-</ParamField>
-<ParamField body="onExit" type="(exitCode: number) => void" optional>
- Callback when the agent process exits.
-</ParamField>
-
-**Returns:** `Promise<AgentSession>`
-
-## AgentSession
-
-The object returned by `sandbox.agent.start()`.
-
-| Property / Method | Type | Description |
-| --- | --- | --- |
-| `sessionId` | `string` | Unique session identifier |
-| `done` | `Promise<number>` | Resolves with the exit code when the agent finishes |
-| `sendPrompt(text)` | `(text: string) => void` | Send a follow-up prompt to the agent |
-| `interrupt()` | `() => void` | Interrupt the agent's current turn |
-| `configure(config)` | `(config: AgentConfig) => void` | Update agent configuration mid-session |
-| `kill(signal?)` | `(signal?: number) => Promise<void>` | Kill the agent process |
-| `close()` | `() => void` | Close the WebSocket connection |
-
-## Agent events
-
-Events are delivered via the `onEvent` callback. Each event has a `type` field:
-
-| Event type | Description |
-| --- | --- |
-| `ready` | Agent process is ready |
-| `configured` | Configuration has been applied |
-| `assistant` | Assistant message (text output from the agent) |
-| `tool_use_summary` | Summary of a tool the agent used |
-| `result` | Final result from the agent |
-| `turn_complete` | A single turn has completed |
-| `interrupted` | Agent was interrupted |
-| `error` | An error occurred |
-
-## Examples
-
-### Send follow-up prompts
-
-```typescript
-const session = await sandbox.agent.start({
- prompt: "Create a Node.js REST API with Express",
- onEvent: (event) => {
- if (event.type === "assistant") console.log(event.content);
- },
-});
-
-// Wait for the first task, then send a follow-up
-await session.done;
-
-const session2 = await sandbox.agent.start({
- prompt: "Now add tests using Jest for the API you just created",
- onEvent: (event) => {
- if (event.type === "assistant") console.log(event.content);
- },
-});
-
-await session2.done;
-```
-
-### Configure MCP servers
-
-```typescript
-const session = await sandbox.agent.start({
- prompt: "Use the database tool to query all users",
- mcpServers: {
- database: {
- command: "npx",
- args: ["-y", "@modelcontextprotocol/server-sqlite", "/data/app.db"],
- },
- },
- onEvent: (event) => {
- if (event.type === "assistant") console.log(event.content);
- },
-});
-```
-
-### List active agent sessions
-
-```typescript
-const sessions = await sandbox.agent.list();
-for (const s of sessions) {
- console.log(`${s.sessionID} — running: ${s.running}`);
-}
-```
-
-### Attach to an existing session
-
-Reconnect to a running agent session by its ID:
-
-```typescript
-const session = await sandbox.agent.attach("session-id", {
- onEvent: (event) => {
- if (event.type === "assistant") console.log(event.content);
- },
-});
-
-await session.done;
-```
diff --git a/docs/cli/checkpoint.mdx b/docs/cli/checkpoint.mdx
index eb5bbe75..2932e161 100644
--- a/docs/cli/checkpoint.mdx
+++ b/docs/cli/checkpoint.mdx
@@ -3,51 +3,66 @@ title: "Checkpoints"
description: "Snapshot, fork, and restore from the CLI"
---
-{/*
- TODO: Expand this stub into full content.
-
- GOAL: Guide-like page for checkpoint workflows from CLI.
- Creating, forking (parallel exploration pattern), restoring, checkpoint vs hibernate.
-*/}
-
## Creating a Checkpoint
-{/* oc checkpoint create. What gets captured (memory, disk, processes). */}
+Capture the current state of a running sandbox:
```bash
oc checkpoint create sb-abc123 --name before-migration
+# or using the shortcut:
+oc cp create sb-abc123 --name before-migration
+```
+
+The checkpoint saves the filesystem and installed state. Status starts as `processing` and transitions to `ready`.
+
+```bash
+oc cp list sb-abc123
+# ID NAME STATUS SIZE CREATED
+# cp-7f3a1b2c before-migration ready 128 MB 2025-01-15T10:30:00Z
```
## Forking from a Checkpoint
-{/* oc checkpoint spawn. Creates a new sandbox from saved state. Parallel exploration pattern. */}
+Create new sandboxes from a saved checkpoint. Each fork is independent:
```bash
# Spawn two independent sandboxes from the same checkpoint
-ID1=$(oc checkpoint spawn cp-7f3a1b2c --json | jq -r '.sandboxID')
-ID2=$(oc checkpoint spawn cp-7f3a1b2c --json | jq -r '.sandboxID')
+ID1=$(oc cp spawn cp-7f3a1b2c --json | jq -r '.sandboxID')
+ID2=$(oc cp spawn cp-7f3a1b2c --json | jq -r '.sandboxID')
# Run different experiments
oc exec $ID1 --wait -- ./experiment-a.sh
oc exec $ID2 --wait -- ./experiment-b.sh
```
+Forked sandboxes start with a fresh boot from the saved disk state — don't assume running processes carry over.
+
## Restoring
-{/* oc checkpoint restore. Reverts in-place — all changes since checkpoint are lost. */}
+Revert a sandbox in-place to a checkpoint. All changes since the checkpoint are lost:
-## Checkpoint vs Hibernate
+```bash
+oc cp restore sb-abc123 cp-7f3a1b2c
+```
+
+## Listing and Deleting
+
+```bash
+oc cp list sb-abc123
+oc cp delete sb-abc123 cp-7f3a1b2c
+```
+
+Maximum 10 checkpoints per sandbox.
-{/* When to use which:
- - Checkpoint: branching, forking, testing multiple approaches
- - Hibernate: pause and resume the same sandbox, cost savings
-*/}
+## Checkpoint vs Hibernate
| | Checkpoint | Hibernate |
| --- | --- | --- |
| Original sandbox | Keeps running | Stopped |
-| Can fork / clone | Yes | No |
-| Use case | Branching, testing | Pause and resume |
+| Can fork | Yes — unlimited new sandboxes | No |
+| Use case | Branching, parallel testing | Pause and resume, cost savings |
+
+Use checkpoints when you need to explore multiple paths from the same state. Use hibernation when you just want to pause and resume later.
<Tip>
SDK usage: [Checkpoints](/sandboxes/checkpoints). Full flags: [CLI Reference](/reference/cli#oc-checkpoint).
diff --git a/docs/cli/checkpoints.mdx b/docs/cli/checkpoints.mdx
deleted file mode 100644
index 41f863f6..00000000
--- a/docs/cli/checkpoints.mdx
+++ /dev/null
@@ -1,130 +0,0 @@
----
-title: "Checkpoints"
-description: "Snapshot, fork, and restore sandboxes"
----
-
-Checkpoints capture the full state of a sandbox — memory, disk, and running processes — so you can restore it later or spin up multiple clones from the same point in time.
-
-## Create a Checkpoint
-
-```bash
-oc checkpoint create sb-abc123 --name my-checkpoint
-```
-
-### `oc checkpoint create <sandbox-id>`
-
-Snapshots the current state of a running sandbox and uploads it to S3.
-
-| Flag | Type | Default | Description |
-| --- | --- | --- | --- |
-| `--name` | string | — | Checkpoint name (required) |
-
-Output:
-
-```
-Checkpoint created: cp-7f3a1b2c (status: ready)
-Name: my-checkpoint
-```
-
-## List Checkpoints
-
-```bash
-oc checkpoint list sb-abc123
-```
-
-### `oc checkpoint list <sandbox-id>`
-
-Lists all checkpoints associated with a sandbox.
-
-Output:
-
-```
-ID NAME STATUS SIZE CREATED
-cp-7f3a1b2c my-checkpoint ready 843.2 MB 2024-01-15T10:30:00Z
-cp-2d9e4a1f before-deploy ready 801.5 MB 2024-01-14T09:00:00Z
-```
-
-## Restore a Sandbox
-
-```bash
-oc checkpoint restore sb-abc123 cp-7f3a1b2c
-```
-
-### `oc checkpoint restore <sandbox-id> <checkpoint-id>`
-
-Reverts an existing sandbox in-place to the state captured in the checkpoint. All changes made after the checkpoint was created are discarded.
-
-## Spawn a New Sandbox from a Checkpoint
-
-```bash
-oc checkpoint spawn cp-7f3a1b2c
-```
-
-Or with a custom timeout:
-
-```bash
-oc checkpoint spawn cp-7f3a1b2c --timeout 600
-```
-
-### `oc checkpoint spawn <checkpoint-id>`
-
-Creates a brand-new sandbox from an existing checkpoint, leaving the original sandbox untouched. Useful for forking — run the same starting state in parallel.
-
-| Flag | Type | Default | Description |
-| --- | --- | --- | --- |
-| `--timeout` | int | `300` | TTL for the new sandbox in seconds |
-
-## Delete a Checkpoint
-
-```bash
-oc checkpoint delete sb-abc123 cp-7f3a1b2c
-```
-
-### `oc checkpoint delete <sandbox-id> <checkpoint-id>`
-
-Permanently removes a checkpoint and its stored data from S3.
-
-## Alias
-
-`oc checkpoint` can also be invoked as `oc cp`:
-
-```bash
-oc cp create sb-abc123 --name quick-save
-oc cp list sb-abc123
-```
-
-## Examples
-
-### Save State Before a Risky Operation
-
-```bash
-oc checkpoint create sb-abc123 --name before-migration
-oc exec sb-abc123 -- ./run-migration.sh
-
-# Something went wrong — roll back
-oc checkpoint restore sb-abc123 cp-7f3a1b2c
-```
-
-### Fork a Sandbox for Parallel Testing
-
-```bash
-# Create a checkpoint with a known-good state
-oc checkpoint create sb-abc123 --name test-base
-
-# Spawn two independent sandboxes from it
-ID1=$(oc checkpoint spawn cp-7f3a1b2c --json | jq -r '.id')
-ID2=$(oc checkpoint spawn cp-7f3a1b2c --json | jq -r '.id')
-
-# Run different experiments in each
-oc exec $ID1 -- ./experiment-a.sh
-oc exec $ID2 -- ./experiment-b.sh
-```
-
-### Checkpoint vs Hibernate
-
-| | Checkpoint | Hibernate |
-| --- | --- | --- |
-| Original sandbox | Keeps running | Stopped |
-| Can fork / clone | Yes | No |
-| Restore target | Any sandbox | Same sandbox only |
-| Use case | Branching, testing | Pause and resume |
diff --git a/docs/cli/commands.mdx b/docs/cli/commands.mdx
deleted file mode 100644
index 20da30b7..00000000
--- a/docs/cli/commands.mdx
+++ /dev/null
@@ -1,92 +0,0 @@
----
-title: "Commands"
-description: "Execute shell commands inside a sandbox"
----
-
-The `exec` command runs a shell command inside a sandbox and captures its output. The CLI exits with the same exit code as the remote command.
-
-## Running a Command
-
-```bash
-oc exec sb-abc123 -- echo "Hello, World!"
-```
-
-Output:
-
-```
-Hello, World!
-```
-
-### `oc exec <id> -- <command...>`
-
-Executes a shell command and waits for it to complete. Everything after `--` is joined into the command string.
-
-| Flag | Type | Default | Description |
-| --- | --- | --- | --- |
-| `--cwd` | string | — | Working directory for the command |
-| `--timeout` | int | `60` | Maximum execution time in seconds |
-| `--env` | string | — | Environment variable (`KEY=VALUE`, repeatable) |
-
-**Default output:** Prints stdout and stderr directly to your terminal, then exits with the remote exit code.
-
-**JSON output (`--json`):** Returns the full `ProcessResult` object.
-
-## ProcessResult
-
-When using `--json`, the output includes:
-
-| Field | Type | Description |
-| --- | --- | --- |
-| `exitCode` | number | Exit code of the process (0 = success) |
-| `stdout` | string | Standard output |
-| `stderr` | string | Standard error |
-
-## Examples
-
-### Run with a Working Directory
-
-```bash
-oc exec sb-abc123 --cwd /app -- ls -la
-```
-
-### Run with Environment Variables
-
-```bash
-oc exec sb-abc123 --env MY_VAR=hello -- echo $MY_VAR
-```
-
-### Run with a Timeout
-
-```bash
-oc exec sb-abc123 --timeout 5 -- sleep 30
-# Killed after 5 seconds, non-zero exit code
-```
-
-### Check for Errors
-
-```bash
-oc exec sb-abc123 -- python3 script.py
-if [ $? -ne 0 ]; then
- echo "Command failed"
-fi
-```
-
-### Chain Commands
-
-```bash
-oc exec sb-abc123 -- bash -c 'cd /app && npm install && npm run build'
-```
-
-### Capture Output as JSON
-
-```bash
-RESULT=$(oc exec sb-abc123 --json -- node -e 'console.log("hello")')
-echo $RESULT | jq '.stdout'
-```
-
-### Install Packages
-
-```bash
-oc exec sb-abc123 -- apt update
-oc exec sb-abc123 -- apt install -y python3 nodejs
-```
diff --git a/docs/cli/exec.mdx b/docs/cli/exec.mdx
index f2b67a8a..f04c8df2 100644
--- a/docs/cli/exec.mdx
+++ b/docs/cli/exec.mdx
@@ -3,61 +3,79 @@ title: "Running Commands"
description: "Execute shell commands from the CLI"
---
-{/*
- TODO: Expand this stub into full content.
-
- GOAL: Guide-like page for running commands via CLI.
- When to use exec vs shell, scripting patterns, session management.
-
- KEY NOTES:
- - `oc exec` defaults to creating an exec session, not waiting for command completion
- - `--wait` switches to synchronous exec/run behavior and mirrors the remote exit code
- - `oc exec attach` is not implemented yet in the CLI; say that explicitly
-*/}
-
## Running a Command
-{/* Start with the synchronous mode most readers expect:
- oc exec <id> --wait -- <command>
- Explain that plain `oc exec` creates a session and prints attach instructions instead.
-*/}
+Use `--wait` to run a command synchronously — output streams to your terminal and the CLI exits with the process exit code:
```bash
oc exec sb-abc123 --wait -- echo "Hello, World!"
+oc exec sb-abc123 --wait -- npm run build
```
-## Working Directory & Environment
+Without `--wait`, `oc exec` creates an **exec session** and prints the session ID with attach instructions. This is useful for long-running commands:
-{/* --cwd and --env flags. When to use them. */}
+```bash
+oc exec sb-abc123 -- node server.js
+# → Session es-xyz created. Attach with: oc exec attach sb-abc es-xyz
+```
+
+## Working Directory & Environment
```bash
oc exec sb-abc123 --wait --cwd /app --env NODE_ENV=production -- npm run build
+oc exec sb-abc123 --wait --env API_KEY=xxx --env DEBUG=true -- ./run.sh
```
## Timeouts
-{/* --timeout flag. Default 60s. What happens when exceeded. */}
+Set a timeout with `--timeout` (in seconds). Default is 0 (no timeout). When exceeded, the command is killed:
+
+```bash
+oc exec sb-abc123 --wait --timeout 30 -- npm test
+```
## Creating an Exec Session
-{/* Plain `oc exec` creates a session for long-running commands and prints the session ID plus attach hint. */}
+Plain `oc exec` (without `--wait`) creates a session for long-running commands. The command keeps running even after you disconnect:
+
+```bash
+oc exec sb-abc123 -- python train.py
+# Session es-abc created
+```
## Capturing Output as JSON
-{/* `--json` with `--wait` gives ProcessResult output for scripting. */}
+Combine `--json` with `--wait` for scripting:
```bash
RESULT=$(oc exec sb-abc123 --json --wait -- node -e 'console.log("hello")')
-echo $RESULT | jq '.stdout'
+echo $RESULT | jq '.stdout' # "hello\n"
+echo $RESULT | jq '.exitCode' # 0
```
## Managing Exec Sessions
-{/* oc exec list and kill are available. `oc exec attach` exists as a command name but is not implemented yet in the CLI; point users to the SDK or raw WebSocket if needed. */}
+```bash
+# List active sessions
+oc exec list sb-abc123
+
+# Kill a session
+oc exec kill sb-abc123 es-xyz
+oc exec kill sb-abc123 es-xyz --signal 15 # SIGTERM
+```
+
+<Warning>
+ `oc exec attach` exists as a command but is not yet implemented. It prints guidance to use the SDK or a WebSocket client. Use `oc exec list` and `oc exec kill` to manage sessions from the CLI.
+</Warning>
## Shell vs Exec
-{/* When to use oc exec (single command, scripting, automation) vs oc shell (interactive, debugging). */}
+| Use Case | Command |
+| --- | --- |
+| Single command, capture output | `oc exec --wait` |
+| Scripting and automation | `oc exec --wait --json` |
+| Long-running background process | `oc exec` (no `--wait`) |
+| Interactive development, debugging | [`oc shell`](/cli/shell) |
<Tip>
SDK usage: [Running Commands](/sandboxes/running-commands). Full flags: [CLI Reference](/reference/cli#oc-exec).
diff --git a/docs/cli/overview.mdx b/docs/cli/overview.mdx
index 71a92fee..f4cd7177 100644
--- a/docs/cli/overview.mdx
+++ b/docs/cli/overview.mdx
@@ -3,26 +3,10 @@ title: "CLI"
description: "Manage sandboxes from your terminal"
---
-{/*
- TODO: Expand this stub into full content.
-
- GOAL: Entry point for CLI users. Install, configure, and learn key workflows.
- Guide-like — teaches patterns and concepts, not exhaustive flag reference.
-
- KEY NOTES:
- - 4 platform install: macOS Apple Silicon/Intel, Linux x86_64/ARM64
- - Config resolution: flags > env > config file > defaults
- - Top-level shortcuts: oc create = oc sandbox create, oc ls = oc sandbox list
- - `oc exec` creates a session by default; use `--wait` for synchronous command execution
- - JSON output mode + jq patterns for scripting
-*/}
-
The `oc` CLI lets you manage OpenComputer sandboxes directly from your terminal — create sandboxes, run commands, open interactive shells, manage checkpoints, and more.
## Installation
-{/* 4 platforms: macOS Apple Silicon, macOS Intel, Linux x86_64, Linux ARM64. CodeGroup with curl commands. */}
-
<CodeGroup>
```bash macOS (Apple Silicon)
@@ -49,12 +33,13 @@ chmod +x /usr/local/bin/oc
## Configuration
-{/* oc config set api-key / api-url. Config file: ~/.oc/config.json. oc config show. */}
+```bash
+oc config set api-key your-api-key
+oc config show
+```
### Resolution Order
-{/* Table: flags > env > config > defaults */}
-
| Priority | Source | Example |
| --- | --- | --- |
| 1 (highest) | CLI flags | `--api-key=xxx` |
@@ -72,14 +57,6 @@ chmod +x /usr/local/bin/oc
## Key Workflows
-{/* Practical patterns — how to actually use the CLI effectively.
- - Create and shell in one line: oc shell $(oc create --json | jq -r '.sandboxID')
- - Scripting with --json and jq
- - Hibernate/wake for cost savings
- - Checkpoint -> fork -> parallel testing pattern
- - Top-level shortcuts: oc create = oc sandbox create, oc ls = oc sandbox list
-*/}
-
### Quick Start
```bash
@@ -98,7 +75,7 @@ oc sandbox kill sb-abc123
### JSON Output & Scripting
-{/* --json flag + jq patterns. Capture IDs, filter by status. */}
+All commands support `--json` for machine-readable output:
```bash
# Get a sandbox ID programmatically
@@ -106,22 +83,57 @@ ID=$(oc create --json | jq -r '.sandboxID')
# List all running sandbox IDs
oc ls --json | jq -r '.[].sandboxID'
+
+# Run a command and capture the result
+RESULT=$(oc exec $ID --json --wait -- npm test)
+echo $RESULT | jq '.exitCode'
```
### Top-level Shortcuts
-{/* oc create = oc sandbox create, oc ls = oc sandbox list */}
+| Shortcut | Expands to |
+| --- | --- |
+| `oc create` | `oc sandbox create` |
+| `oc ls` | `oc sandbox list` |
+| `oc cp` | `oc checkpoint` |
-## Command Reference
+### Create and Shell In
+
+```bash
+oc shell $(oc create --json | jq -r '.sandboxID')
+```
+
+### Hibernate for Cost Savings
+
+```bash
+oc sandbox hibernate sb-abc123
+# ... hours later ...
+oc sandbox wake sb-abc123
+oc shell sb-abc123
+```
+
+### Checkpoint and Fork
+
+```bash
+oc cp create sb-abc --name ready-state
+ID1=$(oc cp spawn cp-xyz --json | jq -r '.sandboxID')
+ID2=$(oc cp spawn cp-xyz --json | jq -r '.sandboxID')
+oc exec $ID1 --wait -- ./test-a.sh
+oc exec $ID2 --wait -- ./test-b.sh
+```
-{/* Links to per-command reference pages (in Reference section) */}
+## Command Reference
| Command | Description |
| --- | --- |
-| [sandbox](/cli/sandbox) | Create, list, kill, hibernate, wake |
-| [exec](/cli/exec) | Run commands, manage exec sessions |
-| [shell](/cli/shell) | Interactive PTY terminal |
-| [checkpoint](/cli/checkpoint) | Snapshot, fork, restore |
-| [patch](/cli/patch) | Checkpoint-attached scripts |
-| [preview](/cli/preview) | Expose ports to the internet |
-| [config](/reference/cli#oc-config) | Configure API key and API URL |
+| [`oc sandbox`](/cli/sandbox) | Create, list, kill, hibernate, wake |
+| [`oc exec`](/cli/exec) | Run commands, manage exec sessions |
+| [`oc shell`](/cli/shell) | Interactive PTY terminal |
+| [`oc checkpoint`](/cli/checkpoint) | Snapshot, fork, restore |
+| [`oc patch`](/cli/patch) | Checkpoint-attached scripts |
+| [`oc preview`](/cli/preview) | Expose ports to the internet |
+| [`oc config`](/reference/cli#oc-config) | Configure API key and API URL |
+
+<Tip>
+ Full flag reference for every command: [CLI Reference](/reference/cli).
+</Tip>
diff --git a/docs/cli/patch.mdx b/docs/cli/patch.mdx
index 777f4e6a..c70fcb26 100644
--- a/docs/cli/patch.mdx
+++ b/docs/cli/patch.mdx
@@ -3,20 +3,13 @@ title: "Patches"
description: "Attach scripts to checkpoints from the CLI"
---
-{/*
- TODO: Expand this stub into full content.
-
- GOAL: Guide-like page for patch workflows from CLI.
- Creating from file or stdin, layering setup steps, inspecting before spawning.
-*/}
-
## What Patches Do
-{/* Shell scripts attached to a checkpoint. Run in order every time a sandbox is forked from that checkpoint. Layer setup without re-creating the checkpoint. */}
+A patch is a shell script attached to a checkpoint. Patches run in order every time a sandbox is forked from that checkpoint — layer setup without re-creating the checkpoint.
## Creating a Patch
-{/* From file or stdin. */}
+From a file or stdin:
```bash
# From a file
@@ -28,19 +21,32 @@ echo "npm install -g typescript" | oc patch create cp-7f3a1b2c --script=-
## Layering Setup
-{/* Pattern: base checkpoint + multiple patches for each layer of configuration. */}
+Add multiple patches — they execute in creation order on every fork:
```bash
oc patch create cp-7f3a1b2c --script ./install-node.sh --description "Node.js 20"
oc patch create cp-7f3a1b2c --script ./app-config.sh --description "App config"
# Each spawned sandbox gets both patches applied in order
-oc checkpoint spawn cp-7f3a1b2c
+oc cp spawn cp-7f3a1b2c
```
## Inspecting Patches
-{/* oc patch list before spawning to review what will run. */}
+Review what will run before forking:
+
+```bash
+oc patch list cp-7f3a1b2c
+# ID SEQ DESCRIPTION STRATEGY CREATED
+# pa-abc123 1 Node.js 20 on_wake 2025-01-15T10:30:00Z
+# pa-def456 2 App config on_wake 2025-01-15T10:31:00Z
+```
+
+## Removing a Patch
+
+```bash
+oc patch delete cp-7f3a1b2c pa-abc123
+```
<Tip>
SDK usage: [Patches](/sandboxes/patches). Full flags: [CLI Reference](/reference/cli#oc-patch).
diff --git a/docs/cli/patches.mdx b/docs/cli/patches.mdx
deleted file mode 100644
index 56da9b2b..00000000
--- a/docs/cli/patches.mdx
+++ /dev/null
@@ -1,96 +0,0 @@
----
-title: "Patches"
-description: "Apply scripted modifications when spawning sandboxes from a checkpoint"
----
-
-Patches are shell scripts attached to a checkpoint. When a new sandbox is spawned from that checkpoint, all patches are applied in sequence before the sandbox is handed back to you. This lets you layer additional setup on top of a base checkpoint without re-creating it.
-
-## Create a Patch
-
-From a file:
-
-```bash
-oc patch create cp-7f3a1b2c --script ./setup.sh --description "Install dependencies"
-```
-
-From stdin:
-
-```bash
-echo "apt install -y curl jq" | oc patch create cp-7f3a1b2c --script=-
-```
-
-### `oc patch create <checkpoint-id>`
-
-Attaches a patch script to a checkpoint. Patches run in the order they were created (by sequence number) whenever `oc checkpoint spawn` is called for that checkpoint.
-
-| Flag | Type | Default | Description |
-| --- | --- | --- | --- |
-| `--script` | string | — | Path to a shell script file, or `-` to read from stdin (required) |
-| `--description` | string | — | Human-readable description of what the patch does |
-
-Output:
-
-```
-Patch created: patch-3c8d2e1a (sequence: 1)
-```
-
-## List Patches
-
-```bash
-oc patch list cp-7f3a1b2c
-```
-
-### `oc patch list <checkpoint-id>`
-
-Shows all patches attached to a checkpoint, in the order they will be applied.
-
-Output:
-
-```
-ID SEQ DESCRIPTION STRATEGY CREATED
-patch-3c8d2e1a 1 Install dependencies 2024-01-15T10:35:00Z
-patch-9a1f4b7c 2 Configure environment 2024-01-15T10:40:00Z
-```
-
-## Delete a Patch
-
-```bash
-oc patch delete cp-7f3a1b2c patch-3c8d2e1a
-```
-
-### `oc patch delete <checkpoint-id> <patch-id>`
-
-Removes a patch from the checkpoint. Future spawns will no longer apply it. Existing sandboxes already spawned are unaffected.
-
-## Examples
-
-### Layer Setup Steps onto a Base Checkpoint
-
-```bash
-# Start with a minimal checkpoint
-oc checkpoint create sb-abc123 --name base
-
-# Add patches for each layer of setup
-oc patch create cp-7f3a1b2c --script ./install-node.sh --description "Node.js 20"
-oc patch create cp-7f3a1b2c --script ./install-postgres.sh --description "PostgreSQL client"
-oc patch create cp-7f3a1b2c --script ./app-config.sh --description "App config"
-
-# Each spawned sandbox gets all three patches applied in order
-oc checkpoint spawn cp-7f3a1b2c
-```
-
-### Use stdin for Quick One-Liners
-
-```bash
-echo "npm install -g typescript" | oc patch create cp-7f3a1b2c --script=- --description "Global TypeScript"
-```
-
-### Inspect Before Spawning
-
-```bash
-# Review the patches that will run
-oc patch list cp-7f3a1b2c
-
-# Spawn knowing exactly what will be applied
-oc checkpoint spawn cp-7f3a1b2c
-```
diff --git a/docs/cli/preview.mdx b/docs/cli/preview.mdx
index b455697e..f22ce664 100644
--- a/docs/cli/preview.mdx
+++ b/docs/cli/preview.mdx
@@ -3,40 +3,59 @@ title: "Preview URLs"
description: "Expose sandbox ports from the CLI"
---
-{/*
- TODO: Expand this stub into full content.
-
- GOAL: Guide-like page for preview URL workflows from CLI.
- Exposing ports, sharing dev server, multiple ports, custom domains.
-*/}
-
## Exposing a Port
-{/* oc preview create. Public HTTPS URL that proxies to a sandbox port. */}
+Create a public HTTPS URL that proxies traffic to a port inside your sandbox:
```bash
oc preview create sb-abc123 --port 3000
+# → hostname: sb-abc123-p3000.preview.opencomputer.dev
```
## Sharing a Dev Server
-{/* Start a server inside sandbox, expose it, share the URL. */}
+Start a server inside the sandbox, expose it, and share the URL:
```bash
+# Start a dev server in the background
oc exec sb-abc123 -- bash -c 'cd /app && npm run dev &'
+
+# Expose port 3000
oc preview create sb-abc123 --port 3000
# Get the URL
-oc preview list sb-abc123 --json | jq -r '.[0].hostname'
+oc preview list sb-abc123
```
## Multiple Ports
-{/* Frontend on 3000, API on 4000. */}
+Expose multiple services from the same sandbox:
+
+```bash
+oc preview create sb-abc123 --port 3000 # Frontend
+oc preview create sb-abc123 --port 8080 # API server
+
+oc preview list sb-abc123
+# PORT HOSTNAME SSL CREATED
+# 3000 sb-abc123-p3000.preview.opencomputer.dev active ...
+# 8080 sb-abc123-p8080.preview.opencomputer.dev active ...
+```
## Custom Domains
-{/* --domain flag. DNS must point to OpenComputer ingress. SSL automatic. */}
+Pass `--domain` to use your own domain. DNS must point to OpenComputer's ingress, and the domain must be verified in the dashboard. SSL is provisioned automatically.
+
+```bash
+oc preview create sb-abc123 --port 3000 --domain preview.myapp.com
+```
+
+## Cleanup
+
+```bash
+oc preview delete sb-abc123 3000
+```
+
+Preview URLs persist across hibernation/wake cycles — no need to re-create them.
<Tip>
SDK usage: [Preview URLs](/sandboxes/preview-urls). Full flags: [CLI Reference](/reference/cli#oc-preview).
diff --git a/docs/cli/previews.mdx b/docs/cli/previews.mdx
deleted file mode 100644
index acb68a33..00000000
--- a/docs/cli/previews.mdx
+++ /dev/null
@@ -1,104 +0,0 @@
----
-title: "Preview URLs"
-description: "Expose sandbox ports to the internet"
----
-
-Preview URLs give a sandbox port a publicly accessible HTTPS hostname. This lets you share a running web server, API, or any TCP service without any networking configuration.
-
-## Create a Preview URL
-
-```bash
-oc preview create sb-abc123 --port 3000
-```
-
-With a custom domain:
-
-```bash
-oc preview create sb-abc123 --port 8080 --domain preview.example.com
-```
-
-### `oc preview create <sandbox-id>`
-
-Provisions a public HTTPS URL that proxies traffic to the specified port inside the sandbox.
-
-| Flag | Type | Default | Description |
-| --- | --- | --- | --- |
-| `--port` | int | — | Sandbox port to expose (required) |
-| `--domain` | string | — | Custom hostname to use instead of the generated one |
-
-Output:
-
-```
-Preview URL created:
- Hostname: sb-abc123-3000.preview.opencomputer.dev
- Port: 3000
- SSL: active
-```
-
-## List Preview URLs
-
-```bash
-oc preview list sb-abc123
-```
-
-### `oc preview list <sandbox-id>`
-
-Shows all active preview URLs for a sandbox.
-
-Output:
-
-```
-PORT HOSTNAME SSL CREATED
-3000 sb-abc123-3000.preview.opencomputer.dev active 2024-01-15T10:30:00Z
-8080 preview.example.com active 2024-01-15T10:31:00Z
-```
-
-## Delete a Preview URL
-
-```bash
-oc preview delete sb-abc123 3000
-```
-
-### `oc preview delete <sandbox-id> <port>`
-
-Removes the preview URL for the given port. The sandbox keeps running; only the public URL is torn down.
-
-## Examples
-
-### Share a Dev Server
-
-```bash
-# Start a web server inside the sandbox
-oc exec sb-abc123 -- bash -c 'cd /app && npm run dev &'
-
-# Expose port 3000
-oc preview create sb-abc123 --port 3000
-
-# Share the URL with a teammate
-oc preview list sb-abc123 --json | jq -r '.[0].hostname'
-```
-
-### Expose Multiple Ports
-
-```bash
-# Frontend on 3000, API on 4000
-oc preview create sb-abc123 --port 3000
-oc preview create sb-abc123 --port 4000
-
-oc preview list sb-abc123
-```
-
-### Use a Custom Domain
-
-```bash
-oc preview create sb-abc123 --port 8080 --domain staging.myapp.com
-```
-
-> Custom domains require DNS to point to the OpenComputer ingress and may take a few minutes for SSL to become active.
-
-### Scripted: Create and Print URL
-
-```bash
-URL=$(oc preview create sb-abc123 --port 3000 --json | jq -r '.hostname')
-echo "Open: https://$URL"
-```
diff --git a/docs/cli/sandbox.mdx b/docs/cli/sandbox.mdx
index 0f19cd70..6a4a5d8f 100644
--- a/docs/cli/sandbox.mdx
+++ b/docs/cli/sandbox.mdx
@@ -3,57 +3,62 @@ title: "Sandbox Management"
description: "Create, manage, and control sandbox lifecycles from the CLI"
---
-{/*
- TODO: Expand this stub into full content.
-
- GOAL: Guide-like page for sandbox lifecycle management from CLI.
- Teach patterns and workflows, not exhaustive flags.
-
- KEY NOTES:
- - Create-and-shell one-liner: oc shell $(oc create --json | jq -r '.sandboxID')
- - Hibernate/wake for cost savings
- - Filter running sandboxes with --json + jq
-*/}
-
## Creating a Sandbox
-{/* oc create (shortcut for oc sandbox create). Timeout, resources, env vars, metadata.
- Do not mention a --template flag unless the CLI grows one.
-*/}
+`oc create` (shortcut for `oc sandbox create`) provisions a new Firecracker microVM:
```bash
oc create
oc create --timeout 600 --cpu 2 --memory 2048 --env NODE_ENV=production
```
-## Listing & Inspecting
+The sandbox ID is printed on success. Use `--json` to capture it programmatically:
-{/* oc ls (shortcut). Table output. oc sandbox get for details. */}
+```bash
+ID=$(oc create --json | jq -r '.sandboxID')
+```
+
+## Listing & Inspecting
```bash
+# List all sandboxes
oc ls
+
+# Detailed info for a specific sandbox
oc sandbox get sb-abc123
```
+`oc ls` shows a table with ID, template, status, CPU, memory, and age. Add `--json` for machine-readable output.
+
## Hibernation & Wake
-{/* Save state and stop paying. Resume the same sandbox later; keep the wording practical rather than over-promising exact process continuity. */}
+Save state and stop paying for compute. Wake resumes the same sandbox — the platform attempts fast snapshot restore with a cold-boot fallback if needed.
```bash
oc sandbox hibernate sb-abc123
# ... hours later ...
oc sandbox wake sb-abc123
-oc shell sb-abc123 # picks up where you left off
+oc shell sb-abc123
```
+The sandbox keeps the same ID across hibernate/wake cycles. Preview URLs remain active.
+
## Adjusting Timeout
-{/* oc sandbox set-timeout. Rolling idle timeout resets on every operation. */}
+The idle timeout resets on every operation (exec, file access, agent activity). Default: 300s.
+
+```bash
+oc sandbox set-timeout sb-abc123 3600 # 1 hour
+```
## Killing a Sandbox
-{/* oc sandbox kill. Data lost unless checkpointed. */}
+```bash
+oc sandbox kill sb-abc123
+```
+
+All data is lost unless you've created a [checkpoint](/cli/checkpoint) first.
## Common Patterns
@@ -69,6 +74,12 @@ oc shell $(oc create --json | jq -r '.sandboxID')
oc ls --json | jq '.[] | select(.status == "running") | .sandboxID'
```
+### Batch Cleanup
+
+```bash
+oc ls --json | jq -r '.[].sandboxID' | xargs -I{} oc sandbox kill {}
+```
+
<Tip>
SDK usage: [Sandboxes](/sandboxes/overview). Full flags: [CLI Reference](/reference/cli#oc-sandbox).
</Tip>
diff --git a/docs/cli/shell.mdx b/docs/cli/shell.mdx
index 05dc0eae..0beafb9d 100644
--- a/docs/cli/shell.mdx
+++ b/docs/cli/shell.mdx
@@ -3,57 +3,61 @@ title: "Shell"
description: "Interactive terminal sessions from the CLI"
---
-{/*
- TODO: Expand this stub into full content.
-
- GOAL: Guide-like page for interactive shell sessions.
- What works (full-screen apps, colors, resizing), shell vs exec decision, tips.
-*/}
-
## Opening a Shell
-{/* oc shell <id>. Full interactive terminal over WebSocket. Ctrl+D or exit to disconnect. */}
-
```bash
oc shell sb-abc123
```
-## Choosing a Shell
+Opens a full interactive terminal over WebSocket. Press `Ctrl+D` or type `exit` to disconnect.
-{/* --shell flag. Default /bin/bash. */}
+## Choosing a Shell
```bash
oc shell sb-abc123 --shell /bin/zsh
```
+Default: `/bin/bash`.
+
## What Works
-{/* Full-screen apps, colors, tab completion, terminal resizing — everything you'd expect. */}
+The PTY supports everything you'd expect from a real terminal:
-- `vim`, `nano` — text editors
-- `top`, `htop` — process monitors
-- Tab completion, command history
-- Terminal resizing (automatic)
+- **Editors:** vim, nano
+- **Monitors:** top, htop
+- **Tab completion** and command history
+- **Colors** and ANSI escape codes
+- **Terminal resizing** — automatic, resize events forwarded
-## Shell vs Exec
+Full-screen applications like `tmux` and `less` work correctly.
-{/* When to use which. */}
+## Shell vs Exec
| Use Case | Command |
| --- | --- |
-| Run a single command, capture output | `oc exec` |
-| Scripting and automation | `oc exec` |
+| Run a single command, capture output | `oc exec --wait` |
+| Scripting and automation | `oc exec --wait --json` |
| Interactive development | `oc shell` |
| Debugging | `oc shell` |
## Tips
-### Create and Shell in One Line
+### Create and Shell In
```bash
oc shell $(oc create --json | jq -r '.sandboxID')
```
+### Shell with Custom Environment
+
+Set up the environment before shelling in:
+
+```bash
+ID=$(oc create --json | jq -r '.sandboxID')
+oc exec $ID --wait -- bash -c 'echo "export PATH=/app/bin:\$PATH" >> ~/.bashrc'
+oc shell $ID
+```
+
<Tip>
SDK usage: [Interactive Terminals](/sandboxes/interactive-terminals). Full flags: [CLI Reference](/reference/cli#oc-shell).
</Tip>
diff --git a/docs/guides/build-a-lovable-clone.mdx b/docs/guides/build-a-lovable-clone.mdx
index f9e2a05f..6ecbb625 100644
--- a/docs/guides/build-a-lovable-clone.mdx
+++ b/docs/guides/build-a-lovable-clone.mdx
@@ -3,12 +3,6 @@ title: "Build a Lovable Clone"
description: "Build an open-source AI app builder using OpenComputer sandboxes"
---
-{/*
- TODO (minor edits only — content is good):
- - Update any "Coming Soon" sections (some features now exist: agent sessions, checkpoints)
- - Ensure code examples use sandbox.exec (not sandbox.commands)
-*/}
-
In this guide you'll build a fully functional **Lovable clone** — an AI-powered web app builder where users describe an app in plain English and get a live, running React application in seconds. The entire project is open-source and uses OpenComputer sandboxes as the execution engine.
<CardGroup cols={2}>
@@ -105,7 +99,7 @@ const sandbox = await Sandbox.create({ template: "node", timeout: 600 });
await sandbox.files.write("/workspace/src/App.tsx", code);
// Run commands
-await sandbox.commands.run("cd /workspace && npm install");
+await sandbox.exec.run("cd /workspace && npm install");
// Get a public URL
const preview = await sandbox.createPreviewURL({ port: 80 });
@@ -171,14 +165,16 @@ This makes the deployment model practical for sharing prototypes and demos witho
- **Single-turn generation** — The current architecture doesn't support multi-turn conversations where Claude can iterate on its output based on build errors or user feedback.
- **No private link sharing** — Deploy URLs are either fully public or not accessible at all. There's no way to share a preview link with specific team members or collaborators behind authentication.
-### Coming Soon to OpenComputer
+### What's Changed Since This Guide Was Written
+
+Several features mentioned as limitations now exist in OpenComputer:
-OpenComputer is building features that directly address these limitations:
+- **In-sandbox agent loop** — [Agent sessions](/agents/overview) now run the Claude Agent SDK inside the sandbox. The agent reads files, runs commands, and iterates on errors locally without leaving the VM. This is the recommended approach for new projects.
+- **Preview URL authentication** — `authConfig` on [preview URLs](/sandboxes/preview-urls) supports restricting access. Not full private link sharing yet, but a step toward it.
+- **Checkpoints** — [Checkpoint and fork](/sandboxes/checkpoints) workflows are available for snapshotting sandbox state, restoring, and branching.
+- **Custom templates** — Build [custom templates](/sandboxes/templates) from Dockerfiles to skip setup time.
-- **Built-in git server** — Each sandbox will have a native git server, enabling checkpoint/restore workflows and git-based deployments. You'll be able to commit the sandbox state at any point, roll back to a previous commit, and deploy from a specific git ref.
-- **Secret sealing** — A secure mechanism for injecting secrets into sandboxes without exposing them in plain text. Sealed secrets will be encrypted at rest and only decrypted inside the sandbox at runtime, making it safe to pass API keys, database credentials, and other sensitive configuration.
-- **In-sandbox agent loop** — Instead of orchestrating the LLM from an external server (where every file write and command execution is a round-trip over the network), the agent loop will run _inside_ the sandbox itself. This dramatically reduces latency — the agent can read files, run commands, and iterate on errors locally without leaving the sandbox. It's also a simpler deployment model: you ship a single sandbox image with the agent baked in, rather than coordinating between an external server and a remote sandbox.
-- **Private link sharing** — The ability to share deploy preview URLs with specific people. You'll be able to grant access to individual team members or collaborators, so preview links aren't fully public but still don't require the recipient to have an OpenComputer account.
-- **Custom base images via SSH** — Instead of building templates solely from Dockerfiles, you'll be able to SSH into a running sandbox, install tools, configure files, and set up the environment exactly how you want it — then snapshot that sandbox as a base image. All future sandboxes created from that snapshot will start with your exact configuration pre-loaded, skipping lengthy setup steps like `npm install` or framework scaffolding.
+### Still Planned
-These additions will make it possible to build a production-grade app builder with full version history, secure secret handling, and robust deployment pipelines — all on top of OpenComputer sandboxes.
+- **Built-in git server** — Git-based version control for sandbox state
+- **Secret sealing** — Encrypted secrets decrypted only inside the sandbox at runtime
diff --git a/docs/introduction.mdx b/docs/introduction.mdx
index 658bfe90..695083ad 100644
--- a/docs/introduction.mdx
+++ b/docs/introduction.mdx
@@ -3,54 +3,25 @@ title: "Introduction"
description: "Cloud sandboxes for AI agents"
---
-{/*
- TODO: Expand this stub into full content.
-
- GOAL: Explain what OpenComputer is, who it's for, and why it exists.
- In 60 seconds a reader should know if this product is relevant.
-
- ABSORBS: Parts of old sdks/typescript/overview.mdx and sdks/python/overview.mdx (install sections).
-
- CHANGES FROM CURRENT:
- - Add install for CLI (link to cli/overview for full platform-specific install)
- - Pin env var name (OPENCOMPUTER_API_KEY)
- - Tighten copy — no filler
- - "Full Linux VM" card replaces "Run agent tasks easily" (redundant with Agent SDK card)
-*/}
-
-
-## What is OpenComputer
-
-{/* One-sentence tagline: cloud sandboxes for AI agents. 3-4 sentences explaining: what a sandbox is, how it differs from containers/serverless (persistent full Linux VM, hibernates, checkpoints). */}
-
-## Key Features
-
-{/* Feature cards (4):
- - Claude Agent SDK built in
- - Long-running (hours/days, not minutes)
- - Checkpoint/fork like git branches
- - Full Linux VM (not a container)
-*/}
+OpenComputer gives your AI agents a full Linux VM in the cloud. Each sandbox is an isolated Firecracker microVM with its own filesystem, network, and process space — persistent, long-running, and capable of hibernating when idle. Run Claude inside a sandbox and it can write files, install packages, run commands, and build complete projects autonomously.
<CardGroup cols={2}>
<Card title="Claude Agent SDK built in" icon="robot">
- {/* Agent runs inside VM with full filesystem and shell access */}
+ Claude runs inside the VM with full filesystem and shell access. Think → act → observe loop, streaming events back to your code.
</Card>
<Card title="Long-running" icon="clock">
- {/* Hours/days, not minutes. Install packages, build, test, iterate. */}
+ Hours or days, not minutes. Install packages, build projects, run test suites, iterate — no cold starts between steps.
</Card>
<Card title="Checkpoint & fork" icon="code-branch">
- {/* Named snapshots. Fork new sandboxes from any checkpoint. Like git branches for VMs. */}
+ Named snapshots you can fork from. Try five approaches in parallel from the same starting point — like git branches for VMs.
</Card>
<Card title="Full Linux VM" icon="server">
- {/* Not a container. Real VM with its own kernel, memory, disk. Hardware isolation via Firecracker. */}
+ Not a container. Real VM with its own kernel, memory, and disk. Hardware-level isolation via Firecracker — the same technology behind AWS Lambda.
</Card>
</CardGroup>
## Install
-{/* CodeGroup: npm / pip / CLI install commands. Set OPENCOMPUTER_API_KEY env var. */}
-
<CodeGroup>
```bash npm
@@ -62,7 +33,8 @@ pip install opencomputer-sdk
```
```bash CLI
-# See /cli/overview for the current install commands for your platform
+# See cli/overview for platform-specific install
+curl -fsSL https://github.com/diggerhq/opencomputer/releases/latest/download/oc-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') -o /usr/local/bin/oc && chmod +x /usr/local/bin/oc
```
</CodeGroup>
@@ -73,21 +45,52 @@ export OPENCOMPUTER_API_KEY=your-api-key
## Quick Example
-{/* Minimal: create sandbox -> run agent -> get result. TS + Python CodeGroup. Keep very short — quickstart has the full walkthrough. */}
+<CodeGroup>
+
+```typescript TypeScript
+import { Sandbox } from "@opencomputer/sdk";
+
+const sandbox = await Sandbox.create();
+const session = await sandbox.agent.start({
+ prompt: "Create a hello world Express app and test it",
+ onEvent: (event) => {
+ if (event.type === "assistant") console.log(event.message);
+ },
+});
+
+await session.done;
+await sandbox.kill();
+```
+
+```python Python
+from opencomputer import Sandbox
+
+sandbox = await Sandbox.create()
+session = await sandbox.agent.start(
+ prompt="Create a hello world Express app and test it",
+ on_event=lambda event: print(event.data.get("message", ""))
+ if event.type == "assistant" else None,
+)
+
+await session.wait()
+await sandbox.kill()
+```
+
+</CodeGroup>
## Next Steps
<CardGroup cols={2}>
<Card title="Quickstart" icon="rocket" href="/quickstart">
- {/* Working agent in 2 minutes */}
+ Working agent in 2 minutes
</Card>
<Card title="How It Works" icon="microchip" href="/how-it-works">
- {/* Architecture: Firecracker VMs, hibernation, checkpoints */}
+ Architecture: Firecracker VMs, hibernation, checkpoints
</Card>
<Card title="Agents" icon="robot" href="/agents/overview">
- {/* Run Claude inside sandboxes */}
+ Run Claude inside sandboxes
</Card>
<Card title="Sandboxes" icon="box" href="/sandboxes/overview">
- {/* The compute primitive */}
+ The compute primitive
</Card>
</CardGroup>
diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx
index cd13215f..ce36efcc 100644
--- a/docs/quickstart.mdx
+++ b/docs/quickstart.mdx
@@ -3,20 +3,9 @@ title: "Quickstart"
description: "Working agent in 2 minutes"
---
-{/*
- TODO: Expand this stub into full content.
-
- GOAL: Working agent in 2 minutes. One example, zero detours.
-
- CHANGES FROM CURRENT:
- - Single focused example instead of three
- - Fix Python quickstart (sandbox.commands.run → agent example)
- - Don't overload — link out to entity pages for depth
-*/}
-
## Prerequisites
-{/* API key + SDK installed (link to intro for install). */}
+An OpenComputer API key and the SDK installed. See [Introduction](/introduction) for install instructions.
```bash
export OPENCOMPUTER_API_KEY=your-api-key
@@ -24,39 +13,81 @@ export OPENCOMPUTER_API_KEY=your-api-key
## Run an Agent
-{/* Single example: create sandbox, agent.start() with a real task, stream events, print result.
- TS + Python CodeGroup. This is the ONLY example on this page.
- Python example must use sandbox.agent (NOT sandbox.commands). */}
-
<CodeGroup>
```typescript TypeScript
-// TODO: create sandbox -> agent.start() -> stream events -> print result -> kill
+import { Sandbox } from "@opencomputer/sdk";
+
+const sandbox = await Sandbox.create();
+
+const session = await sandbox.agent.start({
+ prompt: "Create a Next.js app with a landing page that says 'Hello from OpenComputer'. Run the dev server on port 3000.",
+ onEvent: (event) => {
+ if (event.type === "assistant") {
+ process.stdout.write(String(event.message ?? ""));
+ }
+ if (event.type === "result") {
+ console.log("\n\nResult:", JSON.stringify(event, null, 2));
+ }
+ },
+});
+
+const exitCode = await session.done;
+console.log("Agent finished with exit code:", exitCode);
+
+// Expose the dev server
+const preview = await sandbox.createPreviewURL({ port: 3000 });
+console.log("Preview:", `https://${preview.hostname}`);
+
+await sandbox.kill();
```
```python Python
-# TODO: create sandbox -> agent.start() -> collect_events() -> print result -> kill
+import asyncio
+from opencomputer import Sandbox
+
+async def main():
+ sandbox = await Sandbox.create()
+
+ session = await sandbox.agent.start(
+ prompt="Create a Next.js app with a landing page that says 'Hello from OpenComputer'. Run the dev server on port 3000.",
+ )
+
+ events = await session.collect_events()
+ for event in events:
+ if event.type == "assistant":
+ print(event.data.get("message", ""), end="")
+ if event.type == "result":
+ print("\n\nResult:", event.data)
+
+ # Expose the dev server
+ preview = await sandbox.create_preview_url(port=3000)
+ print("Preview:", f"https://{preview['hostname']}")
+
+ await sandbox.kill()
+
+asyncio.run(main())
```
</CodeGroup>
## What Just Happened
-{/* 2-3 sentences: you created a cloud VM (Firecracker microVM), Claude ran inside it with bash and file tools, worked autonomously, and streamed events back to your code. */}
+You created a cloud VM (Firecracker microVM), ran Claude inside it with bash and file tools, and Claude autonomously scaffolded a Next.js app, installed dependencies, and started the dev server. Events streamed back to your code in real-time over WebSocket. The preview URL exposes the running dev server to the internet.
## Next Steps
<CardGroup cols={2}>
<Card title="How It Works" icon="microchip" href="/how-it-works">
- {/* Architecture and technical decisions */}
+ Architecture and technical decisions
</Card>
<Card title="Agents" icon="robot" href="/agents/overview">
- {/* Events, tools, multi-turn conversations */}
+ Events, tools, multi-turn conversations
</Card>
<Card title="Sandboxes" icon="box" href="/sandboxes/overview">
- {/* Lifecycle, running commands, files */}
+ Lifecycle, running commands, files
</Card>
<Card title="Checkpoints" icon="code-branch" href="/sandboxes/checkpoints">
- {/* Snapshot and fork VMs */}
+ Snapshot and fork VMs
</Card>
</CardGroup>
diff --git a/docs/running-commands.mdx b/docs/running-commands.mdx
deleted file mode 100644
index 54591cc7..00000000
--- a/docs/running-commands.mdx
+++ /dev/null
@@ -1,207 +0,0 @@
----
-title: "Running Commands"
-description: "Execute shell commands inside a sandbox"
----
-
-The `Exec` module lets you run shell commands inside a sandbox. Access it via `sandbox.exec`.
-
-There are two ways to run commands:
-
-- **`sandbox.exec.run()`** — run a command and wait for it to finish (simple, synchronous)
-- **`sandbox.exec.start()`** — start a long-running command and stream its output (async, with callbacks)
-
-## Quick commands with `sandbox.exec.run`
-
-Run a shell command and get the result when it completes.
-
-<CodeGroup>
-
-```typescript TypeScript
-const result = await sandbox.exec.run('echo "Hello, World!"');
-
-console.log(result.stdout); // Hello, World!
-console.log(result.stderr); // (empty)
-console.log(result.exitCode); // 0
-```
-
-```python Python
-result = await sandbox.commands.run('echo "Hello, World!"')
-
-print(result.stdout) # Hello, World!
-print(result.stderr) # (empty)
-print(result.exit_code) # 0
-```
-
-</CodeGroup>
-
-### `sandbox.exec.run(command, opts?)`
-
-Executes a shell command and waits for it to complete.
-
-<ParamField body="command" type="string" required>
- The shell command to execute.
-</ParamField>
-
-<ParamField body="opts" type="RunOpts" optional>
- <Expandable title="properties">
- <ParamField body="timeout" type="number" default="60">
- Maximum execution time in seconds. The command is killed if it exceeds this.
- </ParamField>
- <ParamField body="env" type="Record<string, string>" optional>
- Additional environment variables for this command.
- </ParamField>
- <ParamField body="cwd" type="string" optional>
- Working directory for the command.
- </ParamField>
- </Expandable>
-</ParamField>
-
-**Returns:** `Promise<ProcessResult>`
-
-### ProcessResult
-
-| Field | Type | Description |
-| --- | --- | --- |
-| `exitCode` | `number` | Exit code of the process (0 = success) |
-| `stdout` | `string` | Standard output |
-| `stderr` | `string` | Standard error |
-
-### Examples
-
-```typescript
-// Run with a working directory
-const result = await sandbox.exec.run('ls -la', { cwd: '/app' });
-
-// Run with environment variables
-const result = await sandbox.exec.run('echo $MY_VAR', {
- env: { MY_VAR: 'hello' },
-});
-
-// Run with a timeout
-const result = await sandbox.exec.run('sleep 30', { timeout: 5 });
-
-// Chain commands
-const result = await sandbox.exec.run(
- 'cd /app && npm install && npm run build'
-);
-```
-
----
-
-## Async commands with `sandbox.exec.start`
-
-Start a long-running command and stream its output via callbacks. The command runs in the background and you get a session handle to interact with it.
-
-```typescript
-const session = await sandbox.exec.start("npm run dev", {
- cwd: "/app",
- onStdout: (data) => {
- console.log("stdout:", new TextDecoder().decode(data));
- },
- onStderr: (data) => {
- console.error("stderr:", new TextDecoder().decode(data));
- },
- onExit: (exitCode) => {
- console.log(`Process exited with code: ${exitCode}`);
- },
-});
-
-// Send input to the process
-session.sendStdin("some input\n");
-
-// Kill the process later
-await session.kill();
-
-// Or wait for it to finish
-const exitCode = await session.done;
-```
-
-### `sandbox.exec.start(command, opts?)`
-
-Starts a command and returns an interactive session.
-
-<ParamField body="command" type="string" required>
- The command to execute.
-</ParamField>
-
-<ParamField body="opts" type="ExecStartOpts" optional>
- <Expandable title="properties">
- <ParamField body="args" type="string[]" optional>
- Arguments to pass to the command.
- </ParamField>
- <ParamField body="env" type="Record<string, string>" optional>
- Additional environment variables.
- </ParamField>
- <ParamField body="cwd" type="string" optional>
- Working directory.
- </ParamField>
- <ParamField body="timeout" type="number" optional>
- Maximum execution time in seconds.
- </ParamField>
- <ParamField body="maxRunAfterDisconnect" type="number" optional>
- How long (in seconds) the process continues running after the WebSocket disconnects.
- </ParamField>
- <ParamField body="onStdout" type="(data: Uint8Array) => void" optional>
- Callback for stdout data.
- </ParamField>
- <ParamField body="onStderr" type="(data: Uint8Array) => void" optional>
- Callback for stderr data.
- </ParamField>
- <ParamField body="onExit" type="(exitCode: number) => void" optional>
- Callback when the process exits.
- </ParamField>
- </Expandable>
-</ParamField>
-
-**Returns:** `Promise<ExecSession>`
-
-### ExecSession
-
-| Property / Method | Type | Description |
-| --- | --- | --- |
-| `sessionId` | `string` | Unique session identifier |
-| `done` | `Promise<number>` | Resolves with the exit code when the process exits |
-| `sendStdin(data)` | `(data: string \| Uint8Array) => void` | Send input to the process |
-| `kill(signal?)` | `(signal?: number) => Promise<void>` | Kill the process |
-| `close()` | `() => void` | Close the WebSocket connection |
-
-### Examples
-
-#### Start a dev server and keep it running
-
-```typescript
-const devServer = await sandbox.exec.start("npm run dev", {
- cwd: "/app",
- onStdout: (data) => {
- const text = new TextDecoder().decode(data);
- if (text.includes("ready")) {
- console.log("Dev server is ready!");
- }
- },
-});
-
-// Do other work while the server runs...
-
-// Stop it when done
-await devServer.kill();
-```
-
-#### List running exec sessions
-
-```typescript
-const sessions = await sandbox.exec.list();
-for (const s of sessions) {
- console.log(`${s.sessionID} — ${s.command} — running: ${s.running}`);
-}
-```
-
-#### Attach to an existing session
-
-Reconnect to a running exec session by its ID:
-
-```typescript
-const session = await sandbox.exec.attach("session-id", {
- onStdout: (data) => console.log(new TextDecoder().decode(data)),
- onExit: (code) => console.log(`Exited: ${code}`),
-});
-```
diff --git a/docs/sdks/python/checkpoints.mdx b/docs/sdks/python/checkpoints.mdx
deleted file mode 100644
index ca826290..00000000
--- a/docs/sdks/python/checkpoints.mdx
+++ /dev/null
@@ -1,77 +0,0 @@
----
-title: "Checkpoints"
-description: "Snapshot, fork, and restore sandboxes"
----
-
-Checkpoints capture a sandbox's full state (filesystem + memory). Fork new sandboxes from any checkpoint, or restore a sandbox to a previous point in time.
-
-## Create a Checkpoint
-
-```python
-checkpoint = await sandbox.create_checkpoint("my-checkpoint")
-# {"id": "uuid", "name": "my-checkpoint", "status": "processing"}
-```
-
-### `await sandbox.create_checkpoint(name)`
-
-<ParamField body="name" type="str" required>
- A name for this checkpoint.
-</ParamField>
-
-**Returns:** `dict` — status transitions from `"processing"` to `"ready"` once the snapshot is uploaded.
-
-## List Checkpoints
-
-```python
-checkpoints = await sandbox.list_checkpoints()
-```
-
-**Returns:** `list[dict]`
-
-## Fork from a Checkpoint
-
-Create a new sandbox from a checkpoint. The new sandbox boots with the checkpointed filesystem state.
-
-```python
-fork = await Sandbox.create_from_checkpoint(
- checkpoint["id"],
- timeout=600,
-)
-
-result = await fork.commands.run("cat /root/data.txt")
-```
-
-### `Sandbox.create_from_checkpoint(checkpoint_id, **kwargs)`
-
-<ParamField body="checkpoint_id" type="str" required>
- UUID of the checkpoint to fork from.
-</ParamField>
-<ParamField body="timeout" type="int" default="300">
- Sandbox TTL in seconds.
-</ParamField>
-<ParamField body="api_key" type="str | None" default="None">
- API key override.
-</ParamField>
-<ParamField body="api_url" type="str | None" default="None">
- API URL override.
-</ParamField>
-
-**Returns:** `Sandbox`
-
-## Restore a Checkpoint
-
-Revert a running sandbox to a previous checkpoint. The VM reboots with the checkpointed drives.
-
-```python
-await sandbox.restore_checkpoint(checkpoint["id"])
-```
-
-**Returns:** `None`
-
-## Delete a Checkpoint
-
-```python
-await sandbox.delete_checkpoint(checkpoint["id"])
-```
-
-**Returns:** `None`
diff --git a/docs/sdks/python/commands.mdx b/docs/sdks/python/commands.mdx
deleted file mode 100644
index f338b547..00000000
--- a/docs/sdks/python/commands.mdx
+++ /dev/null
@@ -1,87 +0,0 @@
----
-title: "Commands"
-description: "Execute shell commands inside a sandbox"
----
-
-The `Commands` module lets you run shell commands inside a sandbox and capture their output. Access it via `sandbox.commands`.
-
-## Running a Command
-
-```python
-result = await sandbox.commands.run('echo "Hello, World!"')
-
-print(result.stdout) # Hello, World!
-print(result.stderr) # (empty)
-print(result.exit_code) # 0
-```
-
-### `await sandbox.commands.run(command, **kwargs)`
-
-Executes a shell command and waits for it to complete.
-
-<ParamField body="command" type="str" required>
- The shell command to execute.
-</ParamField>
-<ParamField body="timeout" type="int" default="60">
- Maximum execution time in seconds. The command is killed if it exceeds this.
-</ParamField>
-<ParamField body="env" type="dict[str, str] | None" default="None">
- Additional environment variables for this command.
-</ParamField>
-<ParamField body="cwd" type="str | None" default="None">
- Working directory for the command.
-</ParamField>
-
-**Returns:** `ProcessResult`
-
-## ProcessResult
-
-`ProcessResult` is a dataclass with the following fields:
-
-| Field | Type | Description |
-| --- | --- | --- |
-| `exit_code` | `int` | Exit code of the process (0 = success) |
-| `stdout` | `str` | Standard output |
-| `stderr` | `str` | Standard error |
-
-## Examples
-
-### Run with a Custom Working Directory
-
-```python
-result = await sandbox.commands.run('ls -la', cwd='/app')
-```
-
-### Run with Environment Variables
-
-```python
-result = await sandbox.commands.run(
- 'echo $MY_VAR',
- env={'MY_VAR': 'hello'},
-)
-print(result.stdout) # hello
-```
-
-### Run with a Timeout
-
-```python
-result = await sandbox.commands.run('sleep 30', timeout=5)
-print(result.exit_code) # non-zero (killed)
-```
-
-### Check for Errors
-
-```python
-result = await sandbox.commands.run('python3 script.py')
-
-if result.exit_code != 0:
- print(f"Command failed: {result.stderr}")
-```
-
-### Chain Commands
-
-```python
-result = await sandbox.commands.run(
- 'cd /app && pip install -r requirements.txt && python3 main.py'
-)
-```
diff --git a/docs/sdks/python/filesystem.mdx b/docs/sdks/python/filesystem.mdx
deleted file mode 100644
index 53175047..00000000
--- a/docs/sdks/python/filesystem.mdx
+++ /dev/null
@@ -1,159 +0,0 @@
----
-title: "Filesystem"
-description: "Read, write, and manage files inside a sandbox"
----
-
-The `Filesystem` module provides full file I/O within a sandbox. Access it via `sandbox.files`.
-
-## Reading Files
-
-### `await sandbox.files.read(path)`
-
-Reads a file as a UTF-8 string.
-
-```python
-content = await sandbox.files.read('/app/config.json')
-config = json.loads(content)
-```
-
-<ParamField body="path" type="str" required>
- Absolute path to the file.
-</ParamField>
-
-**Returns:** `str`
-
-### `await sandbox.files.read_bytes(path)`
-
-Reads a file as raw bytes.
-
-```python
-data = await sandbox.files.read_bytes('/app/image.png')
-print(f"File size: {len(data)} bytes")
-```
-
-<ParamField body="path" type="str" required>
- Absolute path to the file.
-</ParamField>
-
-**Returns:** `bytes`
-
-## Writing Files
-
-### `await sandbox.files.write(path, content)`
-
-Writes a string or bytes to a file. Creates parent directories if needed.
-
-```python
-# Write text
-await sandbox.files.write('/app/hello.txt', 'Hello, World!')
-
-# Write binary
-await sandbox.files.write('/app/data.bin', b'\x00\x01\x02')
-```
-
-<ParamField body="path" type="str" required>
- Absolute path to the file.
-</ParamField>
-<ParamField body="content" type="str | bytes" required>
- File content to write.
-</ParamField>
-
-**Returns:** `None`
-
-## Listing Directories
-
-### `await sandbox.files.list(path)`
-
-Lists the contents of a directory.
-
-```python
-entries = await sandbox.files.list('/app')
-
-for entry in entries:
- kind = 'd' if entry.is_dir else 'f'
- print(f"{kind} {entry.name} ({entry.size} bytes)")
-```
-
-<ParamField body="path" type="str" default="/">
- Directory path to list.
-</ParamField>
-
-**Returns:** `list[EntryInfo]`
-
-### EntryInfo
-
-`EntryInfo` is a dataclass:
-
-| Field | Type | Description |
-| --- | --- | --- |
-| `name` | `str` | File or directory name |
-| `is_dir` | `bool` | `True` if this entry is a directory |
-| `path` | `str` | Full path to the entry |
-| `size` | `int` | Size in bytes (0 for directories) |
-
-## Managing Files and Directories
-
-### `await sandbox.files.make_dir(path)`
-
-Creates a directory and any necessary parent directories.
-
-```python
-await sandbox.files.make_dir('/app/src/components')
-```
-
-<ParamField body="path" type="str" required>
- Directory path to create.
-</ParamField>
-
-**Returns:** `None`
-
-### `await sandbox.files.remove(path)`
-
-Deletes a file or directory.
-
-```python
-await sandbox.files.remove('/app/temp.txt')
-```
-
-<ParamField body="path" type="str" required>
- Path to remove.
-</ParamField>
-
-**Returns:** `None`
-
-### `await sandbox.files.exists(path)`
-
-Checks whether a file or directory exists.
-
-```python
-if await sandbox.files.exists('/app/requirements.txt'):
- print('Python project detected')
-```
-
-<ParamField body="path" type="str" required>
- Path to check.
-</ParamField>
-
-**Returns:** `bool`
-
-## Examples
-
-### Upload and Run a Script
-
-```python
-await sandbox.files.write('/tmp/setup.sh', """#!/bin/bash
-echo "Running setup..."
-apt-get update -qq
-echo "Done!"
-""")
-
-result = await sandbox.commands.run('bash /tmp/setup.sh')
-print(result.stdout)
-```
-
-### Copy Files Between Paths
-
-```python
-content = await sandbox.files.read_bytes('/app/original.dat')
-await sandbox.files.write('/backup/original.dat', content)
-```
diff --git a/docs/sdks/python/overview.mdx b/docs/sdks/python/overview.mdx
deleted file mode 100644
index e835e53f..00000000
--- a/docs/sdks/python/overview.mdx
+++ /dev/null
@@ -1,68 +0,0 @@
----
-title: "Python SDK"
-description: "Full reference for the OpenComputer Python SDK"
----
-
-## Installation
-
-```bash
-pip install opencomputer-sdk
-```
-
-**Requirements:** Python 3.10+
-
-**Dependencies:** `httpx>=0.27.0`, `websockets>=12.0`
-
-## Overview
-
-The Python SDK is fully async and provides the same modules as the TypeScript SDK:
-
-| Module | Access | Purpose |
-| --- | --- | --- |
-| [Sandbox](/sdks/python/sandbox) | `Sandbox.create()` | Create, connect to, and manage sandboxes |
-| [Commands](/sdks/python/commands) | `sandbox.commands` | Execute shell commands |
-| [Filesystem](/sdks/python/filesystem) | `sandbox.files` | Read, write, and manage files |
-| [PTY](/sdks/python/pty) | `sandbox.pty` | Interactive terminal sessions |
-| [Templates](/sdks/python/templates) | `Template(api_url, api_key)` | Build and manage container templates |
-
-## Quick Example
-
-```python
-import asyncio
-from opencomputer import Sandbox
-
-async def main():
- sandbox = await Sandbox.create(template='default')
-
- # Run a command
- result = await sandbox.commands.run('python3 --version')
- print(result.stdout)
-
- # Work with files
- await sandbox.files.write('/app/main.py', 'print("hello")')
- output = await sandbox.commands.run('python3 /app/main.py')
- print(output.stdout) # hello
-
- await sandbox.kill()
- await sandbox.close()
-
-asyncio.run(main())
-```
-
-<Note>
- All SDK operations are async. Call `await sandbox.kill()` to stop the sandbox and `await sandbox.close()` to clean up the HTTP client.
-</Note>
-
-## Exports
-
-```python
-from opencomputer import (
- Sandbox,
- Filesystem,
- Commands,
- ProcessResult,
- Pty,
- PtySession,
- Template,
-)
-```
diff --git a/docs/sdks/python/patches.mdx b/docs/sdks/python/patches.mdx
deleted file mode 100644
index 5a2fc664..00000000
--- a/docs/sdks/python/patches.mdx
+++ /dev/null
@@ -1,78 +0,0 @@
----
-title: "Patches"
-description: "Rolling updates for forked sandboxes"
----
-
-Patches attach bash scripts to a checkpoint. When a sandbox boots from that checkpoint or wakes from hibernation, all pending patches run automatically in sequence order.
-
-## Create a Patch
-
-```python
-result = await Sandbox.create_checkpoint_patch(
- checkpoint["id"],
- script="pip install requests==2.31.0",
- description="Pin requests version",
-)
-
-print(result["patch"]["sequence"]) # 1
-```
-
-### `Sandbox.create_checkpoint_patch(checkpoint_id, script, **kwargs)`
-
-<ParamField body="checkpoint_id" type="str" required>
- UUID of the checkpoint to patch.
-</ParamField>
-<ParamField body="script" type="str" required>
- Bash script to execute inside the sandbox.
-</ParamField>
-<ParamField body="description" type="str" default="''">
- Human-readable description.
-</ParamField>
-<ParamField body="api_key" type="str | None" default="None">
- API key override.
-</ParamField>
-<ParamField body="api_url" type="str | None" default="None">
- API URL override.
-</ParamField>
-
-**Returns:** `dict`
-
-## List Patches
-
-```python
-patches = await Sandbox.list_checkpoint_patches(checkpoint["id"])
-# [{"id": "...", "sequence": 1, "script": "...", "description": "..."}, ...]
-```
-
-### `Sandbox.list_checkpoint_patches(checkpoint_id, **kwargs)`
-
-**Returns:** `list[dict]` — ordered by sequence number.
-
-## Delete a Patch
-
-Remove a bad or unwanted patch. Remaining patches continue to apply in sequence order.
-
-```python
-await Sandbox.delete_checkpoint_patch(checkpoint["id"], patch["id"])
-```
-
-### `Sandbox.delete_checkpoint_patch(checkpoint_id, patch_id, **kwargs)`
-
-<ParamField body="checkpoint_id" type="str" required>
- UUID of the checkpoint.
-</ParamField>
-<ParamField body="patch_id" type="str" required>
- UUID of the patch to delete.
-</ParamField>
-
-**Returns:** `None`
-
-## How Patches Apply
-
-| Event | Patches run? |
-| --- | --- |
-| `Sandbox.create_from_checkpoint()` | Yes — after boot |
-| `await sandbox.wake()` | Yes — after restore |
-| Sandbox already running | No — next wake/boot |
-
-Patches run sequentially by sequence number. If a patch fails (non-zero exit), the chain stops. Progress is tracked per-sandbox, so the next wake retries from the last successful patch.
diff --git a/docs/sdks/python/pty.mdx b/docs/sdks/python/pty.mdx
deleted file mode 100644
index a824259e..00000000
--- a/docs/sdks/python/pty.mdx
+++ /dev/null
@@ -1,81 +0,0 @@
----
-title: "PTY"
-description: "Interactive terminal sessions inside a sandbox"
----
-
-The `Pty` module provides interactive pseudo-terminal (PTY) sessions over WebSocket. Access it via `sandbox.pty`.
-
-## Creating a PTY Session
-
-```python
-session = await sandbox.pty.create(
- cols=120,
- rows=40,
- on_output=lambda data: print(data.decode(), end=''),
-)
-```
-
-### `await sandbox.pty.create(**kwargs)`
-
-Opens a new interactive terminal session.
-
-<ParamField body="cols" type="int" default="80">
- Terminal width in columns.
-</ParamField>
-<ParamField body="rows" type="int" default="24">
- Terminal height in rows.
-</ParamField>
-<ParamField body="on_output" type="Callable[[bytes], None] | None" default="None">
- Callback invoked when the terminal produces output.
-</ParamField>
-
-**Returns:** `PtySession`
-
-## PtySession
-
-`PtySession` is a dataclass with the following interface:
-
-| Property / Method | Type | Description |
-| --- | --- | --- |
-| `session_id` | `str` | Unique session identifier |
-| `sandbox_id` | `str` | ID of the parent sandbox |
-| `send(data)` | `async (str \| bytes) -> None` | Send input to the terminal |
-| `recv()` | `async () -> bytes` | Receive output from the terminal |
-| `close()` | `async () -> None` | Close the PTY session |
-
-## Examples
-
-### Run an Interactive Command
-
-```python
-session = await sandbox.pty.create(
- on_output=lambda data: print(data.decode(), end=''),
-)
-
-# Type a command
-await session.send('ls -la\n')
-
-# Wait for output
-import asyncio
-await asyncio.sleep(2)
-
-await session.close()
-```
-
-### Manual Receive Loop
-
-```python
-session = await sandbox.pty.create()
-
-await session.send('echo "hello"\n')
-
-# Read output manually
-data = await session.recv()
-print(data.decode())
-
-await session.close()
-```
-
-<Note>
- PTY sessions use WebSocket connections under the hood. Each session maintains a persistent connection to the sandbox worker.
-</Note>
diff --git a/docs/sdks/python/sandbox.mdx b/docs/sdks/python/sandbox.mdx
deleted file mode 100644
index ebab2920..00000000
--- a/docs/sdks/python/sandbox.mdx
+++ /dev/null
@@ -1,138 +0,0 @@
----
-title: "Sandbox"
-description: "Create, connect to, and manage sandbox lifecycles"
----
-
-The `Sandbox` class is the main entry point to OpenComputer. It supports both manual lifecycle management and async context managers.
-
-## Creating a Sandbox
-
-```python
-from opencomputer import Sandbox
-
-sandbox = await Sandbox.create(
- template='default',
- timeout=300,
- envs={'NODE_ENV': 'production'},
- metadata={'owner': 'my-agent'},
-)
-```
-
-### `Sandbox.create(**kwargs)`
-
-Creates a new sandbox and returns a connected `Sandbox` instance.
-
-<ParamField body="template" type="str" default="default">
- Container template to use.
-</ParamField>
-<ParamField body="timeout" type="int" default="300">
- Sandbox time-to-live in seconds.
-</ParamField>
-<ParamField body="api_key" type="str | None" default="None">
- API key. Falls back to `OPENCOMPUTER_API_KEY` env var.
-</ParamField>
-<ParamField body="api_url" type="str | None" default="None">
- API base URL. Falls back to `OPENCOMPUTER_API_URL` env var, then `https://app.opencomputer.dev`.
-</ParamField>
-<ParamField body="envs" type="dict[str, str] | None" default="None">
- Environment variables injected into the sandbox.
-</ParamField>
-<ParamField body="metadata" type="dict[str, str] | None" default="None">
- Arbitrary key-value metadata attached to the sandbox.
-</ParamField>
-
-**Returns:** `Sandbox`
-
-## Usage
-
-```python
-sandbox = await Sandbox.create(template='default')
-result = await sandbox.commands.run('echo "hello"')
-print(result.stdout)
-await sandbox.kill()
-```
-
-## Connecting to an Existing Sandbox
-
-```python
-sandbox = await Sandbox.connect(
- 'sandbox-abc123',
- api_key='sk-...',
-)
-```
-
-### `Sandbox.connect(sandbox_id, **kwargs)`
-
-Connects to a running sandbox by ID.
-
-<ParamField body="sandbox_id" type="str" required>
- The ID of the sandbox to connect to.
-</ParamField>
-<ParamField body="api_key" type="str | None" default="None">
- API key override.
-</ParamField>
-<ParamField body="api_url" type="str | None" default="None">
- API URL override.
-</ParamField>
-
-**Returns:** `Sandbox`
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| `sandbox_id` | `str` | Unique identifier for the sandbox |
-| `domain` | `str` | Public domain for the sandbox (e.g. `abc123.workers.opencomputer.dev`). HTTP traffic to this domain is routed directly into the sandbox. |
-| `status` | `str` | Current status: `"running"`, `"stopped"`, or `"error"` |
-| `template` | `str` | Template used to create the sandbox |
-| `files` | `Filesystem` | [Filesystem](/sdks/python/filesystem) operations |
-| `commands` | `Commands` | [Command](/sdks/python/commands) execution |
-| `pty` | `Pty` | [PTY](/sdks/python/pty) terminal access |
-
-## Instance Methods
-
-### `await sandbox.kill()`
-
-Stops and destroys the sandbox.
-
-```python
-await sandbox.kill()
-```
-
-**Returns:** `None`
-
-### `await sandbox.is_running()`
-
-Checks if the sandbox is still alive.
-
-```python
-if not await sandbox.is_running():
- print('Sandbox has stopped')
-```
-
-**Returns:** `bool`
-
-### `await sandbox.set_timeout(timeout)`
-
-Updates the sandbox timeout. Resets the TTL countdown.
-
-```python
-# Extend for another 10 minutes
-await sandbox.set_timeout(600)
-```
-
-<ParamField body="timeout" type="int" required>
- New timeout in seconds.
-</ParamField>
-
-**Returns:** `None`
-
-### `sandbox.close()`
-
-Closes the underlying HTTP client connections without killing the sandbox.
-
-```python
-sandbox.close()
-```
-
-**Returns:** `None`
diff --git a/docs/sdks/python/templates.mdx b/docs/sdks/python/templates.mdx
deleted file mode 100644
index e683bb3f..00000000
--- a/docs/sdks/python/templates.mdx
+++ /dev/null
@@ -1,108 +0,0 @@
----
-title: "Templates"
-description: "Build and manage reusable sandbox templates"
----
-
-Templates let you create reusable sandbox images from Dockerfiles. Pre-install languages, tools, and dependencies so your sandboxes start ready to go.
-
-## Building a Template
-
-```python
-from opencomputer import Template
-
-templates = Template(api_url, api_key)
-
-template = await templates.build('python-ml', """
-FROM ubuntu:22.04
-RUN apt-get update && apt-get install -y python3 python3-pip
-RUN pip3 install numpy pandas scikit-learn
-""")
-
-print(template.template_id) # tpl-abc123
-print(template.status) # building → ready
-```
-
-### `await templates.build(name, dockerfile)`
-
-Builds a new template from a Dockerfile.
-
-<ParamField body="name" type="str" required>
- A unique name for the template.
-</ParamField>
-<ParamField body="dockerfile" type="str" required>
- The Dockerfile content to build from.
-</ParamField>
-
-**Returns:** `TemplateInfo`
-
-## Listing Templates
-
-```python
-all_templates = await templates.list()
-
-for t in all_templates:
- print(f"{t.name} ({t.tag}) — {t.status}")
-```
-
-### `await templates.list()`
-
-Returns all templates.
-
-**Returns:** `list[TemplateInfo]`
-
-## Getting a Template
-
-```python
-template = await templates.get('python-ml')
-print(template)
-```
-
-### `await templates.get(name)`
-
-Gets a template by name.
-
-<ParamField body="name" type="str" required>
- Template name.
-</ParamField>
-
-**Returns:** `TemplateInfo`
-
-## Deleting a Template
-
-```python
-await templates.delete('python-ml')
-```
-
-### `await templates.delete(name)`
-
-Deletes a template by name.
-
-<ParamField body="name" type="str" required>
- Template name to delete.
-</ParamField>
-
-**Returns:** `None`
-
-## TemplateInfo
-
-`TemplateInfo` is a dataclass:
-
-| Field | Type | Description |
-| --- | --- | --- |
-| `template_id` | `str` | Unique template identifier |
-| `name` | `str` | Template name |
-| `tag` | `str` | Image tag |
-| `status` | `str` | Build status: `"building"`, `"ready"`, `"error"` |
-
-## Using a Template
-
-Once built, pass the template name when creating a sandbox:
-
-```python
-sandbox = await Sandbox.create(template='python-ml')
-result = await sandbox.commands.run(
- 'python3 -c "import numpy; print(numpy.__version__)"'
-)
-print(result.stdout) # 1.24.0
-await sandbox.kill()
-```
diff --git a/docs/sdks/typescript/checkpoints.mdx b/docs/sdks/typescript/checkpoints.mdx
deleted file mode 100644
index 89b2d4b2..00000000
--- a/docs/sdks/typescript/checkpoints.mdx
+++ /dev/null
@@ -1,80 +0,0 @@
----
-title: "Checkpoints"
-description: "Snapshot, fork, and restore sandboxes"
----
-
-Checkpoints capture a sandbox's full state (filesystem + memory). Fork new sandboxes from any checkpoint, or restore a sandbox to a previous point in time.
-
-## Create a Checkpoint
-
-```typescript
-const checkpoint = await sandbox.createCheckpoint("my-checkpoint");
-// { id: "uuid", name: "my-checkpoint", status: "processing" }
-```
-
-### `sandbox.createCheckpoint(name)`
-
-<ParamField body="name" type="string" required>
- A name for this checkpoint.
-</ParamField>
-
-**Returns:** `Promise<CheckpointInfo>` — status transitions from `"processing"` to `"ready"` once the snapshot is uploaded.
-
-## List Checkpoints
-
-```typescript
-const checkpoints = await sandbox.listCheckpoints();
-```
-
-**Returns:** `Promise<CheckpointInfo[]>`
-
-## Fork from a Checkpoint
-
-Create a new sandbox from a checkpoint. The new sandbox boots with the checkpointed filesystem state.
-
-```typescript
-const fork = await Sandbox.createFromCheckpoint(checkpoint.id, {
- timeout: 600,
-});
-
-const result = await fork.commands.run("cat /root/data.txt");
-```
-
-### `Sandbox.createFromCheckpoint(checkpointId, opts?)`
-
-<ParamField body="checkpointId" type="string" required>
- UUID of the checkpoint to fork from.
-</ParamField>
-<ParamField body="opts" type="object" optional>
- <Expandable title="properties">
- <ParamField body="timeout" type="number" default="300">
- Sandbox TTL in seconds.
- </ParamField>
- <ParamField body="apiKey" type="string" optional>
- API key override.
- </ParamField>
- <ParamField body="apiUrl" type="string" optional>
- API URL override.
- </ParamField>
- </Expandable>
-</ParamField>
-
-**Returns:** `Promise<Sandbox>`
-
-## Restore a Checkpoint
-
-Revert a running sandbox to a previous checkpoint. The VM reboots with the checkpointed drives.
-
-```typescript
-await sandbox.restoreCheckpoint(checkpoint.id);
-```
-
-**Returns:** `Promise<void>`
-
-## Delete a Checkpoint
-
-```typescript
-await sandbox.deleteCheckpoint(checkpoint.id);
-```
-
-**Returns:** `Promise<void>`
diff --git a/docs/sdks/typescript/commands.mdx b/docs/sdks/typescript/commands.mdx
deleted file mode 100644
index 45fc37c9..00000000
--- a/docs/sdks/typescript/commands.mdx
+++ /dev/null
@@ -1,94 +0,0 @@
----
-title: "Commands"
-description: "Execute shell commands inside a sandbox"
----
-
-The `Commands` module lets you run shell commands inside a sandbox and capture their output. Access it via `sandbox.commands`.
-
-## Running a Command
-
-```typescript
-const result = await sandbox.commands.run('echo "Hello, World!"');
-
-console.log(result.stdout); // Hello, World!
-console.log(result.stderr); // (empty)
-console.log(result.exitCode); // 0
-```
-
-### `sandbox.commands.run(command, opts?)`
-
-Executes a shell command and waits for it to complete.
-
-<ParamField body="command" type="string" required>
- The shell command to execute.
-</ParamField>
-
-<ParamField body="opts" type="RunOpts" optional>
- <Expandable title="properties">
- <ParamField body="timeout" type="number" optional>
- Maximum execution time in seconds. The command is killed if it exceeds this.
- </ParamField>
- <ParamField body="env" type="Record<string, string>" optional>
- Additional environment variables for this command.
- </ParamField>
- <ParamField body="cwd" type="string" optional>
- Working directory for the command.
- </ParamField>
- </Expandable>
-</ParamField>
-
-**Returns:** `Promise<ProcessResult>`
-
-## ProcessResult
-
-| Field | Type | Description |
-| --- | --- | --- |
-| `exitCode` | `number` | Exit code of the process (0 = success) |
-| `stdout` | `string` | Standard output |
-| `stderr` | `string` | Standard error |
-
-## Examples
-
-### Run with a Custom Working Directory
-
-```typescript
-const result = await sandbox.commands.run('ls -la', {
- cwd: '/app',
-});
-```
-
-### Run with Environment Variables
-
-```typescript
-const result = await sandbox.commands.run('echo $MY_VAR', {
- env: { MY_VAR: 'hello' },
-});
-console.log(result.stdout); // hello
-```
-
-### Run with a Timeout
-
-```typescript
-const result = await sandbox.commands.run('sleep 30', {
- timeout: 5, // kill after 5 seconds
-});
-console.log(result.exitCode); // non-zero (killed)
-```
-
-### Check for Errors
-
-```typescript
-const result = await sandbox.commands.run('python3 script.py');
-
-if (result.exitCode !== 0) {
- console.error(`Command failed: ${result.stderr}`);
-}
-```
-
-### Chain Commands
-
-```typescript
-const result = await sandbox.commands.run(
- 'cd /app && npm install && npm run build'
-);
-```
diff --git a/docs/sdks/typescript/filesystem.mdx b/docs/sdks/typescript/filesystem.mdx
deleted file mode 100644
index d4155c93..00000000
--- a/docs/sdks/typescript/filesystem.mdx
+++ /dev/null
@@ -1,159 +0,0 @@
----
-title: "Filesystem"
-description: "Read, write, and manage files inside a sandbox"
----
-
-The `Filesystem` module provides full file I/O within a sandbox. Access it via `sandbox.files`.
-
-## Reading Files
-
-### `sandbox.files.read(path)`
-
-Reads a file as a UTF-8 string.
-
-```typescript
-const content = await sandbox.files.read('/app/config.json');
-const config = JSON.parse(content);
-```
-
-<ParamField body="path" type="string" required>
- Absolute path to the file.
-</ParamField>
-
-**Returns:** `Promise<string>`
-
-### `sandbox.files.readBytes(path)`
-
-Reads a file as raw bytes.
-
-```typescript
-const bytes = await sandbox.files.readBytes('/app/image.png');
-console.log(`File size: ${bytes.length} bytes`);
-```
-
-<ParamField body="path" type="string" required>
- Absolute path to the file.
-</ParamField>
-
-**Returns:** `Promise<Uint8Array>`
-
-## Writing Files
-
-### `sandbox.files.write(path, content)`
-
-Writes a string or binary content to a file. Creates parent directories if needed.
-
-```typescript
-// Write text
-await sandbox.files.write('/app/hello.txt', 'Hello, World!');
-
-// Write binary
-const encoder = new TextEncoder();
-await sandbox.files.write('/app/data.bin', encoder.encode('binary data'));
-```
-
-<ParamField body="path" type="string" required>
- Absolute path to the file.
-</ParamField>
-<ParamField body="content" type="string | Uint8Array" required>
- File content to write.
-</ParamField>
-
-**Returns:** `Promise<void>`
-
-## Listing Directories
-
-### `sandbox.files.list(path?)`
-
-Lists the contents of a directory.
-
-```typescript
-const entries = await sandbox.files.list('/app');
-
-for (const entry of entries) {
- console.log(`${entry.isDir ? 'DIR ' : 'FILE'} ${entry.name} (${entry.size} bytes)`);
-}
-```
-
-<ParamField body="path" type="string" default="/">
- Directory path to list.
-</ParamField>
-
-**Returns:** `Promise<EntryInfo[]>`
-
-### EntryInfo
-
-| Field | Type | Description |
-| --- | --- | --- |
-| `name` | `string` | File or directory name |
-| `isDir` | `boolean` | `true` if this entry is a directory |
-| `path` | `string` | Full path to the entry |
-| `size` | `number` | Size in bytes (0 for directories) |
-
-## Managing Files and Directories
-
-### `sandbox.files.makeDir(path)`
-
-Creates a directory and any necessary parent directories.
-
-```typescript
-await sandbox.files.makeDir('/app/src/components');
-```
-
-<ParamField body="path" type="string" required>
- Directory path to create.
-</ParamField>
-
-**Returns:** `Promise<void>`
-
-### `sandbox.files.remove(path)`
-
-Deletes a file or directory.
-
-```typescript
-await sandbox.files.remove('/app/temp.txt');
-```
-
-<ParamField body="path" type="string" required>
- Path to remove.
-</ParamField>
-
-**Returns:** `Promise<void>`
-
-### `sandbox.files.exists(path)`
-
-Checks whether a file or directory exists.
-
-```typescript
-if (await sandbox.files.exists('/app/package.json')) {
- console.log('Node.js project detected');
-}
-```
-
-<ParamField body="path" type="string" required>
- Path to check.
-</ParamField>
-
-**Returns:** `Promise<boolean>`
-
-## Examples
-
-### Upload and Run a Script
-
-```typescript
-await sandbox.files.write('/tmp/script.sh', `#!/bin/bash
-echo "Running setup..."
-apt-get update -qq
-echo "Done!"
-`);
-
-const result = await sandbox.commands.run('bash /tmp/script.sh');
-console.log(result.stdout);
-```
-
-### Copy Files Between Paths
-
-```typescript
-const content = await sandbox.files.readBytes('/app/original.dat');
-await sandbox.files.write('/backup/original.dat', content);
-```
diff --git a/docs/sdks/typescript/overview.mdx b/docs/sdks/typescript/overview.mdx
deleted file mode 100644
index bfb9dafa..00000000
--- a/docs/sdks/typescript/overview.mdx
+++ /dev/null
@@ -1,75 +0,0 @@
----
-title: "TypeScript SDK"
-description: "Full reference for the OpenComputer TypeScript/JavaScript SDK"
----
-
-## Installation
-
-```bash
-npm install @opencomputer/sdk
-```
-
-## Overview
-
-The TypeScript SDK provides five main modules:
-
-| Module | Access | Purpose |
-| --- | --- | --- |
-| [Sandbox](/sdks/typescript/sandbox) | `Sandbox.create()` | Create, connect to, and manage sandboxes |
-| [Commands](/sdks/typescript/commands) | `sandbox.commands` | Execute shell commands |
-| [Filesystem](/sdks/typescript/filesystem) | `sandbox.files` | Read, write, and manage files |
-| [PTY](/sdks/typescript/pty) | `sandbox.pty` | Interactive terminal sessions |
-| [Templates](/sdks/typescript/templates) | `new Templates(apiUrl, apiKey)` | Build and manage container templates |
-
-## Quick Example
-
-```typescript
-import { Sandbox } from '@opencomputer/sdk';
-
-// Create a sandbox
-const sandbox = await Sandbox.create({ template: 'default' });
-
-// Run a command
-const result = await sandbox.commands.run('node --version');
-console.log(result.stdout);
-
-// Work with files
-await sandbox.files.write('/app/index.js', 'console.log("hello")');
-const output = await sandbox.commands.run('node /app/index.js');
-console.log(output.stdout); // hello
-
-// Clean up
-await sandbox.kill();
-```
-
-## Exports
-
-```typescript
-import {
- Sandbox,
- type SandboxOpts,
-} from '@opencomputer/sdk';
-
-// Also available:
-import {
- Filesystem,
- type EntryInfo,
-} from '@opencomputer/sdk';
-
-import {
- Commands,
- type ProcessResult,
- type RunOpts,
-} from '@opencomputer/sdk';
-
-import {
- Pty,
- type PtySession,
- type PtyOpts,
-} from '@opencomputer/sdk';
-
-import {
- Templates,
- type TemplateInfo,
-} from '@opencomputer/sdk';
-```
diff --git a/docs/sdks/typescript/patches.mdx b/docs/sdks/typescript/patches.mdx
deleted file mode 100644
index 63ec9a42..00000000
--- a/docs/sdks/typescript/patches.mdx
+++ /dev/null
@@ -1,81 +0,0 @@
----
-title: "Patches"
-description: "Rolling updates for forked sandboxes"
----
-
-Patches attach bash scripts to a checkpoint. When a sandbox boots from that checkpoint or wakes from hibernation, all pending patches run automatically in sequence order.
-
-## Create a Patch
-
-```typescript
-const result = await Sandbox.createCheckpointPatch(checkpoint.id, {
- script: "npm install [email protected]",
- description: "Pin lodash version",
-});
-
-console.log(result.patch.sequence); // 1
-```
-
-### `Sandbox.createCheckpointPatch(checkpointId, opts)`
-
-<ParamField body="checkpointId" type="string" required>
- UUID of the checkpoint to patch.
-</ParamField>
-<ParamField body="opts" type="object" required>
- <Expandable title="properties">
- <ParamField body="script" type="string" required>
- Bash script to execute inside the sandbox.
- </ParamField>
- <ParamField body="description" type="string" optional>
- Human-readable description.
- </ParamField>
- <ParamField body="apiKey" type="string" optional>
- API key override.
- </ParamField>
- <ParamField body="apiUrl" type="string" optional>
- API URL override.
- </ParamField>
- </Expandable>
-</ParamField>
-
-**Returns:** `Promise<PatchResult>`
-
-## List Patches
-
-```typescript
-const patches = await Sandbox.listCheckpointPatches(checkpoint.id);
-// [{ id: "...", sequence: 1, script: "...", description: "..." }, ...]
-```
-
-### `Sandbox.listCheckpointPatches(checkpointId, opts?)`
-
-**Returns:** `Promise<PatchInfo[]>` — ordered by sequence number.
-
-## Delete a Patch
-
-Remove a bad or unwanted patch. Remaining patches continue to apply in sequence order.
-
-```typescript
-await Sandbox.deleteCheckpointPatch(checkpoint.id, patch.id);
-```
-
-### `Sandbox.deleteCheckpointPatch(checkpointId, patchId, opts?)`
-
-<ParamField body="checkpointId" type="string" required>
- UUID of the checkpoint.
-</ParamField>
-<ParamField body="patchId" type="string" required>
- UUID of the patch to delete.
-</ParamField>
-
-**Returns:** `Promise<void>`
-
-## How Patches Apply
-
-| Event | Patches run? |
-| --- | --- |
-| `Sandbox.createFromCheckpoint()` | Yes — after boot |
-| `sandbox.wake()` | Yes — after restore |
-| Sandbox already running | No — next wake/boot |
-
-Patches run sequentially by sequence number. If a patch fails (non-zero exit), the chain stops. Progress is tracked per-sandbox, so the next wake retries from the last successful patch.
diff --git a/docs/sdks/typescript/pty.mdx b/docs/sdks/typescript/pty.mdx
deleted file mode 100644
index 6b7478d9..00000000
--- a/docs/sdks/typescript/pty.mdx
+++ /dev/null
@@ -1,87 +0,0 @@
----
-title: "PTY"
-description: "Interactive terminal sessions inside a sandbox"
----
-
-The `Pty` module provides interactive pseudo-terminal (PTY) sessions over WebSocket. Access it via `sandbox.pty`.
-
-## Creating a PTY Session
-
-```typescript
-const session = await sandbox.pty.create({
- cols: 120,
- rows: 40,
- onOutput: (data) => {
- process.stdout.write(data);
- },
-});
-```
-
-### `sandbox.pty.create(opts?)`
-
-Opens a new interactive terminal session.
-
-<ParamField body="opts" type="PtyOpts" optional>
- <Expandable title="properties">
- <ParamField body="cols" type="number" optional>
- Terminal width in columns.
- </ParamField>
- <ParamField body="rows" type="number" optional>
- Terminal height in rows.
- </ParamField>
- <ParamField body="onOutput" type="(data: Uint8Array) => void" optional>
- Callback invoked when the terminal produces output.
- </ParamField>
- </Expandable>
-</ParamField>
-
-**Returns:** `Promise<PtySession>`
-
-## PtySession
-
-| Property / Method | Type | Description |
-| --- | --- | --- |
-| `sessionId` | `string` | Unique session identifier |
-| `send(data)` | `(data: string \| Uint8Array) => void` | Send input to the terminal |
-| `close()` | `() => void` | Close the PTY session |
-
-## Examples
-
-### Run an Interactive Command
-
-```typescript
-const session = await sandbox.pty.create({
- onOutput: (data) => {
- const text = new TextDecoder().decode(data);
- process.stdout.write(text);
- },
-});
-
-// Type a command
-session.send('ls -la\n');
-
-// Wait a moment for output, then close
-setTimeout(() => session.close(), 2000);
-```
-
-### Pipe User Input
-
-```typescript
-const session = await sandbox.pty.create({
- cols: 80,
- rows: 24,
- onOutput: (data) => {
- process.stdout.write(new TextDecoder().decode(data));
- },
-});
-
-// Forward stdin to the PTY
-process.stdin.setRawMode(true);
-process.stdin.on('data', (chunk) => {
- session.send(chunk);
-});
-```
-
-<Note>
- PTY sessions use WebSocket connections under the hood. Each session maintains a persistent connection to the sandbox worker.
-</Note>
diff --git a/docs/sdks/typescript/sandbox.mdx b/docs/sdks/typescript/sandbox.mdx
deleted file mode 100644
index 21b8c8b1..00000000
--- a/docs/sdks/typescript/sandbox.mdx
+++ /dev/null
@@ -1,128 +0,0 @@
----
-title: "Sandbox"
-description: "Create, connect to, and manage sandbox lifecycles"
----
-
-The `Sandbox` class is the main entry point to OpenComputer. Use it to create new sandboxes, connect to existing ones, and access all sub-modules (commands, filesystem, PTY, templates).
-
-## Creating a Sandbox
-
-```typescript
-import { Sandbox } from '@opencomputer/sdk';
-
-const sandbox = await Sandbox.create({
- template: 'default',
- timeout: 300,
- envs: { NODE_ENV: 'production' },
- metadata: { owner: 'my-agent' },
-});
-```
-
-### `Sandbox.create(opts?)`
-
-Creates a new sandbox and returns a connected `Sandbox` instance.
-
-<ParamField body="opts" type="SandboxOpts" optional>
- <Expandable title="properties">
- <ParamField body="template" type="string" default="default">
- Container template to use.
- </ParamField>
- <ParamField body="timeout" type="number" default="300">
- Sandbox time-to-live in seconds.
- </ParamField>
- <ParamField body="apiKey" type="string" optional>
- API key. Falls back to `OPENCOMPUTER_API_KEY` env var.
- </ParamField>
- <ParamField body="apiUrl" type="string" optional>
- API base URL. Falls back to `OPENCOMPUTER_API_URL` env var, then `https://app.opencomputer.dev`.
- </ParamField>
- <ParamField body="envs" type="Record<string, string>" optional>
- Environment variables injected into the sandbox.
- </ParamField>
- <ParamField body="metadata" type="Record<string, string>" optional>
- Arbitrary key-value metadata attached to the sandbox.
- </ParamField>
- </Expandable>
-</ParamField>
-
-**Returns:** `Promise<Sandbox>`
-
-## Connecting to an Existing Sandbox
-
-```typescript
-const sandbox = await Sandbox.connect('sandbox-abc123', {
- apiKey: 'sk-...',
-});
-```
-
-### `Sandbox.connect(sandboxId, opts?)`
-
-Connects to a running sandbox by ID.
-
-<ParamField body="sandboxId" type="string" required>
- The ID of the sandbox to connect to.
-</ParamField>
-
-<ParamField body="opts" type="object" optional>
- <Expandable title="properties">
- <ParamField body="apiKey" type="string" optional>
- API key override.
- </ParamField>
- <ParamField body="apiUrl" type="string" optional>
- API URL override.
- </ParamField>
- </Expandable>
-</ParamField>
-
-**Returns:** `Promise<Sandbox>`
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| `sandboxId` | `string` | Unique identifier for the sandbox |
-| `domain` | `string` | Public domain for the sandbox (e.g. `abc123.workers.opencomputer.dev`). HTTP traffic to this domain is routed directly into the sandbox. |
-| `status` | `string` | Current status: `"running"`, `"stopped"`, or `"error"` |
-| `files` | `Filesystem` | [Filesystem](/sdks/typescript/filesystem) operations |
-| `commands` | `Commands` | [Command](/sdks/typescript/commands) execution |
-| `pty` | `Pty` | [PTY](/sdks/typescript/pty) terminal access |
-
-## Instance Methods
-
-### `sandbox.kill()`
-
-Stops and destroys the sandbox. All data is lost.
-
-```typescript
-await sandbox.kill();
-```
-
-**Returns:** `Promise<void>`
-
-### `sandbox.isRunning()`
-
-Checks if the sandbox is still alive.
-
-```typescript
-const alive = await sandbox.isRunning();
-if (!alive) {
- console.log('Sandbox has stopped');
-}
-```
-
-**Returns:** `Promise<boolean>`
-
-### `sandbox.setTimeout(timeout)`
-
-Updates the sandbox timeout. Resets the TTL countdown.
-
-```typescript
-// Extend the sandbox for another 10 minutes
-await sandbox.setTimeout(600);
-```
-
-<ParamField body="timeout" type="number" required>
- New timeout in seconds.
-</ParamField>
-
-**Returns:** `Promise<void>`
diff --git a/docs/sdks/typescript/templates.mdx b/docs/sdks/typescript/templates.mdx
deleted file mode 100644
index c4b7421c..00000000
--- a/docs/sdks/typescript/templates.mdx
+++ /dev/null
@@ -1,105 +0,0 @@
----
-title: "Templates"
-description: "Build and manage reusable sandbox templates"
----
-
-Templates let you create reusable sandbox images from Dockerfiles. Pre-install languages, tools, and dependencies so your sandboxes start ready to go.
-
-## Building a Template
-
-```typescript
-import { Templates } from '@opencomputer/sdk';
-
-const templates = new Templates(apiUrl, apiKey);
-
-const template = await templates.build('python-ml', `
-FROM ubuntu:22.04
-RUN apt-get update && apt-get install -y python3 python3-pip
-RUN pip3 install numpy pandas scikit-learn
-`);
-
-console.log(template.templateID); // tpl-abc123
-console.log(template.status); // building → ready
-```
-
-### `templates.build(name, dockerfile)`
-
-Builds a new template from a Dockerfile.
-
-<ParamField body="name" type="string" required>
- A unique name for the template.
-</ParamField>
-<ParamField body="dockerfile" type="string" required>
- The Dockerfile content to build from.
-</ParamField>
-
-**Returns:** `Promise<TemplateInfo>`
-
-## Listing Templates
-
-```typescript
-const allTemplates = await templates.list();
-
-for (const t of allTemplates) {
- console.log(`${t.name} (${t.tag}) — ${t.status}`);
-}
-```
-
-### `templates.list()`
-
-Returns all templates.
-
-**Returns:** `Promise<TemplateInfo[]>`
-
-## Getting a Template
-
-```typescript
-const template = await templates.get('python-ml');
-console.log(template);
-```
-
-### `templates.get(name)`
-
-Gets a template by name.
-
-<ParamField body="name" type="string" required>
- Template name.
-</ParamField>
-
-**Returns:** `Promise<TemplateInfo>`
-
-## Deleting a Template
-
-```typescript
-await templates.delete('python-ml');
-```
-
-### `templates.delete(name)`
-
-Deletes a template by name.
-
-<ParamField body="name" type="string" required>
- Template name to delete.
-</ParamField>
-
-**Returns:** `Promise<void>`
-
-## TemplateInfo
-
-| Field | Type | Description |
-| --- | --- | --- |
-| `templateID` | `string` | Unique template identifier |
-| `name` | `string` | Template name |
-| `tag` | `string` | Image tag |
-| `status` | `string` | Build status: `"building"`, `"ready"`, `"error"` |
-
-## Using a Template
-
-Once built, pass the template name when creating a sandbox:
-
-```typescript
-const sandbox = await Sandbox.create({ template: 'python-ml' });
-
-const result = await sandbox.commands.run('python3 -c "import numpy; print(numpy.__version__)"');
-console.log(result.stdout); // 1.24.0
-```
diff --git a/docs/troubleshooting.mdx b/docs/troubleshooting.mdx
index 5751d2e9..527a78f7 100644
--- a/docs/troubleshooting.mdx
+++ b/docs/troubleshooting.mdx
@@ -3,44 +3,96 @@ title: "Troubleshooting"
description: "Common errors and debugging tips"
---
-{/*
- TODO: Expand this stub into full content.
-
- GOAL: Help users debug common issues quickly.
-
- KEY NOTES:
- - Common errors: 401 (API key), sandbox not found (killed/timed out), connection refused (creating/hibernated), timeout
- - Debugging: sandbox.isRunning(), exec.list(), agent onError callback
- - Include CLI debugging: oc sandbox get <id>
-*/}
-
## Common Errors
### `401 Unauthorized`
-{/* Check API key, env var name (OPENCOMPUTER_API_KEY). */}
+Your API key is missing or invalid.
+
+- Check that `OPENCOMPUTER_API_KEY` is set: `echo $OPENCOMPUTER_API_KEY`
+- Verify the key in your code matches what's in the dashboard
+- CLI users: run `oc config show` to check the stored key
### `Sandbox not found`
-{/* Sandbox may have been killed or timed out. Check with oc ls or sandbox.isRunning(). */}
+The sandbox may have been killed or timed out (auto-hibernated or stopped).
+
+```bash
+oc ls # list all sandboxes
+oc sandbox get sb-abc123 # check a specific sandbox
+```
+
+In code:
+
+```typescript
+const running = await sandbox.isRunning();
+```
### `Connection refused`
-{/* Sandbox still creating, or hibernated. Check status. */}
+The sandbox is still starting up, or it's hibernated and hasn't finished waking.
+
+- Check the sandbox status — if `hibernated`, call `wake()` or `oc sandbox wake`
+- If just created, wait a moment for the VM to boot (~150ms typical)
### Timeout errors
-{/* Increase timeout. Check idle timeout (rolling, resets on every operation). */}
+**Command timeout:** Increase the `timeout` parameter on `exec.run()` or use `--timeout` with `oc exec`. Default is 60s for SDK `exec.run()`, unlimited for CLI without `--wait`.
+
+**Idle timeout:** Sandboxes auto-hibernate after 300s of inactivity. Increase with `sandbox.setTimeout()` or `oc sandbox set-timeout`. The timeout resets on every operation.
+
+### Agent exits immediately
+
+- Check that the sandbox has the Claude Agent SDK installed (the default template includes it)
+- Verify `ANTHROPIC_API_KEY` is available — pass it via `envs` on sandbox create if the agent needs it
+- Use the `onError` callback to capture stderr from the agent process
## Debugging Tips
-{/*
- - Check sandbox status with sandbox.isRunning() / is_running()
- - Use sandbox.exec.list() to see running processes
- - Agent stderr via onError callback
- - CLI: oc sandbox get <id> for full details
-*/}
+### Check sandbox status
+
+```bash
+oc sandbox get sb-abc123
+```
+
+```typescript
+console.log(sandbox.status);
+const running = await sandbox.isRunning();
+```
+
+### List running processes
+
+```bash
+oc exec sb-abc123 --wait -- ps aux
+```
+
+```typescript
+const sessions = await sandbox.exec.list();
+for (const s of sessions) {
+ console.log(s.sessionID, s.running, s.command);
+}
+```
+
+### Capture agent errors
+
+```typescript
+const session = await sandbox.agent.start({
+ prompt: "...",
+ onEvent: (event) => {
+ if (event.type === "error") console.error("Agent error:", event.message);
+ },
+ onError: (data) => console.error("Stderr:", data),
+});
+```
+
+### Read sandbox logs
+
+```bash
+oc exec sb-abc123 --wait -- cat /var/log/syslog
+oc exec sb-abc123 --wait -- journalctl --no-pager -n 50
+```
## Getting Help
-{/* GitHub issues: https://github.com/diggerhq/opencomputer/issues */}
+- **GitHub Issues:** [github.com/diggerhq/opencomputer/issues](https://github.com/diggerhq/opencomputer/issues)
+- **API Reference:** [HTTP API](/reference/api) · [TypeScript SDK](/reference/typescript-sdk) · [Python SDK](/reference/python-sdk) · [CLI](/reference/cli)
diff --git a/docs/working-with-files.mdx b/docs/working-with-files.mdx
deleted file mode 100644
index 49a51afd..00000000
--- a/docs/working-with-files.mdx
+++ /dev/null
@@ -1,194 +0,0 @@
----
-title: "Working with Files"
-description: "Read, write, and manage files inside a sandbox"
----
-
-The `Filesystem` module provides full file I/O within a sandbox. Access it via `sandbox.files`.
-
-## Reading files
-
-<CodeGroup>
-
-```typescript TypeScript
-// Read as text
-const content = await sandbox.files.read('/app/config.json');
-const config = JSON.parse(content);
-
-// Read as bytes
-const bytes = await sandbox.files.readBytes('/app/image.png');
-console.log(`File size: ${bytes.length} bytes`);
-```
-
-```python Python
-# Read as text
-content = await sandbox.files.read('/app/config.json')
-config = json.loads(content)
-
-# Read as bytes
-data = await sandbox.files.read_bytes('/app/image.png')
-print(f"File size: {len(data)} bytes")
-```
-
-</CodeGroup>
-
-### `sandbox.files.read(path)`
-
-Reads a file as a UTF-8 string.
-
-<ParamField body="path" type="string" required>
- Absolute path to the file.
-</ParamField>
-
-**Returns:** `Promise<string>`
-
-### `sandbox.files.readBytes(path)`
-
-Reads a file as raw bytes.
-
-<ParamField body="path" type="string" required>
- Absolute path to the file.
-</ParamField>
-
-**Returns:** `Promise<Uint8Array>`
-
-## Writing files
-
-<CodeGroup>
-
-```typescript TypeScript
-// Write text
-await sandbox.files.write('/app/hello.txt', 'Hello, World!');
-
-// Write binary
-const encoder = new TextEncoder();
-await sandbox.files.write('/app/data.bin', encoder.encode('binary data'));
-```
-
-```python Python
-# Write text
-await sandbox.files.write('/app/hello.txt', 'Hello, World!')
-
-# Write binary
-await sandbox.files.write('/app/data.bin', b'\x00\x01\x02')
-```
-
-</CodeGroup>
-
-### `sandbox.files.write(path, content)`
-
-Writes a string or binary content to a file. Creates parent directories if needed.
-
-<ParamField body="path" type="string" required>
- Absolute path to the file.
-</ParamField>
-<ParamField body="content" type="string | Uint8Array" required>
- File content to write.
-</ParamField>
-
-**Returns:** `Promise<void>`
-
-## Listing directories
-
-<CodeGroup>
-
-```typescript TypeScript
-const entries = await sandbox.files.list('/app');
-
-for (const entry of entries) {
- console.log(`${entry.isDir ? 'DIR ' : 'FILE'} ${entry.name} (${entry.size} bytes)`);
-}
-```
-
-```python Python
-entries = await sandbox.files.list('/app')
-
-for entry in entries:
- kind = 'd' if entry.is_dir else 'f'
- print(f"{kind} {entry.name} ({entry.size} bytes)")
-```
-
-</CodeGroup>
-
-### `sandbox.files.list(path?)`
-
-Lists the contents of a directory.
-
-<ParamField body="path" type="string" default="/">
- Directory path to list.
-</ParamField>
-
-**Returns:** `Promise<EntryInfo[]>`
-
-### EntryInfo
-
-| Field | Type | Description |
-| --- | --- | --- |
-| `name` | `string` | File or directory name |
-| `isDir` | `boolean` | `true` if this entry is a directory |
-| `path` | `string` | Full path to the entry |
-| `size` | `number` | Size in bytes (0 for directories) |
-
-## Managing files and directories
-
-### `sandbox.files.makeDir(path)`
-
-Creates a directory and any necessary parent directories.
-
-```typescript
-await sandbox.files.makeDir('/app/src/components');
-```
-
-### `sandbox.files.remove(path)`
-
-Deletes a file or directory.
-
-```typescript
-await sandbox.files.remove('/app/temp.txt');
-```
-
-### `sandbox.files.exists(path)`
-
-Checks whether a file or directory exists.
-
-```typescript
-if (await sandbox.files.exists('/app/package.json')) {
- console.log('Node.js project detected');
-}
-```
-
-## Examples
-
-### Upload and run a script
-
-<CodeGroup>
-
-```typescript TypeScript
-await sandbox.files.write('/tmp/script.sh', `#!/bin/bash
-echo "Running setup..."
-apt-get update -qq
-echo "Done!"
-`);
-
-const result = await sandbox.exec.run('bash /tmp/script.sh');
-console.log(result.stdout);
-```
-
-```python Python
-await sandbox.files.write('/tmp/setup.sh', """#!/bin/bash
-echo "Running setup..."
-apt-get update -qq
-echo "Done!"
-""")
-
-result = await sandbox.commands.run('bash /tmp/setup.sh')
-print(result.stdout)
-```
-
-</CodeGroup>
-
-### Copy files between paths
-
-```typescript
-const content = await sandbox.files.readBytes('/app/original.dat');
-await sandbox.files.write('/backup/original.dat', content);
-```