This release is a pre-release and may not be stable for production use.
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
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:
- Pi (Earendil Works), the default interactive harness
- OpenCode (SST)
- Claude Code (Anthropic)
- Codex (OpenAI)
- pi-acp, the ACP adapter for Pi
- claude-agent-acp, the ACP adapter for Claude Code
- codex-acp, the ACP adapter for Codex
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 execwhenever 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
~/.claudeand~/.codexare bind-mounted into the guest (/root/.claudeand/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 throughenv_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/skillsand~/.config/opencode/skillare 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.upwarns when a user skill directory exists on the host but is not mounted in the sandbox. ~/.claude/skillsand~/.codex/skillsare 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.
Codex, Pi and OpenCode read the skills at /root/.agents/skills. Claude
Code (also through claude-agent-acp) reads them as managed skills at
/etc/claude-code/.claude/skills, the same store folder mounted a
second time. If a new skill does not show up in a running Claude Code
session, restart the session. A system skill wins over a skill with the
same name in ~/.claude/skills. Claude Code ignores this folder when
your account gets managed settings from a Claude organization, or when
CLAUDE_CODE_DISABLE_POLICY_SKILLS is set. Sandboxes created before
Claude Code support also need one agent-circus rm -f && agent-circus up.
Your host ~/.agents/skills directory is not used. agent-circus is
independent of it; with --log-level DEBUG, up notes when that
directory holds skills. To
move skills from there, install them again with
agent-circus skills add.
ACP Sessions
For an ACP session from an editor or IDE, add --acp:
agent-circus exec --acp -- pi-acp
agent-circus exec --acp -- opencode acp
agent-circus exec --acp -- claude-agent-acp
agent-circus exec --acp -- codex-acp
In ACP mode, agent-circus streams the session between your editor and the
sandbox without a pseudo-terminal. Standard output carries only ACP
messages. agent-circus keeps standard error silent: editors treat any
stderr output from the agent as an API error and show an error dialog
for it. Warnings and status messages therefore go to the log file (see
Configuration below); pass --log-file or configure
[logging] to keep them, otherwise /tmp/agent-circus-acp.log is used. Fatal errors
still print to standard error right before agent-circus exits. The stream
copies bytes without change, so large messages and non-ASCII text
arrive intact. When the editor disconnects, agent-circus stops the agent
process in the sandbox.
Setting up Editors to Work with ACP
Emacs
This is a working agent-shell
configuration based on agent-circus. The runner starts the harness through
agent-circus exec --acp, so the editor talks to the sandbox over ACP. The
path resolver maps file paths between your editor and the /workspace
mount in the sandbox. The same code is available as a package in
emacs/agent-shell-circus.el; put it on
your load-path and add (require 'agent-shell-circus) to your init file.
The sandbox carries Pi, OpenCode, Claude Code, and Codex. agent-shell
knows the harness command for every agent it supports (for example
'("opencode" "acp") for OpenCode); these defaults name the harnesses
that ship in the sandbox image, so the runner returns the exec prefix
only. API keys do not go into this configuration; agent-circus reads them
from env_passthrough on the host. If you change the mount in
[msb.mounts], change rpo/agent-shell-circus-workspace-path to match it.
The runner writes the agent-circus log to /tmp/agent-circus.log; see
Configuration for logging in ACP mode.
(defvar rpo/agent-shell-circus-workspace-path "/workspace/"
"Workspace path inside the agent-circus sandbox, with a trailing slash.")
(defun rpo/agent-shell-circus-resolve-path (path)
"Resolve PATH between local filesystem and the sandbox workspace.
For example:
- /workspace/README.md
=> /home/you/projects/my-project/README.md
- /home/you/projects/my-project/README.md
=> /workspace/README.md"
(let ((cwd (agent-shell-cwd))
(guest-path rpo/agent-shell-circus-workspace-path))
(if (string-prefix-p cwd path)
;; Local -> sandbox
(string-replace cwd guest-path path)
;; Sandbox -> local
(if agent-shell-text-file-capabilities
(if-let* ((_ (string-prefix-p guest-path path))
(local-path (expand-file-name
(string-replace guest-path cwd path))))
(or
(and (file-in-directory-p local-path cwd) local-path)
(error "Resolves to path outside of working directory: %s" path))
(error "Unexpected path outside of workspace folder: %s" path))
(error "Refuse to resolve to local filesystem with text file capabilities disabled: %s" path)))))
(defun rpo/agent-shell-circus-runner (_buffer)
"Return the agent-circus exec command prefix for any agent.
The prefix is the same for every agent-shell buffer, so the buffer
argument is unused.
This returns the prefix only. agent-shell appends the agent's own
ACP command (for example \\='(\"opencode\" \"acp\") for OpenCode)
after the prefix. Do NOT add a harness command to the prefix: the
doubled command makes the guest harness reject its arguments."
(list "agent-circus" "--log-level" "DEBUG"
"--log-file" "/tmp/agent-circus.log"
"exec" "--acp" "--"))
(use-package agent-shell
:ensure t
:config
(setq acp-logging-enabled t)
(setq agent-shell-command-prefix #'rpo/agent-shell-circus-runner)
(setq agent-shell-path-resolver-function #'rpo/agent-shell-circus-resolve-path)
(setq agent-shell-file-completion-enabled t))
Start the sandbox before the first session, or keep it running. exec
boots the sandbox by itself, but the first session then waits for the boot.
agent-circus up
Configuration
agent-circus reads .agent-circus/config.toml in your project and
~/.config/agent-circus/config.toml ($XDG_CONFIG_HOME respected).
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.
agent-circus applies its own [msb] table, plus the top-level tables
[image], [agent], [tracing], [skills], [[daemons]], [hooks],
[env], logging, env_passthrough, additional_dirs, git, ssh,
hosts, and port_forwards. Known 1.x keys log a warning; any other
unknown key stops the command with an error.
agent-circus logs to stderr. Set the level and an optional log file either on the command line or in the config; the command line wins.
agent-circus --log-level DEBUG --log-file /tmp/agent-circus.log exec --acp --
[logging]
level = "DEBUG"
file = "/tmp/agent-circus.log"
In ACP mode (agent-circus exec --acp), agent-circus never writes logs to
stderr — editors report stderr output from the agent process as API
errors (see ACP Sessions). Logs then go to the log file
only; when no log file is configured, /tmp/agent-circus-acp.log is
used.
Execution Traces
An execution trace records resource use and ACP traffic metadata for one agent session. The trace does not change the ACP byte stream. For terminal sessions, it also does not intercept the terminal input or output.
Use --trace to enable a trace for one session:
agent-circus exec --trace -- pi
agent-circus exec --trace --acp -- pi-acp
By default, agent-circus writes each trace to a new directory under
.agent-circus/traces/. The latest file contains the ID of the newest
trace. The project .gitignore excludes the .agent-circus directory.
agent-circus does not delete old traces. Remove old trace directories when you
no longer need them.
Use this configuration to enable traces for all exec commands:
[tracing]
enabled = true
directory = ".agent-circus/traces"
sample_interval = 1.0
repetition_threshold = 64
capture_payloads = false
max_payload_bytes = 104857600
The sample_interval value sets the time in seconds between resource
samples. The repetition_threshold value sets the number of equal bytes that
creates an event. Relative values for directory use the project workspace
as their base.
Command-line options take priority over the configuration:
agent-circus exec --trace --trace-sample-interval 0.5 -- pi
agent-circus exec --no-trace -- pi
agent-circus exec --trace --trace-dir /tmp/msb-traces -- pi
Trace Files
Each trace directory contains files for one execution. The trace directory
uses mode 0700. Trace files use mode 0600 because some files can contain
project or session data.
The main files are:
| File | Contents |
|---|---|
manifest.json |
Trace version, start time, sandbox resources, executable name, and environment variable names. |
summary.json |
Exit status, duration, maximum VM use, stream counts, and repetition event count. |
events.jsonl |
Trace lifecycle events, collector errors, and repeated-byte events. |
vm-metrics.jsonl |
VM CPU, memory, disk, and network samples from msb metrics. |
processes.jsonl |
Guest process CPU, memory, I/O, thread, and file descriptor samples from /proc. |
acp-transport.jsonl |
ACP chunk direction, size, hash, newline count, and longest equal-byte run. |
msb-system.jsonl |
Microsandbox lifecycle, runtime, and kernel log entries. |
agent-circus.log |
Log messages from agent-circus during the execution. |
collector-errors.log |
Error output from trace collector processes. |
The process trace does not save command arguments or environment values. The manifest saves only the executable name. These limits prevent common prompts and API keys from entering the normal trace files.
acp-transport.jsonl contains data only for ACP sessions. A terminal trace
still contains VM metrics and guest process samples. Microsandbox records only
the first primary exec session in its execution log, so this trace does not
use that log as a copy of the agent stream.
Raw ACP Payloads
Use --trace-payloads when chunk metadata is not sufficient. This option also
enables tracing. It saves the exact ACP input, output, and error streams under
the payloads/ directory.
agent-circus exec --acp --trace-payloads -- pi-acp
Raw payloads can contain prompts, source code, tool results, and credentials.
Do not share these files without inspection. The max_payload_bytes value
limits each stream, and metadata collection continues after this limit.
Evaluate a Trace
Read summary.json first. It shows whether the agent exited normally and
whether the repetition detector found an incident. It also shows the maximum
VM CPU and memory values that were available.
trace_id=$(cat .agent-circus/traces/latest)
trace_dir=".agent-circus/traces/$trace_id"
jq . "$trace_dir/summary.json"
Read all repeated-byte events with this command:
jq 'select(.event == "repetition_detected")' "$trace_dir/events.jsonl"
Byte 33 is the ASCII value for !. If an event contains byte 33, use its
time and sequence values to find the related ACP chunk:
jq 'select(.longest_repeated_byte.count >= 64)' \
"$trace_dir/acp-transport.jsonl"
Use the VM metrics to compare CPU and memory at the incident time:
jq '{timestamp, cpu_percent, memory_bytes, memory_limit_bytes, net_rx_bytes, net_tx_bytes}' \
"$trace_dir/vm-metrics.jsonl"
Use the process samples to find the processes that gained the most CPU ticks during the trace. One CPU tick is a kernel accounting unit. The sample file records the kernel tick rate. The process tick values are cumulative.
jq -s '
[.[].processes[]]
| group_by(.pid)
| map(
select(length > 1)
| {
pid: .[0].pid,
name: .[0].name,
cpu_ticks: (
(.[-1].user_ticks + .[-1].system_ticks)
- (.[0].user_ticks + .[0].system_ticks)
),
max_resident_pages: (map(.resident_pages) | max)
}
)
| sort_by(.cpu_ticks)
| reverse
| .[:10]
' "$trace_dir/processes.jsonl"
If raw payload capture was enabled, search the agent output for a long run of exclamation marks:
rg -a -n '!{64}' "$trace_dir/payloads/agent-to-client.bin"
If the raw ACP output contains the run, the agent harness sent it to the ACP
client. If the VM CPU also rises, use processes.jsonl to identify the busy
guest process. If only VM CPU rises, inspect msb-system.jsonl and
collector-errors.log for a runtime or collector failure.
Configuration Reference
Tables merge key by key with the project file winning; arrays are replaced as a whole (see Configuration).
The [[additional_dirs]] array mounts extra host directories into the
sandbox under /workspaces/<name>, next to the project at /workspace.
The fields: path is required, readonly defaults to
false, and name defaults to the basename of path.
[[additional_dirs]]
path = "/home/user/shared-libs"
readonly = true
[[additional_dirs]]
path = "/home/user/other-project"
# name defaults to the basename of path
name = "other-project"
env_passthrough = ["OPENAI_API_KEY", "ANTHROPIC_API_KEY"]
[env] # non-secret variables; see
# "Environment Variables"
# GCX_KEYCHAIN = "off"
[msb]
# binary = "/usr/local/bin/msb" # default: the bundled msb binary
[image]
tag = "docker.io/library/msb-agents:26"
# dockerfile = "Dockerfile.msb-agents" # default: the bundled Dockerfile
# platform = "linux/arm64" # default: the host architecture
[msb.sandbox]
memory = "4G"
# cpus = 2 # default: 1
# init = "auto" # "none" for custom images without
# an init; or an absolute init path.
# Applies at sandbox creation only.
# stop_timeout = 45 # seconds to wait for a clean stop
# docker_stop_timeout = 20 # seconds dockerd may take to stop
# containers at shutdown
# root_disk = "flat:32G" # root disk spec, see "Docker and Disks"
# docker_disk = "10G" # docker opt-in: dedicated ext4 disk
# for /var/lib/docker; unset = no docker
# docker_disk_persist = false # keep docker data in a named volume
# that survives rm/destroy
[msb.mounts]
"." = "/workspace" # default; more mounts: "/data" = "/data:ro"
[msb.network]
mode = "public,private" # default; unrestricted network access
# trust_host_cas = false # trust the host's CAs; see
# "CA Certificates"
[skills] # user config only
# store = "~/.local/share/agent-circus/system-skills" # system skill store;
# see "System skills"
[[port_forwards]] # publish a guest port on the host
guest_port = 8000 # or container_port
# host_port = 8000 # default: guest_port
# host = "127.0.0.1" # default: loopback only
# protocol = "tcp" # or "udp"
[agent]
command = ["pi"] # default exec target
# workdir = "/workspace" # default; host path with git.worktree_mirror
[[daemons]] # a supervised process; see "Daemons"
name = "opencode-web" # lowercase letters, digits and "-"
command = ["opencode", "serve", "--hostname", "0.0.0.0", "--port", "4096"]
# autostart = true # start on every boot
# port = 4096 # wait for it; show the URL
# workdir = "/workspace" # default: [agent] workdir
# env = { KEY = "value" } # extra variables
# env_passthrough = ["OPENAI_API_KEY"] # host variables for this daemon
[hooks] # project setup scripts; see "Hooks"
provision = "apt-get update && apt-get install -y ripgrep" # once per
# sandbox and after each change
[hooks.startup] # table form: once per boot
script = "uv sync" # or: file = "path/to/script.sh"
# required = false # default: true for provision
# timeout = 300 # seconds; default: no timeout
# workdir = "/workspace" # default: [agent] workdir
# env = { KEY = "value" } # extra variables
# env_passthrough = ["NPM_TOKEN"] # host variables for this hook
[ssh] # forward the host SSH agent; see
# "SSH Agent Forwarding"
# config_path = "~/.ssh/config" # copied to /root/.ssh/config
# known_hosts_path = "~/.ssh/known_hosts" # copied to /root/.ssh/known_hosts
[hosts] # forward host hosts-file entries; see
# "Host Entries"
patterns = [] # globs or re:-prefixed regexes
# file = "/etc/hosts" # hosts file to read
[git] # forward the host git config; see
# "Git Configuration"
# config_path = "~/.gitconfig" # default: ~/.gitconfig, then
# $XDG_CONFIG_HOME/git/config
# signing_key_path = "~/.ssh/id_ed25519.pub" # SSH public key
# worktree_mirror = true # default; see "Git Worktrees"
All fields are optional. The values above are the defaults. The
[[daemons]] and [hooks] entries are examples; there are no
daemons and no hooks by default.
Environment Variables
Set fixed, non-secret variables for the sandbox in the [env] table:
[env]
GCX_KEYCHAIN = "off"
GOPROXY = "https://proxy.corp.internal/go,direct"
agent-circus applies the variables at these times:
- when it creates the sandbox, so the services of the image (for example the Docker engine) see them;
- at every
agent-circus exec, so a running sandbox gets a changed value at the next command, without a new sandbox; - at every hook run and in the environment file of every daemon (see Hooks and Daemons).
A service of the image keeps the value that it had when the sandbox was
created. To change such a value, re-create the sandbox
(agent-circus rm -f && agent-circus up).
When a variable is set in more than one place, the later source in this list wins:
[env]env_passthrough(top level)env_passthroughandenvof a hook or daemonagent-circus exec -e KEY=VALUE
Dollar References
Values that contain $ are guest shell words: agent-circus expands the
references inside the sandbox, against the sandbox's own environment
(the same behavior as the guest shell):
[env]
PATH = "$PATH:/home/node/.local/bin"
The rules:
- Full shell semantics apply inside double quotes:
${VAR}works, and$(command)or backticks run a command in the guest. Keep that in mind for values you did not write yourself. $$gives a literal$, soCOST = "5$$"becomes5$.- A reference to an unset variable expands to an empty string (POSIX behavior). agent-circus does not detect typos.
- References resolve against the sandbox environment, not against other
[env]values.$OTHERdoes not read a variable defined in the same table. - Values from
env_passthroughnever expand: a host secret keeps its$characters as they are. - msb fixes the sandbox environment at creation and passes values
literally there, so values with
$are not applied at creation time. They take effect when agent-circus runs commands:exec, hooks, and daemons. A service of the image that starts at boot reads the raw value.
Variable names must not start with MSB_. msb reserves this prefix
and rejects such variables, so agent-circus stops with an error.
Do not put secrets in [env]: config.toml is often in Git. Use
env_passthrough (see Secrets).
Secrets
API keys never go into the image. agent-circus passes them per command with
--env KEY=VALUE, or you list them once under env_passthrough:
agent-circus exec -e OPENAI_API_KEY=sk-... -- pi
Claude Code and Codex usually need no API key variable: their credentials
live in the host config directories that agent-circus bind-mounts into the
sandbox (see Running Agents). env_passthrough is the
way to authenticate Pi and OpenCode, or to override the mounted
credentials for a single command.
agent-circus reads the variables under env_passthrough from your host shell
at every command. Entries are patterns: a plain name
must exist, or the command fails before msb starts. A glob (LG_*) or a
regex with the re: prefix (re:^LG_, matched case-insensitively) expands
to every matching variable that is set. Log output never contains secret
values.
The variables are not stored in the sandbox. Each command gets them from
the shell that starts it, for example the shell of agent-circus proxy --shell for browser shells. To make a variable optional, use a regex
that matches only its name: agent-circus then skips it when it is unset.
env_passthrough = ["re:^LG_", "re:^ARTIFACTS_DIR$", "re:^DEBUG_BUILD$"]
For values that are not secret and do not change, use [env] instead.
Daemons are different: s6 starts them in the guest, not agent-circus exec,
so their variables must be stored in the guest. See
Daemon Secrets.
Networking
By default, a sandbox starts with --net "public,private". This gives the
sandbox unrestricted network access, which the Docker engine in the guest
needs to pull images. Your model API endpoints and MCP servers are reachable
through this profile.
agent-circus does not yet translate a network policy into msb network rules. Until that feature exists, treat the default as an open profile and keep sensitive host services outside the reach of the sandbox.
Port Forwarding
Use the [[port_forwards]] array to publish a guest port on the host, for
example to reach a dev server, a debugger, or an MCP server that the agent
starts inside the sandbox:
[[port_forwards]]
container_port = 3333
# host_port = 3333 # default: container_port
# host = "127.0.0.1" # default: loopback only
# protocol = "tcp" # or "udp"
The service field is accepted but ignored:
agent-circus runs one sandbox per workspace, so there is nothing to select a
service from. guest_port is accepted as an alias for container_port.
Forwarded ports bind to 127.0.0.1 on the host by default — the same
default msb itself uses. Set host = "0.0.0.0" only when the service should
be reachable from other machines on your network. The process inside the
sandbox must bind to 0.0.0.0 or the guest network interface; a server
bound to 127.0.0.1 inside the guest is not reachable through the forward.
Servers differ in how they opt in, for example:
opencode serve --hostname 0.0.0.0 --port 4096
Port mappings are fixed when the sandbox is created. msb start and msb modify cannot change them. When up reuses an existing sandbox whose
mappings differ from the configuration, agent-circus prints a warning. Remove
and re-create the sandbox to apply the new ports:
agent-circus rm -f
agent-circus up
If a forwarded port does not answer from the host with Empty reply from server (or hangs), the service inside the sandbox most likely bound to the
guest loopback interface (127.0.0.1) instead of all interfaces. The
forward targets the guest network interface, so it cannot reach a
loopback-bound server. Restart the service bound to 0.0.0.0 in the guest,
for example opencode serve --hostname 0.0.0.0 --port <port>. If that does
not help, check whether another process
on the host holds the port. agent-circus probes every configured host port
before booting and fails with the conflicting host:port -> guest/protocol
mapping when it is already bound (for example by a second VM); the probe is
best-effort, so msb may still report a conflict grabbed between probe and
boot.
agent-circus adds one extra port forward at sandbox creation: the router
forward. It publishes the guest's HTTP router on a free host port
(guest port 7780; see Central Proxy). It appears in
agent-circus ps like any other forward. Guest port 7780 is reserved: do
not use it for a daemon or a [[port_forwards]] entry (agent-circus
rejects a TCP forward to 7780). When up starts a stopped sandbox whose
router host port was taken by another process in the meantime, agent-circus
prints a warning; the sandbox then needs a re-creation.
A daemon is a long-running process that agent-circus starts and supervises
in the sandbox, for example a web interface of a harness or a dev server.
Without daemons, you start such a process by hand in a shell
(agent-circus exec -- bash) and it stops when the shell ends. You define
daemons in .agent-circus/config.toml, and agent-circus starts them on every
boot.
The sandbox image runs the process supervisor s6 as PID 1 (see How It Works). agent-circus registers every daemon as an s6 service. s6 restarts a daemon when it exits, and stops it with SIGTERM when the sandbox stops. The image's own s6 services (the Docker engine, the SSH agent bridge) are not daemons; you do not configure them.
OpenCode Web Interface
This example runs the OpenCode server in the sandbox and makes it
reachable from the host browser at
http://opencode-web.<sandbox>.localhost:7700/ through the
central proxy:
[[daemons]]
name = "opencode-web"
command = ["opencode", "serve", "--port", "4096"]
port = 4096
env_passthrough = ["OPENCODE_PASSWORD"]
- No
[[port_forwards]]entry is needed. A daemon with aportis exposed through the central proxy by default, and the daemon can bind to127.0.0.1in the guest; the router reaches it there. - OpenCode always requires a login: user
opencodeand a password.env_passthroughreads the password fromOPENCODE_PASSWORDin your host shell. The variable must be set; otherwise agent-circus registers no daemon at all and prints a warning. - Without the
env_passthroughline, OpenCode makes up a new password at every start, including restarts after a crash. Read it withagent-circus daemon logs opencode-web | grep 'server password'. The password then stays in plain text in the daemon log. - Do not put the password in
env:config.tomlis often in Git. - A direct
[[port_forwards]]entry still works as before, for example when a client needs a fixed host port. An exposed daemon then shows both URLs (agent-circus urls).
Daemon Settings
| Field | Default | Meaning |
|---|---|---|
name |
(required) | Unique name: lowercase letters, digits and -, at most 40 characters |
command |
(required) | Command and arguments, as a list. No shell runs it; use ["sh", "-c", "..."] for shell syntax. |
autostart |
true |
Start the daemon on every boot. With false, start it with agent-circus daemon start. |
port |
none | Guest TCP port. agent-circus waits up to 30 seconds for it after a start, and shows the URL. |
expose |
true |
Route the port through the central proxy (only effective with a port). |
workdir |
the [agent] workdir |
Guest working directory |
env |
none | Extra environment variables |
env_passthrough |
none | Host environment variables, with the same patterns as the top-level env_passthrough |
A daemon also gets the variables of the top-level env_passthrough, and
SSH_AUTH_SOCK when SSH agent forwarding is on. env wins over both.
HOME defaults to /root (the guest runs as root). s6 daemons inherit
the VM boot environment, which does not reliably carry HOME; without
it, harnesses such as OpenCode cannot find their config below
~/.config and fall back to their defaults. Set HOME in env to
override it.
Values of env that contain $ are guest shell words: agent-circus
expands the references when the daemon starts, against the daemon's
environment (see "Dollar References").
env_passthrough values never expand. Before agent-circus supported $
references, such values stayed literal.
Commands
agent-circus daemons # list daemons: state, PID, uptime, URL
agent-circus daemon start opencode-web # start a stopped or failed daemon
agent-circus daemon stop opencode-web # stop it until the next start or boot
agent-circus daemon restart opencode-web
agent-circus daemon logs opencode-web # last 100 lines
agent-circus daemon logs -f -n 20 opencode-web # follow new lines
up and start register the daemons from the configuration. up also
applies configuration changes to a sandbox that is already running: it
adds new daemons, updates changed ones and removes deleted ones. A changed
daemon keeps running with its old settings until you restart it with
agent-circus daemon restart. When you delete the last daemon from the
configuration, it keeps running until the sandbox stops. agent-circus exec
does not register daemons.
The STATE column of agent-circus daemons shows one of these values:
| State | Meaning |
|---|---|
running |
The process runs. |
starting |
s6 starts or restarts the process. |
stopping |
The process got SIGTERM and has not exited yet. |
stopped |
The daemon is stopped (daemon stop, or autostart = false). |
failed |
The daemon exited 5 times within 60 seconds, and s6 stopped restarting it. Read the log, fix the cause, then run agent-circus daemon start. |
not registered |
The daemon is in the configuration but not in the sandbox. Run agent-circus up. |
The logs are in the guest at /var/log/circus-daemons/<name>/current.
They keep the daemon's stdout and stderr, with a timestamp per line, and
survive a restart of the sandbox. s6 rotates them at 1 MB and keeps 10 old
files. agent-circus daemon logs <name> reads them; agent-circus logs
shows all daemon logs together with the other sandbox logs (see
Logs).
Daemon Secrets
agent-circus exec passes variables to one process, and they are gone when
it ends. A daemon is started by s6, and s6 restarts it after a crash, so
the variables must be stored in the guest. agent-circus therefore writes the
environment of each daemon (env, env_passthrough, the top-level
env_passthrough, and [env]) to a file in the guest:
- The file is
/run/circus-daemons/<name>/env.sh./run/circus-daemonsis a separate tmpfs (memory only) that only root can read. The values do not reach the disk of the sandbox, and they are gone when the sandbox stops. agent-circus writes them again at the nextuporstart. - Every process that runs as root in the sandbox can read the file. All commands in the sandbox run as root, including the agents. An agent can therefore read the secrets of every daemon, the same as it can read the secrets of its own environment.
- While agent-circus registers the daemons, the values are on the command
line of the
msbprocess on the host, the same as foragent-circus exec -e.
Give a daemon only the secrets it needs.
Limitations of Daemons
- Daemons need s6-overlay as PID 1. A custom image without s6 (see Images) cannot run daemons; agent-circus prints a warning and boots the sandbox without them.
portonly checks TCP on127.0.0.1in the guest.- A daemon runs as root, like every other command in the sandbox.
Central Proxy
The central proxy reaches every web daemon of every sandbox at one host
port, by name. You do not need a [[port_forwards]] entry per daemon,
there is no host port clash between sandboxes, and adding a daemon later
does not need a re-creation of the sandbox:
http://<daemon>.<sandbox>.localhost:7700/
e.g. http://opencode-web.agents-myproject.localhost:7700/
Browsers, Chrome, Firefox and curl resolve *.localhost names to the
loopback interface, so the URL works without an /etc/hosts entry. Other
clients may need one.
How it works
flowchart LR
A["🌐<br/>browser<br/>/ curl"]
B["agent-circus<br/>proxy<br/><i>on the host</i>"]
F["msb<br/>port forward"]
R["circus-router<br/><i>in the guest</i>"]
D["📦<br/>daemon"]
A -- "http://opencode-web.agents-foo.localhost:7700/" --> B
B -- "accepts only *.localhost names<br/>finds the router host port<br/>via msb inspect (cached 5 s)" --> F
F -- "127.0.0.1:auto-picked port<br/>to guest :7780<br/>(one per sandbox, added at creation)" --> R
R -- "looks up the first Host label<br/>in routes.json, e.g. opencode-web: 4096" --> D
agent-circus rewrites the routes file on every up, so new or changed
daemons need no re-creation. Only the router port itself is fixed at
sandbox creation.
Daemon Lookup
How the proxy and the router find the daemon for one request:
sequenceDiagram
autonumber
participant B as browser
participant P as agent-circus proxy (host)
participant M as msb
participant R as circus-router (guest)
participant D as daemon (guest)
B->>P: GET, Host: opencode-web.agents-foo.localhost
P->>P: split Host into daemon + sandbox names
P->>M: msb inspect agents-foo
M-->>P: ports, incl. the router forward 127.0.0.1:56263 -> 7780
Note over P: cached for 5 seconds
P->>R: connect to the router forward, replay the head
R->>R: first Host label -> routes.json
R->>D: connect to 127.0.0.1:4096 in the guest
D-->>R: response
R-->>P: response
P-->>B: response
Note over B,D: from here on: raw bytes both ways<br/>(WebSockets, SSE, streaming)
The two halves split the name between them. The proxy resolves the
sandbox name through msb's own metadata (msb inspect); the guest
router resolves the daemon name through the routes file. Neither reads
your configuration at request time.
If a step fails, you get a distinct error: unknown sandbox gives 404 from the proxy, a sandbox without the router forward gives 502, an unknown daemon name gives 404 from the guest router, and a closed daemon port gives 502 from the guest router.
Using the proxy
Start the proxy in a terminal (a foreground process; you start it once per login session):
agent-circus proxy
agent-circus proxy --port 7701 # or: AGENT_CIRCUS_PROXY_PORT=7701
agent-circus proxy --shell # also allow browser shells (see below)
The proxy port is not a config file key. The order is: --port, then
AGENT_CIRCUS_PROXY_PORT, then 7700.
To keep the proxy running in the background, see Run as a systemd user service.
List the URLs of this workspace's exposed daemons:
agent-circus urls # table with NAME, PORT, URL, DIRECT
agent-circus urls --format json # machine-readable, notes on stderr
The proxy binds to 127.0.0.1 and [::1] only, never to a wildcard
address. It accepts only *.localhost host names; any other name (for
example a foreign domain that resolves to 127.0.0.1) gets HTTP 421
with a pointer to the dashboard. This is a DNS rebinding guard.
To stop a daemon from being reachable through the proxy, set
expose = false on its [[daemons]] entry. A daemon without a
port is never exposed.
Run as a systemd user service
The proxy is a foreground process. A systemd user service keeps it running in the background, starts it at login, and restarts it when it crashes. No root rights are needed; the service runs as your user.
Start without --shell. The dashboard works, browser shells stay off:
# ~/.config/systemd/user/agent-circus-proxy.service
[Unit]
Description=agent-circus central proxy
[Service]
ExecStart=%h/.local/bin/agent-circus proxy --workspace %h/devel/myproject
Restart=on-failure
RestartSec=2
[Install]
WantedBy=default.target
Notes on the unit file:
ExecStartneeds the absolute path of theagent-circusprogram (command -v agent-circus). A user service does not read your shell profile, soPATHis minimal. agent-circus then finds themsbbinary in the bundled microsandbox install, throughbinaryin your config, or onPATH; setbinaryin the config when in doubt.--workspacepoints at the workspace whose sandbox URLs you want (any directory with anagent-circus.toml). The proxy serves all sandboxes of your user, not only this workspace's one; the workspace only picks the config.%his your home directory. Use it instead of~: systemd does not expand~inExecStart.- Set the port with
Environment=AGENT_CIRCUS_PROXY_PORT=7701, or add--port 7701to the command line.
Enable and start it:
systemctl --user daemon-reload
systemctl --user enable --now agent-circus-proxy.service
journalctl --user -u agent-circus-proxy -f # follow the logs
The service starts at your next login. To start it at boot, before you log in, run once:
loginctl enable-linger
With shell support
Add --shell to the ExecStart line. The token file then lives under
$XDG_RUNTIME_DIR/agent-circus/shell-token. systemd sets
XDG_RUNTIME_DIR to /run/user/<uid> for the service, so the token
lands in the same file your terminal sessions use; it is removed at
reboot, and the service creates a new one at the next start.
Two things change when the proxy runs under systemd instead of your terminal:
-
The proxy process owns no terminal, so read the dashboard URL with the token from the logs (
journalctl --user -u agent-circus-proxy), or runagent-circus dashboardin any terminal; it reads the same token file and prints the full URL. Rotate the token by deleting the file and runningsystemctl --user restart agent-circus-proxy. -
Browser shells read
[env],env_passthroughandSSH_AUTH_SOCKfrom the environment of the proxy process. A systemd service does not have your login shell's environment. Pass every variable a shell needs in the unit, for example:EnvironmentFile=%h/.config/agent-circus/proxy.env Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
Keep
proxy.envmode 0600; it holds secrets.
The shell token lets anyone who holds it open a shell in every running sandbox of your user. A long-running service holds it for a long time; weigh this against the short-lived terminal run described in Browser Shell.
Dashboard
While the proxy runs, it serves a live dashboard on the same port:
agent-circus proxy
# Dashboard: http://localhost:7700/
agent-circus dashboard # print the URL and open the browser
agent-circus dashboard --no-browser # only print the URL
agent-circus dashboard --here # open this workspace's sandbox detail view
The overview shows the sandboxes as a list (one row per sandbox:
state, daemon counts, problem icons, active connections, a small
traffic sparkline and the age). A click anywhere on a row opens the
sandbox's detail view. A List | Cards switch brings back the card
layout; the choice is remembered. The filter input and the two
checkboxes (show stopped, show other msb sandboxes) work in both
layouts.
The detail view (#/sandbox/<name>) shows everything about one
sandbox: state, age, workspace, router state, fix hints, a full daemon
table with proxy links and log buttons, this sandbox's own traffic and
connections, and the published ports. The address can be bookmarked;
the browser back button returns to the list.
The page shows, refreshed every few seconds:
- every msb sandbox: state, age, workspace path and published ports;
- every daemon in every running sandbox: s6 state, uptime, port, whether the port answers, and a clickable proxy URL;
- every connection through the proxy: active ones, recent ones (the first request line and response status of each connection), per-route totals and a traffic sparkline for the last 10 minutes;
- a fix hint with a copyable command for every problem it finds.
Daemon details come from the running guest, so a stopped sandbox shows
no daemons. Sandboxes with a router from before this feature show
"outdated"; run agent-circus up once in that workspace to update it.
The dashboard counts connections, not requests: the proxy routes per connection, so a page load that reuses one keep-alive connection counts once. Only the first request and the first response status of each connection are recorded.
Privacy: the connection log stores the method and the path, never the query string (it may contain tokens), and never headers or bodies. Dashboard requests themselves are not logged. All data lives in the proxy's memory and is lost when the proxy exits.
Traffic is tracked per sandbox: each sandbox keeps its own last 100 connections and its own 10-minute series, so a busy sandbox cannot push a quiet sandbox's connections out of the view. The proxy tracks at most 64 sandboxes and forgets the least recently used one first; an evicted sandbox loses its traffic history until new traffic arrives.
The dashboard is read-only; it never changes anything. Every problem it finds comes with a copyable command:
| Problem | Command |
|---|---|
| Sandbox is stopped | agent-circus up |
| Created without the router port | agent-circus rm -f && agent-circus up |
| Router does not answer | agent-circus up |
| Router older than agent-circus | agent-circus up |
| Daemon failed (crash limit) | agent-circus daemon restart <name> |
| Daemon runs but port is closed | agent-circus daemon logs <name> |
| Daemon is stopped | agent-circus daemon start <name> |
Security: the dashboard answers only on the loopback names
(localhost, 127.0.0.1, [::1]), is read-only, and is served with a
strict Content-Security-Policy (no inline script, same-origin
resources only). Every local process that can open the page can read
it — the same exposure as msb list. The log viewer shows the same
data as agent-circus daemon logs, including any secrets a daemon
prints (for example a generated password).
Browser Shell
The dashboard can open an interactive shell in a running sandbox, in a browser tab. It is off by default. Turn it on for one proxy run:
agent-circus proxy --shell
There is no config key and no environment variable for it: one explicit flag is easy to audit, and a forgotten config line cannot turn the shell on.
What runs: the same as agent-circus exec -- bash in the sandbox's
workspace (sh when the guest has no bash). The workspace config is
read again for every new shell, so [env], env_passthrough and
SSH_AUTH_SOCK apply as in exec, and config edits apply to the
next shell. One difference to a terminal: env_passthrough values
come from the environment of the terminal where agent-circus proxy --shell was started, so start it where your API keys are set. A
missing required variable gives a clear error in the page.
The token: the shell is guarded by a secret token in
$XDG_RUNTIME_DIR/agent-circus/shell-token (else
~/.local/state/agent-circus/shell-token), a file only your user can
read. agent-circus proxy --shell prints the dashboard URL with the
token in the address fragment, and agent-circus dashboard adds it the
same way; the browser stores it and strips it from the address at
once (a fragment is never sent to a server). Each browser needs the
token once. To rotate it: delete the file and restart the proxy.
Anyone with the token can open a shell in every running sandbox of
your user. The page is a terminal into a VM with a read-write
workspace and possibly SSH agent forwarding. The proxy also checks
the Origin header, accepts loopback host names only, allows at most 8
shells at the same time, and prints one audit line per shell in its
terminal (shell opened: … / shell closed: …). The page itself is
read-only otherwise; the shell is the only feature that executes
something.
Handling: Ctrl+Shift+C / Ctrl+Shift+V copy and paste (on macOS
Cmd+C/Cmd+V work as usual), A+ / A− change the font size, and
Reconnect starts a new shell. The Theme menu in the shell's top
bar picks the terminal colors; Auto follows the dashboard's
light/dark Theme button. The browser remembers the choice for all
shells. Available themes: agent-circus light and dark, Modus Operandi,
Modus Operandi Tinted, Modus Vivendi, Modus Vivendi Tinted, Catppuccin
Latte and Mocha, Dracula, Gruvbox Light and Dark, Nord, Solarized
Light and Dark. Only the color values are taken from these projects;
each theme in shell-themes.js names its source. Closing the tab ends
the shell; there is no detach. Run long jobs in tmux inside the
guest.
Known limits of the shell: a sandbox whose workspace directory is gone
or unknown cannot get a browser shell (use agent-circus exec in a
terminal); bash starts as a non-login interactive shell, so profile
scripts that only run for login shells do not run; window resizing
depends on msb reading the new size after SIGWINCH (if it does not,
"Reconnect" picks up the current size); passthrough values are
visible in the host process list while a shell runs, as with
agent-circus exec today; the shell page needs
style-src 'unsafe-inline' for xterm.js, but scripts stay restricted
to the same origin; the two agent-circus themes use xterm's default ANSI
colors, which are hard to read on the light background for yellow and
white text (pick Modus Operandi for a light theme with tuned ANSI
colors); Solarized has a lower text contrast (about 4.1:1 in Solarized
Light) by design.
Known limits
- Routing happens per connection, not per request. After the first request head, the proxy and the router only copy bytes (this is what makes WebSockets, SSE and streaming responses work). A client that reuses one keep-alive connection for a different host name stays on the first backend; browsers do not do this over plain HTTP/1.1.
- HTTP/1.x only. No TLS and no HTTP/2 on the proxy port. Non-HTTP
protocols still need
[[port_forwards]]. - The proxy is a foreground process. It does not auto-start; run it in a terminal, or wrap it in a systemd user service.
- The dashboard only exists while the proxy runs. Traffic history is in memory only and covers 10 minutes; it resets when the proxy restarts.
- Per-sandbox traffic is kept for at most 64 sandboxes; the least
recently used one is evicted and loses its history. Per-route totals
(
traffic.routes) are unbounded. - The sandbox list has no column sorting.
- A dashboard table re-renders every 2 s; text selection inside a table is lost on refresh.
- Daemon details need a sandbox that runs a current router; run
agent-circus uponce after updating agent-circus. - Counts are per connection, and only the first request and response of a keep-alive connection are recorded.
- Direct
[[port_forwards]]traffic does not pass the proxy and is not shown in the dashboard. - Sandboxes created before this feature need one re-creation
(
agent-circus rm -f && agent-circus up) to get the router port. - The router host port is picked at creation. If another process takes
it later,
upwarns, and the sandbox needs a re-creation. - The router needs
python3in the guest image. The bundled image has it. Custom images without it get a warning and the proxy cannot reach their daemons. *.localhostresolution: Chrome, Firefox and curl resolve it to the loopback. Other clients may need an/etc/hostsentry.- The
Hostheader is not rewritten. Dev servers with strict host allow-lists may reject*.localhostnames; Vite allows.localhostsubdomains by default. - Every local process can reach every exposed daemon through the proxy. This is the same exposure as loopback port forwards today.
Logs
The command agent-circus logs shows the log output of the sandbox VM. It
reads the log files that the sandbox services write inside the guest and
prefixes every line with its source in square brackets, in the style of
docker compose logs:
[kernel] [ 0.079527] Run /init.krun as init process
[bridge] --- circus-ssh-agent-bridge start 2026-01-01T10:00:02+00:00
[dockerd] time="2026-01-01T10:00:00.000000000Z" level=info msg="Starting up"
[hook.provision] gcx config set stacks.default.stack default
[daemon.opencode-web] 2026-01-01 10:00:03.123456789 --- circus-daemon opencode-web start 2026-01-01T10:00:03+00:00
[daemon.opencode-web] 2026-01-01 10:00:03.456789012 server listening on http://0.0.0.0:4096
| Label | Source name | Guest path | Content |
|---|---|---|---|
[kernel] |
kernel |
dmesg in the guest |
Kernel messages |
[bridge] |
bridge |
/tmp/ssh-agent-bridge.log |
The SSH agent bridge |
[dockerd] |
dockerd |
/tmp/dockerd.log |
The Docker engine daemon |
[hook.<name>] |
hooks |
/var/log/agent-circus/*.log |
The last run of each hook |
[daemon.<name>] |
daemons |
/var/log/circus-daemons/*/current |
Each [[daemons]] entry |
The output is grouped by source; the order above is a display convention, not event time. The kernel section comes first because its ring buffer covers the boot. The bridge and dockerd s6 services start independently, so their real relative order is not guaranteed. The command does not merge lines by event time.
agent-circus logs # all sources, last 50 lines each
agent-circus logs -n 200 # more lines per source
agent-circus logs dockerd # one source only
agent-circus logs dockerd kernel # several sources
agent-circus logs -t # podman-style leading timestamps
agent-circus logs -f # follow all sources, labels included
agent-circus logs --list # list the sources and their guest paths
-t/--timestamps moves the stamps that sources embed in their lines
to a podman-style leading position (RFC 3339, like podman logs -t).
It does not sort lines:
2026-01-01T10:00:03.456789012+00:00 [daemon.opencode-web] server listening on http://0.0.0.0:4096
2026-01-01T10:00:00.000000000Z [dockerd] level=info msg="Starting up"
Only lines that carry a stamp change:
- Daemon lines carry s6-log stamps. s6-log stamps record when the
logger receives a complete line and contain no timezone; agent-circus
generates the daemon loggers with
TZ=UTC0, so-tcan label them+00:00. Daemon logs written by an older sandbox (before this guarantee) may carry another timezone and stay ambiguous; re-create the sandbox or restart its daemons to switch new lines to UTC. - dockerd writes its own wall-clock timestamp on most of its lines
(logrus
time="..."fields). - The kernel stamps are time since guest boot (
[ 0.064705]= 65 ms after power-on), not wall-clock time. - Bridge and hook lines do not have a timestamp on every line.
Unstamped lines and the kernel stamps print unchanged; agent-circus never invents a timestamp and never sorts lines.
The kernel source reads dmesg in the guest. Follow mode prints a
limited dmesg snapshot first and then follows only new records with
dmesg --follow-new, which needs a readable /dev/kmsg. A kernel
record arriving between the snapshot and the follower start can be
missed.
By default every line carries its source label. With --no-labels, each
file is printed under a ==> path <== header (the tail multi-file
style) and the lines stay as the services wrote them; following without
labels runs a single plain tail -F, joined by the two-stage kernel
follower when the kernel is selected.
==> /tmp/dockerd.log <==
time="2026-01-01T10:00:00.000000000Z" level=info msg="Starting up"
To follow a single daemon instead of all sources, use
agent-circus daemon logs -f <name>.
The command needs a running sandbox: a stopped sandbox keeps no guest
processes, and a sandbox that failed to boot wrote nothing this command
can reach. agent-circus logs -f ends when you press Ctrl-C; the sandbox
keeps running. With labels, follow mode runs one labeled tail -F
pipeline per file (plus the two-stage kernel follower) in the guest;
the pipelines share one output stream, so line order is preserved
within each source, but sources interleave by arrival.
Hooks
A hook is a shell script that agent-circus runs in the sandbox to set up your project. Use hooks to install project software without building your own image. There are two hooks:
| Hook | Runs | Typical use |
|---|---|---|
provision |
Once per sandbox, and again when the script changes | Install packages and tools: apt-get install, npm install -g, downloads, docker pull |
startup |
Once per boot of the sandbox | Prepare the project: write tool configs, docker compose up -d, database migrations |
Both hooks run as root, in the agent workdir ([agent] workdir).
A long-running process does not belong in a hook. Make it a daemon (see
Daemons).
Example: install and configure a CLI tool
This example installs the Grafana CLI gcx and configures it with a
server URL and a token from your host shell:
env_passthrough = ["GRAFANA_*"]
[hooks]
provision = """
set -eu
GCX_VERSION=1.6.0
case "$(uname -m)" in
x86_64) arch=amd64 ;;
aarch64) arch=arm64 ;;
*) echo "unsupported architecture: $(uname -m)" >&2; exit 1 ;;
esac
curl -fsSL "https://github.com/grafana/gcx/releases/download/v${GCX_VERSION}/gcx_${GCX_VERSION}_linux_${arch}.tar.gz" \
| tar xz -C /usr/local/bin gcx
"""
startup = """
set -eu
: "${GRAFANA_SERVER:?GRAFANA_SERVER is required}"
: "${GRAFANA_TOKEN:?GRAFANA_TOKEN is required}"
gcx config set stacks.default.grafana.server "${GRAFANA_SERVER}"
gcx config set stacks.default.grafana.token "${GRAFANA_TOKEN}"
gcx config set contexts.default.stack default
gcx config set stacks.default.grafana.org-id 1
"""
provisioninstallsgcxonce. The binary stays in the sandbox acrossstopandstart.- If you change
GCX_VERSION, the script changes, and the nextagent-circus uprunsprovisionagain. startupwrites the configuration on every boot, so a new token in your host shell reaches the sandbox at the next start.- The script detects the CPU architecture, because the sandbox image is built for the architecture of your host.
set -eustops the script at the first failing command. agent-circus does not add it for you.
When Hooks Run
| Command | Sandbox before | provision |
startup |
|---|---|---|---|
up |
missing (created) | runs | runs |
up, start |
stopped (started) | runs if the script changed | runs |
up |
running | runs if the script changed | runs if it has not run in this boot |
exec |
missing or stopped | runs if the script changed | runs |
exec |
running | does not run; prints a warning if the script changed | runs if it has not run in this boot |
rm, destroy |
– | its result is lost; the next up runs it again |
– |
The order after a boot or start is: host entries, SSH files, Git
configuration, Docker engine ready, provision, startup, daemons. So
provision can clone private repositories through the SSH agent, and
daemons can use what the hooks set up.
exec on a running sandbox never runs provision, so a session does not
change the sandbox under you. Run agent-circus up to apply a changed
provision script.
agent-circus compares only the script text. A change to env,
env_passthrough or a passed-through value does not run provision
again. Use agent-circus hook run provision --force for that.
Hook Settings
The short form is a string with the script. The table form allows more settings:
[hooks.provision]
file = ".agent-circus/hooks/provision.sh" # or: script = "..."
required = true # default: true for provision,
# false for startup
timeout = 600 # seconds; default: no timeout
workdir = "/workspace" # default: [agent] workdir
env = { NPM_CONFIG_LOGLEVEL = "warn" } # extra variables
env_passthrough = ["NPM_TOKEN"] # host variables for this hook
| Field | Default | Meaning |
|---|---|---|
script |
– | The script text. Set script or file, not both. |
file |
– | A script file on the host. A relative path starts at the workspace root. agent-circus reads the file on the host at every run. |
required |
true (provision), false (startup) |
When a required hook fails, the command exits with code 1 and skips the later steps (startup, daemons). The sandbox keeps running. When an optional hook fails, agent-circus prints a warning and continues. |
timeout |
none | Stop the hook after this many seconds. |
workdir |
the [agent] workdir |
Guest working directory |
env |
{} |
Extra variables |
env_passthrough |
[] |
Host variables for this hook, with the same rules as the top-level env_passthrough |
A hook gets the same variables as a daemon: [env], the
top-level env_passthrough, SSH_AUTH_SOCK (with [ssh]), its own
env_passthrough, and its env. If a plain name in env_passthrough is
not set on the host, the hook fails. Variable names must not start with
MSB_: msb reserves that prefix and rejects such variables. Values of
env that contain $ expand inside the sandbox before the hook runs
(see "Dollar References").
A script that starts with #! runs with that interpreter. Any other
script runs with bash. A script can be at most 64 KiB. For larger
setups, call a script from your repository in the hook.
A failed provision run is due again: the next up or start runs it
again. A failed startup run is not repeated in the same boot; run it by
hand with agent-circus hook run startup.
Writing Hook Scripts
- Make
provisionsafe to run more than once.apt-get installanddocker pullare safe. A script that appends a line to a file is not. - A background process that a hook starts must not keep the hook's
output open. Otherwise agent-circus waits for it. Redirect its output,
for example
some-tunnel >/dev/null 2>&1 &. Better: make it a daemon. provisionresults are lost withagent-circus rm, and the nextuprunsprovisionagain. Docker images thatprovisionpulls survive withdocker_disk_persist = true(see Docker and Disks).- The workspace is the same folder as on the host. A tool that writes
into it, such as
uv syncwriting.venv, shares that folder with the host. SetUV_PROJECT_ENVIRONMENTto a path in the sandbox if the host uses its own.venv.
Hook Commands
| Command | Effect |
|---|---|
agent-circus hooks |
Show each hook: up to date, due, never run or not configured, the last exit code and the time of the last run. |
agent-circus hook run <hook> |
Run provision or startup now, if it is due. Exits with code 1 when the hook fails. |
agent-circus hook run <hook> --force |
Run it even when it is up to date. |
agent-circus hook logs <hook> [-n N] [-f] |
Show the output of the last run. |
The output of a hook appears on the terminal while it runs. A copy is in
/var/log/agent-circus/<hook>.log in the sandbox; each run replaces it.
In ACP mode (exec --acp), the output goes only to that file. If the
sandbox must boot first, an ACP start waits for the hooks. Run
agent-circus up once before you connect an editor to a new sandbox.
Hooks and Agents
- The agent can change hook files and
config.tomlthrough the workspace mount. A changed hook runs at the next boot orup. In the sandbox, this gives the agent no new rights: it already runs as root. But the change is in your repository. Review it like other code before you commit it. agent-circus logsThe provision script changed since the last runbefore it runs a changed script. - Variables that only a hook gets (
env_passthroughof the hook) are not hidden from the agent: the agent can edit the hook to print them. - Hook variables are on the command line of the
msbprocess on the host while the hook runs, the same as for daemons andexec -e.
Docker and Disks
The sandbox image ships Docker 29. Docker 29 stores images and containers
with the overlayfs snapshotter, and that snapshotter needs a real
filesystem under /var/lib/docker. The sandbox root filesystem is an
overlayfs by default, and the kernel refuses to stack one overlayfs on
another. A sandbox without disk configuration therefore cannot run
containers. The sandbox boots, and every docker command fails with
"Cannot connect to the Docker daemon". The boot log explains why.
Enable docker with one of two settings under [msb.sandbox]:
[msb.sandbox]
# Option 1: a dedicated ext4 disk for docker data, removed with the
# sandbox. Docker data does not count against the root disk size.
docker_disk = "10G"
# Option 2: a flat root. The whole root filesystem becomes one real
# filesystem with no overlayfs, and docker data shares it with the rest
# of the guest. Size it for image content plus docker data (about 3G of
# image content plus your docker usage).
root_disk = "flat:32G"
Both settings can be combined: root_disk = "flat:32G" with
docker_disk = "10G" puts docker data on its own disk inside a flat
root. A plain size such as root_disk = "16G" keeps the managed root
and does not enable docker.
Without root_disk, the managed root stays at the msb default of 4G.
Docker data does not count against it, but image content and rootfs
writes do. The sandbox image carries about 3G of content, so expect
roughly 1G of headroom. If your agents write a lot outside
/var/lib/docker, raise the root next to the docker disk.
dockerd runs as a supervised s6 service inside the sandbox. It is
restarted when it crashes and stopped cleanly when the sandbox stops.
docker_stop_timeout (default 20 seconds) bounds how long dockerd waits
for running containers at shutdown. It is passed to the sandbox at
creation, so a change needs a re-created sandbox.
Disk settings apply at sandbox creation. agent-circus warns when the settings of an existing sandbox differ from the configuration. Remove and re-create the sandbox to apply them:
agent-circus rm && agent-circus up
Removing the sandbox deletes the docker data disk, together with all
images and containers in it. The disk survives stop and start.
Persistent Docker Data
Large images or slow builds are expensive to recreate. Set
docker_disk_persist = true to keep docker data when you remove the
sandbox:
[msb.sandbox]
docker_disk = "20G"
docker_disk_persist = true
agent-circus then stores /var/lib/docker in a named msb volume called
agents-<project>-docker instead of a disk that belongs to the sandbox.
up creates the volume on first use and reuses it when the sandbox is
created again. rm and destroy keep the volume and print its name.
Everything in it survives: images, build cache, containers, networks,
and docker volumes. Containers with a restart policy start again with
the new sandbox.
To delete the volume as well, add --volumes:
agent-circus destroy --volumes
agent-circus rm -f --volumes
You can also delete it later with msb volume rm agents-<project>-docker.
msb volume list shows all volumes and their sizes.
Rules and limits:
docker_disk_persistneedsdocker_disk. A flat root alone cannot persist docker data.- The size of an existing volume cannot change. When
docker_diskdoes not match the volume,upstops with an error. Setdocker_diskto the size that the error names, or delete the volume. - Only one running sandbox can use a disk volume at a time. msb refuses
a second one, and
upreports that the volume is in use. - An existing sandbox keeps the disk it was created with. After you turn
the setting on or off,
upwarns until you re-create the sandbox. The images on the old private disk are lost when you re-create it. - A newer dockerd can use the data of an older one. Going back to an older sandbox image with an older dockerd can fail on the same volume.
Host storage lives under the msb storage root (~/.microsandbox by
default). A flat root or a docker disk adds its size there per sandbox.
A persistent docker volume stays there until you delete it.
Git Worktrees
agent-circus supports Git worktrees through the worktree mirror. It is on
by default ([git] worktree_mirror = true). To turn it off, set:
[git]
worktree_mirror = false
A [git] table also turns on the forwarding of your host Git
configuration (see "Git Configuration"), even when it only sets
worktree_mirror.
The mirror adds a second bind mount for the workspace at its exact host absolute
path inside the sandbox (in addition to the standard /workspace mount).
Both paths point to the same directory, so Git's recorded absolute paths
are valid on both sides of the sandbox boundary — git worktree list,
git worktree add, and all other operations that consume or emit absolute
paths work without any manual path rewriting.
The mount applies at sandbox creation, like all msb mounts. agent-circus warns when an existing sandbox was created without the mirror. Remove and re-create the sandbox to apply the flag:
agent-circus rm -f && agent-circus up
Earlier releases had the mirror off by default. A sandbox created by such
a release has no mirror mount, so agent-circus warns until you re-create
it, or until you set worktree_mirror = false to keep the old behavior.
Re-creating removes the guest state: installed packages and the result of
the provision hook (Docker data survives only with
docker_disk_persist).
When agent-circus cannot add the default mirror, because the host path of
the workspace is already a mount target in the sandbox (for example a
workspace at /workspace on the host, as in a dev container), it boots
without the mirror and logs a short note. An explicit
worktree_mirror = true stops with an error in that case instead.
With the mirror on, agents start in the host path of the workspace
instead of /workspace (unless [agent] workdir or exec --workdir
sets another directory). Git then records paths that are valid on the
host, and you do not need extra instructions in AGENTS.md. ACP sessions
from an editor still open in /workspace, because the editor maps file
paths to it; the git wrapper runs their worktree commands through the
host path (see below).
Create worktrees below .agent-circus/worktrees/, for example
git worktree add .agent-circus/worktrees/my-branch -b my-branch.
agent-circus creates this directory on up, start, and exec in the main
checkout, with a .gitignore that hides it from git status. It is part
of the workspace mount, so the worktree and its uncommitted files are
visible on the host, and Git paths are valid on both sides. Claude Code's
own worktrees in .claude/worktrees/ work the same way. Add
.claude/worktrees/ to your .gitignore if you use them.
A worktree outside the workspace (such as ../my-branch) created in the
sandbox exists only in the sandbox. agent-circus warns about such worktrees
on up, start, exec, and destroy. They are lost when you remove the
sandbox and leave a stale entry in .git/worktrees/ (clean it up with
git worktree prune). Without worktree_mirror, worktrees in
.agent-circus/worktrees/ record /workspace paths that are invalid on
the host; agent-circus warns about this as well.
The sandbox runs git through a small wrapper (/usr/local/bin/git,
installed by agent-circus on every start). It rejects git worktree add
and git worktree move to paths outside .agent-circus/worktrees/ and
.claude/worktrees/. Agents act on the first lines of an error, so the
error starts with the command to run: the rejected command, rewritten to
run in the repository root with a target below .agent-circus/worktrees/
(named after the new branch or the rejected path). Then follow one line
with the reason (for example "outside the workspace", so the worktree
would be lost with the sandbox) and a warning not to bypass the check
with /usr/bin/git:
fatal: agent-circus: rejected worktree path /home/user/feature
Run this instead:
git -C /home/user/myrepo worktree add .agent-circus/worktrees/feature -b feature
Why: /home/user/feature is outside the workspace. A worktree there would exist only in this sandbox and would be lost when the sandbox is removed.
Do not use /usr/bin/git to get around this check: the worktree would not work correctly on the host.
All other Git commands pass through
unchanged. The wrapper guides agents; it is not a security boundary:
/usr/bin/git bypasses it. Worktrees that Codex creates under ~/.codex
are rejected as well, because their paths differ between host and
sandbox.
With worktree_mirror = true, /workspace and the host path are the
same directory, but Git records the path it is given. Agents in ACP
sessions work in /workspace, so the wrapper translates their worktree
commands: git worktree add, move, remove, lock, unlock and
repair on this checkout through /workspace run through the host path
instead, with every path argument mapped to it. For example,
git worktree add .agent-circus/worktrees/feature -b feature in
/workspace runs as
git -C /home/user/myrepo worktree add /home/user/myrepo/.agent-circus/worktrees/feature -b feature.
The wrapper prints one line that says so. The new worktree is also
reachable as /workspace/.agent-circus/worktrees/feature, and Git works
there as well. A target outside the worktree directories is still
rejected, with a suggestion through the host path, e.g.
git worktree add ../feature -b feature becomes
git -C /home/user/myrepo worktree add .agent-circus/worktrees/feature -b feature.
With --git-dir or --work-tree, the wrapper does not translate and
rejects every target through /workspace.
An agent can still create a worktree through /workspace without the
wrapper, for example with /usr/bin/git or with a Git library inside a
harness. Git then records /workspace paths, and the worktree is broken
on the host although its files are there. With worktree_mirror = true,
agent-circus repairs such worktrees on the host at every up, start and
exec: for each registered worktree below /workspace whose directory
exists in the workspace, it runs git worktree repair with the host
path, and logs Repaired Git worktree .... This needs git on the
host; without it, agent-circus prints a warning. Until the next up,
start or exec, the worktree stays broken on the host. Without the
mirror, agent-circus does not repair anything, because /workspace paths
are the only paths that work in the sandbox then.
agent-circus does not run in a linked worktree (a directory created with
git worktree add). Its Git metadata lives in the main repository, outside
the sandbox, so Git cannot work inside the sandbox. up, start, and
exec fail with an error when the workspace or one of its parent
directories is a linked worktree. Run agent-circus from the main checkout and
create or change worktrees there, on the host or in the sandbox. ps,
stop, rm, and destroy still work, so you can remove a sandbox that
was created in a worktree earlier.
The remaining agent-circus [git] keys are supported as well; see
"Git Configuration".
Git Configuration
The [git] table forwards the git configuration of your host into the
sandbox. Agents in the sandbox then use your git identity, and they can
sign commits with your SSH key. Any [git] table turns forwarding on,
even when it only sets worktree_mirror:
[git]
config_path = "~/.gitconfig" # optional, default search
signing_key_path = "~/.ssh/id_ed25519.pub" # optional, SSH public key
worktree_mirror = true # optional; see "Git Worktrees"
With no config_path, agent-circus uses the first file that exists:
~/.gitconfig, then $XDG_CONFIG_HOME/git/config (default
~/.config/git/config). Only the first file is copied.
agent-circus writes three files into the sandbox, below
/root/.config/agent-circus/git/: the copy of the host gitconfig, the
copy of the signing key, and a managed gitconfig that includes the host
copy and sets user.signingkey. Symlinks on the host (for example from
home-manager) are followed; the sandbox gets a copy of the target file. The top of /root/.gitconfig in the
sandbox gets one managed include block that points at the managed
file. Everything else in /root/.gitconfig stays as it is. Your own
git config --global changes in the sandbox stay and win over host
settings, because git uses the last value it reads.
The files are refreshed at every up, start, and exec. The copy is
one-way: guest-side edits of the copies are overwritten. If you remove
the [git] table, the last files stay in the sandbox until you
re-create it.
To sign commits in the sandbox, set gpg.format = ssh in the host git
config, point signing_key_path at your public key, and configure
the [ssh] table so the SSH agent is forwarded. git then signs with
ssh-keygen and the private key stays in your host agent. agent-circus
refuses files that do not look like one OpenSSH public key, and it never
copies a file that contains a private key.
Missing or invalid files never stop a command. agent-circus logs a warning (or an INFO message when no default gitconfig exists) and forwards the parts it can.
Limitations:
- Host paths inside the host gitconfig do not exist in the sandbox.
This affects
includeIftargets,core.excludesFile,gpg.ssh.allowedSignersFile, and credential helpers. Signing works, butgit log --show-signaturemay not verify signatures. - The host gitconfig may contain secrets, for example tokens in remote URLs. They are copied into the sandbox.
SSH Agent Forwarding
An SSH agent is a small program on your host that holds your private SSH
keys and signs requests for them. With agent forwarding, the ssh and
git commands inside the sandbox use this agent. Git over SSH then works
without a private key in the sandbox, and no private key material ever
enters the guest.
Add an [ssh] table to .agent-circus/config.toml to turn the forwarding
on. An empty table is enough:
[ssh]
The host needs a running SSH agent. Make sure that SSH_AUTH_SOCK is set
and that ssh-add -l on the host lists your keys. When SSH_AUTH_SOCK is
not set, up and start fail with an error before msb runs.
You can copy an SSH client configuration and a known_hosts file into the
sandbox:
[ssh]
config_path = "~/.ssh/config"
known_hosts_path = "~/.ssh/known_hosts"
agent-circus copies these files to /root/.ssh after every up and
start. The copy is one-way. Files that you edit inside the sandbox are
overwritten at the next refresh. Symlinks on the host (for example from
home-manager) are followed; the sandbox gets a copy of the target file.
A host ~/.ssh/config with macOS-only options such as UseKeychain
makes ssh inside the sandbox fail. Add this line at the top of the file:
IgnoreUnknown UseKeychain
IdentityFile entries that point at host paths produce warnings only.
The keys come from the agent, not from files in the sandbox.
Two setup steps apply:
- Rebuild the image once with
agent-circus build. The image then containsopenssh-clientandsocat. - Re-create the sandbox when you add or remove the
[ssh]table:agent-circus rm -f && agent-circus up. The connection route between the sandbox and the host agent is fixed at sandbox creation.
After every boot and start, agent-circus refreshes the route target and runs
ssh-add -l inside the sandbox. The check warns when it cannot reach the
agent, for example after you restarted the agent on the host. Run
agent-circus up again in that case, so agent-circus refreshes the route.
Warning: every process in the sandbox can ask the host agent to sign. Run
ssh-add -c on the host to confirm each use, or run a dedicated agent
with only the keys that the sandbox needs.
Host Entries
The hosts file of your host (/etc/hosts by default) maps names to IP
addresses. This is where a company VPN or a local test server adds its
names. The sandbox does not see these names, because it has its own hosts
file and its own resolver.
The [hosts] table forwards selected entries from the host hosts file
into the sandbox. The table uses the same pattern syntax as agent-circus:
[hosts]
patterns = ["*.corp.internal", "myserver", "re:\\.vpn\\.example\\.com$"]
# file = "/etc/hosts" # optional, defaults to /etc/hosts
A pattern matches a name in the hosts file. A pattern without re: is a
glob, where * matches any text. A pattern with re: is a regular
expression. Matching ignores upper and lower case. When one name of a
line matches, all names of that line are forwarded.
agent-circus writes the matching entries into a managed block in
/etc/hosts inside the sandbox. Everything outside this block stays as
it is. The block is refreshed at every up, start, and exec, so a
change on the host applies without re-creating the sandbox. Names resolve
through the guest resolver and never reach the DNS rules of msb.
Entries that point at a loopback address (127.0.0.0/8 or ::1) resolve
to the sandbox itself, not to your host. agent-circus warns about them.
Use host.microsandbox.internal (with the host network profile) to
reach services on your host instead.
Containers that an agent starts with the Docker engine inside the sandbox do not get these entries.
If you remove the [hosts] table, the last block stays in the sandbox
until you re-create it. To empty the block without re-creating, set
patterns = [] and run agent-circus up once.
CA Certificates
Company networks often use a private certificate authority (CA). A TLS inspection proxy or an internal server, such as an artifact store, uses such a CA. Programs in the sandbox do not trust this CA by default, so HTTPS requests to these servers fail.
Set trust_host_cas = true under [msb.network]:
[msb.network]
trust_host_cas = true
agent-circus then creates the sandbox with --trust-host-cas. msb copies
every CA that the host trusts into the sandbox and adds it to the system
store of the sandbox.
The certificates must be in the CA store of the host. agent-circus does
not select or copy single certificates. The [ca_certs] table of
agent-circus is not supported; agent-circus logs a message and ignores it.
On Debian or Ubuntu hosts, put the certificate files into
/usr/local/share/ca-certificates/ and run sudo update-ca-certificates
on the host.
Security note: every CA that the host trusts is also trusted in every sandbox with this option. A CA that someone plants on the host is trusted in the sandbox as well. The option is off by default.
The option applies only when the sandbox is created. After you change it, or after you add or remove a CA on the host, re-create the sandbox:
agent-circus rm -f && agent-circus up
agent-circus warns when the sandbox and the configuration disagree about the option.
curl, git, the Docker engine, Node-based agents, Python (requests,
ssl) and uv use the system store. Codex is not verified yet. Changes
to the image need agent-circus build and a re-created sandbox.
Containers that an agent starts with the Docker engine inside the
sandbox do not get these certificates.
Troubleshooting
If the sandbox boots but the Docker engine stays unreachable, read the log of dockerd:
agent-circus logs dockerd
The log contains one --- circus-dockerd start line per (re)start of the
service, including restarts after a crash. The command
msb exec agents-<project> -- /command/s6-rc -a list lists the services
that s6 currently runs.
If a command fails with a message about the msb storage root and path
substitution, an ancestor of the msb storage root is writable by other
accounts. The msb storage root is ~/.microsandbox by default. Fix the
directory named in the error. Then run umask in your shell to make sure
that new directories get safe permissions:
chmod g-w,o-w ~/.microsandbox
If up or start reports that dockerd did not become ready, the warning
names the probe error and the diagnostic commands. Run the commands from the
warning and compare their output with the dockerd log
(agent-circus logs dockerd).
If docker commands fail with "Cannot connect to the Docker daemon" and
the boot log says that the docker data root is on overlayfs, docker is
not enabled for this sandbox. Add docker_disk = "10G" or
root_disk = "flat:32G" under [msb.sandbox], then remove and re-create
the sandbox. See the Docker and Disks section.
If a forwarded port answers with Empty reply from server, see the
Port Forwarding section under Networking: the server inside the sandbox is
bound to 127.0.0.1 in the guest and must be restarted on 0.0.0.0.
If ssh-add -l inside the sandbox reports that it cannot connect to the
agent, see the SSH Agent Forwarding section. Common causes are a missing
[ssh] table at sandbox creation, a stopped host agent, or a sandbox
created before the image rebuild.
If a name from your host hosts file does not resolve inside the sandbox,
see the Host Entries section. Check that the [hosts] table is present,
that the pattern matches the name, and that agent-circus up ran after the
last change to the host file.
If a mounted directory is empty inside the sandbox, make sure that the host path in the configuration contains files. agent-circus fails the boot when a host path does not exist or is not a directory, but it cannot see inside the directory, so an empty source produces an empty guest directory.
Limitations
msb is beta software. agent-circus pins the msb version through the
microsandbox package and warns about version drift, but command line flags
can still change between releases.
One workspace maps to one sandbox, and all harnesses of a workspace share it. Commands in the sandbox run as root, because the Docker engine in the guest needs root. There is no per-agent user separation yet.
agent-circus does not start sidecar containers. Features of agent-circus that need companion containers, for example llama.cpp or claude-mem, have no agent-circus equivalent yet. A process that runs in the sandbox itself can run as a daemon.
Metadata
Release files for agent-circus 2.0.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agent_circus-2.0.0rc1.tar.gz | 1.6 MB | With provenance | Details for agent_circus-2.0.0rc1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agent_circus-2.0.0rc1-py3-none-any.whl | Python 3 | none | any | Details for agent_circus-2.0.0rc1-py3-none-any.whl |
Total release size: 2.0 MB
Release files / agent_circus-2.0.0rc1.tar.gz
| Download URL | agent_circus-2.0.0rc1.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f925177cd3d8aa8e9c45e9027fc84ccdf93cbf4d21fe036cdd090b82dffab2de
|
|
BLAKE2b-256 checksum How to use checksums |
6f3a5d9dd918215f4baa29ce96bda8e808ffece388f600f8c36b5e392047a91f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / agent_circus-2.0.0rc1-py3-none-any.whl
| Download URL | agent_circus-2.0.0rc1-py3-none-any.whl |
|---|---|
| Size | 371.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d991b2e3f0be220adcef9d52c30d6c98bc0bca06f6c2c14ff7b87190cc7d6f7
|
|
BLAKE2b-256 checksum How to use checksums |
968feef4c8a54a081f3252409918cafce33f8f13d0d6a6a52fc2352eb2b9677b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for agent-circus 2.0.0rc1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for agent_circus-2.0.0rc1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.