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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentgate_firewall-0.13.0.tar.gz (114.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentgate_firewall-0.13.0-py3-none-any.whl (111.3 kB view details)

Uploaded Python 3

File details

Details for the file agentgate_firewall-0.13.0.tar.gz.

File metadata

  • Download URL: agentgate_firewall-0.13.0.tar.gz
  • Upload date:
  • Size: 114.4 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for agentgate_firewall-0.13.0.tar.gz
Algorithm Hash digest
SHA256 33013aa5f33b2332d15ad1e8091bcea429036d2db77355fbff4038a62885e2a2
MD5 d782f8c2335309222143d79920d6a535
BLAKE2b-256 698acf734002bf26b8258ef0fbc60f3bef1a2c76a805bbc7fc2ec7c90eb40228

See more details on using hashes here.

File details

Details for the file agentgate_firewall-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: agentgate_firewall-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 111.3 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for agentgate_firewall-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57d59b85eb6d5cc06fb3bfc39ac7babbf38dac52bf19e8fa9f8c5974b9972fa5
MD5 41ab3437610e567ef84a22a217ab1b23
BLAKE2b-256 4ac412d214dcfdf3635d619a5a9b67a79c109e65f38aa98539f4bbf5581b3331

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page