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-framework

For the HTTP adapters:

pip install "reconcile-framework[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.1.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.1-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.1.tar.gz.

File metadata

  • Download URL: reconcile_framework-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 d3e0a22c319a7ad387fa0b1d1854a85e14a9ecfdb946547e9ac5b0d4ef50a455
MD5 2e7f919ed6259a6d5980fb4f4e1ea3ae
BLAKE2b-256 60ceb4451319ad9ce2c6573b0e330c89e1ea832edea8fd319a3ef9309a72a85e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for reconcile_framework-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c89fcba6bf6f5085a94601314a584a08ee37ed897fc86e8a4001f806e1f02c28
MD5 93556a9273e525d4113e987c341e67de
BLAKE2b-256 fc2df45983fcf899bad95a1da8e838a449c49dac9fad16122c29158e12e40b51

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