tiny-agent-sandbox
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tiny-agent-sandbox run python code to calculate factorial of 5"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Tiny Agent Sandbox
A small, inspectable Docker-backed sandbox that agents can call as an MCP tool.
It runs Python, JavaScript, or shell snippets in a new container with no network, no host mounts, a read-only root filesystem, a non-root user, dropped capabilities, and hard resource/output limits. Results are returned as structured data for an agent to reason about.
This is a learning and local-development project, not a production multi-tenant security boundary. Docker containers share a kernel. ReadSECURITY.md before using untrusted code.
What the agent sees
The MCP server exposes two tools:
sandbox_status()reports Docker readiness and missing runtime images.run_code(language, code, timeout_seconds)returnsstdout,stderr, exit status, timeout and truncation flags, duration, and the runtime image.
The agent cannot choose an image, command, mount, environment variable, network policy, or Docker flag. Those remain operator-controlled policy.
Related MCP server: agent-jail-mcp
Quick start
Prerequisites: Docker, Python 3.11+, and uv.
git clone https://github.com/wesleyzhangwq/tiny-agent-sandbox.git
cd tiny-agent-sandbox
docker pull python:3.12-alpine
docker pull node:22-alpine
docker pull alpine:3.22
uv sync --no-editable
uv run --no-editable tas doctor
uv run --no-editable tas run python -c 'print(sum(range(10)))'Start the MCP server over stdio:
uv run --no-editable tiny-agent-sandboxConnect an MCP client
For clients that accept the common mcpServers JSON shape:
{
"mcpServers": {
"tiny-agent-sandbox": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/wesleyzhangwq/tiny-agent-sandbox",
"tiny-agent-sandbox"
]
}
}
}Pull the three runtime images before starting the client. Tool calls use --pull=never, so an agent
cannot cause an image download.
Example tool input:
{
"language": "python",
"code": "import statistics\nprint(statistics.mean([2, 4, 9]))",
"timeout_seconds": 5
}Example structured result:
{
"language": "python",
"image": "python:3.12-alpine",
"exit_code": 0,
"stdout": "5\n",
"stderr": "",
"timed_out": false,
"output_truncated": false,
"duration_ms": 180
}Default policy
Control | Default |
Network | disabled |
Root filesystem | read-only |
Writable storage | 64 MiB ephemeral |
User | UID/GID 65534 |
Linux capabilities | all dropped |
Privilege escalation | disabled |
Memory / swap | 256 MiB / 256 MiB |
CPU | 1 core |
Processes | 64 |
File descriptors | 64 |
Wall time | 5 seconds default, 30 seconds maximum |
Input / combined output | 64 KiB / 128 KiB |
The fixed policy is assembled in
src/tiny_agent_sandbox/runner.py. Timeout and output overflow
remove the named container rather than merely terminating the Docker client.
Development
uv sync --no-editable --extra dev
uv run --no-editable ruff check .
uv run --no-editable pytest -m "not integration"
docker pull python:3.12-alpine node:22-alpine alpine:3.22
uv run --no-editable pytest -m integrationThe preliminary ecosystem notes and design tradeoffs are in
docs/research.md.
Roadmap
Optional gVisor (
runsc) backend with explicit runtime detection.Digest-pinned, operator-configurable runtime images.
Per-session workspaces with strict size and lifetime limits.
Egress proxy with destination allowlists and audit logs.
Concurrency quotas and OpenTelemetry execution traces.
License
Apache-2.0
Available Tools
2 toolsrun_codeA
Run code without network or host mounts and return bounded stdout, stderr, and status.
The timeout may be 1-30 seconds. Output is truncated at the operator-controlled limit. Images must already exist locally; this tool never pulls an image on the agent's behalf.
Inputs: code (required), language (required), timeout_seconds. Returns: Result of one isolated execution.
sandbox_statusA
Report Docker daemon readiness and any missing allowlisted runtime images.
Inputs: no named parameters. Returns: Local runtime readiness information.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools serve clearly distinct purposes: run_code executes code while sandbox_status reports environment readiness. There is no meaningful overlap between them, so an agent can easily distinguish which to use.
Both tools follow a consistent verb_noun pattern: run_code and sandbox_status. The naming style is uniform snake_case with clear, descriptive verbs and nouns.
With only 2 tools, the surface feels thin for a sandbox server that presumably supports code execution. A richer surface might include file operations, image management, or environment configuration, but for a narrowly-scoped execution sandbox two tools can be reasonable.
The core execute-and-check lifecycle is covered: run code and check readiness. However, there are notable gaps such as no image listing, no stop/cleanup of sandboxes, and no way to provision or configure runtimes beyond status reporting.
Related MCP Connectors
Build your own tools from chat: design, test and host them on a shareable MCP server URL.
Execute code in 8 languages (Python, JS, TS, Go, Java, C++, C, Bash) in gVisor sandboxes.
Remote MCP for JSON repair, hashing, formatting, IDs, dates, units, and other small tools.
327 dev tools via REST API and MCP. Generate Dockerfiles, schemas, K8s, APIs, and more.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables secure execution of Python code, SQL queries, and metric fetching through MCP with ephemeral Docker sandboxing.-
- FlicenseNot gradedqualityDmaintenanceProvides MCP tools for managing disposable Docker sandboxes that let AI agents safely execute commands in isolated, ephemeral environments.-
- AlicenseNot gradedqualityBmaintenanceSpins up isolated opencode instances in Docker containers as MCP servers, providing 80 tools for file and shell operations within a scoped workspace without exposing the host filesystem.458 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables secure execution of Python scripts in isolated Docker containers via MCP, with resource limits, package allowlisting, read-only filesystem, and artifact return.MIT