Run Agents in Parallel
Tell your orchestrator agent to spin up N disposable VMs, give each one a task, and report back when any finishes
You want three features built at once. Or one feature tried three different ways. One orchestrator agent on your laptop fans the work out to disposable VMs and reports back when any of them finishes.
Works with any MCP-capable agent: Claude Code, Cursor, Cline, Aider, anything that speaks MCP. The examples below use Claude because that's what we test against, but swap in your agent of choice.
Gibil's job here is the boxes: forged, isolated, self-destructing, with the repo and a coding agent ready to go. The orchestration (assigning tasks, polling, picking diffs) is your agent's job, not gibil's. If you'd rather have that loop managed for you than drive it yourself, Sandcastle runs the same agent loop on gibil VMs out of the box.
The prompt
Once gibil's MCP server is wired up (see setup), this is all you need to give your orchestrator:
Spin up three VMs for these branches:
- feat/payments → wire up stripe checkout
- feat/onboarding → rebuild the welcome flow
- feat/retries → add exponential backoff to the webhook handler
Each VM should have my repo, the right branch, and a coding agent installed.
Assign each VM its task, poll until one produces a green diff, then tell me.
Burn the VMs when their branch is done.The orchestrator handles the rest using MCP tools: create_server, vm_bash, vm_job_status, destroy_server. You watch PRs land, not progress bars.
What the orchestrator actually does
Under the hood, the agent forges all three VMs in parallel (~90s each). create_server takes branch and agent directly, so each box comes up with the repo cloned, the right branch checked out, and the worker agent installed. Pass its API key through env:
create_server({ name: "feat-payments", repo: "github.com/you/proj", branch: "feat/payments", agent: "claude", ttl: 120, env: { ANTHROPIC_API_KEY: "sk-ant-..." } })
create_server({ name: "feat-onboarding", repo: "github.com/you/proj", branch: "feat/onboarding", agent: "claude", ttl: 120, env: { ANTHROPIC_API_KEY: "sk-ant-..." } })
create_server({ name: "feat-retries", repo: "github.com/you/proj", branch: "feat/retries", agent: "claude", ttl: 120, env: { ANTHROPIC_API_KEY: "sk-ant-..." } })The orchestrator then dispatches each task with vm_bash in background mode:
vm_bash({ server: "feat-payments", command: "claude -p 'wire up stripe checkout'", background: true })
vm_bash({ server: "feat-onboarding", command: "claude -p 'rebuild the welcome flow'", background: true })
vm_bash({ server: "feat-retries", command: "claude -p 'add exponential backoff'", background: true })Each background call returns a job ID. The orchestrator polls vm_job_status({ job_id }) until exit codes come back, then vm_read / vm_bash to check the diff, and finally destroy_server when satisfied.
Swap agent: "claude" for aider or codex and the matching -p/prompt invocation, and the fan-out shape is identical.
CLI shortcut
If you'd rather kick off the fan-out yourself before handing it to an agent:
gibil branch feat/payments feat/onboarding feat/retries \
--agent claude --ttl 2hThat's the same create_server calls, three at once, with --agent claude (or aider, codex) installing the agent binary on each VM. From there you can SSH in manually, or point your orchestrator at the running boxes via list_servers.
Heads up: for private repos, set GITHUB_TOKEN before running. Without it, the VM's git clone falls back to anonymous HTTPS and 404s. The orchestrator will see "checkout failed" and won't know why.
Why this pattern
- One driver, N workers. Your laptop agent is the orchestrator. The workers are disposable and isolated: they can
rm -rf /, install anything, run Docker-in-Docker. They can't see each other and can't touch your laptop. - Self-destruct. TTL burns each VM when its task is done or when you forget.
- Agent-agnostic on both sides. The orchestrator can be any MCP client. The worker agent (
--agent) can beclaude,aider, orcodex, or skip--agententirely and have the orchestrator drive the VM directly viavm_bash. - Cheap. Three small VMs at 2 hours each is pennies on Hetzner, a bit more on Vultr for APAC proximity.
This also works for "try one feature three different ways": same branch on three VMs, different prompts per VM, pick the winning diff.
Next steps
- Orchestration: the orchestrator + box model this recipe is built on
- AI Agent via MCP: wire up the MCP server (one-time setup)
- Build a Feature with Sandcastle: a managed agent loop on gibil VMs
- Agent Code-Test Loop: the single-VM loop each worker runs
- CLI:
gibil branch: all the flags