agentbreeder

Local Development

Run the full AgentBreeder stack on your machine.

Local Development Guide

This guide covers setting up AgentBreeder for local development and contributing.

Prerequisites

ToolVersionPurpose
Python3.11+Backend, CLI, engine
Node.js22+Dashboard frontend
Docker & ComposeLatestLocal services, container builds
GitLatestVersion control

Setup

1. Clone and install

git clone https://github.com/rajitsaha/agentbreeder.git
cd agentbreeder

# Python environment
python -m venv venv
source venv/bin/activate
pip install -e ".[dev]"

# Copy environment config
cp .env.example .env

2. Start local services

# Start PostgreSQL and Redis
docker compose -f deploy/docker-compose.yml up -d postgres redis

Wait for services to be healthy:

docker compose -f deploy/docker-compose.yml ps

3. Run database migrations

alembic upgrade head

4. Start the API server

uvicorn api.main:app --reload --port 8000

API is available at http://localhost:8000. OpenAPI docs at http://localhost:8000/docs.

5. Start the dashboard

cd dashboard
npm install
npm run dev

Dashboard is available at http://localhost:5173. It proxies API requests to port 8000 via Vite config.

6. Verify the CLI

agentbreeder --help
agentbreeder list agents

Full Stack (Docker Compose)

To run everything in Docker (API + Dashboard + Postgres + Redis + migrations):

docker compose -f deploy/docker-compose.yml up -d
ServiceURL
Dashboardhttp://localhost:3001
APIhttp://localhost:8000
API Docshttp://localhost:8000/docs
PostgreSQLlocalhost:5432
Redislocalhost:6379

Default credentials for local dev:

  • DB: agentbreeder / agentbreeder / database agentbreeder
  • App login: admin@agentbreeder.local / changeme

Running Tests

Python unit tests

pytest tests/unit/                        # All unit tests
pytest tests/unit/test_api_routes.py      # Specific file
pytest tests/unit/ -k "test_deploy"       # Pattern match
pytest tests/unit/ --cov=api --cov-report=html  # With coverage

Playwright E2E tests

cd dashboard

# Install browsers (first time only)
npx playwright install --with-deps chromium

# Run tests
npx playwright test                    # Headless
npx playwright test --headed           # Watch in browser
npx playwright test --ui               # Interactive UI mode
npx playwright test tests/e2e/agents   # Specific directory

Coverage report

pytest tests/unit/ \
  --cov=api --cov=engine --cov=cli --cov=registry --cov=connectors \
  --cov-report=html

# Open htmlcov/index.html in your browser

Linting & Formatting

Python

# Lint
ruff check .

# Auto-fix
ruff check --fix .

# Format
ruff format .

# Type check
mypy api/ engine/ cli/ registry/ connectors/

TypeScript

cd dashboard

# Lint
npm run lint

# Type check
npx tsc -b --noEmit

Database Migrations

# Apply all pending migrations
alembic upgrade head

# Create a new migration from model changes
alembic revision --autogenerate -m "add new column to agents"

# Downgrade one version
alembic downgrade -1

# View migration history
alembic history

Project Layout

agentbreeder/
├── api/                    # FastAPI backend
│   ├── main.py             # App entry, middleware, routers
│   ├── routes/             # REST endpoints
│   │   ├── agents.py       # Agent CRUD
│   │   ├── deploys.py      # Deploy from dashboard (POST /api/v1/deploys)
│   │   ├── prompts.py      # Prompts + test panel (POST /api/v1/prompts/test)
│   │   ├── sandbox.py      # Tool sandbox execution (POST /api/v1/tools/sandbox/execute)
│   │   ├── rag.py          # RAG indexes, file ingestion, hybrid search
│   │   ├── memory.py       # Memory configs, conversation storage
│   │   ├── git.py          # Git workflow + PR review backend
│   │   ├── providers.py    # Provider config endpoints
│   │   └── ...
│   ├── services/           # Business logic
│   │   ├── git_service.py  # Git operations
│   │   └── pr_service.py   # Pull request workflow
│   ├── models/             # SQLAlchemy models + Pydantic schemas
│   └── auth.py             # Auth dependencies
├── cli/                    # CLI (Typer + Rich)
│   ├── main.py             # App entry, command registration
│   └── commands/           # One file per command
├── engine/                 # Deploy pipeline
│   ├── config_parser.py    # YAML parsing + validation
│   ├── builder.py          # Container image builder
│   ├── providers/          # Provider abstraction (OpenAI, Ollama, fallback chains)
│   ├── runtimes/           # Framework-specific builders (LangGraph, OpenAI Agents)
│   ├── deployers/          # Cloud-specific deployers (Docker Compose, GCP Cloud Run)
│   └── schema/             # JSON Schema for agent.yaml
├── registry/               # Catalog services (CRUD + search)
├── connectors/             # Integration plugins
├── dashboard/              # React frontend
│   ├── src/pages/          # Page components (see list below)
│   ├── src/components/     # Shared UI components
│   ├── src/hooks/          # React Query hooks
│   ├── src/lib/            # API client, utilities
│   └── tests/e2e/          # Playwright tests
├── deploy/                 # Docker Compose config
├── tests/unit/             # Python unit tests
└── alembic/                # Database migrations

