Catalog PyPI
Back to packageRELEASE DETAILS

0.1.0

PyPI

agentguard-firewall

Network egress firewall for AI agents. Declarative allow/deny list of hosts your agent tools may reach. Python port of @mukundakatta/agentguard.

agentsaiallowlistegressfirewallllmpolicysecuritytool-use
Published27 Apr 2026
Direct dependencies1
Transitive dependenciesNot calculated

README

Version 0.1.0 documentation

agentguard-py

PyPI Python License: MIT

Network egress firewall for AI agents. Declarative allow/deny list of hosts your agent tools may reach. Zero runtime dependencies.

Python port of @mukundakatta/agentguard.

Install

pip install agentguard-py

Usage

from agentguard import policy, check, PolicyViolation

p = policy({
    "network": {
        "allow": ["api.openai.com", "*.anthropic.com"],
        "deny":  ["billing.openai.com"],
        "methods": ["GET", "POST"],
    },
})

decision = check(p, "https://api.openai.com/v1/chat", {"method": "POST"})
# Decision(action='allow')

decision = check(p, "https://evil.example.com/")
# Decision(action='deny', reason='not_in_allowlist', detail='evil.example.com')

Plugging into HTTP clients

check() is the decision primitive. Wrap your favorite HTTP client around it:

import httpx
from agentguard import policy, check, PolicyViolation

p = policy({"network": {"allow": ["api.openai.com"]}})

class GuardedClient(httpx.Client):
    def send(self, request, **kw):
        d = check(p, str(request.url), {"method": request.method})
        if d.action == "deny":
            raise PolicyViolation(d.reason, d.detail, str(request.url), request.method)
        return super().send(request, **kw)

Pattern matching

PatternMatches
"api.openai.com"exact host
"*.example.com"example.com and any subdomain (api.example.com, *.api.example.com, ...)
"*"everything (handy as a catch-all in deny)

Deny rules win over allow rules.

API differences from the JS sibling

  • No firewall(spec, fn) -- Python doesn't have AsyncLocalStorage / a clean global-fetch monkey-patching equivalent. Wire check() into your HTTP client of choice (see above).
  • No wrap_fetch() for the same reason.
  • Policy, Decision, and the inner network/budget objects are immutable dataclasses.
  • budget.maxRequests is accepted as an alias for budget.max_requests for parity with the JS docs.

See the JS sibling's README for the full design notes.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pytest>=8.0; extra == "dev"runtime

Distribution files

2 collected
agentguard_firewall-0.1.0-py3-none-any.whl

bdist_wheel · 6.52 KB · Python py3

Source file
agentguard_firewall-0.1.0.tar.gz

sdist · 6.17 KB · Python source

Source file

Repository

PENDING
mukundakatta/agentguard-py

Shared repository data · GitHub

License detected in repository
Not collected

Repository

PENDING
mukundakatta/agentguard

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:06 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:ce6dc13a4f21792ec76be6532d9261c058e3268487d50b7ffd237a8b82d99ee3

Other collected versions

View all collected versions →