Execute code and retrieve results in sandbox
The agent runs a specific script in an isolated environment and returns the output or generated artifacts to the user, ensuring no side effects on the host system.
How it works
Read-onlyData and analysis
The agent identifies the code to be executed and prepares any necessary input files in the workspace if needed. It then uses run_code to execute the script in the isolated sandbox. The agent captures the stdout/stderr or any files written to the workspace by the code and presents the results to the user. The user should ensure the code is safe and review the output for accuracy.
Prompt
Paste this into an agent that has the servers below connected. Adjust the names and dates to your own.
Prompt for Execute code and retrieve results in sandbox
Run a Python script that calculates the sum of numbers from 1 to 100 and prints the result. Show me the output.MCP servers it needs
Source
The vendor page this playbook is drawn from, and the passage that supports it.
run_code Execute code in an isolated container with your workspace mounted at /workspace and set as the working directory.AgentSpace for AI agents: a persistent workspace, sandbox and hosting