AI Agents Circus
Run AI coding agents in Microsandbox micro-VMs with one configuration file.

Open Protocols ·
Getting Started ·
How It Works ·
Running Agents ·
Editors ·
Images ·
Lifecycle ·
Configuration ·
Hooks ·
Environment Variables ·
Secrets ·
Networking ·
Host Entries ·
CA Certificates ·
Logs ·
Troubleshooting
[!NOTE]
Looking for the Docker/Podman version? See the
v1 branch.
Overview
agent-circus runs AI coding agents inside Microsandbox
(msb). Microsandbox starts each sandbox as a small virtual machine on your
Linux host. Each sandbox boots from an OCI image, the same image format that
Docker and Podman use.
The sandbox image contains the agent harnesses and a Docker engine. An agent
harness is the CLI tool that drives an agent, for example pi or opencode.
The Docker engine runs inside the sandbox, so agents can build and run
containers in their own workspace. The Docker or Podman installation on your
host only builds the sandbox image. It never runs agent workloads.
agent-circus reads .agent-circus/config.toml in your project and
~/.config/agent-circus/config.toml. The two files merge key by key:
tables merge recursively and the project value wins; arrays (for
example [[daemons]] or env_passthrough) are replaced as a whole by
the project value. Known 1.x keys log a warning; any other unknown key
stops the command with an error.
The supported agent harnesses come preinstalled in the image:
Editors and IDEs connect to the agents through the
Agent Client Protocol (ACP). In ACP mode,
the editor talks to the agent through the sandbox, and the sandbox boundary
stays in place.
Open Protocols
agent-circus is built around open interfaces instead of editor- or
vendor-specific integrations:
- ACP — Agent Client Protocol connects
editors and IDEs to coding agents through a shared client protocol.
The image contains an ACP entry point for every harness (
opencode acp,
pi-acp, claude-agent-acp, codex-acp); see
Setting up Editors to Work with ACP.
- MCP — Model Context Protocol connects
agents to tools, services, and contextual data sources. The agents
reach MCP servers through the sandbox network, or run them inside the
sandbox, for example as a daemon; see Networking and
Daemon Settings.
- Agent Skills package reusable agent capabilities
as portable, declarative instructions and resources. agent-circus makes
project, user, and system skills available in the sandbox; see
Skills.
- A2A — Agent2Agent Protocol defines a common
protocol for communication and task handoff between agents. agent-circus
does not use A2A yet; the map shows where it fits.
Getting Started
This section gets you from zero to a first agent session. Read the
requirements first, because KVM and an image builder are host features.
Requirements
You need a Linux host with KVM. KVM is the virtual machine feature of the
Linux kernel. agent-circus does not need it directly, but msb does. Run
ls /dev/kvm to make sure that KVM is available. You also need
uv
and one image builder, Podman or Docker, on the host.
You do not need a separate msb installation. The microsandbox Python
package bundles the msb binary, and agent-circus finds it there.
Installing agent-circus
Until 2.0.0 is released, uv tool install agent-circus installs the
1.x Docker/Podman version. To install a 2.x release candidate, use the
pre-release command from Installing a
Pre-release.
To install agent-circus from a checkout, run this command in the
repository root:
uv tool install .
To run agent-circus without installing it, use uv run from the repository
root:
uv run agent-circus version
Version Information
The version command prints the version of agent-circus, the path of the msb
binary, and the msb version. agent-circus expects the msb version that matches
the installed microsandbox package. It logs a warning when a msb binary on
your PATH differs from that version, because command line flags can
change between releases.
Installing a Pre-release
Pre-releases (for example 2.0.0rc1) are on PyPI. uv, pip, and
pipx do not install them unless you ask for the exact version, so a
normal upgrade keeps you on the latest stable version:
uv tool install agent-circus==2.0.0rc1
uvx agent-circus@2.0.0rc1 version
How It Works
agent-circus manages one sandbox per workspace. The sandbox name is
agents-<project>, where <project> is the name of your project directory.
All agent harnesses run in this one sandbox. You select the harness per
command, not per sandbox.
The lifecycle has three steps:
- Build the agent image on the host and import it into the msb image cache.
- Boot the sandbox from that image with
agent-circus up.
- Start a harness with
agent-circus exec whenever you need one.
The sandbox boots with msb run --detach --init auto. That hands PID 1
to s6-overlay, the init system in the image. s6 starts and supervises
the services of the image: the SSH agent bridge, the TLS CA import, and
the Docker engine. The services start on every boot, including
agent-circus start, and s6 restarts them when they crash. A
msb create boot skips this hand-off. agent-circus never uses it.
After a boot or a start, agent-circus asks the guest for docker info until
the Docker engine answers. If the engine does not answer within the probe
budget, agent-circus prints the last probe error and the path to the guest log.
Images
The build command builds the agent image on the host and imports it into
the msb image cache:
agent-circus build --platform linux/amd64
The image comes from a Dockerfile that ships with agent-circus. That
Dockerfile pins the base image, the uv image, and all agent versions by
hash, so builds are reproducible. build writes the image to a temporary
tar file, imports it with msb load, and deletes the tar file. Use
--keep-tar <path> to write the tar file to a path and keep it.
The build skips itself when the image tag is already in the msb image cache.
Use --force to rebuild anyway. Use --engine docker to build with Docker
instead of Podman.
If you use your own Dockerfile instead (see [image] dockerfile), it
needs an init system for the sandbox services, or the setting
init = "none" under [msb.sandbox]. Without an init, the image must
not set ENTRYPOINT ["/init"]; msb then keeps its own guest agent as
PID 1. See "Configuration Reference" and "Lifecycle".
The import command loads an existing docker-archive tar file into the msb
image cache:
agent-circus import msb-agents.tar
Lifecycle
All commands work from your project directory and address the sandbox
agents-<project> of that workspace. The commands are:
| Command |
Effect |
agent-circus up |
Boot the sandbox, or reuse the running one. |
agent-circus ps |
Show sandbox status for this workspace. |
agent-circus exec ... |
Run a command or an ACP session in the sandbox. |
agent-circus stop |
Stop the sandbox. Guest state persists. |
agent-circus start |
Start the sandbox again and verify the Docker engine. |
agent-circus rm -f |
Remove the sandbox and its guest state. |
agent-circus destroy |
Remove the sandbox with a confirmation prompt. |
up never replaces an existing sandbox. Guest state survives every up.
Your workspace files come from the host and stay on the host, so rm and
destroy do not touch them. To reclaim the space of cached images, run
msb image prune.
ps prints a docker compose ps-style table (NAME, ID, CREATED,
STATUS, PORTS) with relative creation ages. The PORTS column shows
the persisted port forwards in podman ps style (for example
127.0.0.1:8000->8000/tcp), comma-joined, and stays empty when the
sandbox publishes no ports. ps --all lists every sandbox
that msb knows about, not only the sandbox of this workspace.
ps --running lists only running sandboxes.
agent-circus stop shuts the sandbox down cleanly: it asks the s6 init
inside the sandbox to stop all services in order, and waits up to
stop_timeout seconds (default 45) for msb to report the sandbox as
stopped. Only then does it force the stop. Do not use msb stop or
msb restart directly for these sandboxes: msb 0.7.13 waits forever
(status draining), because the init is PID 1 and msb does not reach
it. If that happened to you, run
msb exec agents-<project> -- kill -TERM 1 or
msb stop --force agents-<project>.
For scripts, ps --format json prints a JSON array with name, id,
status, created_at, updated_at and a typed ports array (objects
of host, host_port, guest_port, protocol) per sandbox, and
ps --quiet prints sandbox names only. Both stay silent when no
sandbox matches.
Running Agents
Boot the sandbox once, then start a harness:
agent-circus up
agent-circus exec
Without a command, exec starts Pi, the default harness. To run another
command, pass it after --:
agent-circus exec -- bash
agent-circus exec -- docker ps
agent-circus exec -- opencode
agent-circus exec -- claude
agent-circus exec -- codex
exec boots the sandbox first when it is not running. The workspace is
mounted at the same absolute path as on the host, so file paths agree
between your editor and the agent.
agent-circus brings your host harness configuration into the sandbox:
- Claude Code and Codex: the host config directories
~/.claude and
~/.codex are bind-mounted into the guest (/root/.claude and
/root/.codex) when the sandbox is created. The mount is read-write and
carries the credentials file (.credentials.json, auth.json), so a
login or token refresh inside the sandbox persists on the host, and the
other way around. A missing host directory is skipped with a warning;
create it and re-create the sandbox (agent-circus rm -f && agent-circus up)
to mount it. Because msb fixes mounts at creation, agent-circus also warns
when a running sandbox was created without a mount that is expected now.
- Pi and OpenCode: selected config files (
~/.pi/agent/settings.json,
~/.pi/agent/models.json, ~/.config/opencode/opencode.json) are copied
into the guest after every boot or start. The copy is one-way: guest-side
edits to these files are overwritten by the next refresh. Authenticate
through env_passthrough (see Secrets).
agent-circus pre-trusts the agent workdir ([agent] workdir), the
worktree mirror path (when enabled), and every
additional_dirs mount for pi and pi-acp: after each boot or start it
writes ~/.pi/agent/trust.json in the guest, so the first harness start in
a new sandbox does not ask to trust the directory. The write is idempotent
and overwrites an existing trust file — add your own entries through
the configuration, not by editing the file in the guest. If the write
fails, agent-circus warns and pi simply asks on first start, as before.
Skills
Project skills need no setup: they live in the repository
(.agents/skills/, .claude/skills/, .pi/skills/), and the workspace
is mounted read-write. Install them on the host or from inside the
sandbox. Use relative symlinks; installers such as npx skills already
do this. Absolute symlinks to host paths break inside the sandbox;
up and start warn about skill links that do not resolve there.
- User skills in
~/.pi/agent/skills,
~/.config/opencode/skills and ~/.config/opencode/skill are mounted
read-only at the same paths below /root. A skill changed in the
sandbox would later run on your host, so the mount refuses writes.
- Install user skills on the host. A new skill appears in a running
sandbox; restart the agent session to load it. If the directory did
not exist when the sandbox was created, re-create the sandbox with
agent-circus rm -f && agent-circus up. up warns when a user skill
directory exists on the host but is not mounted in the sandbox.
~/.claude/skills and ~/.codex/skills are part of the read-write
config mounts, so they are not read-only.
- Skills that an agent writes in the sandbox land in the project.
Review them, then move them to your user directory on the host if you
want them everywhere.
System skills
System skills are skills that every sandbox sees. They live in a store
on the host, by default ~/.local/share/agent-circus/system-skills/
(below $XDG_DATA_HOME when that is set). Set [skills] store to
use another absolute path (~ is allowed). agent-circus reads this key
only from the user config (~/.config/agent-circus/config.toml); it
ignores it in a project config, with a warning, because the store is
the same for all projects.
Manage the store with:
agent-circus skills add <owner>/<repo> --skill <name> -y
agent-circus skills list
agent-circus skills remove <name> -y
agent-circus skills update
agent-circus skills check
agent-circus skills find <query>
Each command runs the skills CLI inside a short-lived sandbox that
mounts the store read-write, so the host needs no Node.js. You do not
type -g; agent-circus adds it for you. Every command boots a small VM,
which takes a few seconds. The installer uses the configured network
profile and needs access to npm and the git host. Private repositories
do not work: the installer has no SSH agent and no git credentials.
dockerd inside the installer has no disk and fails; that is harmless.
A running agent may briefly see a half-copied skill during an install.
Agents see the skills at /root/.agents/skills, read-only. msb enforces
this on the host side, so agents cannot change them. A new skill shows
up in a running sandbox; restart the agent session to load it.
Sandboxes created before this feature need one
agent-circus rm -f && agent-circus up.