Local Development
Run the full AgentBreeder stack on your machine.
This guide covers setting up AgentBreeder for local development and contributing.
Prerequisites
| Tool | Version | Purpose |
|---|---|---|
| Python | 3.11+ | Backend, CLI, engine |
| Node.js | 22+ | Studio frontend |
| Docker & Compose | Latest | Local services, container builds |
| Git | Latest | Version control |
Setup
1. Clone and install
git clone https://github.com/agentbreeder/agentbreeder.git
cd agentbreeder
# Python environment
python -m venv venv
source venv/bin/activate
pip install -e ".[dev]"
# Copy environment config
cp .env.example .env2. Start local services
# Start PostgreSQL and Redis
docker compose -f deploy/docker-compose.yml up -d postgres redisWait for services to be healthy:
docker compose -f deploy/docker-compose.yml ps3. Run database migrations
alembic upgrade head4. Start the API server
uvicorn api.main:app --reload --port 8000API is available at http://localhost:8000. OpenAPI docs at http://localhost:8000/docs.
5. Start Studio
cd dashboard
npm install
npm run devStudio is available at http://localhost:5173. It proxies API requests to port 8000 via Vite config.
6. Verify the CLI
agentbreeder --help
agentbreeder list agentsAuth
All 247/247 management API routes under /api/v1/* are auth-gated via Depends(get_current_user) or Depends(require_role(...)). Only auth/login and auth/register are open by design.
Bootstrap a token once per development session:
# 1. Register an account (first time only)
curl -X POST http://localhost:8000/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"you@company.com","password":"…","name":"You"}'
# 2. Login → JWT
curl -X POST http://localhost:8000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"you@company.com","password":"…"}'
# → {"access_token": "eyJ…", "token_type": "bearer"}
# 3. Export — the CLI picks this up automatically
export AGENTBREEDER_API_TOKEN=eyJ…Without AGENTBREEDER_API_TOKEN set, registry CLI commands will fail with 401.
Agent runtime auth (AGENT_AUTH_TOKEN)
Deployed agent runtimes use a separate bearer token, supplied via the AGENT_AUTH_TOKEN env var on the runtime container. It gates /invoke and /stream; /health stays open for k8s and Cloud Run probes. Both Python (6 servers) and Node (9 servers) runtime templates ship with the same auth contract.
Use the registry CLI
The registry CLI manages prompts, tools, and agents — the three entities resolved at agent startup (file-first, with the registry as DB-backed fallback).
# Prompts
agentbreeder registry prompt push <file.md> [--name --version --team --description]
agentbreeder registry prompt list [--team]
agentbreeder registry prompt try <name> --input "..." [--model gemini-2.5-flash]
# Tools — auto-detects .py → python:<abs>, .ts/.js → node:<abs>, module path → as-is
agentbreeder registry tool push <module-or-file> [--description]
agentbreeder registry tool list
agentbreeder registry tool run <name> [--args '{"key":"value"}']
# Agents
agentbreeder registry agent push agent.yaml
agentbreeder registry agent list [--team]
agentbreeder registry agent invoke <name> --input "..." [--endpoint URL --token T --session SID]All commands require AGENTBREEDER_API_TOKEN. See the How-To Guide → Push prompts and tools for end-to-end examples.
Reference example agents
Several reference agents demonstrate the full registry + auth + deploy chain end-to-end. Use them when migrating an existing agent into the AgentBreeder pattern:
| Example | What it shows |
|---|---|
examples/google-adk-agent | Google ADK runtime, registry-backed prompt + tools, local + Cloud Run deploy |
examples/ai-news-digest | Scheduled agent, multiple stdlib tools, prompt versioning |
examples/registry-pattern-ts | TypeScript runtime — resolvePrompt() / resolveTool() from engine/runtimes/templates/node/_shared_loader.ts |
The canonical reference is microlearning-ebook-agent: 1 prompt registered (microlearning-system v1.0.2), 2 stdlib tools (web-search, markdown-writer), all /health /invoke /stream endpoints gated by AGENT_AUTH_TOKEN, deployed to Cloud Run with secrets in Secret Manager.
End-to-end verification script
microlearning-ebook-agent/scripts/e2e_test.sh runs 7 verifications against a running stack — auth gates, prompt versioning, tool registry, runtime auth, real-tool-chat — and exits non-zero on any failure. Use it as a smoke test after schema changes:
cd microlearning-ebook-agent/
./scripts/e2e_test.sh
# 7/7 passFull Stack (Docker Compose)
To run everything in Docker (API + Studio + Postgres + Redis + migrations):
docker compose -f deploy/docker-compose.yml up -d| Service | URL |
|---|---|
| Studio | http://localhost:3001 |
| API | http://localhost:8000 |
| API Docs | http://localhost:8000/docs |
| PostgreSQL | localhost:5432 |
| Redis | localhost:6379 |
Default credentials for local dev:
- DB:
agentbreeder/agentbreeder/ databaseagentbreeder - App login:
admin@agentbreeder.local/plant(Studio forces a password rotation on first sign-in)
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 coveragePlaywright 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 directoryLive Docker E2E tests (full stack)
Runs 97 Playwright tests against the real Docker Compose stack — no mocks. Covers all 12 feature domains: providers, prompts, tools, RAG, MCP servers, agent builders (no-code + YAML), playground execution, tracing, evaluations, cost tracking, and RBAC.
# Start the stack first
docker compose -f deploy/docker-compose.yml up -d
# Run all 97 live E2E tests
cd dashboard && npm run test:e2e:live
# Watch tests run in a browser (recommended for development)
npm run test:e2e:live:ui
# Debug a single failing test
npm run test:e2e:live:debug -- --grep "provider"Test credentials and stack config are in dashboard/.env.e2e. The global setup provisions test users and teardown cleans them up automatically.
Coverage report
pytest tests/unit/ tests/integration/ \
--cov=api --cov=engine --cov=cli --cov=registry --cov=connectors --cov=sdk \
--cov-report=html
# Open htmlcov/index.html in your browser
# Current baseline: 95% source coverage (3,666 tests)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 --noEmitDatabase 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 historyProject Layout
agentbreeder/
├── api/ # FastAPI backend
│ ├── main.py # App entry, middleware, routers
│ ├── routes/ # REST endpoints
│ │ ├── agents.py # Agent CRUD
│ │ ├── deploys.py # Deploy from Studio (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 migrationsStudio Pages
| Page | Path | Description |
|---|---|---|
| Agents | /agents | Agent registry browser |
| Agent Detail | /agents/:id | Agent detail + deploy history |
| Agent Builder | /agents/builder | Visual drag-and-drop agent builder (ReactFlow canvas, 8 node types) |
| Deploys | /deploys | Deploy from Studio with 8-step pipeline dialog |
| Prompts | /prompts | Prompt registry + test panel |
| Prompt Builder | /prompts/builder | Template variables, live preview, versioning |
| Tools | /tools | Tool registry |
| Tool Builder | /tools/builder | Tool builder + sandbox execution |
| MCP Servers | /mcp-servers | MCP server registry |
| Models | /models | Model registry + model compare |
| RAG Builder | /rag | RAG index management, file ingestion, hybrid search |
| Memory Builder | /memory | Memory config management, conversation storage |
| Approvals | /approvals | Approval workflow, PR review UI, environment promotion |
| Activity | /activity | Activity feed / audit log |
| Settings | /settings | Org + user settings |
API Route Groups
| Method | Endpoint prefix | Description |
|---|---|---|
GET/POST | /api/v1/agents | Agent CRUD + clone, validate, from-yaml |
POST | /api/v1/deploys | Trigger deploy; poll status |
GET/POST | /api/v1/prompts | Prompt registry; /prompts/test for live testing |
GET/POST | /api/v1/registry/tools | Tool registry |
GET/POST | /api/v1/rag | RAG indexes, file ingestion, hybrid search |
GET/POST | /api/v1/memory | Memory configs, conversation storage |
GET/POST | /api/v1/mcp-servers | MCP server registry (CRUD, test, discover, execute) |
GET/POST | /api/v1/git | Git workflow + PR review |
GET/POST | /api/v1/providers | LLM provider config |
POST | /api/v1/tools/sandbox/execute | Execute a tool in sandbox |
GET/POST | /api/v1/teams | Team management |
GET | /api/v1/costs | Cost tracking (filterable by team/agent/model) |
GET | /api/v1/audit | Audit trail |
GET/POST | /api/v1/tracing | Distributed tracing |
GET/POST | /api/v1/evals | Agent evaluation |
GET/POST | /api/v1/playground | Chat playground |
GET/POST | /api/v1/a2a | Agent-to-agent (A2A) communication |
GET | /api/v1/agentops | Fleet operations page in Studio |
GET | /api/v1/gateway | Model gateway status + proxy |
GET/POST | /api/v1/marketplace | Community marketplace |
GET/POST | /api/v1/templates | Agent templates |
GET/POST | /api/v1/orchestrations | Orchestration management |
GET | /api/v1/registry/search | Cross-entity registry search |
GET | /api/v2/agents | v2 agents endpoint (cursor pagination) |
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:4000Common Tasks
Add a new API endpoint
- Add route in
api/routes/ - Add service logic in
api/services/orregistry/ - Add Pydantic schemas in
api/models/schemas.py - Write unit tests in
tests/unit/
Add a new CLI command
- Create
cli/commands/your_command.py - Register in
cli/main.py:app.command(name="your-command")(your_module.your_function) - Write unit tests
Add a new Studio page
- Create page in
dashboard/src/pages/ - Add route in
dashboard/src/App.tsx - Add navigation link in
dashboard/src/components/shell.tsx - Write Playwright E2E test in
dashboard/tests/e2e/
Modify the database schema
- Update SQLAlchemy model in
api/models/ - Create migration:
alembic revision --autogenerate -m "description" - Review the generated migration file
- Apply:
alembic upgrade head
Troubleshooting
Port already in use:
lsof -i :8000 # Find what's using the port
kill -9 <PID> # Kill itDatabase connection refused:
docker compose -f deploy/docker-compose.yml ps # Check if postgres is running
docker compose -f deploy/docker-compose.yml up -d postgresStale migrations:
alembic downgrade base && alembic upgrade head # Reset DBNode modules issues:
cd dashboard && rm -rf node_modules && npm install