Run coding agents (pi, Claude Code) on Vers VMs and drive them programmatically from a coordinator. This is the foundation for agent swarms, parallel task execution, and remote agent workflows.Documentation Index
Fetch the complete documentation index at: https://docs.vers.sh/llms.txt
Use this file to discover all available pages before exploring further.
Architecture
A remote agent runs inside a Vers VM with a FIFO-based RPC channel. The coordinator (your local machine, a CI runner, or another agent) sends JSON messages over SSH and reads responses back.- pi-keeper: Runs
sleep infinity > /tmp/pi-rpc/into hold the FIFO write-end open (prevents pi from getting EOF) - pi-rpc: Runs
pi --mode rpc < /tmp/pi-rpc/in >> /tmp/pi-rpc/out 2>> /tmp/pi-rpc/err
Prerequisites
- Vers CLI installed and authenticated
- API keys configured via
vers env set(e.g.,ANTHROPIC_API_KEY) - A golden image with pi pre-installed, or willingness to install it on a fresh VM
Step 1: Boot an Agent VM
From a Golden Image (Fast)
If you have a golden image with pi and the RPC scaffold pre-configured:From a Fresh VM (Manual Setup)
Start a fresh VM and install the agent manually:exit).
Step 2: Send a Task
From your coordinator, send a JSON message to the agent:The
-i flag is required when piping stdin into vers exec. Without it, stdin is not forwarded to the remote command. vers execute is an alias for vers exec and works identically.Step 3: Read Output
One-shot (last N lines)
Streaming (live)
Check for errors
Message Protocol
Standard Task
Queue a task. If the agent is idle, it starts immediately. If busy, it queues.Steer (Interrupt + Redirect)
Interrupt current work and redirect the agent:Follow-up
Queue a task to run after the current one completes:Other Commands
Response Format
The agent writes JSON lines to/tmp/pi-rpc/out. A completed task produces a line with:
"type": "response" to know when work is done.
Polling Pattern for Long Tasks
For tasks that take minutes, poll for new output:Multiple Agents (Swarm Pattern)
Spawn several agents and fan out work:Snapshotting Agent State
Save an agent’s working state as a commit for later reuse:- Checkpointing before risky operations
- Creating reusable “warmed up” agent states
- Sharing agent environments across team members
Building Golden Images for Agents
Manually setting up each agent VM is slow. For repeatable agent workflows, build a golden image once and boot from it instantly. See Custom Golden Images for the full process. The key steps:- Start a fresh VM, install your agent and tools
- Set up the tmux/FIFO scaffold and systemd auto-start
- Clean secrets and regenerate SSH keys
- Commit as a tagged snapshot
Troubleshooting
No output from agent
Check that tmux sessions are running:pi-keeper and pi-rpc. If missing, re-create the scaffold (Step 1 manual setup).
Agent exits immediately
Thepi-keeper session isn’t running. Without it, the FIFO gets EOF and pi exits. Restart:
Task sent but nothing happens
Check if pi is actually running:SSH / connection issues
Verify the VM is running:See Also
- Agent Bootstrap for initial Vers setup (including authentication)
- Custom Golden Images for baking reusable agent VMs
- Coding Agent (SSH) for interactive agent use
- Agent Swarms for multi-agent orchestration patterns