Server SDK
The Server SDK runs inside the sandbox. It is the HTTP service the image keeps listening on, port 9000 by default. The package is agent-sandbox-server. Import agent_sandbox.server. A template's commands.py uses it to register commands, turn capabilities on, and call start(9000).
pip install agent-sandbox-server
from agent_sandbox.server import command, start
@command(description="Say hello")
def hello(name: str = "world") -> dict:
return {"message": f"Hello, {name}!"}
if __name__ == "__main__":
start(9000)
This code does not create a cloud sandbox and does not read a sandbox API key. Creating the sandbox and calling these routes is the Client SDK or the abx CLI.
Start here
| Guide | What it covers |
|---|---|
| Authoring templates | template.yaml, the Dockerfile, commands.py |
| Template server HTTP API | The routes the process actually serves |
| Best practices | The server carries no provider; turn groups on only when needed |
| Fine-grained capabilities | Enable routes one endpoint at a time |
| File and command controls | Limit paths and commands |
| Agents API | HTTP sessions for Codex and Qwen Code inside the sandbox |
| Hosted agents | How those routes refuse and what they return |
Reference: Server HTTP API, template.yaml, Agents API reference, Server API design.
Examples
These commands.py files start with the image. See the example index:
examples/templates/python-hello/commands.py— the smallest command serverexamples/templates/agents-cli/commands.py— only the session Agents routes are open
examples/templates/python-hello/call_api.py is not the Server SDK. It runs outside the sandbox and sends HTTP to a server that is already listening. That script is a Client SDK example.