Base URL
Each sandbox has a unique VM Agent API URL:public_host or direct_url field when you create a sandbox.
Authentication
All VM Agent API requests require a JWT token. This token is automatically generated when you create a sandbox:- Is returned in the
auth_tokenfield when creating a sandbox - Expires after a set time (check
token_expires_at) - Can be refreshed using the Control Plane API
What You Can Do
Code Execution
- Synchronous execution - Execute code and wait for results
- Rich output capture - Capture matplotlib plots, pandas DataFrames, and visualizations
- Background execution - Run long-running tasks asynchronously
- Async execution - Execute code with webhook callbacks
- Process management - List and kill running processes
Command Execution
- Run commands - Execute shell commands synchronously
- Background commands - Run long-running commands asynchronously
File Operations
- Read/write files - Manage files in the sandbox
- List directories - Browse filesystem
- Upload/download - Transfer files to/from sandbox
- File watching - Monitor file changes
Environment Variables
- Get/set variables - Manage environment variables
- Update variables - Merge or replace variables
- Clear variables - Remove all variables
Desktop Automation
- VNC access - Remote desktop via VNC
- Mouse/keyboard control - Automate user interactions
- Screenshots - Capture screen images
- Screen recording - Record desktop sessions
- Window management - Control application windows
Observability
- Metrics - CPU, memory, disk usage
- Processes - System and background processes
- Cache - Execution result cache statistics
- Terminal - Interactive terminal via WebSocket
API Endpoints
Code Execution
Commands
Files
Environment
Desktop
Observability
Response Format
All responses use JSON:Success Response
Error Response
Status Codes
Supported Languages
The VM Agent supports multiple programming languages:- Python - Python 3.x with common packages
- JavaScript - Node.js runtime
- Bash - Shell scripting
- Go - Go runtime (if available in template)
Related
- SDK: File Operations - Python SDK file operations
- SDK: Code Execution - Python SDK code execution
- SDK: Commands - Python SDK command execution
- Code Execution Concepts - Learn about code execution
- CLI Reference - Command-line interface
Next Steps
- Execute Code - Run code synchronously
- Rich Output - Capture plots and visualizations
- Background Execution - Run long-running tasks
- File Operations - Manage files in sandbox

