Skip to main content

Guard AI agent tool calls with a Prosader runtime security gateway

Project description

Prosader Python SDK

Guard AI agent tool calls with a Prosader runtime security gateway. Every guarded call is evaluated against your policy and produces a signed, tamper-evident audit receipt — evidence you can hand to an auditor and verify independently with prosader-verify.

No dependencies: the SDK uses only the Python standard library (3.9+).

Install

pip install prosader

Usage

import prosader

client = prosader.Client(
    gateway_url="https://gateway.example.com:8443",
    api_key="psk-live-...",
    agent_id="billing-agent",
)

# Option 1 — explicit check before you execute a tool:
decision = client.check("bash", parameters={"command": "rm -rf /tmp/cache"})
if decision.allowed:
    run_command(...)
else:
    print(f"blocked by rule {decision.rule_id}: {decision.reason}")
    # decision.receipt_id — signed audit receipt either way

# Option 2 — wrap a function; blocked calls raise prosader.Denied:
@client.wrap("send_email")
def send_email(to, subject, body):
    ...

try:
    send_email(to="cfo@example.com", subject="Invoice", body="...")
except prosader.Denied as e:
    print(e.decision.reason)

Or configure once and use module-level helpers:

prosader.configure(gateway_url="https://...", api_key="psk-...", agent_id="my-agent")

@prosader.wrap("bash")
def run_bash(command): ...

Configuration falls back to environment variables: PROSADER_GATEWAY_URL, PROSADER_API_KEY, PROSADER_AGENT_ID.

Outcomes

Outcome decision.allowed Meaning
ALLOW True Proceed.
DENY False Blocked by policy (rule_id, reason populated).
STEP_UP False Held for human approval in the Prosader dashboard.

Errors:

  • prosader.Denied — raised by wrapped functions when blocked.
  • prosader.BillingError — subscription inactive or decision quota exhausted (HTTP 402).
  • prosader.GatewayError — gateway unreachable. Prosader is fail-closed: treat this as a denial.

Notes

  • Function arguments of wrapped functions are sent as the tool call's parameters so policy rules can match on them (e.g. deny bash where command contains rm -rf).
  • For development gateways with a self-signed certificate, pass verify_tls=False. Never do this in production.
  • Requires a gateway new enough to support check-only mode (X-Prosader-Check-Only), July 2026 or later.

Running tests

python -m unittest discover -s tests -v

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

prosader-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

prosader-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for prosader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 129d3261c9f4458faca2ac5596fb748288468dda1f6174ef1e9f42f5e61a5326
MD5 65c1256cc0e9b1960414c932b1a628b7
BLAKE2b-256 a7cbffed1c5895600fd1631374fb99f488b5b4b37df1b0af1fdc638a2facbb1f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for prosader-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9856be3901aecfb5615e4af1cae8b961b02bba55d561dbf3a49cfbc1760c623
MD5 83e09211c2c39cb586acaf2e74cf64fa
BLAKE2b-256 53ef2448c9918d965e4dfe1a063b772fc8c1f9674f2e148c1fce10280c2e4120

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