directRunCode
Execute code in a temporary sandbox, automatically destroying it post-execution. Supports multiple languages, custom environment variables, and optional file download. Ideal for isolated, one-time code runs without persistent sandbox operations.
Instructions
Automatically creates a sandbox, executes code, and immediately destroys the sandbox after execution. Optionally exports sandbox files (compresses multiple files into a zip archive if there are multiple files in the specified path, or exports a single file directly). Recommended for use cases that don't require continuous sandbox operations.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"language": "<language>",
"code": "<code>"
},
"name": "directRunCode"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The source code to be executed in the sandbox | |
| envs | No | Environment variables to be set during code execution. Supports passing custom environment variables as key-value pairs | |
| is_download | No | Flag to indicate whether to download generated files. Must be enabled if the code generates files that need to be retrieved | |
| language | Yes | The programming language to execute the code. If not provided or if the value is not in the allowed options, it will be treated as Python code | |
| timeout | No | Maximum execution time in seconds for the sandbox. If code execution exceeds this time, it will be terminated and return a timeout error. Default is 5 |