Skip to main content

AgentGate — Firewall for AI Coding Agents

PyPI version CI License: Apache 2.0

AgentGate sits between AI coding agents (Claude Code, Cursor, Continue.dev, Aider, Gemini CLI, OpenAI Codex) and your machine. It intercepts every Bash / Read / Edit / Write call, applies a policy, scans outgoing HTTP for data-exfiltration patterns, and asks a human via Telegram / Discord / Slack when the call is risky.

Why

Without AgentGate With AgentGate
Agent can rm -rf / with no warning Deny rules block destructive ops before they run
Agent can leak API keys to pastebin.com DLP scanner rejects outgoing bodies containing sk-ant-…
Agent can fetch arbitrary URLs Allowlist / blocklist of domains
No record of what the agent did Tamper-evident SQLite audit chain, optionally Ed25519-signed
Prompt-injection payloads slip through 28+ injection patterns scanned on every request

Install

pip install agentgate-firewall
agentgate doctor        # check pre-requisites
agentgate init          # write a starter policy.yaml
agentgate start         # launch the proxy on :18790

Then install the Claude Code / Cursor / Aider hook:

agentgate install-hook           # Claude Code
agentgate install-cursor-hook    # Cursor
agentgate install-continue-hook   # Continue.dev
agentgate install-aider-hook      # Aider
agentgate install-gemini-hook     # Gemini CLI
agentgate install-codex-hook      # OpenAI Codex CLI

Policy example

version: 1
default: deny

rules:
  # Read access to dotfiles is OK
  - id: allow-read-configs
    match: {tool: Read, file_glob: "~/.config/*"}
    action: allow

  # Block destructive Bash commands
  - id: deny-rm-rf
    match: {tool: Bash, command_regex: "rm\\s+-[rf]+.*"}
    action: deny
    reason: "Recursive delete blocked"

  # Allow `kubectl apply` but require human approval
  - id: ask-kubectl-apply
    match: {tool: Bash, command_regex: "kubectl apply.*"}
    action: ask

  # CEL-lite `when` conditions
  - id: deny-rm-elsewhere
    match: {tool: Bash, command_regex: "rm -rf.*"}
    action: deny
    when: 'event.cwd != "/srv"'

  # Rate-limit noisy rules
  - id: ask-deploy
    match: {tool: Bash, command_regex: "kubectl apply.*"}
    action: ask
    rate_limit: {capacity: 5, refill_per_sec: 0.1}

network:
  allowed_domains:
    - "*.github.com"
    - "*.anthropic.com"
    - "registry.npmjs.org"
  require_https: true

Subcommands

Command Purpose
agentgate start Run the mitmproxy-based intercept proxy
agentgate scan Static security scanner for AI agent configs
agentgate audit Read the audit log
agentgate audit verify Verify the SHA-256 audit chain
agentgate receipts verify Verify Ed25519-signed receipts
agentgate coverage Dead-rule + uncovered-tool report
`agentgate env add use
agentgate policy test Replay events against a policy (dry-run)
agentgate doctor Pre-flight health check

Security features

  • Bash/Read/Edit/Write intercept — every tool call passes through policy.evaluate().
  • CEL-lite when — gate matches on event fields (event.cwd != "/srv").
  • Token-bucket rate limiting — per-rule throttling without bricking the agent.
  • DLP egress scan — 50+ API-key patterns, JWTs, private keys, DB connection strings.
  • Prompt-injection scanner — 28+ markers (ignore previous instructions, role overrides, etc.).
  • Network allow/block lists — domain + HTTPS enforcement + per-rule exemptions.
  • Tamper-evident audit chain — SHA-256 chained rows; integrity verifiable.
  • Ed25519-signed receipts — optional cryptographic proof of audit entry provenance.
  • HMAC-signed webhooks — verify callbacks actually came from AgentGate.
  • Multi-channel approval — Telegram / Discord / Slack / approval server / file.
  • Multi-environment manager — dev / staging / prod switching.

Supported agents

Agent Hook Install
Claude Code PreToolUse → JSON agentgate install-hook
Cursor beforeShellExecution agentgate install-cursor-hook
Continue.dev beforeCommand etc. agentgate install-continue-hook
Aider pre-commit adapter agentgate install-aider-hook
Gemini CLI BeforeTool agentgate install-gemini-hook
OpenAI Codex CLI Before hook agentgate install-codex-hook

Contributing

See CONTRIBUTING.md. Run agentgate doctor first to verify your environment.

License

Apache 2.0 — see LICENSE.

Metadata

Release files for agentgate-firewall 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentgate-firewall 0.14.0
File Size Uploaded
agentgate_firewall-0.14.0.tar.gz 130.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentgate-firewall 0.14.0
File Interpreter ABI Platform
agentgate_firewall-0.14.0-py3-none-any.whl Python 3 none any Details

Total release size: 257.8 kB

Release files / agentgate_firewall-0.14.0.tar.gz

Download URL agentgate_firewall-0.14.0.tar.gz
Size 130.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f54a5c68c8972d8206955943c1bdad1e81b380cdbaf3c2250feb88d347659eca
BLAKE2b-256 checksum
How to use checksums
5d6b1d9e17cf3744680648b7fa6f726d88ec840045d80729f469bfbfdfdf0229
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / agentgate_firewall-0.14.0-py3-none-any.whl

Download URL agentgate_firewall-0.14.0-py3-none-any.whl
Size 127.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9ae2fdb4be4e292fc8d4372054763e40445cd29b01c89d0a07003f517958729
BLAKE2b-256 checksum
How to use checksums
739f04501bdf9e86f3d796e2ffbcf572a26b1c01fb1d04e5d8420dd9dbe60f68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.14.0 This release

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page