Observed since 20 Oct, 22:06 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
agentguard-firewall
Network egress firewall for AI agents. Declarative allow/deny list of hosts your agent tools may reach. Python port of @mukundakatta/agentguard.
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.
pip install agentguard-py
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')
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 | Matches |
|---|---|
"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.
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).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.
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
pytestEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | pytest>=8.0; extra == "dev" | runtime |
bdist_wheel · 6.52 KB · Python py3
sdist · 6.17 KB · Python source
Shared repository data · GitHub
Observed since 20 Oct, 22:06 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:ce6dc13a4f21792ec76be6532d9261c058e3268487d50b7ffd237a8b82d99ee3