Skip to main content

Governance runtime for enterprise workflows, policies, and state transitions.

Project description

Reconcile

Reconcile is a governance runtime for enterprise workflows.

You define a stateful domain model once, then execute every transition through a single kernel that enforces:

  • state machines
  • role-based permissions
  • policies and compliance rules
  • invariants
  • audit trails
  • graph relationships
  • controller automation
  • agent recommendations

It ships as a Python package backed by a Rust core.

Install

pip install reconcile

For the HTTP adapters:

pip install "reconcile[api]"

A 50-Line Enterprise System

from reconcile import define_system, PolicyResult, InvariantResult


def high_value_requires_review(resource, ctx, query):
    if ctx.get("to_state") == "APPROVED" and resource.data.get("amount", 0) > 2_500_000:
        return PolicyResult.deny("Loans above ₹25L must go through SENIOR_REVIEW")
    return PolicyResult.allow()


def positive_amount(resource, query):
    if resource.data.get("amount", 0) <= 0:
        return InvariantResult.violated("amount must be positive")
    return InvariantResult.ok()


loan_os = define_system(
    name="loan",
    states=[
        "DRAFT", "APPLIED", "DOCS", "UNDERWRITING", "SENIOR_REVIEW",
        "APPROVED", "DISBURSED", "REPAYING", "CLOSED", "REJECTED",
    ],
    transitions=[
        ("DRAFT", "APPLIED"),
        ("APPLIED", "DOCS"),
        ("DOCS", "UNDERWRITING"),
        ("UNDERWRITING", "APPROVED"),
        ("UNDERWRITING", "SENIOR_REVIEW"),
        ("UNDERWRITING", "REJECTED"),
        ("SENIOR_REVIEW", "APPROVED"),
        ("SENIOR_REVIEW", "REJECTED"),
        ("APPROVED", "DISBURSED"),
        ("DISBURSED", "REPAYING"),
        ("REPAYING", "CLOSED"),
    ],
    terminal_states=["CLOSED", "REJECTED"],
    roles={
        "data_entry": ["view", "transition:APPLIED"],
        "doc_officer": ["view", "transition:DOCS", "transition:UNDERWRITING"],
        "underwriter": ["view", "transition:APPROVED", "transition:SENIOR_REVIEW", "transition:REJECTED"],
        "senior_underwriter": ["view", "transition:*"],
        "branch_manager": ["view", "transition:DISBURSED", "transition:REPAYING", "transition:CLOSED"],
    },
    policies=[{
        "name": "high_value_requires_review",
        "description": "RBI-style maker-checker threshold",
        "evaluate": high_value_requires_review,
        "applicable_states": ["UNDERWRITING"],
        "resource_types": ["loan"],
        "priority": 90,
    }],
    invariants=[{
        "name": "positive_amount",
        "description": "loan principal must be positive",
        "mode": "strong",
        "scope": "resource",
        "check": positive_amount,
        "resource_types": ["loan"],
    }],
)

That system is immediately usable:

loan = loan_os.create({"amount": 800_000, "purpose": "working_capital"}, actor="maker-1")
loan_os.transition(loan.resource.id, "APPLIED", actor="maker-1", role="data_entry")
projection = loan_os.project(loan.resource.id, "underwriter")
print(projection.to_json())

Reference Implementations

  • Lending: reconcile.examples.create_loan_operating_system()
  • Procurement: reconcile.examples.create_procurement_system()
  • Clinical trials: reconcile.examples.create_clinical_trials_system()

The lending example is the full reference implementation:

  • 13 loan states
  • 7 roles
  • RBI-style policies
  • graph-enforced borrower exposure limits
  • agent-based risk and fraud recommendations
  • decision-node auto-underwriting
  • supporting applicant and collateral resource types

FastAPI Adapters

Single-system API:

from reconcile.api import create_app
from reconcile.examples import create_loan_operating_system

system = create_loan_operating_system().native
app = create_app(system)

Multi-app platform:

from reconcile import ReconcilePlatform
from reconcile.api import create_platform_app
from reconcile.examples import (
    create_loan_operating_system,
    create_procurement_system,
)

platform = ReconcilePlatform()
platform.register_app("lending", create_loan_operating_system())
platform.register_app("procurement", create_procurement_system())
app = create_platform_app(platform)

Packaging Notes

  • Core runtime: Rust + PyO3 via maturin
  • Python package source: python/reconcile
  • Native extension module: reconcile._native
  • Tests: ./.venv/bin/python -m pytest tests/python -q

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

reconcile_framework-0.1.0.tar.gz (99.1 kB view details)

Uploaded Source

Built Distribution

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

reconcile_framework-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file reconcile_framework-0.1.0.tar.gz.

File metadata

  • Download URL: reconcile_framework-0.1.0.tar.gz
  • Upload date:
  • Size: 99.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for reconcile_framework-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4340cd6463f757a2ec7948a2fd63e8cb6497293995f185e215cda662ff23a166
MD5 d59907c4c875883bb14acb5a1a567050
BLAKE2b-256 0d67d2e8cf40dae7c7f9080ec6558410c39916ac10c99f9d07d1a3865620e42f

See more details on using hashes here.

File details

Details for the file reconcile_framework-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for reconcile_framework-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6b1b8d88ddae54ccba048ce91144195117fa63a48ce301f18212047add4a90da
MD5 140c64dc9f9a1538de52f55c49065fc9
BLAKE2b-256 f424a8a576afcd340faf80553bcbbbe64d58babef7ba4a77d6089b6e38398987

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