Skip to main content
Run Claude Code or the Codex CLI inside a sandbox with a prompt, follow its events, steer or interrupt it, and resume the conversation later. The agent runs in your sandbox, so it edits your files and runs your commands there and nowhere else.

What you need

  • A sandbox with Python and Node: the base template (the default) has both, and git. A sandbox without python3 answers 409 agent_runtime_missing.
  • Outbound access to npm from the sandbox. The first prompt of a harness installs it into ~/.agent/npm (@anthropic-ai/claude-code or @openai/codex, the current release) and says so in the stream (harness.installing, harness.installed). Later turns reuse it. The template does not ship either harness.
  • Your own model credentials, passed with each prompt (see below). Styne does not supply a model.

Send a prompt

The answer is 202: the turn runs on in the sandbox while you read its events. A conversation runs one turn at a time: a prompt into a conversation with a running turn is 409 conversation_busy (steer or interrupt it instead). Up to 8 turns run at once in one sandbox, in different conversations; more is 429 too_many_turns.

Pass your credentials

The env values travel in the request body to the sandbox’s agent launcher on its standard input. They are not written to disk, not logged, not stored by Styne and not echoed back (the answer lists the variable names only), and every event masks them as ***. The harness itself can still see them in its environment, as any program you run in the sandbox can, so give an agent a key you are willing to give that sandbox. Send env again with every prompt and every steer: Styne keeps no copy to reuse.

Follow the events

A page of events; resume from nextCursor:
A live stream of newline-delimited JSON until the turn ends:
Every event carries conversationId, promptId, harness and ts. conversation takes one id or a comma-separated list; without it every conversation of the sandbox is read. A page answers {"events": [...], "nextCursor": N, "more": bool} (limit 1 to 1000, default 200). cursor is a byte position: keep the nextCursor and send it back. With follow=1 the stream also carries {"type":"ping","cursor":N} after 15 quiet seconds and ends with {"type":"end","cursor":N} after 10 minutes, or earlier when the prompt named by until has finished: reconnect from that cursor. Each event line is cut to 1 MiB (truncated: true replaces the event).

Read status and conversations

  • GET /sandboxes/{id}/prompts/{promptId}: status is queued (the launcher is starting), running, succeeded, failed, interrupted or lost (the turn’s process is gone without an end, e.g. the sandbox was stopped), with exitCode and the times.
  • GET /sandboxes/{id}/conversations: every conversation, most recently used first, with harness, model, promptCount, lastPrompt, running, runningPrompt and current (the one a prompt without new or conversationId continues).
  • GET /sandboxes/{id}/conversations/{conversationId}: one of them.
Conversations live in the sandbox’s disk (~/.agent), so they survive an API restart and a stop and resume of the sandbox, and are in its snapshots. A turn running when the sandbox stops is lost.

Steer or interrupt a turn

A steer interrupts the running turn and continues the same conversation, with the same harness session and so its memory, on your message. The answer has native: false: neither harness takes a new message into a running non-interactive turn, so the turn is stopped and a new one resumes the session; what the first turn had finished stays. A conversation with nothing running answers 409 no_running_turn (error.details.reason: no_turn or turn_ended); start work with a prompt instead. An interrupt stops every running turn of the sandbox, or only conversation’s. The turn ends with prompt.finished interrupted. An interrupt with nothing running answers 200 with an empty list.

Customise the harness

Put your rules, MCP servers and skills in the harness’s ordinary config files in the sandbox home. Only sandboxes of the same account are reachable: a sandbox of another account is a 404. The same routes exist under /boat/v1 for clients of that API.

Operations