run command. Supports Python, JavaScript, Bash, and Go with options for files, environment variables, and timeouts.
Command Syntax
Options
CODE- Code to execute as argument (use-to read from stdin)--file, -f PATH- File containing code to execute--sandbox, -s TEXT- Sandbox ID (creates temporary sandbox if omitted)--template, -t TEXT- Template for temporary sandbox (default:code-interpreter)--language, -l TEXT- Programming language:python,javascript,bash,go--timeout INTEGER- Execution timeout in seconds--env TEXT- Environment variable in KEY=VALUE format (repeatable)--workdir TEXT- Working directory for execution--output, -o FORMAT- Output format:table,json,plain(default:table)
Examples
Execute Python Code
Execute JavaScript
Execute Bash
Execute from File
Execute with Environment Variables
Execute in Existing Sandbox
Execute with Timeout
Execute from stdin
JSON Output
Get JSON output for scripting:Exit Codes
0- Success1- General error3- Authentication error4- Sandbox not found5- Timeout
Shell Scripting Examples
Execute and Capture Output
Execute with Error Handling
Execute Multiple Scripts
Related
- CLI Quickstart - Get started with CLI
- Sandbox Commands - Manage sandboxes
- Python SDK: Code Execution - Python SDK code execution
- JavaScript SDK: Code Execution - JavaScript SDK code execution
- API: Execute Code - REST API endpoint
Next Steps
- Learn about Sandbox Management to create and manage sandboxes
- Explore File Operations to work with files
- Review Environment Variables to configure execution environment

