Skip to main content
The VM Agent API runs inside each sandbox and provides endpoints for code execution, file operations, command execution, desktop automation, and observability. Each sandbox has its own VM Agent API instance.

Base URL

Each sandbox has a unique VM Agent API URL:
For example:
The base URL is returned in the 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:
The JWT token:
  • Is returned in the auth_token field 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)

Next Steps