Allow or deny tools
Set a default action and name the tools that may run.
Open-source firewall for AI agent tools
Megent checks each Python tool you guard against your policy before it runs—allowing approved calls and blocking the rest.
version: "1"default_action: deny tools: send_email: allow: true pii_mask: [email, phone]The execution boundary
Megent is an open-source Python firewall you run with your application. It checks the tool functions you guard; there is no hosted dashboard or web service. Keep the policy in your project and inspect the implementation on GitHub.
From policy to execution
Keep your agent and tools. Add a policy file and guard the functions that need a decision at runtime.
Start with a default action, then explicitly allow the tools your agent needs.
default_action: denyWrap the Python function that performs the action with Megent.
@mg.guardUse structured audit events to see which calls were allowed or blocked.
allow · blockPolicy controls
Keep the first policy readable. Add controls where the workflow needs them.
Set a default action and name the tools that may run.
Apply pattern-based masking to fields such as email addresses and phone numbers.
Emit structured events with the tool and policy decision.
Optional JWT identity and per-agent rate limits are available in the runtime.
Know the boundary
Megent governs the calls you wrap. It does not inspect every prompt or model response, and it does not secure the tools themselves. Keep the rest of your application security controls in place.
Megent evaluates calls to the Python tool functions you guard. It applies the configured policy before the wrapped function runs. Coverage depends on which functions your agent routes through Megent.
No. Megent is a Python runtime layer you add around the tools or execution functions you want to protect. Check your framework's call path and make sure the relevant tool boundary is wrapped.
The runtime supports configurable pattern-based masking for fields such as email addresses and phone numbers. Define the fields in your policy and review the behavior against your own data before using it in production.
No. Megent focuses on policy checks around guarded tool calls. Prompt injection, model output, secrets in prompts, and the tools themselves need their own security controls.
Megent is an open-source Python package that runs with your application. The project is Apache-2.0 licensed. See the repository for current setup instructions and implementation details.
Start small
Install the Python package, read the quickstart, and guard one tool function first.
pip install megent