You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: agent-schema.json
-46Lines changed: 0 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -831,10 +831,6 @@
831
831
"type": "string",
832
832
"description": "Name for the a2a tool"
833
833
},
834
-
"sandbox": {
835
-
"$ref": "#/definitions/SandboxConfig",
836
-
"description": "Sandbox configuration for running shell commands in a Docker container (shell tool only)"
837
-
},
838
834
"file_types": {
839
835
"type": "array",
840
836
"description": "File extensions this LSP server handles (e.g., [\".go\", \".mod\"]). Only for lsp toolsets.",
@@ -1012,48 +1008,6 @@
1012
1008
],
1013
1009
"additionalProperties": false
1014
1010
},
1015
-
"SandboxConfig": {
1016
-
"type": "object",
1017
-
"description": "Configuration for running shell commands inside a sandboxed Docker container",
1018
-
"properties": {
1019
-
"image": {
1020
-
"type": "string",
1021
-
"description": "Docker image to use for the sandbox container. Defaults to 'alpine:latest' if not specified.",
1022
-
"examples": [
1023
-
"alpine:latest",
1024
-
"ubuntu:22.04",
1025
-
"python:3.12-alpine",
1026
-
"node:20-alpine"
1027
-
]
1028
-
},
1029
-
"paths": {
1030
-
"type": "array",
1031
-
"description": "List of paths to bind-mount into the container. Each path can have an optional ':ro' suffix for read-only access (default is read-write ':rw'). Relative paths are resolved from the agent's working directory.",
1032
-
"items": {
1033
-
"type": "string"
1034
-
},
1035
-
"minItems": 1,
1036
-
"examples": [
1037
-
[
1038
-
".",
1039
-
"/tmp"
1040
-
],
1041
-
[
1042
-
"./src",
1043
-
"./config:ro"
1044
-
],
1045
-
[
1046
-
"/data:rw",
1047
-
"/secrets:ro"
1048
-
]
1049
-
]
1050
-
}
1051
-
},
1052
-
"required": [
1053
-
"paths"
1054
-
],
1055
-
"additionalProperties": false
1056
-
},
1057
1011
"ScriptShellToolConfig": {
1058
1012
"type": "object",
1059
1013
"description": "Configuration for custom shell tool",
Copy file name to clipboardExpand all lines: docs/configuration/sandbox/index.md
+21-92Lines changed: 21 additions & 92 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
---
2
2
title: "Sandbox Mode"
3
-
description: "Run shell commands in an isolated Docker container for enhanced security."
3
+
description: "Run agents in an isolated Docker container for enhanced security."
4
4
permalink: /configuration/sandbox/
5
5
---
6
6
7
7
# Sandbox Mode
8
8
9
-
_Run shell commands in an isolated Docker container for enhanced security._
9
+
_Run agents in an isolated Docker container for enhanced security._
10
10
11
11
## Overview
12
12
13
-
Sandbox mode runs shell tool commands inside a Docker container instead of directly on the host system. This provides an additional layer of isolation, limiting the potential impact of unintended or malicious commands.
13
+
Sandbox mode runs the entire agent inside a Docker container instead of directly on the host system. This provides an additional layer of isolation, limiting the potential impact of unintended or malicious commands.
14
14
15
15
<divclass="callout callout-info">
16
16
<divclass="callout-title">ℹ️ Requirements
@@ -19,111 +19,44 @@ Sandbox mode runs shell tool commands inside a Docker container instead of direc
19
19
20
20
</div>
21
21
22
-
## Configuration
22
+
## Usage
23
+
24
+
Enable sandbox mode with the `--sandbox` flag on the `docker agent run` command:
25
+
26
+
```bash
27
+
docker agent run --sandbox agent.yaml
28
+
```
29
+
30
+
This runs the agent inside a Docker container with the current working directory mounted.
| `/path` | Mount with read-write access (default) |
53
-
| `/path:rw` | Explicitly read-write |
54
-
| `/path:ro` | Read-only mount |
55
-
| `.` | Current working directory |
56
-
| `./relative` | Relative path (resolved from working directory) |
57
-
58
-
Paths are mounted at the same location inside the container as on the host, so file paths in commands work the same way.
59
-
60
-
## Example: Development Agent
61
-
62
-
```yaml
63
-
agents:
64
-
developer:
65
-
model: anthropic/claude-sonnet-4-0
66
-
description: Development agent with sandboxed shell
67
-
instruction: |
68
-
You are a software developer. Use the shell tool to run
69
-
build commands and tests. Your shell runs in a sandbox.
70
-
toolsets:
71
-
- type: shell
72
-
sandbox:
73
-
image: node:20-alpine # Node.js environment
74
-
paths:
75
-
- "." # Project directory
76
-
- "/tmp:rw" # Temp directory for builds
77
-
- type: filesystem
45
+
```bash
46
+
docker agent run --sandbox agent.yaml
78
47
```
79
48
80
49
## How It Works
81
50
82
-
1. When the agent first uses the shell tool, docker-agent starts a Docker container
83
-
2. The container runs with the specified image and mounted paths
84
-
3. Shell commands execute inside the container via `docker exec`
85
-
4. The container persists for the session (commands share state)
86
-
5. When the session ends, the container is automatically stopped and removed
87
-
88
-
## Container Configuration
89
-
90
-
Sandbox containers are started with these Docker options:
91
-
92
-
- `--rm`— Automatically remove when stopped
93
-
- `--init`— Use init process for proper signal handling
94
-
- `--network host`— Share host network (commands can access network)
95
-
- Environment variables from host are forwarded to container
96
-
97
-
## Orphan Container Cleanup
98
-
99
-
If docker-agent crashes or is killed, sandbox containers may be left running. docker-agent automatically cleans up orphaned containers from previous runs when it starts. Containers are identified by labels and the PID of the docker-agent process that created them.
100
-
101
-
## Choosing an Image
102
-
103
-
Select a Docker image that has the tools your agent needs:
104
-
105
-
| Use Case | Suggested Image |
106
-
| ---------------------- | -------------------- |
107
-
| General scripting | `alpine:latest` |
108
-
| Node.js development | `node:20-alpine` |
109
-
| Python development | `python:3.12-alpine` |
110
-
| Go development | `golang:1.23-alpine` |
111
-
| Full Linux environment | `ubuntu:24.04` |
112
-
113
-
<div class="callout callout-tip">
114
-
<div class="callout-title">💡 Custom Images
115
-
</div>
116
-
<p>For complex setups, build a custom Docker image with all required tools pre-installed. This avoids installation time during agent execution.</p>
117
-
118
-
</div>
51
+
1. When `--sandbox` is specified, docker-agent launches a Docker container
52
+
2. The current working directory is mounted into the container
53
+
3. All agent tools (shell, filesystem, etc.) operate inside the container
54
+
4. When the session ends, the container is automatically stopped and removed
119
55
120
56
<divclass="callout callout-warning">
121
57
<divclass="callout-title">⚠️ Limitations
122
58
</div>
123
59
124
-
- Only the <code>shell</code> tool runs in the sandbox; other tools (filesystem, MCP) run on the host
125
-
- Host network access means network-based attacks are still possible
126
-
- Mounted paths are accessible according to their access mode
127
60
- Container starts fresh each session (no persistence between sessions)
0 commit comments