How AGCMS works
AGCMS is an OpenAI-compatible reverse proxy with a 13-step request lifecycle. Every request goes through authentication, rate limiting, PII scanning, prompt-injection detection, policy resolution, and signed audit before reaching the upstream LLM.
The 13 steps
- Parse request
- Per-IP global rate limit
- Authenticate (API key or JWT)
- Per-tenant rate limit
- PII scan (parallel)
- Prompt-injection scan (parallel)
- Policy resolution (ALLOW / REDACT / BLOCK / ESCALATE)
- Enforce — block, redact, or escalate
- Forward to LLM (Groq / Gemini / Mistral / Ollama)
- Response compliance check
- HMAC-signed, hash-chained audit row
- Nightly Merkle anchor to S3 Object Lock
- Deliver response with X-AGCMS-Interaction-ID
Three-line integration
from openai import OpenAI from agcms import openai_wrap client = openai_wrap(OpenAI(api_key="..."), agcms_base_url="...", agcms_api_key="...")