Overview
The Code Interpreter provides:- Multi-language support: Python, Java, Go, TypeScript, and more
- Isolated execution: Each code execution runs in a secure sandbox
- Rich output: Capture stdout, stderr, and return values
- Error handling: Detailed error messages and stack traces
Setup
Running Code in Different Languages
Complete Example
Here’s the full working example:Environment Variables
You can customize the behavior using environment variables:| Variable | Description | Default |
|---|---|---|
SANDBOX_DOMAIN | Sandbox service address | localhost:8080 |
SANDBOX_API_KEY | API key for authentication | None |
SANDBOX_IMAGE | Docker image to use | sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/code-interpreter:v1.0.1 |
Supported Languages
The Code Interpreter SDK supports:- Python - Full Python 3.x support with pip packages
- Java - Java 11+ with Maven dependencies
- Go - Go 1.20+ with module support
- TypeScript - TypeScript with Node.js runtime
- JavaScript - ES6+ JavaScript
- Bash - Shell script execution
Error Handling
Always check for errors in code execution:Next Steps
File Operations
Learn to read and write files in sandboxes
Advanced Examples
Explore browser automation, ML training, and more
API Reference
Code Interpreter API documentation
Troubleshooting
Common issues and solutions