the Docker sandbox image ships with features configured in the Dockerfile (e.g., secure defaults and services like VSCode and VNC exposed behind well-defined ports), which are not available in the local (non-Docker) agent server.
1) Basic Docker Sandbox
This example is available on GitHub: examples/02_remote_agent_server/02_convo_with_docker_sandboxed_server.py
examples/02_remote_agent_server/02_convo_with_docker_sandboxed_server.py
Running the Example
Key Concepts
DockerWorkspace Context Manager
TheDockerWorkspace uses a context manager to automatically handle container lifecycle:
- Pulls or builds the Docker image
- Starts the container with an agent server
- Waits for the server to be ready
- Cleans up the container when done
Platform Detection
The example includes platform detection to ensure the correct Docker image is built and used:Testing the Workspace
Before creating a conversation, the example tests the workspace connection:Automatic RemoteConversation
When you use a DockerWorkspace, the Conversation automatically becomes a RemoteConversation:Pre-built vs Base Images
2) VS Code in Docker Sandbox
This example is available on GitHub: examples/02_remote_agent_server/04_vscode_with_docker_sandboxed_server.py
examples/02_remote_agent_server/04_vscode_with_docker_sandboxed_server.py
Running the Example
Key Concepts
VS Code-Enabled DockerWorkspace
The workspace is configured with extra ports for VS Code access:extra_ports=True setting exposes:
- Port
host_port+1: VS Code Web interface (host_port + 1) - Port
host_port+2: VNC viewer for visual access
VS Code URL Generation
The example retrieves the VS Code URL with authentication token:VS Code URL Format
- vscode_port: Usually host_port + 1 (e.g., 8011)
- tkn: Authentication token for security
- folder: Workspace directory to open
3) Browser in Docker Sandbox
This example is available on GitHub: examples/02_remote_agent_server/03_browser_use_with_docker_sandboxed_server.py
examples/02_remote_agent_server/03_browser_use_with_docker_sandboxed_server.py
Running the Example
Key Concepts
Browser-Enabled DockerWorkspace
The workspace is configured with extra ports for browser access:extra_ports=True setting exposes additional ports for:
- Port
host_port+1: VS Code Web interface - Port
host_port+2: VNC viewer for browser visualization
Enabling Browser Tools
Browser tools are enabled by settingcli_mode=False:
cli_mode=False, the agent gains access to browser automation tools for web interaction.
When VNC is available and extra_ports=True, the browser will be opened in the VNC desktop to visualize agent’s work. You can watch the browser in real-time via VNC. Demo video:
VNC Access
The VNC interface provides real-time visual access to the browser:- autoconnect=1: Automatically connect to VNC server
- resize=remote: Automatically adjust resolution
Next Steps
- Local Agent Server
- Agent Server Overview - Architecture and implementation details
- API Sandboxed Server - Connect to hosted API service
- Agent Server Package Architecture - Remote execution architecture

