Python SDK for Statis — the trust layer for production AI agents (policy-gated tool calls + signed receipts)
Project description
statis-ai
The trust layer for production AI agents. One decorator turns any function into a policy-gated, audit-logged tool call. No agent framework lock-in, no proxy in front of your model, no rewrites.
statis-ai is the Python SDK for Statis. Drop it in
front of any side-effectful function your agent calls — Stripe refunds,
internal APIs, database writes — and Statis evaluates a deterministic policy
before the function executes, then writes a signed receipt of the decision.
from statis import gate
@gate(action_name="issue_refund")
def issue_refund(charge_id: str, recipient_email: str, cents: int) -> dict:
return stripe.Refund.create(charge=charge_id, amount=cents)
The decorator does three things on every call:
- Context In — Strips prompt injections, redacts PII, meters tokens
before the model call. (Re-exported from
statis-kit, our open-source pre-call hygiene library.) - Action Out — Sends the proposed call to the Statis policy engine.
Approved → executes. Denied → raises
ActionDeniedErrorwith a receipt. Escalated → human approves in the console; agent resumes. - Receipt Through — Every decision is recorded in an Ed25519-signed,
hash-chained ledger. Verifiable offline with the public key at
/.well-known/aarm-pubkey.
Install
pip install statis-ai
# optional: receipt signature verification (offline)
pip install "statis-ai[verify]"
Set your API key:
export STATIS_API_KEY=st_...
(Get one for free during beta at statis.dev.)
Quick start — gate a function
from statis import gate, ActionDeniedError
@gate(
action_name="issue_refund",
entity=lambda: {"customer_id": "CUST-7781"},
target_system="stripe",
timeout_s=10,
)
def issue_refund(charge_id: str, recipient_email: str, cents: int) -> dict:
"""Issue a Stripe refund. Only runs after the policy engine approves."""
return {"id": f"re_{charge_id[-6:]}", "amount": cents, "status": "succeeded"}
try:
result = issue_refund(
charge_id="ch_3PxOrder9921",
recipient_email="alice@bigcustomer.com",
cents=4999,
)
print("approved:", result)
except ActionDeniedError as e:
print(f"denied by rule {e.receipt.rule_id}: {e}")
# e.receipt has receipt_id, hash, signature — audit-ready, no extra wiring.
Policy as code
Rules are deterministic YAML, evaluated server-side per call. No LLM in the decision path:
- rule_id: refund_recipient_must_match_state
action_type: issue_refund
conditions:
recipient_matches_customer_of_record: true
decision: APPROVED
priority: 100
Apply with the CLI:
statis policy apply policies.yaml
What you get out of the box
@statis.gatedecorator — sync + async, idempotent, with timeout + escalationStatisClient— lower-level access for custom flowsprocess_context()— re-exported fromstatis-kitfor one-line pre-call hygiene (Guard + Compressor + Meter)- CLI —
statis init,statis policy apply,statis receipts list,statis receipts verify - Distributed lock + at-most-once execution semantics
- Console (web UI) for approvals, escalations, kill-switch, and receipt verification
Free during beta
The Developer Cloud (policy engine, ledger, console) is free while in beta — no Stripe at launch. Self-hosted Enterprise (SSO, SCIM, VPC, compliance exports) is contract-driven.
Links
- Homepage → statis.dev
- Source → github.com/statis-ai/statis-core
- OSS kit →
statis-kit(the Context-In primitives — works offline, no API key required) - TypeScript SDK →
npm install statis-ai
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file statis_ai-0.4.2.tar.gz.
File metadata
- Download URL: statis_ai-0.4.2.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11da941aab129713bbfa204c131190a5dbedb849d1d8ae8a8f6ed60e4be9e9cf
|
|
| MD5 |
96d58351a63e1c5f08649a3e8292ab58
|
|
| BLAKE2b-256 |
a714326d10b500d4f6216290181c5dbe84c2bf843f27781df4f131b864b7acc5
|
File details
Details for the file statis_ai-0.4.2-py3-none-any.whl.
File metadata
- Download URL: statis_ai-0.4.2-py3-none-any.whl
- Upload date:
- Size: 26.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8836b99cbfe9496edccdccc5b119e0367d1042ffc0d681cdbf73ff42a30c59f6
|
|
| MD5 |
8b7aa426210df22a3075bae576d92c55
|
|
| BLAKE2b-256 |
18736aec29da823a548549ffbb25fd3d289b3981b730df7ee443ce17dbdfced5
|