A ready-to-run example is available here!The API-sandboxed agent server demonstrates how to use
APIRemoteWorkspace to connect to a OpenHands runtime API service. This eliminates the need to manage your own infrastructure, providing automatic scaling, monitoring, and secure sandboxed execution.
Key Concepts
APIRemoteWorkspace
TheAPIRemoteWorkspace connects to a hosted runtime API service:
- Connects to a remote runtime API service
- Automatically provisions sandboxed environments
- Manages container lifecycle through the API
- Handles all infrastructure concerns
Runtime API Authentication
The example requires a runtime API key for authentication:Pre-built Image Selection
You can specify which pre-built agent server image to use:Workspace Testing
Just like withDockerWorkspace, you can test the workspace before running the agent:
Automatic RemoteConversation
The conversation uses WebSocket communication with the remote server:Ready-to-run Example
This example is available on GitHub: examples/02_remote_agent_server/04_convo_with_api_sandboxed_server.py
examples/02_remote_agent_server/04_convo_with_api_sandboxed_server.py
Running the Example
Next Steps
- Docker Sandboxed Server
- Local Agent Server
- Agent Server Overview - Architecture and implementation details
- Agent Server Package Architecture - Remote execution architecture

