Expand description
Container management for container-type agent panes (Phase 1).
Manages persistent Docker containers — one per container agent. Each
container runs the configured image (e.g. ghcr.io/agentmuxai/agent-claude)
with tini as PID 1 and is kept alive between turns. Individual turns are
executed via docker exec -i (no -t — avoids CR/LF corruption of NDJSON).
Platform support (cross-platform, matches SPEC_CONTAINER_PANE_SUPPORT_2026_06_11.md):
- Windows: named pipe
//./pipe/docker_engine - macOS: socket resolved via
docker context inspect(Docker Desktop or Rancher) - Linux:
/var/run/docker.sockor rootless path in XDG_RUNTIME_DIR
Independence boundary: this module has no dependency on a5af/claw. Docker best practices here were researched independently.
Structs§
- Container
Manager - Shared container manager. Clone-on-Arc; cheap to pass around.
- Container
Manager 🔒Inner - Container
Mount Spec - Host directories a container agent needs mounted to be able to work.
- Container
Runtime Handle - Self-healing holder for the container runtime connection.
- Exec
Outcome 🔒 - What a collected exec produced.
- Exec
Session - Exec session handle for a single turn.
Enums§
- CliProvision
- Whether
provision_clifound the CLI in place or had to install it. - Container
Error - Errors from container operations.
- Runtime
Slot 🔒 - State of the container-runtime slot held by
ContainerRuntimeHandle.
Constants§
- AGENTMUX_
DOCKER_ NETWORK - Shared user-defined Docker bridge network every agent container is
attached to, ADDITIVE to whatever
network_mode/extra_hostsalready set up (container→host reachability, unaffected — see the doc comment onnetwork_modebelow). Unlike the default bridge network, a user-defined one gives per-container DNS resolution and lets the native dev-proxy (backend::dev_proxy) route to a container by its internal IP. See docs/specs/SPEC_NATIVE_CONTAINER_DEV_PROXY_2026_09_19.md §3.1. - CLAUDE_
CREDENTIALS_ FILE - The credentials file inside the account’s config dir, and inside the image.
- CONTAINER_
CLAUDE_ DIR - Where the agent CLI’s config dir lives inside the image (
CLAUDE_CONFIG_DIR). - CONTAINER_
ENV_ DENYLIST - Env var names that reference host-filesystem paths and must NOT be forwarded
into a container via
docker exec -e. The container image supplies its own values for these (e.g.CLAUDE_CONFIG_DIR=/home/agent/.claudebaked in). - CONTAINER_
WORKSPACE_ DIR - Where the agent’s working directory is bind-mounted inside the image.
Functions§
- agent_
home_ 🔒mounts - The mounts that make up the agent’s home dir inside the container.
- agent_
id_ 🔒from_ container_ name - Reverses
container_name_for_slug—"agentmux-foo"→Some("foo"). Used bycleanup_dev_proxy_routesto key off the container name alone (stop/removeonly get a container_name, not the agent’s own id). - cli_
dir_ 🔒mount - The per-agent volume the provider CLI is installed into.
- container_
name_ for_ slug - Derive the stable container name for an agent from its slug.
Format:
agentmux-<slug>. Deterministic so restarts reuse the same container. - credentials_
dir_ if_ file_ backed - The account config dir to hand to
ContainerMountSpec::claude_config_host_dir, orNonewhen this account has no file-backed credential to mount. - fold_
mount_ 🔒source - Canonical form of a mount source for comparison.
- normalize_
host_ 🔒path - Normalize a host path for Docker’s mount API: backslashes are not accepted in
a bind source, so
C:\Users\xhas to travel asC:/Users/x. - parse_
id_ 🔒output - Parse
id -u; id -goutput into(uid, gid). - parse_
volume_ 🔒spec - Parse a Docker volume spec into
(source, target, read_only). - pull_
error 🔒 - Map a bollard pull error to
ContainerError::ImagePull. - rewrite_
local_ url_ for_ container - Rewrite a host-loopback
AGENTMUX_LOCAL_URL(e.g.http://127.0.0.1:PORT) into something a container’s network namespace can actually reach.