Official Decionis Python SDK for execution interception.
Project description
Decionis Python SDK
Decionis SDKs are execution interceptors. They do not encode policy logic inside the client application. They capture execution intent, submit it to Decionis, and continue, block, or escalate based on the signed decision.
pip install decionis
Decorator
from decionis import DecionisClient, decionis_gate
client = DecionisClient(
api_key="DECIONIS_API_KEY",
tenant_id="trading_client_001",
)
@decionis_gate(
client=client,
action="OPEN_POSITION",
policy="cfd-risk-policy",
actor={"id": "cfd_bot_7", "type": "TRADING_BOT"},
)
def open_position(order):
return broker.open_position(order)
The trading client does not own policy criteria, approvals, escalation rules, or compliance decisions. Those stay versioned in Decionis.
Client Gate
@client.gate(
action="TRANSFER_FUNDS",
policy="treasury-transfer-policy-v3",
actor={"id": "treasury-agent", "type": "AI_AGENT"},
)
def transfer_funds(request):
return payment_service.transfer(request)
Low-Level Enforcement
Use enforce when you need to package execution intent manually:
decision = client.enforce(
tenant_id="bank_001",
actor={"id": "agent_42", "type": "AI_AGENT"},
action={"type": "TRANSFER_FUNDS", "resource": "liquidity_pool"},
context={"workflow": "treasury_ops"},
policy_refs=["treasury-transfer-policy-v3"],
)
enforce returns only for ALLOW. BLOCK, ESCALATE, and REVIEW_REQUIRED
raise DecionisBlockedException with the decision ID, reason codes,
explanation, dossier URL, and original response.
Configuration
client = DecionisClient(
api_key="DECIONIS_API_KEY",
base_url="https://api.decionis.ai",
timeout=10.0,
max_retries=2,
retry_backoff=0.25,
tenant_id="bank_001",
)
FastAPI
from fastapi import FastAPI
from decionis import DecionisClient
from decionis.middleware.fastapi import FastAPIDecionisMiddleware
app = FastAPI()
client = DecionisClient(api_key="DECIONIS_API_KEY", tenant_id="bank_001")
app.add_middleware(
FastAPIDecionisMiddleware,
client=client,
build_request=lambda scope: {
"actor": {"id": "api", "type": "SERVICE"},
"action": {"type": "HTTP_REQUEST"},
"context": {"path": scope["path"]},
"policy_refs": ["api-execution-policy-v1"],
},
)
Release
The package is ready for PyPI Trusted Publishing from GitHub Actions. Releases
are triggered from GitHub Releases and start at 0.1.0.
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 decionis-0.1.0.tar.gz.
File metadata
- Download URL: decionis-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdbdf65877cf28611697537f0ce432c010f1d317eea2cc92d486c51daac1b838
|
|
| MD5 |
6b33c781534f37cbf4ddffd737b4b52d
|
|
| BLAKE2b-256 |
c68c15d321158f5cda84cf923e9ada5415d546f19309aed77f72b966f9d8a7ba
|
File details
Details for the file decionis-0.1.0-py3-none-any.whl.
File metadata
- Download URL: decionis-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00cc4e7a1bad94b1b74019fbe66bbd72ad409e071653c51b39f574e9c6cb699c
|
|
| MD5 |
905764dac5ae5452a7da93f0478f4672
|
|
| BLAKE2b-256 |
50379306ef1762ec6eedf05944e5ab0d26bf602989839c9d44fb107e902526e7
|