9.2. Squad Container Mode¶
Squad Container Mode runs individual squad agents inside isolated containers, providing stronger security boundaries and reproducible execution environments. You can enable container mode per-agent within a squad, so some agents run in-process while others run in containers.
Prerequisites¶
Before enabling container mode, complete the Container Execution Guide:
- Container runtime installed (Docker or Apple Container)
- Agent runner image built (
aigo-agent-runner:latest) - Mount allowlist configured
- Credential proxy running (if agents need external API access)
How It Works¶
When an agent runs in container mode:
sequenceDiagram
participant Host as Backend.AI GO Host
participant NS as Namespace Manager
participant C as Container
participant CP as Credential Proxy
Host->>NS: Create session directory
NS->>C: Start container with workspace mounts
C->>CP: API request (with placeholder credential)
CP->>CP: Substitute real credential
CP-->>C: Forwarded request with real credential
C->>Host: IPC: send message / create task
Host-->>C: IPC: follow-up message
C->>Host: IPC: close (task complete)
Host->>C: Container stops Each container receives:
/workspace— the squad's shared workspace directory (read-write for main agents, read-only for others)/workspace/extra/{name}— additional mounts you configure/workspace/ipc— the IPC directory for host-container communication.claude/— the agent's SDK session state
Step 1: Create or Edit a Squad¶
-
Go to Squad in the sidebar.
-
Click New Squad or open an existing squad.
-
Configure the squad's workspace directory if not already set.
Step 2: Enable Container Mode for an Agent¶
-
In the squad editor, click on the agent you want to containerize.
-
In the agent configuration panel, find Execution Mode.
-
Select Container from the dropdown (default is In-Process).
-
The container configuration options appear:
Field Default Description Image aigo-agent-runner:latestContainer image to use Timeout 30 minutes Maximum execution time Idle Timeout None Kill container if no output for this duration Additional Mounts Empty Extra host paths to mount
Step 3: Configure Additional Mounts (Optional)¶
If the agent needs access to host paths beyond the workspace:
-
Click Add Mount in the agent's container configuration.
-
Fill in:
- Host Path: The path on the host to mount (must be in the mount allowlist)
- Container Path: Where to mount it inside the container (must be under
/workspace/extra/) - Read-Only: Toggle on to prevent the agent from writing to this path
-
Click Add.
Mount Security
Only paths under an allowed root can be mounted. Paths containing patterns like .ssh, .env, or .aws are always blocked.
Step 4: Configure Group Namespaces¶
Group namespaces organize containers into isolated session groups. Each group gets its own session directory and instruction set.
Create a Group Namespace¶
-
Go to Settings > Container > Groups.
-
Click New Group.
-
Enter a Name (filesystem-safe, e.g.,
dev-team). -
Optionally add a Description.
-
Click Create.
Set Group Instructions¶
Group-specific instructions (equivalent to CLAUDE.md) are injected into every container session for that group:
-
Click the group name in the Groups list.
-
Click Edit Instructions.
-
Enter your instructions (Markdown supported).
-
Click Save.
Global Instructions¶
Global instructions apply to all groups. They are combined with group-specific instructions and merged for each container:
-
Go to Settings > Container > Groups.
-
Click Edit Global Instructions.
-
Enter your global directives.
-
Click Save.
Step 5: Run the Squad¶
-
Click Run in the squad panel.
-
Submit your task description.
-
The planner creates a task graph and assigns tasks to agents.
-
When a task is assigned to a container-mode agent:
- A session directory is created under
DATA_DIR/sessions/{group}/ - The container is started with the workspace and IPC mounts
- The agent processes the task and communicates results via IPC
- The container stops when the task completes or times out
- A session directory is created under
Monitoring Container Execution¶
Container Status Panel¶
The squad monitoring dashboard shows container-specific status:
| Status | Description |
|---|---|
provisioning | Container is starting, image being prepared |
running | Container is active and processing |
completed | Container finished successfully |
failed | Container exited with an error |
timeout | Container exceeded the execution time limit |
Run History¶
-
Go to Settings > Container > Run History.
-
View past container executions with start time, duration, exit code, and output.
Audit Log¶
-
Go to Settings > Container > Audit Log.
-
Browse security events, permission checks, and mount validations.
Troubleshooting Container Mode¶
Agent container does not start¶
- Verify the agent runner image exists: Settings > Container > Image Status
- Check the runtime is available:
curl http://localhost:55765/api/v1/container/runtime - Review the audit log for permission errors
Agent cannot write to workspace¶
- Confirm the squad workspace directory is under an allowed root
- Check that the agent is designated as a main agent (only main agents get read-write workspace access)
Container times out¶
- Increase the timeout in the agent's container configuration
- Review the container logs in the run history for slow steps
- Consider splitting the task into smaller subtasks
API calls fail inside container¶
- Verify the credential proxy is running: Settings > Container > Credential Proxy
- Confirm the correct credential mapping exists for the upstream API
- Check that the container's environment has the correct
ANTHROPIC_BASE_URLpointing to the proxy
API Reference¶
| Endpoint | Method | Description |
|---|---|---|
/api/v1/container/queue/groups | GET | List all container groups |
/api/v1/container/queue/groups/{group} | GET | Get container group state |
/api/v1/container/queue/counts | GET | Get queue counts per group |
/api/v1/container/queue/max-concurrent | GET/PUT | Get or set max concurrent containers |
/api/v1/container/run-history | GET | View container run history |
/api/v1/container/metrics | GET | Current container metrics |
/api/v1/container/analytics | GET | Aggregated container analytics |