AI agents have API keys, shell access, and internet connections. When one gets compromised through prompt injection or a poisoned MCP tool, secrets leave through HTTP requests before anyone notices. An AI firewall is the enforcement point between the agent and the network. It scans the traffic it mediates: HTTP, WebSocket, and MCP, including local stdio servers run through the wrapper.
The question is whether that firewall should be a SaaS product you can’t inspect, or open source software you control.
Three meanings of AI firewall
The term describes products at different control points. The boundaries can overlap, so ask what traffic a product sees and where it runs.
| Meaning | Control point | Typical job |
|---|---|---|
| AI-powered network firewall | Traffic between hosts or networks | Use machine learning alongside network security policy to identify suspicious traffic. |
| Prompt or LLM firewall | Inputs and outputs around an AI application or model | Screen prompts, retrieved content, or responses against application policy. |
| Agent egress and MCP firewall | Traffic and tool calls mediated between an agent and external services | Inspect supported outbound requests and inbound content for risks such as secret leaks and malicious instructions. |
A network firewall controls traffic between networks or hosts. Some vendors use machine learning to help identify threats and add AI traffic controls. Check Point describes its AI Network Firewall as protecting AI applications, agents, and data across the network. A web application firewall (WAF) focuses on HTTP requests to web applications, often at the application edge. A network firewall can cover a broader set of connections, while a WAF may examine web requests in more application-specific detail.
A prompt or LLM firewall checks content entering or leaving a model-powered application. Cloudflare’s Firewall for AI announcement describes AI-specific protections alongside its WAF. A conventional WAF checks web traffic for web application threats; an LLM firewall adds checks aimed at model-related risks such as attempts to change instructions. Some products combine those functions. A prompt filter can’t evaluate actions or traffic that never pass through it.
An agent egress firewall mediates supported traffic between an agent and external services. A WAF generally protects the application receiving web requests. Both can protect different points in the same workflow. MCP vulnerabilities explains risks in tool descriptions and responses, while AI agent security covers the broader runtime.
Pipelock inspects supported mediated traffic, with checks and outcomes dependent on the path and configuration. HTTPS CONNECT payload inspection requires TLS interception; without it, the proxy sees only the destination hostname, not the path, query, or body. Network isolation or another containment control is needed to prevent direct proxy bypass. Detection can miss secrets or instructions, even on inspected paths. See Pipelock for deployment options.
What is an open source AI firewall?
An open source AI firewall is a security tool with source code you can inspect. Depending on the project, it may check model inputs and outputs or mediate agent network and tool traffic for risks such as credential leaks and prompt injection.
LLM firewall vs agent firewall vs AI gateway: what the terms mean
Three terms get used interchangeably and aren’t. Pick the one that matches the threat you actually have.
LLM firewall. Protects the LLM API surface itself: prompt injection screening, jailbreak detection, output classification, content moderation. Treats the model as the asset and the prompt or completion as the payload. Trylon Gateway, NeMo Guardrails, and most “AI security” products from incumbent network vendors sit here. They look at text, not network actions.
Agent firewall. Protects what the agent does on the network: HTTP requests, MCP tool calls, WebSocket frames, fetched content. Treats the agent’s outbound actions as the asset and assumes the model can be compromised. Capability separation is the structural answer: the agent holds credentials and reasoning, the firewall holds network reach, and the two are isolated processes. Pipelock and Agent Wall sit here. They look at network actions, not just text.
AI gateway. Routing layer for LLM API traffic across multiple providers (rate limiting, key management, observability, sometimes caching). Cloudflare AI Gateway, Portkey, and LiteLLM sit here. Some add basic firewall-like checks, but routing is the core function, not enforcement. An AI gateway typically lives in front of the LLM provider, not in front of the agent’s outbound calls to the rest of the world.
The categories overlap at the edges. The buyer’s question to answer first: are you trying to protect the LLM from bad prompts, the agent from bad actions, or the LLM call from going to the wrong provider? Different problem, different category, different open-source tool.
| If you searched for… | The market usually means… | Use it when… | Open-source fit |
|---|---|---|---|
| LLM firewall | Prompt and completion screening before or around the model. | You expose an LLM app to user prompts and need jailbreak, moderation, or prompt-injection checks at the inference boundary. | LlamaFirewall, NeMo Guardrails, Trylon Gateway. |
| Agent firewall | Runtime enforcement on what an agent sends, fetches, and receives through tools and the network. | Your agent has credentials, calls MCP tools, fetches web content, or can make outbound HTTP requests. | Pipelock, Agent Wall. |
| AI gateway | LLM-provider routing, observability, key management, and rate limits. | You need to route model calls across providers or centralize LLM API operations. | LiteLLM, Portkey, agentgateway. |
This distinction matters because the LLM-firewall model tries to stop the hostile prompt before the model acts on it. That can help, but it is an incomplete primary boundary for agents. Pipelock takes the opposite bet: assume prompt screening can miss, then block the unsafe outbound effect. The longer version is why Pipelock is an egress agent firewall, not an inbound WAF, and the WAF comparison is separate at agent firewall vs WAF.
The proof standard is different too. A control description is not a measurement. Pipelock publishes the Agent Egress Bench results and the known limitations register so buyers can see both measured coverage and documented gaps instead of a vendor-only assertion.
GitHub projects by security boundary
Open-source AI firewall searches mix several boundaries. Read GitHub projects by the control point they own, not by the label in the README.
| Project | License | Boundary | Best fit | Does not replace |
|---|---|---|---|---|
| Pipelock | Apache-2.0 core; Enterprise features under ELv2 | Agent egress firewall | Network-enforced HTTP, MCP, and WebSocket inspection with DLP, injection scanning, SSRF defense, signed evidence, and runtime audit. | MCP identity gateways, model-layer moderation, package-manager risk scoring. |
| LlamaFirewall | See repo | Model and prompt layer | PromptGuard, AlignmentCheck, and CodeShield-style filtering around prompts, completions, and generated code. | Agent network enforcement or MCP traffic inspection. |
| NeMo Guardrails | See repo | Dialog guardrails | Colang policies for conversational behavior, topical rails, and application-level flow control. | Outbound traffic inspection or runtime MCP proxying. |
| agentgateway | Apache 2.0 | Gateway and routing | MCP, A2A, and LLM routing with configurable content guardrails. | Check the documented guardrails and integrations against your traffic and policy needs. |
| DefenseClaw | Apache 2.0 | Application sidecar | MCP server governance and access-control workflows around agent applications. | A separate network firewall for arbitrary agent egress. |
| Prismor | Apache 2.0 | Hooks and supply chain | Tool-call hooks, policy checks, package-manager wrapping, canary tokens, and session telemetry for coding agents. | Capability separation at the network boundary. |
The clean split is: guardrails decide whether text is acceptable, gateways decide where agent traffic routes, hooks decide whether a tool call should run, and an agent firewall decides what bytes may cross the network boundary.
What counts as an AI firewall
The term gets used loosely. Three categories of tools call themselves AI firewalls or AI security layers, and they work at different points in the stack.
Network-level inspection (proxy firewalls). A separate process sits between the agent and the internet. Supported HTTP, MCP, and WebSocket traffic must be routed through it for inspection. Checks vary by transport and configuration; HTTPS CONNECT payload inspection requires TLS interception. Because it runs as its own process, prompt injection targeting the agent doesn’t directly compromise the proxy. Full isolation requires network controls (firewall rules or container networking) that prevent the agent from bypassing the proxy or killing the process. Pipelock and GitHub’s agent workflow firewall operate here, though GitHub’s tool does domain allowlisting without content scanning.
Inference guardrails. Libraries that classify prompts and completions at the model layer. They check whether the model’s input or output is “safe” according to a policy. NeMo Guardrails and LlamaFirewall operate here. They don’t see HTTP traffic or MCP messages. A guardrail can approve a prompt while the agent exfiltrates credentials in the next HTTP request.
Agent-side hooks. Code that intercepts tool calls inside the agent’s runtime before execution. Claude Code’s permission system and Sage work this way. Hooks see tool names and arguments but not network traffic. They run inside the agent’s process, which means a successful injection can potentially bypass them.
These are not interchangeable. Each layer sees different data and stops different attacks. A real security posture uses more than one. But the network layer is the hardest for an attacker to circumvent because it runs outside the agent’s trust boundary.
Why open source matters for security
A security tool you can’t read is a security tool you can’t trust. This applies doubly to AI firewalls because they sit on the critical path of every agent action.
Auditability. You can read the scanning logic, the DLP patterns, the injection detection rules, and the logging behavior. No wondering whether the vendor added telemetry in the last update or whether a “block” decision actually blocks.
No vendor lock-in. SaaS firewalls hold your policy configuration, your audit logs, and your integration. If the vendor raises prices, gets acquired, or shuts down, you start over. Open source tools run on your infrastructure. You own the data.
Self-hosted by default. Your agent traffic never leaves your network. Secrets, prompts, and tool call arguments stay on machines you control. For regulated industries, this is not optional.
Community review. More eyes on the scanning pipeline means bugs and bypasses get found faster. Published detection rules can be reviewed by anyone, not just the vendor’s internal team.
Open source options compared
Seven open source projects address AI agent security. They solve different problems at different layers.
| Tool | Layer | Language | Content Scanning | MCP Support | Deployment |
|---|---|---|---|---|---|
| Pipelock | Network proxy | Go | DLP (65 patterns), response scanning (34 patterns), SSRF, encoding evasion (6-pass normalization) | Bidirectional (stdio, HTTP, WebSocket) with tool poisoning + rug-pull detection | Single binary, Docker, K8s companion proxy |
| LlamaFirewall | Inference | Python | PromptGuard classifier, AlignmentCheck, CodeShield | Not documented in public docs | Python library |
| NeMo Guardrails | Inference | Python | Colang-based dialog policy, topical control | Not documented in public docs | Python library |
| Trylon Gateway | Gateway | Python | Self-hosted firewall for LLM apps | Gateway routing | Container |
| Agent Wall | Network | Node.js | MCP-focused security firewall | MCP-based AI agents | Library / sidecar |
| DefenseClaw | Application sidecar | Python | Policy enforcement, access control | MCP server governance | Sidecar container |
| agentgateway | Gateway | Rust | Regex and integrations for content guardrails | A2A and MCP routing | Binary, Docker |
What this means in practice:
- LlamaFirewall and NeMo Guardrails are inference-layer tools. They’re strong at classifying unsafe model outputs but don’t see network traffic.
- Trylon Gateway is an LLM-app firewall focused on the application layer rather than agent egress.
- Agent Wall is the closest peer to Pipelock on the MCP side and the most recent entrant. Both target MCP-based agents; Pipelock adds full HTTP, WebSocket, and A2A coverage plus mediator-signed action receipts.
- DefenseClaw governs MCP server access but is not a content-inspecting proxy.
- agentgateway routes agent-to-agent and agent-to-tool traffic and documents content guardrails using regex and integrations.
Pipelock combines content-inspecting DLP, prompt injection detection, MCP protocol scanning (tool poisoning + rug-pull + chain detection), SSRF protection, and mediator-signed action receipts (cryptographic evidence per decision, with a published cross-language verifier) at the network layer. That’s not a knock on the others. They solve different problems.
Open source or commercial?
Open source lets you inspect and modify the available code, but the license, model weights, dependencies, and optional services can have different terms. Self-hosting can keep inspection on infrastructure you operate, subject to your configuration and any external services you choose. It also puts updates, monitoring, capacity, and incident response on your team.
A commercial service may offer managed operation, support, and centralized administration. Check where prompts and logs go, retention settings, pricing, and what happens if the service is unavailable. Commercial software can also be self-hosted, and open-source projects can offer paid services. Verify the actual deployment and license instead of assuming either from the label.
How to choose AI firewall software
- Draw the path. Identify the model API, application, tools, and outbound connections. Decide which must pass through the control and how you prevent direct bypass.
- Check visibility. Ask which protocols, encrypted payloads, streaming responses, and MCP transports are inspected. Find out what happens to content that exceeds limits or can’t be parsed.
- Test policy. Run representative prompts, secret-like test data, tool calls, and legitimate workloads. Measure missed cases and false blocks against your requirements.
- Ask about failure. Determine whether a timeout or unavailable scanner blocks, allows, or queues traffic, and whether operators can change that behavior.
- Inspect operations. Review logging and redaction, policy updates, resource costs, integration, data retention, and who can change or bypass the control.
- Use multiple boundaries. Limit credentials and tool permissions, isolate the runtime, and monitor activity. A firewall supplements those controls.
For a coding agent, the Claude Code security guide covers permissions and other controls around the agent itself.
Proxy vs in-process
The architectural split matters more than the feature list.
Proxy (separate process). The firewall runs as its own process. The agent’s traffic routes through it via HTTPS_PROXY or MCP wrapping. The agent and the firewall don’t share memory. Prompt injection targeting the agent doesn’t directly affect the proxy’s rules or logs. With proper network isolation (container networking, firewall rules), the agent can’t route around the proxy either. The tradeoff: added latency per request (typically 1-5ms for Pipelock) and an extra process to manage.
In-process (library/SDK). The firewall runs inside the agent’s process as an imported library. Lower latency because there’s no inter-process communication. But the agent and the firewall share memory. A sophisticated injection that gains code execution can disable the library, modify its rules, or suppress its logs. The security boundary is the process, and both the attacker and the defender are inside it.
For security-critical deployments, the proxy model wins. The latency cost is negligible compared to LLM inference time (which dominates every agent request). The isolation guarantee is not.
Self-hosted deployment
Open source AI firewalls should be easy to deploy wherever your agents run. Pipelock ships as a single Go binary with zero runtime dependencies.
Single binary. Download, run. No Python, no Node, no container runtime required. Works on Linux, macOS, and Windows.
Docker. Pull and run with two environment variables.
docker run -p 8888:8888 ghcr.io/pipelab-org/pipelock:3.8.0
Kubernetes companion proxy. In v2.2.0, pipelock init sidecar --inject-spec generates an enforced companion proxy topology with a separate proxy Deployment, Service, NetworkPolicies, and bound workload identity. Use this when you want the cluster to enforce that the agent pod can only reach Pipelock. The full guide is Pipelock Kubernetes companion proxy.
Same-pod sidecar. Pipelock can still run as a same-pod sidecar when you want the fastest rollout, but that is a soft deployment pattern because the agent shares the pod network namespace and still relies on HTTPS_PROXY cooperation.
CI pipeline. Run pipelock mcp scan in CI to check MCP configs, tool descriptions, and policy files before deployment. Catches tool poisoning and policy drift before production. pipelock audit and pipelock git scan-diff cover related static surfaces.
Getting started with Pipelock
Install Pipelock and run it in under a minute.
# Install
# Requires Go 1.26+, Git, and Make. Start in a directory without a pipelock subdirectory. Community build only; use a release binary for paid features.
git clone --branch v3.8.0 --depth 1 https://github.com/pipelab-org/pipelock.git
make -C pipelock install
# Homebrew alternative on macOS/Linux: brew install luckyPipewrench/tap/pipelock
# Set up Claude Code with hooks and MCP proxy
pipelock claude setup
# Or proxy any agent's HTTP traffic
pipelock generate config --preset generic-agent --output pipelock.yaml
export HTTPS_PROXY=http://127.0.0.1:8888
export HTTP_PROXY=http://127.0.0.1:8888
export http_proxy=http://127.0.0.1:8888
pipelock run --config pipelock.yaml
Pipelock scans mediated traffic for 65 credential patterns, prompt injection (with 6-pass encoding normalization), SSRF, DNS rebinding, and MCP tool poisoning. The configured flight recorder records audit evidence; signing requires the appropriate key configuration.
Further reading
- Agent Security Control Layers: the four-lane map showing where open-source egress inspection sits among sandboxing, identity governance, and MCP gateways
- What is an Agent Firewall?: the architecture behind network-layer agent security
- Why Pipelock Is an Egress Agent Firewall: why Pipelock controls outbound effects instead of relying on prompt filtering at the door
- Agent Firewall vs WAF: why inbound web protection and agent egress control solve different problems
- MCP Runtime Security: live-traffic defenses for MCP that pre-deploy scanners miss
- MCP Security Tools: scanners, gateways, and proxies compared
- AI Runtime Security: the runtime threat surface beyond the network layer
- Pipelock: full feature list, deployment options, and framework coverage
- AI Agent Security: three security layers explained
- Pipelock vs LlamaFirewall: network proxy vs inference guardrails
- Pipelock vs DefenseClaw: network proxy vs framework-hook governance
- Pipelock vs Cloudflare AI Gateway: self-hosted egress inspection vs a hosted gateway in front of the model API
- Pipelock vs Prisma AIRS: a focused open-source proxy vs an enterprise AI security platform
- Pipelock on GitHub