Skip to main content Switch to mobile version riskbound 0.1.1 Ask Riskbound before an AI agent acts, then carry out the answer.
pip install riskbound==0.1.1 Copy PIP instructions
The Python SDK. It asks Riskbound before an AI agent acts, then carries out the answer. It matches the TypeScript SDK in ../sdk in behaviour and on the wire. It has no runtime dependencies, needs Python 3.10 or later, and is not published yet.
import os from riskbound import Riskbound, RiskboundBlockedError rb = Riskbound(api_key=os.environ["RISKBOUND_API_KEY"], base_url="http://localhost:8200") refund = rb.guard("refund", agent="support-bot") try: result = refund( {"order_id": "ord_2291", "amount_minor": 48000, "currency": "USD"}, lambda: payments.refund("ord_2291", 48000), ) # result.outcome is "allow" or "ask_human"; result.value is what the action returned. except RiskboundBlockedError as err: # err.reasons says why: a policy id, "spend_cap", "kill_switch", ... ... For asyncio code, use AsyncRiskbound. Actions may be async or plain functions. HTTP runs in a worker thread, so the event loop is not blocked.
from riskbound import AsyncRiskbound rb = AsyncRiskbound(api_key=..., base_url=...) refund = rb.guard("refund", agent="support-bot") result = await refund({"amount_minor": 48000, "currency": "USD"}, do_refund_async) What happens for each outcome
When Riskbound cannot be reached
By default the guard fails closed: it raises RiskboundUnavailableError and the action does not run. That covers no connection, a timeout (timeout=, 3 seconds by default) and any 5xx answer. Pass fail_mode="open" to a guard to run the action unchecked instead; the result says outcome="fail_open" and the error goes to on_error. Fail-open never applies to a rejected request (4xx, RiskboundRequestError), and never once a person has been asked.
Reporting the result
After the action runs, the SDK tells Riskbound whether it worked. A raised exception is reported as failed, with its message, and raised again unchanged. By default the guard waits for the report. Pass report_result="background" to send it after: on a daemon thread for Riskbound, as a task for AsyncRiskbound (call await rb.drain() before the program exits). A failed report goes to on_error and never changes the result.
idempotency_key= on a call: send the same key again to get the same answer instead of a new decision.
Requests carry via: "sdk", which the risk score uses (../docs/adr/0010-risk-score.md).
transport=, sleep= and clock= are for tests.
Send amounts as whole numbers in minor units (amount_minor: 48000 for $480.00). Floats are rejected by the backend.
uv venv .venv && uv pip install -e '.[dev]' .venv/bin/ruff check . && .venv/bin/ruff format --check . && .venv/bin/mypy && .venv/bin/pytest Tests run the SDK against a stand-in Riskbound API on a real local HTTP server (tests/fake_server.py), so the real transport is used.
Released: Dec 2, 2026
Both files in this release have provenance metadata.
View provenance details
Apache-2.0 View SPDX License List
ai-agents agent-security ai-governance guardrails mcp human-in-the-loop
Development Status 3 - Alpha
Intended Audience Developers
Programming Language Python :: 3
Release files for riskbound 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 31.4 kB
Release files / riskbound-0.1.1.tar.gz
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Release files / riskbound-0.1.1-py3-none-any.whl
Security for riskbound 0.1.1
Both files in this release have been uploaded with provenance metadata.
With provenance riskbound-0.1.1.tar.gz Dec 2, 2026
With provenance riskbound-0.1.1-py3-none-any.whl Dec 2, 2026
Attestation for riskbound-0.1.1.tar.gz
Attestation for riskbound-0.1.1-py3-none-any.whl
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Dec 2, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from 6571ef3











