Code Runner
Execute code in a secure sandboxed environment (Docker or subprocess).
Usage
Run Python:
code
run_code(language="python", code="print('Hello')", timeout=10000)
Run JavaScript:
code
run_code(language="javascript", code="console.log(42)", timeout=5000)
Run shell script:
code
run_code(language="bash", code="curl -s https://api.example.com | jq .", timeout=15000)
Supported Languages
- •Python 3.x
- •JavaScript (Node.js)
- •Bash / Shell
- •TypeScript (via tsx)
Parameters
- •
language(required): Programming language - •
code(required): Code to execute - •
timeout(default: 10000): Max execution time in ms - •
installDeps(optional): Dependencies to install before execution (e.g., ["requests", "pandas"])
Safety
- •All code runs in an isolated sandbox
- •Network access is restricted by default
- •File system access limited to sandbox working directory
- •Memory capped at 512MB, CPU time limited
- •NEVER run on the host machine
For Skill Crystallization
When using code-runner to validate a solution for crystallization:
- •Run the code at least once successfully
- •Capture stdout, stderr, and exit code
- •If it fails, iterate (search docs -> fix -> retry, max 3x)
- •On success, the Learner agent can crystallize it into a permanent skill