> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sb0.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# sb0 init

> Initialize a new agent project

## Command

```bash theme={null}
sb0 init [name]
```

## Description

Creates a new agent project with complete scaffolding, configuration, and dependencies automatically installed.

## Usage

Create a new project:

```bash theme={null}
mkdir my-project && cd my-project
sb0 init
```

This creates both `agent/` and `gateway/` directories. The gateway is platform infrastructure—you'll work primarily in the `agent/` directory.

## What Gets Created

### Agent Directory (`agent/`)

```
agent/
├── .sb0/                  # Internal sb0 files
│   └── wheels/            # Embedded Python packages
├── .venv/                 # Python virtual environment (auto-created)
├── handle_query.py        # Your agent handler code
├── agent.config.yaml      # Agent configuration
├── pyproject.toml         # Python dependencies
├── uv.lock                # Dependency lockfile
├── .dockerignore          # Docker build exclusions
└── .gitignore            # Git exclusions
```

### Gateway Directory (`gateway/`)

Platform infrastructure—you can ignore this for now.

## Automatic Setup

The `sb0 init` command automatically:

1. **Creates project structure** - Agent and gateway directories
2. **Generates configuration** - `agent.config.yaml` and `pyproject.toml`
3. **Embeds packages** - Copies sb0-runner and sb0-protocol wheels
4. **Locks dependencies** - Runs `uv lock` to create `uv.lock`
5. **Installs dependencies** - Runs `uv sync --no-dev` to create `.venv/`

## Example Output

```
Generating uv.lock...
Installing agent dependencies...
✔ Agent initialized successfully!

Next steps:
  cd agent
  sb0 run --prompt "Hello!"
```

## Configuration Files

### agent.config.yaml

```yaml theme={null}
version: "0.1"
image: "my-agent:latest"

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

runtime:
  handler: "handle_query:Handler"
```

### pyproject.toml

```toml theme={null}
[project]
name = "sb0-agent"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
  "claude-agent-sdk~=0.1.0",
  "sb0-runner",
  "sb0-protocol",
]
```

## Next Steps

After initialization:

1. **Navigate to agent directory:**
   ```bash theme={null}
   cd agent
   ```

2. **Set your API key:**
   ```bash theme={null}
   export ANTHROPIC_API_KEY="sk-ant-..."
   ```

3. **Test your agent:**
   ```bash theme={null}
   sb0 run --prompt "Hello!"
   ```

## Related

* [Creating your first agent](/v0-docs/quickstart/creating-agent)
* [Agent configuration](/v0-docs/agents/configuration)
* [Testing locally](/v0-docs/quickstart/testing-locally)
