OpenCode Agent
Run the OpenCode agent in a session using an Anthropic API key.
Spin up the OpenCode coding agent inside a VM session and prompt it with natural language. Reach for this when you want an autonomous coding agent that can read files, run commands, and follow project conventions — backed by your own Anthropic API key.
How it works
Register the opencode software with agentOS({ software: [opencode] }) so the runtime knows the agent type. The client then calls agent.createSession("opencode", ...), passing ANTHROPIC_API_KEY through env, and drives the agent with agent.sendPrompt. The example also shows two extension points: drop a SKILL.md into ~/.config/opencode/skills/ before creating the session and the agent auto-discovers it, and wire in extra tools via mcpServers (local child-process or remote URL). Pre-install any npx MCP server first so install output does not corrupt the stdio handshake.
Run it
npm install
export ANTHROPIC_API_KEY=sk-ant-...
npx tsx server.ts # starts the registry on http://localhost:6420
npx tsx client.ts # creates a session and prints the agent's reply
The agent answers your prompt — e.g. listing the files in the working directory.