execute_code
Execute code in Python, Node.js, or Go with automatic environment setup and timeout controls. Runs code in isolated, non-persistent environments for secure execution.
Instructions
Execute code snippets in Python, Node.js, or Go with automatic environment setup.
This tool creates temporary files and executes code in isolated environments
with proper cleanup and timeout handling. Supports multiple programming
languages with their respective runtimes.
Supported Languages:
- Python: Full Python 3.x environment with standard library
- Node.js/JavaScript: Node.js runtime with npm packages
- Go: Go compiler and runtime environment with CGO_ENABLED=0
Features:
- Automatic temporary file management
- Language-specific execution environments
- Configurable timeout controls
- Detailed execution feedback
- Secure code isolation
- Temporary files are deleted after execution; code is non-persistent. Use the shell tool to create reusable scripts.
Args:
request: Code execution parameters including code, language, and timeout
Returns:
ExecutionResponse: Complete execution results with output, errors,
performance metrics, and success status
Examples:
- Python: {"code": "print('Hello World')", "language": "python"}
- Node.js: {"code": "console.log('Hello World')", "language": "node"}
- Go: {"code": "package main\nfunc main() { println("Hello") }", "language": "go"}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes |