Code layout

AreaLocationPurpose
Application entrysrc/main.pyBuilds the FastAPI app, browser cross-origin policy, exception handling, router includes.
HTTP routessrc/apis/Domain routers: auth, users, messages, tasks, simulation_admin, organizations, and others.
Domain logicsrc/core/Scheduler, AutoGen, simulation behavior, and related services.
Persistencesrc/memory/MongoDB access, repositories, Qdrant, mem0.

Conventions

  • Dependencies — Use FastAPI Depends for database handles and auth; mirror patterns from neighboring routes when adding endpoints.
  • Data access — Prefer repository helpers in src/memory/repositories.py and related classes over ad hoc queries in routers.
  • Models — Shared Pydantic models live in src/common/models.py; feature-specific models may live beside their module.

Background work

Scheduled and periodic tasks use the async scheduler, heartbeat modules, or related wiring (src/heartbeat/, src/core/scheduler.py). When you introduce new jobs, document trigger, idempotency, and what happens on failure.

Next