sandbox_management
Manage Docker-based sandboxes for safe, isolated code execution. Supports ephemeral containers and persistent sessions with file operations.
Instructions
Docker-based code sandbox management for safe, isolated code execution.
Requires Docker Desktop running on the host. Two execution modes:
Ephemeral: throwaway container, auto-removed after run (execute_code, execute_file)
Stateful: persistent session, state preserved between calls (session_*)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Operation to perform. One of: --- EPHEMERAL (throwaway containers) --- - "execute_code": Run code snippet. Requires: code. Optional: language, timeout, network_enabled - "execute_file": Run a host file. Requires: host_path. Optional: language, timeout, network_enabled --- STATEFUL SESSIONS (persistent containers) --- - "session_create": Create session. Optional: image, sandbox_name - "session_run": Run command in session. Requires: sandbox_id, command - "session_write_file": Write file to session. Requires: sandbox_id, container_path, content - "session_read_file": Read file from session. Requires: sandbox_id, container_path - "session_list": List active sessions. No extra args needed. - "session_destroy": Remove session. Requires: sandbox_id | |
| code | No | Code string to execute (for execute_code) | |
| language | No | "python" | "javascript" | "bash" (default: python) | python |
| host_path | No | Absolute Windows path to file (for execute_file) | |
| timeout | No | Max execution seconds (default: 30) | |
| network_enabled | No | Allow outbound network in container (default: False) | |
| sandbox_id | No | Session ID from session_create (for session_* actions) | |
| image | No | Docker image for session_create (default: python:3.13-slim) | python:3.13-slim |
| sandbox_name | No | Optional container name for session_create | |
| command | No | Shell command for session_run | |
| container_path | No | Path inside container for file operations | |
| content | No | File content string for session_write_file |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||