AI-FW is the **AI firewall and governance gateway** between your AI agents and the models they call. Every prompt and response is inspected, governed, and routed, with provable agent identity and regulator-ready audit, all in one process that runs in your own environment.
- [x] **Fail-closed by design**: offline guardrails never delegate to third parties, no traffic while scanning is unhealthy
- [x] **Agents are identities**: A2A protocol, agent registry, mTLS, Kerberos, OIDC SSO, SCIM provisioning
- [x] **Cost savings without safety holes**: semantic-gated prompt compression and inspection-gated caching
- [x] **Audit you can hand to a regulator**: metadata-only transaction log with encrypted export to your SIEM
- [x] **Surfaces others cannot reach**: Claude inference hooks, Cursor Agent Hooks, MCP tool governance, M365 Copilot admin with agent sync
- [x] **Opt-in endpoint gateway**: images, audio, files, fine-tuning, and batches under the same inspection pipeline
## ๐ก๏ธ Features
Every feature is documented on [aifw.io/docs](https://aifw.io/docs) and in this repository's `docs/` folder. Product updates and practical guidance are published on [AI-FW Insights](https://aifw.io/insights), with an [RSS feed](https://aifw.io/insights/rss.xml).
Legend: โ native ยท ๐งฉ via partner or plugin ยท โ not supported
| Category | Feature | Doc | Native |
|---|---|---|---|
| Security & guardrails | [Prompt & response guardrails](docs/guides/01-prompt-response-guardrails.mdx) | [Read](https://aifw.io/docs/guides/prompt-response-guardrails) | โ |
| Security & guardrails | [Semantic intent analysis](docs/guides/03-semantic-intent-analysis.mdx) | [Read](https://aifw.io/docs/guides/semantic-intent-analysis) | โ |
| Security & guardrails | [Fail-open options (opt-in)](docs/guides/01-prompt-response-guardrails.mdx) | [Read](https://aifw.io/docs/guides/prompt-response-guardrails) | โ |
| Security & guardrails | [Claude inference hooks](docs/guides/08-claude-inference-hooks.mdx) | [Read](https://aifw.io/docs/guides/claude-inference-hooks) | โ |
| Identity & agents | [Identity & access (IDAM)](docs/guides/04-identity-access.mdx) | [Read](https://aifw.io/docs/guides/identity-access) | โ |
| Identity & agents | [Admin-issued API keys](docs/guides/11-agent-api-keys.mdx) | [Read](https://aifw.io/docs/guides/agent-api-keys) | โ |
| Identity & agents | [A2A agent protocol](docs/api-reference/03-a2a-agent-protocol.mdx) | [Read](https://aifw.io/docs/api-reference/a2a-agent-protocol) | โ |
| Identity & agents | [Chain of Command](docs/guides/12-chain-of-command.mdx) | [Read](https://aifw.io/docs/guides/chain-of-command) | โ |
| Identity & agents | [Agent self-enrollment](docs/tutorials/04-agent-self-enrollment.mdx) | [Read](https://aifw.io/docs/tutorials/agent-self-enrollment) | โ |
| Cost | [Completion cache](docs/guides/06-reliability-caching.mdx) | [Read](https://aifw.io/docs/guides/reliability-caching) | โ |
| Cost | [Prompt compression](docs/guides/07-prompt-compression.mdx) | [Read](https://aifw.io/docs/guides/prompt-compression) | โ |
| Observability & audit | [Observability & dashboard](docs/guides/09-observability-dashboard.mdx) | [Read](https://aifw.io/docs/guides/observability-dashboard) | โ |
| Observability & audit | [Risk profiles & auto-block](docs/guides/05-risk-profiles.mdx) | [Read](https://aifw.io/docs/guides/risk-profiles) | โ |
| Observability & audit | [Audit logs & export](docs/guides/10-audit-logs-export.mdx) | [Read](https://aifw.io/docs/guides/audit-logs-export) | โ |
| Governance & compliance | [Compliance module administration](docs/admin/13-compliance-module.mdx) | [Read](https://aifw.io/docs/admin/compliance-module) | โ |
| Governance & compliance | [Skills & Tools governance](docs/admin/14-skills-tools.mdx) | [Read](https://aifw.io/docs/admin/skills-tools) | โ |
| Governance & compliance | [IDE Artifacts](docs/admin/15-ide-artifacts.mdx) | [Read](https://aifw.io/docs/admin/ide-artifacts) | โ |
| Governance & compliance | [Configuration backup and restore](docs/admin/16-backup-restore.mdx) | [Read](https://aifw.io/docs/admin/backup-restore) | โ |
| Integrations | [M365 Copilot admin](docs/tutorials/03-m365-copilot-bridge.mdx) | [Read](https://aifw.io/docs/tutorials/m365-copilot-bridge) | โ |
| Integrations | [Claude Code, Cursor & MCP](docs/tutorials/02-claude-code-cursor-mcp.mdx) | [Read](https://aifw.io/docs/tutorials/claude-code-cursor-mcp) | โ |
| Integrations | [Cursor Agent Hooks and shims](docs/guides/13-cursor-agent-hooks.mdx) | [Read](https://aifw.io/docs/guides/cursor-agent-hooks) | โ |
| Integrations | [securetron-aifw hook package](tools/securetron-aifw/README.md) | [Use the package](tools/securetron-aifw/README.md) | โ |
| Integrations | [Endpoint gateway](docs/api-reference/01-openai-compatible-api.mdx) | [Read](https://aifw.io/docs/api-reference/openai-compatible-api) | โ |
| Core & reference | [Model routing & registry](docs/guides/02-model-routing.mdx) | [Read](https://aifw.io/docs/guides/model-routing) | โ |
| Core & reference | [Reliability](docs/guides/06-reliability-caching.mdx) | [Read](https://aifw.io/docs/guides/reliability-caching) | โ |
| Core & reference | [Advanced parameters](docs/how-to/01-configure-models-keys.mdx) | [Read](https://aifw.io/docs/how-to/configure-models-keys) | โ |
| Core & reference | [Prompt Analyzer](docs/admin/03-rules-manager.mdx) | [Read](https://aifw.io/docs/admin/rules-manager) | โ |
| Core & reference | [Admin pages](docs/admin/01-settings.mdx) | [Read](https://aifw.io/docs/admin/settings) | โ |
| Core & reference | [Supported models & endpoints (200+)](docs/api-reference/04-openai-compatible-endpoints.mdx) | [Read](https://aifw.io/docs/api-reference/openai-compatible-endpoints) | โ |
| Insights | [AI-FW Insights](https://aifw.io/insights) | [Read](https://aifw.io/insights) | โ |`r`n| SDKs | [Chain of Command Python and TypeScript SDKs](sdk/README.md) | [Read](https://github.com/securetron-gh/aifw/tree/main/sdk) | โ |
           
> [!WARNING]
> Model IDs change frequently. Always verify against each vendor's live model list before registering a model (see the [models reference](https://aifw.io/docs/api-reference/openai-compatible-endpoints)).
## โก Quick start
### 1. Run the gateway and its database
```bash
docker compose up -d
```
The [`docker-compose.yml`](docker-compose.yml) in this repository starts the gateway alongside PostgreSQL: both share a network, the database runs on a named volume so data survives restarts, and the gateway waits for it to report healthy before starting. One command, no manual setup.
The default login is `superadmin` / `happy`.
> [!NOTE]
> The gateway listens on **80 (HTTP)** and **443 (HTTPS)**. Pin a published version with `AIFW_TAG=1.1.245 docker compose up -d`.
Running the container without Docker Compose
The image can be started on its own, but it does **not** provision a database, so you must supply a reachable PostgreSQL:
```bash
docker run -d --name aifw-gateway -p 8080:80 \
-e "ConnectionStrings__PostgreSQL=Host=your-postgres;Port=5432;Database=aifw;Username=...;Password=..." \
ghcr.io/securetron-gh/aifw:latest
```
> [!IMPORTANT]
> Without a reachable PostgreSQL the gateway still starts, but it falls back to in-memory stores and **all data is lost on restart**. The built-in default connection string points at `localhost`, which inside the container is the container itself, so a sibling database container must be addressed by its name on a shared Docker network.
The same image is published to Docker Hub as `securetron/aifw`.
### 2. Make your first request
```bash
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello!"}]}'
```
Open the gateway at `http://localhost:8080` and watch the transaction appear in the dashboard.
> [!TIP]
> To route traffic through the gateway, register these backend URLs and models in the AI-FW Model Inventory (see [Configure models and keys](https://aifw.io/docs/how-to/configure-models-keys)).
## ๐ How it works
```mermaid
flowchart LR
A["Client / Agent"] --> B["AI-FW Gateway"]
B --> C["Inspect prompt scan, PII mask"]
C --> D["Govern rules, semantic tier"]
D --> E["Route registry, resilience"]
E --> F["LLM Backend"]
F --> G["Audit metadata-only log"]
G --> A
```
1. **Connect** - point any OpenAI-compatible or Anthropic client at the gateway (SDKs, Claude Code, Cursor, MCP tools, or plain HTTP)
2. **Inspect** - every prompt and response is scanned, PII-masked, and semantically scored
3. **Govern** - routing rules, risk profiles, and policy decide what flows and what is blocked
4. **Audit** - metadata-only logs and events record exactly what happened
## ๐ Documentation
This repository holds the AI-FW knowledge base. The rendered version lives at [aifw.io/docs](https://aifw.io/docs).
```mermaid
flowchart TD
A["docs/"] --> B["getting-started/"]
A --> C["guides/"]
A --> D["tutorials/"]
A --> E["how-to/"]
A --> F["api-reference/"]
A --> G["admin/"]
A --> H["community-edition/"]
B --> B1["what is AI-FW, quick start"]
C --> C1["guardrails, routing, semantic, identity, risk, reliability, compression, hooks, observability, audit, API keys"]
D --> D1["OpenAI SDK, Claude Code & MCP, M365, agent enrollment"]
E --> E1["models & keys, AI-assisted rules, Azure"]
F --> F1["OpenAI-compatible, Anthropic Messages, A2A, endpoints, current model catalog"]
G --> G1["settings, inventory, rules, risk, audit, dashboard, M365, users, keys, agents, CA, trust, compliance"]
H --> H1["license & monthly token allowance"]
```
| Section | Topics | Files |
|---|---|---|
| Getting Started | What AI-FW is, quick start | `docs/getting-started/` |
| Guides | Guardrails, routing, semantic analysis, identity, risk, reliability, compression, hooks, observability, audit, API keys, Chain of Command, Cursor Agent Hooks | `docs/guides/` |
| Tutorials | OpenAI SDK, Claude Code & MCP, M365 Copilot admin, agent self-enrollment | `docs/tutorials/` |
| How-To | Models & keys, AI-assisted rules, Azure deployment | `docs/how-to/` |
| API Reference | OpenAI-compatible, Anthropic Messages, A2A agent protocol | `docs/api-reference/` |
| Admin Reference | Settings, Model Inventory, Rules Manager, Risk Profiles, Audit, M365, Users, Agents, CA, Agent Trust, Compliance, Skills & Tools, IDE Artifacts, Backup & Restore | `docs/admin/` |
| Community Edition | [License & monthly token allowance](https://aifw.io/docs/community-edition/license) | `docs/community-edition/` |
## ๐งฉ Enterprise
- โ **ISO 27001 certified and SOC2 compliant**
- โ **Fail-closed by design** - no traffic while scanning is unhealthy
- โ **App-only Microsoft 365 Copilot integration** with agent sync
- โ **Role-based access control, OIDC SSO, and SCIM provisioning**
- โ **Encrypted audit export** to your SIEM (syslog over TLS)
- โ **Self-hosted** in your environment with no per-token fees
[Book a demo](https://aifw.io/contact) or [get started](https://aifw.io/get-started).
## ๐ Security
To report a security issue, contact us at [aifw.io/contact](https://aifw.io/contact).
## ๐ค Contributing
PRs are welcome.
We would also like to thank the Securetron.net team for their continued support in helping the community.