-
Notifications
You must be signed in to change notification settings - Fork 0
Development
Lucius Morningstar edited this page Aug 8, 2026
·
1 revision
mailroom/
agents/ # Specialist agents (Sorter, Contract, Corp, etc.)
graph/ # LangGraph: state, nodes, routing
llm/ # Provider-agnostic client
schemas/ # Pydantic models
pipeline/ # Watcher, bins, ops monitor
storage/ # Postgres: catalog, audit log
api/ # FastAPI
observability/ # Langfuse callbacks
config/ # taxonomy.yaml
docker/ # docker-compose
tests/ # pytest suite
docs/ # In-repo documentation
wiki/ # GitHub wiki pages
pip install -e ".[dev]"
docker compose -f docker/docker-compose.yml up -d postgrespytest tests/ -v # All tests
pytest tests/test_agents/ -v # Agent unit tests
pytest tests/test_routing.py -v # Routing logic
pytest tests/test_audit_log.py -v # Hash chain
pytest tests/test_pipeline_e2e.py -v # E2E pipeline
pytest tests/ --cov=. --cov-report=html # Coverage- Unit tests: 25 agent tests with mocked LLM calls
- Routing tests: 12 conditional edge tests
- Audit tests: 9 hash chain integrity tests
- E2E tests: 4 full pipeline tests with mocked LLM
- Add entry to
config/taxonomy.yamlunderdoc_classes - Create Pydantic schema in
schemas/documents.py - Register in
EXTRACTION_SCHEMASdict - Create agent class in
agents/(extendBaseAgent) - Add dispatch entry in
graph/build_graph.py(extract_nodeandretry_extract_node) - Add agent config under
agentsinconfig/taxonomy.yaml - Add test fixtures in
tests/fixtures/<new_type>/ - Add unit tests in
tests/test_agents/
- Add provider config to
llm/providers.pyin_build_providers() - Add default models to
DEFAULT_MODELSdict - Add agent model mapping in
config/taxonomy.yaml
Every node function signature:
def node_name(state: DocumentState) -> dict[str, Any]:
# state: current DocumentState TypedDict
# return: dict of fields to update in state
...Conditional edge functions:
from typing import Literal
def routing_fn(state: dict) -> Literal["node_a", "node_b", "node_c"]:
...- No provider-specific code in agents — use
BaseAgent.__init__for LLM client - No hardcoded thresholds or doc types — everything reads from
config/taxonomy.yaml - All filesystem operations go through
pipeline/bins.py— never directos.rename/shutil.move - Audit entries are created by
build_audit_entry()inschemas/audit.py— never manual hash computation - Langfuse is optional — use
observability/langfuse_setup.pywhich has noop fallback
Mailroom — Multi-Agent Legal Document Processing Pipeline. Built with LangGraph, OpenRouter, and Postgres.