Hold an AI agent's irreversible tool calls until a person approves that exact call
pip install openscript-sdk==0.1.0 Copy PIP instructions
Irreversible actions wait for a person, even when the model has been fooled.
OpenScript sits between an AI agent and the tools it calls. It refuses calls outside rules you write, holds the ones that cannot be undone until a person approves that exact call, masks secrets and PII, and records every decision. None of it depends on recognising an attack, so it still holds when the model is fooled, wrong, or swapped for another.
It is for anyone building an agent whose tools have real effects, such as payments, email or a shell, in Python with any framework. It is version 0.1.0 and alpha: the API may still change.
Try the live demo → The package runs in your browser tab, compiled to WebAssembly, with no backend.
Measured on AgentDojo's banking and Slack suites, with Qwen2.5-7B-Instruct, a model that follows prompt injections. The protocol was frozen before the run.
Every number, with its date, command and caveats, is in docs/metrics.md. The claim and what it does not cover are in the threat model.
agent ── calls a tool ──► SecureTool ── before: tool rules · session rule ──► refuse / hold for a person │ ▼ the call that was checked, and nothing else effect side ── a person's token? ──► apply, and write it in the ledger │ ▼ after: mask secrets and PII · record Tool rules limit which tools, arguments, recipients and amounts are allowed, in YAML. The session rule remembers when a session has read something a stranger wrote, and then holds the calls you list as irreversible. An approval is single-use, expires in an hour, and is bound to the tool, its exact arguments and the session. The effect side (evals/ledger.py) is a reference implementation, standard library only. Quick start pip install openscript-sdk # Python 3.11+; pulls pydantic, structlog and PyYAML The distribution is openscript-sdk and the package imports as openscript_sdk. The extras are [server] (the FastAPI server, whose database migrations are in this repository's alembic/), [redis], [metrics] and [otel]. To work on it, clone the repository and run make install.
A tool that the rules hold waits for a person, and the retry with the approval runs that exact call once:
from openscript_sdk import ActionBlockedError, SecureTool, ToolFirewallPolicy async def transfer_funds(to: str, amount: int) -> str: ... transfer = SecureTool(transfer_funds, policies=[ToolFirewallPolicy(rules_path="tools.yaml")]) call = {"to": "acct-22", "amount": 500} try: await transfer.call(call) # held: the tool does not run except ActionBlockedError as held: approval_id = held.approval_id # a person approves it ... await transfer.call(call, approval_id=approval_id) # ... and the same call runs, once # tools.yaml default_deny: true rules: transfer_funds: requires_approval: true args: amount: {min: 0, max: 1000} Also in the package: redaction of secrets and PII, input screening, an audit trail and an event server. The guide covers each.
make install && pytest && ruff check . && black --check . && mypy --strict openscript_sdk/ --exclude openscript_sdk/server/ CONTRIBUTING.md has the full checklist, including the Pyodide and Java checks. Changes to approvals, the session rule or the hook also run pytest tests/bypass.
ai-agents agent-security prompt-injection human-in-the-loop tool-calling llm guardrails claude-code
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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.
None of the files in this release were uploaded with provenance metadata.
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.




