How dgexplores/aegis-gateway works
AEGIS is a FastAPI gateway that screens tenant requests before sending them to configured AI providers, then returns results with audit evidence. Its main path runs from caller authentication and limits through prompt safety, routing and provider failover to response handling; tenant-scoped retrieval can supply grounded context. Separate branches cover operator controls, audit records and the browser console. The graph preserves documented capabilities and central modules; some links rely on README or SOURCE INDEX references rather than sampled call sites.
Main entry points: routes.py HTTP routes · gateway.py Gateway orchestration · service.py RAG service · registry.py Provider failover
Components 25
API and console
- HTTP routes
src/aegis/api/routes.py - Browser console
src/aegis/static/dashboard.js - Request middleware
src/aegis/api/middleware.py
Request policy
- Tenant authentication
src/aegis/security/auth.py - Rate limits
src/aegis/ratelimit.py - Tenant budgets
src/aegis/budget.py - Gateway orchestration
src/aegis/gateway.py - Injection screening
src/aegis/security/injection.py - PII masking
src/aegis/security/pii.py
Provider execution
- Model routing
src/aegis/router.py - Provider failover
src/aegis/providers/registry.py - Provider contracts
src/aegis/providers/base.py
Tenant retrieval
- RAG service
src/aegis/rag/service.py - Document chunking
src/aegis/rag/ingest.py - Hybrid retrieval
src/aegis/rag/retriever.py - Embedding providers
src/aegis/rag/embeddings.py - RAG persistence
src/aegis/store/db.py
Audit and operations
- Tamper-evident audit
src/aegis/security/audit.py - Operator controls
src/aegis/opscontrol.py - Admin sessions
src/aegis/security/admin_session.py - Metrics
src/aegis/metrics.py - Evaluation datasets
src/aegis/evals/dataset.py - Evaluation runner
src/aegis/evals/runner.py - Evaluation judges
src/aegis/evals/judges.py
Other components
- Client application
Connections 26
- Client application → HTTP routes: sends requests
- HTTP routes → Request middleware: uses middleware
src/aegis/api/routes.py - HTTP routes → Tenant authentication: authenticates callers
src/aegis/api/routes.py - HTTP routes → Rate limits: checks limits
src/aegis/api/routes.py - HTTP routes → Tenant budgets: checks budgets
src/aegis/api/routes.py - HTTP routes → Gateway orchestration: dispatches requests
src/aegis/api/routes.py - Gateway orchestration → Injection screening: screens prompts
src/aegis/gateway.py - Gateway orchestration → PII masking: masks data
src/aegis/gateway.py - Gateway orchestration → Model routing: selects tier
src/aegis/gateway.py - Gateway orchestration → Provider failover: requests completion
src/aegis/gateway.py - Provider failover → Provider contracts: dispatches completion
src/aegis/providers/registry.py - Provider failover → Gateway orchestration: returns completion
src/aegis/gateway.py - Gateway orchestration → Tamper-evident audit: records decisions
src/aegis/gateway.py - HTTP routes → RAG service: requests retrieval
src/aegis/api/routes.py - RAG service → Document chunking: chunks documents
src/aegis/rag/service.py - RAG service → Hybrid retrieval: retrieves context
src/aegis/rag/service.py - RAG service → RAG persistence: persists chunks
src/aegis/rag/service.py - Hybrid retrieval → Embedding providers: uses vectors
src/aegis/rag/retriever.py - RAG service → Gateway orchestration: supplies context
- HTTP routes → Admin sessions: checks sessions
src/aegis/api/routes.py - HTTP routes → Operator controls: exposes controls
- HTTP routes → Tamper-evident audit: serves audit records
src/aegis/api/routes.py - Gateway orchestration → Metrics: records metrics
src/aegis/gateway.py - Client application → Browser console: uses console
- Evaluation runner → Evaluation datasets: loads cases
src/aegis/evals/runner.py - Evaluation runner → Evaluation judges: uses judges
src/aegis/evals/runner.py