How quantodh/cp-guardrail works
Lumen AI Gateway Lab demonstrates a banking-style assistant protected by layered gateway, agent, and network controls. The main user flow starts in either portal, passes through LiteLLM for model and guardrail enforcement, and returns a response; agentic requests can also reach MCP tools. The POC adds a test-and-score workflow and a RAG path with ingestion screening and query-time retrieval. The graph also preserves documented model, audit, and observability capabilities. Some subsystem links are based on README descriptions because their implementation was not sampled.
Main entry points: config.yaml LiteLLM Gateway · server.py POC Portal · runner.py Test Runner · ingest.py Document Ingestion
Components 25
User Workflows
- Demo Console
demo-console/app.py - Red-Team Runner
demo-console/redteam.py - POC Portal
poc/portal/server.py - Bank Backdrop
poc/portal/backdrop.py
Gateway Controls
- LiteLLM Gateway
litellm/config.yaml - Lakera Guard
- Custom Guardrails
litellm/lakera_tiered.py - MCP Guardrail
litellm/lakera_mcp.py - Chat Models
- Gateway PostgreSQL
Agent Tools
- Portal MCP Client
poc/portal/mcpcli.py - MCP Servers
mcp-servers - Egress Proxy
egress-proxy
POC RAG
- Document Ingestion
poc/rag/ingest.py - Query Retrieval
poc/rag/retrieve.py - Embedding Client
poc/rag/embed.py - Vector Store
poc/rag/store.py - RAG Settings
poc/rag/config.py - Ollama
- Qdrant
Testing Evidence
- Test Runner
poc/runner.py - Level Calibration
poc/find_levels.py - Audit & Observability
poc/observability
Other components
- User
- Lakera Service
Connections 35
- User → Demo Console: uses
README.md - User → POC Portal: uses
README.md - Demo Console → LiteLLM Gateway: sends requests
README.md - Red-Team Runner → Demo Console: posts samples
demo-console/redteam.py - POC Portal → Test Runner: runs tests
poc/portal/server.py - POC Portal → Bank Backdrop: uses context
poc/portal/server.py - POC Portal → Portal MCP Client: calls tools
poc/portal/server.py - POC Portal → Document Ingestion: ingests documents
poc/portal/server.py - POC Portal → Query Retrieval: queries documents
poc/portal/server.py - POC Portal → LiteLLM Gateway: sends requests
README.md - LiteLLM Gateway → Lakera Guard: screens content
README.md - LiteLLM Gateway → Custom Guardrails: applies policies
README.md - LiteLLM Gateway → MCP Guardrail: screens tool traffic
README.md - LiteLLM Gateway → Chat Models: routes inference
README.md - LiteLLM Gateway → Gateway PostgreSQL: stores keys and logs
README.md - Lakera Guard → Lakera Service: requests verdicts
README.md - Portal MCP Client → LiteLLM Gateway: routes guarded calls
poc/portal/mcpcli.py - Portal MCP Client → MCP Servers: calls directly
poc/portal/mcpcli.py - LiteLLM Gateway → MCP Servers: dispatches tools
README.md - MCP Servers → Egress Proxy: fetches through
README.md - Document Ingestion → Test Runner: screens documents
poc/rag/ingest.py - Document Ingestion → Embedding Client: embeds chunks
poc/rag/ingest.py - Document Ingestion → Vector Store: indexes chunks
poc/rag/ingest.py - Query Retrieval → Embedding Client: embeds query
poc/rag/retrieve.py - Query Retrieval → Vector Store: searches vectors
poc/rag/retrieve.py - Embedding Client → Ollama: requests embeddings
poc/rag/embed.py - Vector Store → Qdrant: reads and writes
poc/rag/store.py - Document Ingestion → RAG Settings: reads settings
poc/rag/ingest.py - Query Retrieval → RAG Settings: reads settings
poc/rag/retrieve.py - Embedding Client → RAG Settings: reads settings
poc/rag/embed.py - Vector Store → RAG Settings: reads settings
poc/rag/store.py - Test Runner → LiteLLM Gateway: tests enforcement
poc/runner.py - Test Runner → Lakera Service: checks verdicts
poc/runner.py - Level Calibration → Test Runner: measures policy levels
poc/find_levels.py - Test Runner → Audit & Observability: records evidence
README.md