Skip to main content

Official Python SDK for AxioRank — route AI agent tool calls through your agent firewall.

Project description

axiorank

Official Python SDK for AxioRank — route your AI agent's tool calls through your agent firewall so policies are enforced, risk is scored, and every call is audited.

Parity with the TypeScript @axiorank/sdk.

Install

pip install axiorank

Quickstart (sync)

import os
from axiorank import AxioRank

axio = AxioRank(api_key=os.environ["AXIORANK_API_KEY"])  # looks like axr_live_...

# Get the decision and act on it yourself:
result = axio.tool_call("github.push", {"repo": "myrepo"})
if result.decision == "deny":
    print(f"Blocked: {result.reason} (risk {result.risk})")
else:
    ...  # proceed with the real tool call

enforce() — guard in one line

from axiorank import AxioRank, AxioRankDeniedError

axio = AxioRank(api_key=os.environ["AXIORANK_API_KEY"])

try:
    axio.enforce("aws.delete_bucket", {"name": "prod-data"})
    delete_bucket("prod-data")  # only runs if AxioRank allowed it
except AxioRankDeniedError as e:
    log.warning("AxioRank blocked the call: %s", e.result.reason)

A require_approval policy holds the call for a human; tool_call/enforce transparently wait out the hold and resolve to the final allow/deny.

Quickstart (async)

import os
from axiorank import AsyncAxioRank

async def main():
    async with AsyncAxioRank(api_key=os.environ["AXIORANK_API_KEY"]) as axio:
        result = await axio.tool_call("stripe.refund", {"amount": 5000})
        print(result.decision, result.risk)

Preflight an external server before trusting it

result = axio.verify_card(url="https://mcp.acme.com")
print(result.decision, result.identity.signature_valid, result.protocol)

# Or guard in one line — raises AxioRankCardDeniedError on `deny`:
axio.enforce_card(url="https://mcp.acme.com")

LangChain

pip install "axiorank[langchain]"
from axiorank import AxioRank
from axiorank.integrations.langchain import AxioRankCallbackHandler

axio = AxioRank(api_key=os.environ["AXIORANK_API_KEY"])

# Every tool the agent runs is checked against your policies first; a blocked
# tool raises and the step fails.
agent_executor.invoke(
    {"input": "..."},
    config={"callbacks": [AxioRankCallbackHandler(axio)]},
)

Prefer a model-readable refusal over a raised exception? Wrap individual tools:

from axiorank.integrations.langchain import guard_tool

safe_tool = guard_tool(my_tool, axio, on_deny="return")

Configuration

Argument Default Notes
api_key — (required) Your agent's key (axr_live_...).
base_url https://app.axiorank.com Point at your own deployment.
timeout 10.0 Per-request timeout, in seconds.
approval_timeout 300.0 Max wait for a human to resolve a hold, seconds.
client a fresh httpx.Client Inject your own httpx client (tests, proxies).

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

axiorank-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

axiorank-0.1.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file axiorank-0.1.0.tar.gz.

File metadata

  • Download URL: axiorank-0.1.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for axiorank-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f5378ea6a291b28f160569b3a5ef19834f930663af1fd1e942ae8b7ec2573922
MD5 ac9daeaea05ce2236ebe3d3762e5b17b
BLAKE2b-256 6e6b2f3d46dd736bba106cfd1bbe0920f6815f66e0604ee49d04cbaf7bc10f4f

See more details on using hashes here.

File details

Details for the file axiorank-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: axiorank-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for axiorank-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11ae22de2afb1f6061ed5ba4e94cf77daaf8524d6d88e77dcb567808b7e45e72
MD5 bf053be56ab854d08a2a08f342d008a3
BLAKE2b-256 0f425c878b1c427ad4a636e2872a544b6ec5e618d17cce2178af9c0a3a53b15f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page