There are two ways to run agents on OpenComputer. This is the SDK path — you create a sandbox yourself and drive a Claude session inside it directly, owning the sandbox and the loop. If you’d instead like the platform to manage an agent definition for you — reached through persistent instances or ephemeral sessions, and connectable to messaging channels or a public API — see Hosted Agents (Hermes, OpenClaw).
How It Works
The SDK spawns the Claude Agent SDK inside the sandbox VM as a regular process. Claude gets bash and file tools, then works in a think → act → observe loop. Events stream back to your code over WebSocket as JSON lines. The agent has full access to the sandbox filesystem, network, and shell — the same environment you’d get withsandbox.exec or oc shell.
Starting an Agent
sandbox.agent.start() creates an agent session and returns immediately. Events arrive via callbacks.
Parameters
TypeScript only:
Python uses snake_case:
system_prompt, allowed_tools, permission_mode, max_turns, mcp_servers, on_event, on_error.AgentSession
The returned session object lets you interact with the running agent.Attaching to an Existing Session
Reconnect to a running agent session to resume receiving events:Listing Sessions
Events
Understanding the event stream
Tools
Configure tools and MCP servers
Multi-turn
Follow-ups, resume, session management