Get started

Wrap a tool, see what your agent did, then turn on blocking.

Pick your language

01Install

PythonOne decorator

One decorator, @agentx_protect(agent_id="my_agent"), on any tool checks every call inside your own process before it runs, no key.

pip install agentx-security-sdk
import requests
from 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/")

The tool behaves exactly as it does today: the wrap watches and records, and blocks nothing. Add posture="enforce" to the decorator above when you want it stopping calls, and it keeps blocking until you delete the argument. See what it recorded with agentx audit

Step up to the gateway below for more rules and Recover.

The install is all step 02 needs. The decorator comes at step 03.

02See a call stopped

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 blocked

03Wrap your own tool, then read the record

One decorator on the tool function. Nothing is blocked yet, so your agent behaves exactly as it does today.

from agentx_sdk import agentx_protect

@agentx_protect(agent_id="crm_worker")
def run_sql(query: str, db=None):
    ...

Run your agent, then from the folder it runs in:

agentx audit   # grouped by tool

A sample, shortened. Your tools and numbers will differ:

TOOL                   CALLS  SURFACE       ARGUMENTS
-----------------------------------------------------------------------
fetch_invoice_pdf          1  HTTP          url
issue_refund               1  -             amount, currency +2 more
                              largest amount passed: >=1,000
run_sql                    1  DB            db_session, query

1 call tripped a policy.
1 ran because nothing was blocking at the time.

Calls are recorded whether blocking is on or off. Only wrapped tools appear here, so this is not all your agent did.

04Turn on blocking

Add posture="enforce" to the decorator for one tool, or set it for a whole run:

AGENTX_POSTURE=enforce python your_agent.py  # mac/linux
$env:AGENTX_POSTURE="enforce"; python your_agent.py  # PowerShell

The dangerous call then never runs. It comes back as a value, not an error, carrying coaching your agent can retry on, so check it before you use it:

from agentx_sdk import is_block

out = run_sql(query=agent_query, db=session)

if is_block(out):
    # str(out) says what was unsafe and the safe path to take.
    revised_query = your_llm(str(out))
    out = run_sql(query=revised_query, db=session, receipt_id=out.receipt_id)

A tool with a strict return type, such as -> dict, raises AgentXSecurityBlock instead, so catch that.

Name the argument for what it carries (query, sql, command, path, url), so the check reads it.

05Get a free gateway key

The gateway adds more rules and the checks a keyword match can't do, coached recovery, and team review and approval before a risky action runs. Get a free key at agentx-core.com/gateway, with nothing to run. The setup steps come with the key. With a key, blocking is on by default, so handle a block first (step 04), or set AGENTX_POSTURE=audit to keep watching.

06Where next