How k-rouma/agentix works
Purpose and runtime entry point
Agentix is a Python 3.12 FastAPI backend intended to orchestrate agent workflows (LangGraph is a declared platform dependency), with an initial tenant-scoped Notes API. The service starts at app/main.py; its health endpoint validates application dependencies before traffic is considered healthy.
Application composition
The codebase separates reusable platform concerns from business modules:
• Core infrastructure and cross-cutting concerns: app/core/config.py, app/core/db.py, app/core/redis.py.
• Business capabilities are isolated under app/modules/; the current vertical slice is Notes: app/modules/notes/router.py, app/modules/notes/model.py.
• app/main.py composes routers, lifecycle/dependency wiring, and health checks. Future agent, workflow, and RAG capabilities should follow the module boundary rather than expand core.
Request, auth, and tenancy flow
Requests enter FastAPI routes, then authentication dependencies construct a request auth context and enforce tenant identity:
• Auth abstraction and request dependencies: app/core/auth/provider.py, app/core/auth/dependencies.py, app/core/auth/context.py.
• Supabase-specific token validation/provider implementation: app/core/auth/supabase_provider.py.
• Tenant-aware domain routes consume this context; Notes is the concrete example in app/modules/notes/router.py.
This makes Supabase Auth an external identity boundary while application routes operate on normalized internal auth/tenant context.
Persistence and isolation
Postgres in managed Supabase Cloud is the system of record. Runtime API connections use the transaction pooler only, while Alembic uses a separate direct connection:
• Runtime database setup: app/core/db.py.
• Shared ORM model conventions and tenancy model: app/core/models/base.py, app/core/models/tenancy.py.
• Notes persistence model: app/modules/notes/model.py.
• Schema evolution source of truth: alembic/env.py, alembic/versions/20260714_100000_tenancy.py, alembic/versions/20260714_100200_notes_rls_template.py.
Tenancy is enforced at both application and database levels, including PostgreSQL RLS policies. The vector extension is provisioned through Alembic, not Supabase CLI migrations.
Infrastructure boundaries
Supabase Cloud supplies PostgreSQL, Auth, and potentially Storage; it is explicitly not self-hosted. Redis is the only local Docker dependency and is accessed through app/core/redis.py, with deployment definition at docker/docker-compose.yml. Configuration draws environment-specific secrets and endpoint URLs through app/core/config.py. /health exercises DB connectivity, Redis, and availability of the Postgres vector extension.
Schema and deployment control
Alembic exclusively owns database schema, extensions, RLS, and related database hooks:
• Migration configuration/runtime: alembic.ini, alembic/env.py.
• Vector extension migration: alembic/versions/20260707_180120_create_vector_extension.py.
• Auth access-token database hook: alembic/versions/20260714_100100_access_token_hook.py.
The Supabase CLI linkage/configuration in supabase/config.toml is administrative only; it must not become a competing schema-management path.
Architectural direction
The repository includes a broader planned agent platform—agent orchestration, tools, LLM management, memory, RAG, workflows, and domain modules—documented under docs/Doc architecture/. These are design targets rather than represented runtime components in the current application tree. The present foundation establishes the expected expansion pattern: generic infrastructure in app/core/, independently routable tenant-aware capabilities in app/modules/, and all durable data contracts expressed through Alembic migrations.
Main entry points: main.py FastAPI composition · dependencies.py Auth dependencies · router.py Notes routes · db.py Runtime DB access
Components 18
Application Runtime
- FastAPI composition · Composes routes, lifecycle wiring, and health checks.
app/main.py - Configuration
app/core/config.py - Runtime DB access · Uses the Supabase transaction pooler for API traffic.
app/core/db.py - Redis access
app/core/redis.py - Auth dependencies · Builds normalized auth and tenant context for routes.
app/core/auth/dependencies.py - Auth context
app/core/auth/context.py - Auth provider contract
app/core/auth/provider.py - Supabase token provider
app/core/auth/supabase_provider.py - ORM tenancy conventions · Provides shared model and tenant conventions.
app/core/models/tenancy.py
Notes Module
- Notes routes
app/modules/notes/router.py - Notes model
app/modules/notes/model.py
Schema Control
- Alembic migration runtime · The exclusive schema-management path.
alembic/env.py - Schema migrations · Own extensions, RLS policies, tenancy, and auth hooks.
alembic/versions/20260714_100000_tenancy.py
Infrastructure Boundaries
- Supabase PostgreSQL · Managed Postgres with RLS and vector extension.
- Supabase Auth
- Redis · The only local Docker dependency.
docker/docker-compose.yml - Supabase CLI config · Administrative linkage only; not a schema path.
supabase/config.toml
Other components
- Planned agent platform · Documents future agent, workflow, memory, and RAG modules.
docs/Doc architecture/00_index.md
Connections 20
- FastAPI composition → Configuration: loads
- FastAPI composition → Runtime DB access: wires
- FastAPI composition → Redis access: wires
- FastAPI composition → Auth dependencies: applies
- FastAPI composition → Notes routes: mounts
- FastAPI composition → Runtime DB access: health checks
- FastAPI composition → Redis access: health checks
- Auth dependencies → Auth context: constructs
- Auth dependencies → Auth provider contract: uses
- Supabase token provider → Auth provider contract: implements
- Supabase token provider → Supabase Auth: validates tokens with
- Notes routes → Auth dependencies: requires
- Notes routes → Notes model: reads and writes
- Notes model → ORM tenancy conventions: follows
- Runtime DB access → Supabase PostgreSQL: transaction pooler
- Redis access → Redis: connects to
- Alembic migration runtime → Schema migrations: runs
- Schema migrations → Supabase PostgreSQL: creates schema, RLS, vector
- Supabase CLI config → Supabase PostgreSQL: administrative linkage
- Planned agent platform → Notes routes: expansion pattern