Documentation
AgentX is a runtime firewall for AI agents. It blocks catastrophic tool calls (DROP TABLE, secret exfiltration, SSRF) before they execute, then coaches the agent to a safe path so the run finishes. Pick your path below and start keyless in 30 seconds.
01Get started
Pick your language. Each path shows only its own steps, numbered in the order you take them.
This path is for a TypeScript tool your code calls directly, a Vercel AI SDK or LangChain.js tool() that is not behind an MCP server. If your agent reaches its tools through MCP servers instead, the keyless agentx-mcp proxy protects those today with no code change and no key: switch to the MCP tab above.
This path is for MCP servers your client launches itself, the ones with a command entry in your mcp.json (Claude Code, Cursor, Claude Desktop, Windsurf, VS Code). agentx-mcp wraps that command, so every tools/call is screened before it reaches the server. If your tools are Python functions in your own process, the decorator is your path: switch to the Python tab above.
A remote MCP server your client reaches over HTTP is not wrapped this way today. If that is your setup, tell us in our Discord (the bugs and feature requests channel) so we know who needs it.
See your risk surface first. Lists every tool your agent can call, ranked by risk, and which are unguarded. Works on Vercel AI SDK and LangChain.js.
npx @agentx-core/scan .Then bring what it finds to us: the in-process guard runs against the gateway, and we wire it up with you.
Would you rather install a TypeScript guard yourself, with no key and no call with us?
Install the SDK, then drop @agentx_protect on any tool. The dangerous call is blocked in process RAM before it runs, no key.
pip install agentx-security-sdkfrom agentx_sdk import agentx_protect
@agentx_protect(agent_id="crm")
def call_api(url):
return requests.get(url)
# the agent picks the url at runtime:
call_api("http://169.254.169.254/")Trying it on a live agent? enforcement="audit" records that tool's calls and blocks none. Your other wrapped tools keep enforcing, and it stays until you delete that argument. See it: agentx audit
Step up to the gateway below for the full floor and Recover.
One line in mcp.json wraps any server. The dangerous tools/call never reaches it, and the agent is coached to self-correct keyless.
{
"mcpServers": {
"filesystem": {
"command": "uvx",
"args": [
"agentx-mcp", "npx", "-y",
"@modelcontextprotocol/server-filesystem",
"/data"
]
}
}
}Config uses uvx (no install). Want to watch it block something first?
Trying it on servers you already use? AGENTX_ENFORCEMENT=audit in a server's env records that server's calls and blocks none of them. Add it per server block. Read it back with uvx agentx-mcp --audit.
This is keyless and it is your protection for MCP servers today. Gateway-backed Recover over MCP is on the roadmap.
Want the gateway to cover your MCP traffic too?
The gateway is an HTTP service, so any language can call it. Your tool sends the call to /v1/evaluate before it runs, and acts on the verdict. That is all our TypeScript guard is, and the same thin client is straightforward in any language.
What you do not get yet is a packaged client for your stack, or a keyless local floor like the Python one. We write that client with you during onboarding.
Which language should we package next?
Or skip the vote and talk to us directly in our Discord and we will wire the gateway into your stack with you.
What you would run
For context, not as a step. The gateway is the service your tools would call, and it is free and runs locally. There is no point standing it up until something in your stack calls it, which is the part we do together.
docker compose up -d # what runs once we have wired your clientWhat your tools call over HTTP, whatever language they are written in. The full deterministic floor (AST parsing, the SSRF normalizer, the whole failure catalog), coached recovery that finishes the run, and team review before a risky action runs.
The floor runs with no key at all. Your own Gemini key turns on Recover, which writes the safe path and runs the retry for you. There is no keyless local option for your language yet.
02See it work
Watch a dangerous tool call get stopped, coached to a safe path, and the run finish. This is the same gateway check your guarded tools make on every call. Nothing to install, no key to get.
Open the playground02See it work
Once the SDK is installed, watch a prompt-injected DROP TABLE get blocked in ten seconds, offline, with no key and no gateway:
agentx demo # watch a prompt-injected DROP TABLE get blockedThen see what audit records, on the same demo. Audit watches every call and blocks nothing, so this run stops nothing and writes down all of it:
agentx demo --audit # then: agentx audit03Choose how it runs
Two postures. Audit watches every call and blocks nothing. Enforce stops the dangerous ones.
Nothing is blocked. Your agent behaves exactly as it does today, and every call it makes through a wrapped tool gets written down. Wrap the tool function, then run your agent once with AGENTX_ENFORCEMENT=audit. That run only. Read what actions your agent takes with agentx audit. To watch one tool for good while the rest keep blocking, put enforcement="audit" in the decorator. It stays until you delete that argument, and turning blocking on globally will not override it.
@agentx_protect(agent_id="crm_worker")
# then run your agent with audit onThe dangerous call never runs. It comes back carrying the coaching your agent retries on, so the run finishes instead of failing. This is what a fresh install does. A blocked call comes back as a value, not an error, so check it with is_block() below or your code treats a block as a real result.
@agentx_protect(agent_id="crm_worker")
# enforce is the default: nothing to setA blocked call returns an AgentXBlock (strictly-typed tools raise AgentXSecurityBlock instead). Check it with is_block(), feed its .challenge back to your LLM to revise the action, then retry, threading receipt_id so the recovery is tied to the original incident.
from agentx_sdk import agentx_protect, is_block
@agentx_protect(agent_id="crm_worker")
def dispatch_update(client_id: str, notes: str, db=None):
query = f"UPDATE clients SET notes = '{notes}' WHERE id = '{client_id}'"
return db.execute(query)
# Call the tool, then check the result before you trust it:
out = dispatch_update(client_id="c-99401", notes=agent_notes, db=session)
if is_block(out):
# out.challenge says what was unsafe and how to fix it. Hand it to your
# LLM to revise, then call the SAME tool again, passing receipt_id so the
# retry is tied to the original block.
revised_notes = your_llm(out.challenge)
out = dispatch_update(
client_id="c-99401",
notes=revised_notes,
db=session,
receipt_id=out.receipt_id,
)
# out is now the real return value of your tool, safely.out.policy names the policy that fired; out.safe_path is the preferred alternative when a policy names one (else None). Doing this with your own LLM is the manual version of Recover; the gateway automates it.
02Handle a block
Nothing to write. When the Shield blocks a tools/call, the proxy returns it to the agent as a coaching tool error, and the agent reads the guidance and self-corrects on its next turn. The run keeps going and the dangerous call never reaches the server.
To watch it happen before you wire your own servers, run the demo. It drives the same proxy your MCP client spawns, against a bundled stub server, and shows a DROP TABLE blocked with coaching and a scoped SELECT allowed through:
uvx agentx-mcp --demo # no key, no gateway, no Node, no checkoutThat coaching is in-band and keyless. Gateway-backed Recover over MCP (richer, model-coached self-heal) is on the roadmap; today the agentx-mcp proxy is your keyless protection.
Trying it on servers you already use?One server's calls can all be recorded and none of them blocked, while every other server you wrapped keeps enforcing. Add this beside argsin that server's block, with a comma between them, and repeat it per server you want in audit:
"env": { "AGENTX_ENFORCEMENT": "audit" }Then read it back with uvx agentx-mcp --audit, call by call. Remove the env line to enforce.
03Install agentx-mcp
The mcp.json in the door uses uvx, so it needs no install. For a persistent install, get the agentx-mcp command however suits your stack. All three run the same keyless Shield:
With pip or pipx, agentx-mcp lands on your PATH; then set command to agentx-mcp and drop the uvx arg.
Recover → Control
The gateway judge catches what keyword rules can't see, writes the safe path when your policy carries none, and runs the coach-and-retry for you, so your agent finishes the task instead of dying on a 403. Needs the gateway and your own Gemini key.
guide + continue
Get the gatewayConnect the cloud control plane for team human-in-the-loop and SOC approvals, shared dashboards, and a fleet-wide audit trail. Central oversight for when one machine isn't the whole story.
review + govern
Request AccessBoth run through the gateway, which any language can call over HTTP. There is no keyless rung here yet: that one needs a client we ship for your language, and we have not built yours.
04Shield → Recover → Control
pip install, then one decorator on a Python tool or one line in your mcp.json to wrap any MCP server. The keyless Shield blocks the blatant catastrophic calls (DROP TABLE, secret exfiltration, SSRF) before they run, and coaches your agent to self-correct. No LLM key, no signup, runs on your machine.
block + coach
The gateway judge catches what keyword rules can't see, writes the safe path when your policy carries none, and runs the coach-and-retry for you, so your agent finishes the task instead of dying on a 403. Needs the gateway and your own Gemini key.
guide + continue
Get the gatewayConnect the cloud control plane for team human-in-the-loop and SOC approvals, shared dashboards, and a fleet-wide audit trail. Central oversight for when one machine isn't the whole story.
review + govern
Request Access04Shield → Recover → Control
One line in your mcp.json wraps any MCP server. The keyless Shield blocks the blatant catastrophic calls (DROP TABLE, secret exfiltration, SSRF) before they run, and coaches your agent to self-correct. No LLM key, no signup, runs on your machine.
block + coach
The gateway judge catches what keyword rules can't see, writes the safe path when your policy carries none, and runs the coach-and-retry for you, so your agent finishes the task instead of dying on a 403. Needs the gateway and your own Gemini key.
guide + continue
Get the gatewayConnect the cloud control plane for team human-in-the-loop and SOC approvals, shared dashboards, and a fleet-wide audit trail. Central oversight for when one machine isn't the whole story.
review + govern
Request AccessRecover and Control run through the gateway. The keyless Shield blocks AND coaches your agent to self-correct; Recover adds the gateway judge that catches what keywords miss and runs the coach-and-retry for you, so it needs both the gateway and a Gemini key.
Shield is where MCP sits today, and the whole rung is yours with no key. Recover and Control run through the gateway, which does not cover MCP traffic yet, so those two apply to Python and TypeScript tools you write rather than to your MCP servers.
03Scan → Recover → Control
Lists every tool your agent can call, ranked by risk, and flags the ones nothing is guarding. Works on Vercel AI SDK and LangChain.js. It reads your code and reports: nothing is blocked at this rung, so treat it as the map, not the guard.
see + rank
The gateway judge catches what keyword rules can't see, writes the safe path when your policy carries none, and runs the coach-and-retry for you, so your agent finishes the task instead of dying on a 403. Needs the gateway and your own Gemini key.
guide + continue
Get the gatewayConnect the cloud control plane for team human-in-the-loop and SOC approvals, shared dashboards, and a fleet-wide audit trail. Central oversight for when one machine isn't the whole story.
review + govern
Request AccessRecover and Control run through the gateway. Scan maps what is unguarded; enforcement starts at Recover, where the in-process guard checks each call with the gateway and the judge catches what keyword rules miss.
04Run the gateway
The gateway adds the full deterministic floor (AST parsing, the SSRF normalizer, the whole failure catalog), coached recovery, and team review and approval before a risky action runs.
Worth knowing before you run this: it will not carry your MCP traffic. Run it for Python tools you write yourself, or skip it for now.
docker compose up -d # the full floor + Recover run hereStand it up now. Traffic starts flowing through it once we wire your guard, which is the next step.
Gateway protection over MCP is on the roadmap, so the keyless agentx-mcp proxy stays your protection for MCP servers today.
It is free and runs locally: get it self-serve. Questions or something broke? Join the Discord.
Where your guarded TypeScript tools send every call. The full deterministic floor (AST parsing, the SSRF normalizer, the whole failure catalog), coached recovery that finishes the run, and team review before a risky action runs.
The floor runs with no key at all. Your own Gemini key turns on Recover, which writes the safe path and runs the retry for you.
05Turn it on in your code
An in-process guard wraps each tool and checks the call against the gateway before it runs, so a blocked action never executes and your agent gets the same coaching to recover that the Python decorator delivers. The guard needs a gateway key, so we wire it up with you rather than hand you a copy-paste snippet. Say hello in our Discord and we will get you set up.
06Close the loop
Every block your agents hit is a chance to teach the firewall. Run agentx reviewfor a one-key pass over what got blocked: adopt the safe-path an agent already found, so AgentX coaches straight to it next time, or label a block right or wrong so the org's picture of what's a real threat sharpens. The protection compounds with use instead of staying static.
agentx review # one key each: adopt a safe-path, or label a block06Close the loop
Blocks and recoveries pile up as your agents run. Walk them with one key each: adopt a safe path an agent already found, or label a block right or wrong, so the protection gets better at your work instead of staying generic.
uvx agentx-mcp --review # one key each: adopt a safe-path, or label a blockWorks whether or not you installed anything, and reads the store the proxy wrote, wherever your MCP host launched it from.
Reference
Concepts
AgentX blocks a dangerous tool call, then hands your agent coaching so the run recovers instead of dead-ending. A few terms tie it together:
| Policy | A built-in floor: a trigger plus the coaching it delivers on a block. agentx policies lists them (e.g. "Mass Destructive Intent"). |
| Trigger | The deterministic detector that fires the block (a blocked intent or a structural signature). Runs keyless and offline, no LLM. |
| Coaching | What your agent receives on a block: what went wrong plus a safe path to try. This is what lets the run recover instead of dead-ending on a 403. |
| Challenge | The coaching message your agent actually reads (the text of the coaching). |
| Safe path | The concrete alternative the coaching names (e.g. "add a WHERE clause, or snapshot first"). |
Rewrite any policy's coaching by name, keyless, with agentx customize. It applies on both the @agentx_protect decorator and the agentx-mcp proxy. The tiers in step 04 (Shield, Recover, Control) are orthogonal: they set how much reasoning backs the block, from the keyless floor up to the gateway judge.
CLI reference
The agentx CLI ships with the Python SDK. Every command runs locally; agentx help prints this list.
| agentx demo | Ten-second offline 'aha': watch a DROP TABLE get blocked (no key, no gateway) |
| agentx audit | What your wrapped tools DID, call by call, while audit is on (blocks nothing) |
| agentx share | Turn your most recent block into a postable card + share draft |
| agentx status | Local protection stats + armed policies (live view needs the gateway) |
| agentx insights | Review your agents' learned safe-paths (numbered) for adoption |
| agentx adopt | Adopt a learned safe-path so AgentX coaches your agents to it |
| agentx review | One-key pass over pending blocks: adopt a safe-path, or label a block right/wrong |
| agentx policies | List the customizable floor policies + your active coaching (--check to validate) |
| agentx customize | Customize a floor policy's coaching by name, keyless (--text or --edit) |
| agentx pull | Pull your org's policy config from the control plane |
| agentx push | Contribute abstract threat signals to shared immunity (opt-in) |
| agentx sync | pull + push |
Customize the coaching, keyless. A block hands your agent a coaching message (what went wrong plus a safe path), and that wording drives whether it recovers. Run agentx policies to see the built-in floor policies and the coaching each ships with, then override one by name with agentx customize "Mass Destructive Intent" --text "..." (or --edit to open your editor on the current text). It saves to ./.agentx/overrides.json and applies keyless on both the @agentx_protect decorator and the agentx-mcp proxy.