MCP Server
agentguard-firewall-py
MukundaKatta/agentguard-firewall-py
48
InicialPluginScore · de 0 a 100Python port of @mukundakatta/agentguard: network egress firewall for AI agents
Instalação
$
npx convez-ai MukundaKatta/agentguard-firewall-py1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Estrelas
0Forks
0Acompanhando
0Saúde
42%Último commit
há 5 mesesVersão
—Issues abertas
0Contribuidores
1README
A tradução para o português deste README ainda está na fila.
agentguard-firewall
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-firewall
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
| 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.
API differences from the JS sibling
- No
firewall(spec, fn)-- Python doesn't have AsyncLocalStorage / a clean global-fetch monkey-patching equivalent. Wirecheck()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.maxRequestsis accepted as an alias forbudget.max_requestsfor parity with the JS docs.
See the JS sibling's README for the full design notes.