Skip to main content

Prerequisites

You have installed the sb0 CLI:
curl -fsSL https://raw.githubusercontent.com/terminal-use/sb0-cli/main/install.sh | bash

Create Your Agent Project

Create a new directory and scaffold your agent:
sb0 agent init my-agent
This creates the directory my-agent/ with your agent code and configuration.
Your agent/ directory contains:
agent/
├── .sb0/                  # Internal sb0 files
│   └── wheels/            # Embedded Python packages
├── .venv/                 # Python virtual environment
├── handle_query.py        # Your agent handler code
├── agent.config.yaml      # Agent configuration
├── pyproject.toml         # Python dependencies
├── .dockerignore          # Docker build exclusions
└── .gitignore            # Git exclusions
The key files are:
  • handle_query.py, which contains your agent’s logic:
class Handler:
    async def handle_query(
        self,
        prompt: str,
        session_id: str | None = None,
        **kwargs,
    ) -> AsyncIterator[Message]:
        # ... your agent logic
  • agent.config.yaml, which contains the build and runtime configuration:
version: "0.1"
image: "my-agent:latest"

build:
  python_version: "3.12"
  python_project: "pyproject.toml"
  system_packages: []

runtime:
  handler: "handle_query:Handler"

“Hello World!”

You can now test your agent with a single prompt:
cd my-agent
sb0 agent run --prompt "Hello"
Expected output:
Streaming agent response...

Hello! How can I assist you today?
This step requies an Anthropic API key. Get one at console.anthropic.com. Then add it to your environment:
export ANTHROPIC_API_KEY="sk-ant-..."