A background agent in three calls.
Define an agent, start a session, and it runs on its own — cloning repos, editing files, running commands while you're away. OpenComputer keeps it alive: crashes resume from the event log, idle runs hibernate, and your model key never touches the sandbox. You write the agent, not the plumbing.
Free tier, no credit card. First session in ~30 seconds.
import { OpenComputer } from '@opencomputer/sdk';
const oc = new OpenComputer();
// 1. Define a durable agent — the brain runs apart
// from the sandbox; your model key never enters it.
const agent = await oc.agents.create({
name: 'support-triage',
model: 'claude-opus-4-8',
prompt: 'You triage inbound support tickets.',
runtime: 'claude-agent-sdk',
});
// 2. Start a session — returns a browser-safe token.
const session = await oc.sessions.start({
agent: agent.id,
input: 'Investigate ticket #4821, draft a reply.',
});
// 3. Stream every step. Crash? It restarts.
// Disconnect? Reconnect from any seq, no gaps.
for await (const e of oc.sessions.stream(session.id)) {
console.log(e.seq, e.type);
}
// Steer mid-run with the client token.
await oc.sessions.send(session.id, 'Escalate to a human.');Auto-restart
runtime crashes recover themselves
Resume any seq
reconnect with no gaps
Steerable
redirect a run mid-flight
Keys stay out
model key never enters the sandbox
An example
A coding agent that survives a crash and a change of mind.
Label a GitHub issue and a session starts. It clones the repo and edits files in the sandbox. The test run OOMs and the runtime dies — but the event log is intact, so it restarts and resumes from exactly where it stopped. Nothing is re-run.
Mid-run you send one message — “also bump the changelog” — and it adapts. When the PR opens, a signed webhook hits your backend. You were asleep the whole time.
The agent loop is easy. Keeping it alive is the work.
Running agents yourself means writing crash recovery, reconnection, and stuck-run handling before you ship a single feature. A durable session hands you all of it.
Crash recovery
Runtime crashes restart automatically. No supervisor loop, no half-finished state to reconcile.
Reconnection logic
Every session has an append-only event log. Reconnect from any seq and resume the stream without gaps.
Stuck-run handling
Hung runs stop cleanly instead of staying stuck and burning tokens until someone notices.
Idle cost
Idle sessions hibernate and wake on the next message. You don't pay to keep an agent parked.
Key exposure
The brain runs apart from the sandbox. Your model key lives in the secret store and never reaches untrusted code.
Audit trail
The event log is the durable record of every step — replayable, inspectable, and there when you need to debug.
Three calls from idea to a running, steerable agent.
01
Define an agent
A reusable object: name, model, system prompt, and runtime. Reference a saved credential instead of pasting a key.
02
Start a session
Hand it an input and it runs autonomously. You get back a browser-safe client token — no org key in the front end.
03
Stream, steer, get webhooks
Watch events live over EventSource, send follow-ups to redirect the run, and receive signed webhooks on your backend.
The brain
The agent loop, managed.
The reasoning loop runs in a controlled runtime that reads and writes the event log. It holds your model key — pulled from the secret store — and decides what to do next.
The hands
An isolated sandbox for files and commands.
Every file write and command runs in a sandbox the agent cannot use to reach your secrets. The model key stays in the brain and never enters untrusted code — separation by construction, not by policy.
When to reach for a session
Use a session for long-running or interactive agents — anything that needs to survive a restart, take human steering, or run longer than a single request. For a one-shot command in a throwaway box, use a sandbox directly. Sessions are the layer on top, for when the agent has to stick around.
Start free. Pay per second when you scale.
No commitment, no idle charges. Sessions hibernate when they have nothing to do, so you only pay for compute that's actually running.
Free
$0
no card required
- ✓Run real sessions, end to end
- ✓Event log + resume
- ✓Up to 5 concurrent runs
- ✓Full sandbox access
Pay as you go
Most popularfrom $0.012
per session-hour, billed per second
- ✓Only pay while a session runs
- ✓Idle sessions hibernate free of compute
- ✓Signed webhooks + dead-letter
- ✓Steering + client tokens
Scale
Custom
volume pricing & SLAs
- ✓Dedicated capacity & large pools
- ✓Higher concurrency
- ✓Volume discounts
- ✓Priority support
Ship the agent. Skip the plumbing.
Start a durable session in under a minute. Free tier, no credit card, and the crash-recovery code you were about to write is already done.