Dashboard Pages

PagePathDescription
Agents/agentsAgent registry browser
Agent Detail/agents/:idAgent detail + deploy history
Agent Builder/agents/builderVisual drag-and-drop agent builder (ReactFlow canvas, 8 node types)
Deploys/deploysDeploy from dashboard with 8-step pipeline dialog
Prompts/promptsPrompt registry + test panel
Prompt Builder/prompts/builderTemplate variables, live preview, versioning
Tools/toolsTool registry
Tool Builder/tools/builderTool builder + sandbox execution
MCP Servers/mcp-serversMCP server registry
Models/modelsModel registry + model compare
RAG Builder/ragRAG index management, file ingestion, hybrid search
Memory Builder/memoryMemory config management, conversation storage
Approvals/approvalsApproval workflow, PR review UI, environment promotion
Activity/activityActivity feed / audit log
Settings/settingsOrg + user settings

API Routes (v0.3)

Routes added in v0.3:

MethodEndpointDescription
POST/api/v1/deploysTrigger deploy from dashboard
POST/api/v1/prompts/testTest a prompt with model + variables
POST/api/v1/tools/sandbox/executeExecute a tool in sandbox
GET/POST/api/v1/rag/*RAG indexes, file ingestion, search
GET/POST/api/v1/memory/*Memory configs, conversation storage
GET/POST/api/v1/git/*Git operations, PR review workflow
GET/POST/api/v1/providers/*Provider configuration

Environment Variables

Key variables in .env:

# Required
DATABASE_URL=postgresql+asyncpg://agentbreeder:agentbreeder@localhost:5432/agentbreeder
REDIS_URL=redis://localhost:6379
SECRET_KEY=dev-secret-key
AGENTBREEDER_ENV=development

# Auth
JWT_SECRET_KEY=dev-jwt-secret
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=1440

# Optional integrations
LITELLM_BASE_URL=http://localhost:4000

Common Tasks

Add a new API endpoint

  1. Add route in api/routes/
  2. Add service logic in api/services/ or registry/
  3. Add Pydantic schemas in api/models/schemas.py
  4. Write unit tests in tests/unit/

Add a new CLI command

  1. Create cli/commands/your_command.py
  2. Register in cli/main.py: app.command(name="your-command")(your_module.your_function)
  3. Write unit tests

Add a new dashboard page

  1. Create page in dashboard/src/pages/
  2. Add route in dashboard/src/App.tsx
  3. Add navigation link in dashboard/src/components/shell.tsx
  4. Write Playwright E2E test in dashboard/tests/e2e/

Modify the database schema

  1. Update SQLAlchemy model in api/models/
  2. Create migration: alembic revision --autogenerate -m "description"
  3. Review the generated migration file
  4. Apply: alembic upgrade head

Troubleshooting

Port already in use:

lsof -i :8000    # Find what's using the port
kill -9 <PID>    # Kill it

Database connection refused:

docker compose -f deploy/docker-compose.yml ps    # Check if postgres is running
docker compose -f deploy/docker-compose.yml up -d postgres

Stale migrations:

alembic downgrade base && alembic upgrade head    # Reset DB

Node modules issues:

cd dashboard && rm -rf node_modules && npm install

On this page