Skip to main content

Enterprise Decision Protocol for policy-enforced automation and verifiable audit trails.

Project description

Decionis Python SDK

PyPI version Python versions License

Decionis: The Governance Protocol for Automated Enterprise Decisions.

Decionis is the Decision Protocol infrastructure for encoding, evaluating, and auditing organizational policy at scale. The Python SDK acts as an execution interceptor: it captures execution intent, sends it to Decionis, and locally continues, stops, or hands off based on the signed decision.

The SDK does not implement guardrails or expose IF-THEN policy logic in the client application. Policy versions, thresholds, approvals, reason codes, and audit evidence remain governed inside Decionis.

Core Concept

  • Trust: Every governed action receives a deterministic Decionis decision: ALLOW, BLOCK, ESCALATE, REVIEW_REQUIRED, or ERROR.
  • Automation: Applications, bots, API routes, and workflows keep moving only after Decionis returns a signed policy evaluation.
  • Auditability: Decision Dossiers preserve the execution intent, reason codes, cryptographic signature, and verification trail for enterprise review.

Installation

pip install decionis

Quickstart

Set DECIONIS_API_KEY in your server-side runtime. Get a key by subscribing at https://decionis.com or by requesting an API key from Decionis. API-key registration can include an industry such as financial_services, healthcare, retail, or technology; Decionis can provision a default encoded policy binding for that industry in shadow mode.

import os

from decionis import DecionisClient

client = DecionisClient(
    api_key=os.environ["DECIONIS_API_KEY"],
    base_url="https://api.decionis.com",
    tenant_id="bank_001",
)

decision = client.evaluate(
    {
        "actor": {"id": "agent_42", "type": "AI_AGENT"},
        "action": {"type": "TRANSFER_FUNDS", "resource": "liquidity_pool"},
        "context": {"workflow": "treasury_ops", "environment": "production"},
        "policy_refs": ["treasury-transfer-policy-v3"],
        "idempotency_key": "txn_123456",
    }
)

dossier = client.create_dossier(decision.decision_id)
health = client.ping()

print(decision.status.value)
print(decision.dossier_url)
print(dossier["decision_id"])
print(health["status"])

Use enforce when the SDK should fail closed for non-allowed decisions:

from decionis import DecionisBlockedException

try:
    decision = client.enforce(
        {
            "actor": {"id": "checkout-worker", "type": "SERVICE"},
            "action": {"type": "CAPTURE_PAYMENT", "resource": "order_9812"},
            "context": {"surface": "shopify", "channel": "checkout"},
            "policy_refs": ["commerce-integrity-policy-v1"],
        }
    )
except DecionisBlockedException as exc:
    print(exc.decision_id)
    print(exc.status.value)
    print(exc.dossier_url)

Interceptors

Decorators keep execution policy outside the application while giving Decionis a clear interception point.

import os

from decionis import DecionisClient, decionis_gate

client = DecionisClient(
    api_key=os.environ["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)

Native Surfaces

Reddit

Govern automated moderation with transparent removal receipts. A Reddit mod surface can intercept remove, approve, lock, or escalate actions; Decionis evaluates the intent, returns reason codes, and links the outcome to a Decision Dossier.

Enterprise

Apply deterministic policy enforcement to ServiceNow, Salesforce, and Microsoft Teams workflows. Decionis can govern IT approvals, CRM state transitions, collaboration escalations, and back-office automation without embedding policy rules in those systems.

Commerce and Financial Integrity

Use Decionis before Shopify payment capture, refund approval, inventory release, or financial workflow execution. The application exposes intent; Decionis owns the policy version, audit trail, and block or escalation decision.

CI/CD

Gate deployments, infrastructure changes, and privileged operations before they execute. Decionis turns policy review into a signed protocol decision that can be verified after the pipeline completes.

Policy Encoding

Most applications should not call policy encoding. Use it only from an internal policy authoring or deployment pipeline that already has a reviewed Decionis policy bundle artifact. The SDK forwards that artifact to Decionis and returns the accepted artifact metadata; it does not evaluate policy rules locally.

encoding = client.encode_policy(
    {
        "protocol_version": "1.0",
        "bundle_id": "018f4e6a-64d1-7b31-91ac-42d6db8a0001",
        "org_id": "trading_client_001",
        "version": "cfd-risk-policy@2026-05-03",
        "effective_from": "2026-05-03T00:00:00Z",
        "rules": [{"artifact_ref": "decionis-admin-export:policy-rule-001"}],
        "metadata": {"source": "decionis-admin-export"},
    },
    idempotency_key="policy-bundle-001",
)

print(encoding.artifact_id)

FastAPI

import os

from fastapi import FastAPI

from decionis import DecionisClient
from decionis.middleware.fastapi import FastAPIDecionisMiddleware

app = FastAPI()
client = DecionisClient(api_key=os.environ["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"],
    },
)

Configuration

client = DecionisClient(
    api_key=os.environ["DECIONIS_API_KEY"],
    base_url="https://api.decionis.com",
    timeout=10.0,
    max_retries=2,
    retry_backoff=0.25,
    tenant_id="bank_001",
)

Changelog

v0.1.1

  • Published the professional PyPI project description and package metadata for the Decision Protocol positioning.
  • Added ping() as a connectivity alias for health().
  • Updated default SDK API routing to https://api.decionis.com.

v0.1.0

  • Introduced Decionis execution interceptors for Python applications, FastAPI services, and native enterprise surfaces.
  • Introduced Cryptographic Decision Dossiers for verifiable audit trails, signed decisions, dossier URLs, and local signature verification.
  • Released the initial Protocol Logic Engine integration surface for policy bundle encoding, validation, evaluation, and enforcement.

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

decionis-0.1.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

decionis-0.1.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file decionis-0.1.1.tar.gz.

File metadata

  • Download URL: decionis-0.1.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for decionis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3e31368a75f014ccc013d580449fbd48de1cebd8e66d8b40ed1a0e1ad9cd92e8
MD5 14461ed705fb1ee0ea3c4fb83d48ff23
BLAKE2b-256 9aec18b446cb09f64c180e3aa0d29b9b158a98b10f0f75c38b00cb873e991373

See more details on using hashes here.

File details

Details for the file decionis-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: decionis-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for decionis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 174053380ba6dbc197a2ec65fe08ac388b122a67518a964d5fed850da125dde9
MD5 6a7c038b3d5542a7cbd273b9eed07019
BLAKE2b-256 12c513284d9304f6df505b5a3a37a55c6de811e8d0d6b681d0b40dc6ad38122e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page