Skip to main content

Setup

Prerequisites

  • Python 3.12+
  • Docker
  • Git
  • uv (Python package manager)

First time setup

Code quality

Pre-commit hooks run automatically on every commit. They check formatting, linting, type hints, and security.

What gets checked

Commands

Commit messages

Required format: type(scope): description

Types

Scope (optional)

Specify the affected area: api, auth, db, graph, tests, docs, ci.

What happens when you commit

Development workflow

Visit http://localhost:2026/docs to see the API.
Migrations run automatically on server startup (aegra dev, Docker, or manual). You only need manual migration commands when creating new migrations or troubleshooting.

Database migrations

Aegra uses Alembic for database migrations. Migrations apply automatically on server startup — you only need these commands when creating or debugging migrations.

Making database changes

  1. Edit ORM models in libs/aegra-api/src/aegra_api/core/orm.py
  2. Generate a migration: uv run --package aegra-api alembic revision --autogenerate -m "Description"
  3. Review the generated file in libs/aegra-api/alembic/versions/
  4. Restart the server — migrations apply automatically

Testing migrations

Running tests

Test levels

Every feature needs tests at all applicable levels:

LangGraph service architecture

The LangGraphService manages graph loading, caching, and execution.

Design principles

  1. Cache base graphs, not execution instances — compiled graph structure (without checkpointer/store) is cached for fast loading
  2. Fresh copies per-request — each execution gets a fresh graph copy with checkpointer/store injected
  3. Thread-safe by design — no locks needed because cached state is immutable

Usage patterns

For graph execution (runs, state operations):
For validation/schema extraction (no execution needed):

Why this pattern

Pull request checklist

Before creating a PR:
  • Git hooks installed (make setup-hooks)
  • All commits follow the conventional format
  • Tests pass (make test)
  • Code formatted (make format)
  • No linting errors (make lint)
  • PR title follows format: type: description
  • make ci-check passes

Troubleshooting

Common commit hook failures

Common database issues

Get help