examples/agent-os/README.md
Run coding agents inside isolated VMs with full filesystem, process, and network control using RivetKit.
Install dependencies:
pnpm install
Each example has a server and a client. Start the server in one terminal, then run the client in another.
Hello World - Write a file and read it back:
pnpm hello-world:server
# In another terminal:
pnpm hello-world
Git - Clone a repository and check out a branch:
pnpm git:server
# In another terminal:
pnpm git
Filesystem - Directories, stat, move, delete, and mount configuration:
pnpm filesystem:server
# In another terminal:
pnpm filesystem
Processes - Run shell commands and spawn processes:
pnpm processes:server
# In another terminal:
pnpm processes
Network - Start a server inside the VM, fetch from it, and create preview URLs:
pnpm network:server
# In another terminal:
pnpm network
Cron - Schedule and manage recurring jobs:
pnpm cron:server
# In another terminal:
pnpm cron
Tools - Define host toolkits callable from inside the VM:
pnpm tools:server
# In another terminal:
pnpm tools
Agent Session - Create a PI agent session and send prompts (requires ANTHROPIC_API_KEY):
pnpm agent-session:server
# In another terminal:
ANTHROPIC_API_KEY=sk-... pnpm agent-session
Sandbox Mounting - Mount a sandbox into the VM (requires Docker for demonstrating local sandbox):
pnpm sandbox:server
# In another terminal:
pnpm sandbox
vmFetch and signed preview URLs for external accessANTHROPIC_API_KEY for the agent-session exampleEach example folder contains a server.ts that configures an agentOS actor and a client.ts that connects to it. The server boots an isolated VM on first use. The client calls actor actions over WebSocket.
src/hello-world/ - Minimal write/read filesrc/git/ - Local clone and branch checkoutsrc/filesystem/ - Full filesystem operations with mount configsrc/processes/ - Shell commands and process managementsrc/network/ - In-VM HTTP server with vmFetch and preview URLssrc/cron/ - Cron job schedulingsrc/tools/ - Host toolkits with Zod schemassrc/agent-session/ - PI agent session with promptssrc/sandbox/ - Docker sandbox filesystem and toolkitMIT