Skip to main content
A ready-to-run example is available here!
A Sailbox is a hosted sandbox from Sail Research. This guide starts one from the agent-server image, starts the server in it, and connects to it with a remote Workspace. The SDK has no workspace class for Sail: a Sailbox is only the place where the agent server runs, and the SDK talks to it like to any other remote agent server.

Prerequisites

  • A Sail API key from app.sailresearch.com, exported as SAIL_API_KEY
  • The Sail Python SDK: pip install sail
  • An LLM API key, exported as LLM_API_KEY

Key Concepts

Creating the Sandbox

The sandbox is created from a pre-built agent-server image, with the server’s port published:
Sail imports the image from the registry the first time it is used and reuses it afterwards. ingress_ports gives the port an HTTPS URL, and max_lifetime_seconds ends the sandbox even if your script is killed before it can terminate it.

Starting the Agent Server

A Sailbox does not run the image’s ENTRYPOINT, so the server is started with an explicit command:
wait_for_listener returns once the server answers through the sandbox URL.
The sandbox URL is reachable from the internet. The session key in OH_SESSION_API_KEYS_0 is what protects the server: every request must carry it. The agent runs on the agent server, so your LLM settings, including the API key, are sent to the sandbox.

Connecting with a Remote Workspace

With the URL and the session key, the rest is the same as for any remote agent server:
Passing this workspace to Conversation gives a RemoteConversation that streams events over a WebSocket.

Cleaning Up

Terminate the sandbox when you are done, in a finally block so it also happens on errors:

Ready-to-run Example

examples/02_remote_agent_server/18_convo_with_sail_sandboxed_server.py
Running the Example

ACP Agent in a Sail Sandbox

The same sandbox can run an ACPAgent. The only difference is the environment of the server process, which carries the variables the ACP CLI needs. See the ACP Agent guide for how ACP agents work.
examples/02_remote_agent_server/19_acp_agent_with_sail_sandbox.py

Next Steps