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.1.tar.gz (124.3 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.1-py3-none-any.whl (121.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentgate_firewall-0.13.1.tar.gz
  • Upload date:
  • Size: 124.3 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.1.tar.gz
Algorithm Hash digest
SHA256 9a344bd8955f403d5e2a966937b27a60d19d6bbae3b38d3863240c871677a332
MD5 7bb61fe4ec8da8f9e6a4abce50fd6176
BLAKE2b-256 61830d5b169b02cc1d48e2e3e234e1d8424798c75de533055ffba657100ddc2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentgate_firewall-0.13.1-py3-none-any.whl
  • Upload date:
  • Size: 121.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3380d910638375f372c49bcf07b1db3558f1f2d59b193095b3e138489242d6c7
MD5 680cbf11911a00dd0de03b16d81c3f7c
BLAKE2b-256 7c072dfd0453d26d517a042aa4f6f5bf4c3ac89822627280864f9b47c338171b

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