Skip to main content

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

Metadata

Release files for prosader 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prosader 0.1.0
File Size Uploaded
prosader-0.1.0.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prosader 0.1.0
File Interpreter ABI Platform
prosader-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / prosader-0.1.0.tar.gz

Download URL prosader-0.1.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
129d3261c9f4458faca2ac5596fb748288468dda1f6174ef1e9f42f5e61a5326
BLAKE2b-256 checksum
How to use checksums
a7cbffed1c5895600fd1631374fb99f488b5b4b37df1b0af1fdc638a2facbb1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / prosader-0.1.0-py3-none-any.whl

Download URL prosader-0.1.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9856be3901aecfb5615e4af1cae8b961b02bba55d561dbf3a49cfbc1760c623
BLAKE2b-256 checksum
How to use checksums
53ef2448c9918d965e4dfe1a063b772fc8c1f9674f2e148c1fce10280c2e4120
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page