threvo-actions
threvo-actions is a Python runtime for approving, executing and reconciling
governed business operations, starting with financial actions. It is
framework-neutral: hosts retain business truth, authorization, governed
execution, authoritative verification, and retention policy.
Read the documentation for the runnable quickstart, one guide per feature, complete runnable examples, Pydantic AI, PostgreSQL, MySQL, SQLite, and SQLAlchemy/Alembic integrations, the optional Stripe action groups, and the full API reference.
Installation
The StripeActions.refunds interface combines validated policy,
host payment resolution and reservation with the existing runtime. This facade is
included in 0.3.0. Read the
Stripe Actions guide, run
uv run --extra stripe python -m examples.stripe_actions.demo from this checkout,
and see the proposition and pipeline.
The facade also provides StripeActions.subscriptions for scheduling or
withdrawing period-end cancellation and StripeActions.credit_notes for reducing
an open invoice or crediting a paid invoice's customer balance. Each group can be
configured independently. See the billing action guide
and reviewed implementation plan.
Run all four credential-free scenarios with
uv run --extra stripe python -m examples.stripe_billing.demo. Cancellation scheduling does not end service immediately, and credit
notes in this scope do not refund cash or send customer email.
Python 3.11 through 3.13 is supported.
uv add "threvo-actions==0.3.0"
Install only after the signed v0.3.0 tag completes the TestPyPI and PyPI
release workflow. Do not install a moving branch for a financial-action
runtime.
PostgreSQL, MySQL, SQLAlchemy/Alembic, and Pydantic AI integrations are optional. SQLite uses the Python standard library and is included in the base installation:
uv add "threvo-actions[postgres]==0.3.0"
uv add "threvo-actions[mysql]==0.3.0"
uv add "threvo-actions[sqlalchemy]==0.3.0"
uv add "threvo-actions[pydantic-ai]==0.3.0"
uv add "threvo-actions[stripe]==0.3.0"
The distribution also bundles an Agent Skills-compatible guide for coding agents. Install the copy matching your Python package with:
THREVO_ACTIONS_SKILL_DIR=$(threvo-actions skill path) || exit 1
npx skills add "$THREVO_ACTIONS_SKILL_DIR" \
--skill threvo-actions --agent '*' --yes
See the coding-agent guide for source-repo and global installation options.
Current contract
The package provides strict, immutable Pydantic v2 boundary models plus an
ordinary-Python confirm-first runtime and concurrency-correct in-memory store.
New integrations should start with the supported typed Action facade or the
public ActionDefinition. Applications may opt into the namespaced
experimental ActionApplication and ActionSpec only when they pin an exact
patch, rerun expert-path equivalence tests before every patch upgrade, and
review migration notes before every minor-line upgrade. All three paths compile
to the same expert runtime. Its explicit ports own
preparation, live authorization, authority evaluation, state re-resolution,
atomic execution, authoritative verification, snapshot protection, keyed
commitments, and retention decisions.
The runtime persists only a protected private snapshot and a separate minimized display preview. Tenant-scoped revision checks guard every transition, while a separate semantic-effect claim prevents competing proposals from admitting the same effect. Transport acceptance remains verification-pending until the host's authoritative verifier reports a terminal business outcome.
The optional PostgreSQL adapter supplies guarded persistence, explicit
advisory-locked migrations, a credential-free complete SQL renderer, and
separate runtime/retention privilege boundaries. Its three action roles can
target a dedicated database when deployments need maximum isolation from host
business persistence.
The optional MySQL 8 adapter supplies InnoDB-backed guarded persistence,
immutable explicit migrations, and security-definer runtime/retention lanes.
The SQLite adapter supplies explicit migrations and durable storage for local
development, evaluation, tests, and bounded single-writer deployments; it does
not claim database-role separation or general multi-worker production safety.
The SQLAlchemy/Alembic recipe keeps host business persistence and migrations
separate from qualified asyncpg action stores and the library-owned ledger. It
runs the library migration before Alembic as a serialized deployment step
rather than dynamically invoking installed package code from env.py.
The optional Pydantic AI Capability exposes typed command tools while treating
framework approvals and message history as untrusted continuation material.
See the PostgreSQL guide,
MySQL guide,
SQLAlchemy/Alembic guide, and
Pydantic AI guide. The public conformance
helpers and two local reference applications exercise the same runtime against a
PSP refund and a cross-service supplier-destination change. Application code
continues to own canonical state and all business mutations.
Guarantees
- Core imports require only Pydantic and the Python standard library.
- Money uses
Decimaland always carries an uppercase three-letter currency; hosts validate the currency or payment rail's permitted precision. - Boundary timestamps are timezone-aware.
- Participant roles and receipt families use closed discriminators.
- Boundary models reject extra fields and implicit type coercion.
- Receipt serialization uses the internal experimental version
internal/v0. - Canonical JSON uses a versioned, float-free profile with proposal-scoped, domain-separated keyed commitments.
- Authority evidence binds tenant, action/version, proposal instance, semantic effect, commitment, audience, channel assurance, issue time, and expiry.
- Failed-unknown effects re-enter authoritative verification, never blind send eligibility. Bounded retries terminalize as verification-unresolved.
- Private-state erasure destroys host key material and leaves a minimized lifecycle tombstone.
Commitment and protection providers must make destruction idempotent. The runtime records erasure intent before calling them so an interrupted erasure stays hidden and can safely resume without losing its opaque key handles. The full responsibility matrix is in Guarantees and limitations.
Conformance and reference applications
threvo_actions.conformance provides pytest-independent checks for action
stores, commitment/protection providers, runtime lifecycle behavior, recursive
seeded-canary leakage, and deterministic performance profiles. Passing these
generic checks is a baseline; every host action and external connector still
needs domain-specific adversarial tests.
Official store security profiles make the tested writer topology, privilege boundary, per-guarantee enforcement level, and data-handling exclusions inspectable. The independent-connection scenario exercises one-winner revisions and semantic-effect admission through separately created connection sources. Its report is reproducible test evidence, not a signed, deployment, or compliance certificate.
The refund example proves stable per-intent PSP
idempotency, atomic live-balance reservation, timeout-after-acceptance recovery,
provisional versus final absence, exact returned-effect binding, and
authoritative completion. The
supplier-destination example runs an
initiator and supplier-master receiver as two local FastAPI services. Its
application/v0 envelope is private to the example and is not a proposed
protocol. It demonstrates confidential extracted details, dual authority,
authenticated trigger and receiver boundaries, receiver-side state and request
binding checks, and a later payment bound to a verified destination version.
Run both without external accounts:
uv run pytest -q examples/refund/test_example.py
uv run pytest -q examples/supplier_destination/test_example.py
The repeatable overhead harness and the current local measurements are in the runtime benchmark. The adoption-timing gate has a published measurement methodology, and a coding-agent clean-room run passed the task-specific timing targets.
Non-goals and limitations
This package does not provide distributed exactly-once execution, an
authorization policy engine, a payment protocol, compliance certification, or
an audit-completeness product. The in-memory store is deterministic and
concurrency-correct but process-local; the SQLite adapter has a bounded-use
support tier; and the PostgreSQL adapter still relies on target-side idempotency
and authoritative verification. A receipt records typed
lifecycle evidence; it does not by itself prove that the host authorized an
action or that an external effect completed. finance.action/v1 is not a
published standard.
Do not place raw payment credentials, private canonical snapshots, internal host identifiers, or unnecessary personal data in generic models, previews, errors, telemetry, fixtures, or receipts. See the threat model.
Extension
The contract is deliberately small. Host-specific commands, results, business rules, authorization, and external-system clients stay outside the core. The included approval requirements count already authenticated and host-authorized evidence; they do not grant permission to approve. Optional persistence and agent adapters depend inward on these contracts; the core does not import an adapter, database driver, web framework, agent framework, ORM, or hosted-service SDK.
Stripe refund application
The Stripe reference app includes a Greek and English browser UI, Pydantic AI assistant, independent finance approval, PostgreSQL intent reservation, protected proposals, recovery sweeping and late-failure cases. It runs in Stripe sandbox mode and refuses live credentials.
uv sync --extra stripe-app --locked
uv run python -m examples.stripe_refunds --help
See the connector contract, target Stripe customers, and next steps. A Stripe refund object is accepted transport; independent verification establishes the operation's completion milestone. No blind resend or unlimited idempotency is claimed.
Migration
The documented Python imports and CLI are supported at 0.3.0. Pin the exact
patch release, review the 0.3.0 migration, and keep
host adapters at the application boundary.
Experimental interoperability surfaces may change in a minor 0.x release;
the versioning policy defines the exact boundary.
Development
See CONTRIBUTING.md for setup, verification, security, and change requirements.
License
Apache License 2.0. See LICENSE.
Metadata
Release files for threvo-actions 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| threvo_actions-0.3.0.tar.gz | 303.8 kB | With provenance | Details for threvo_actions-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| threvo_actions-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for threvo_actions-0.3.0-py3-none-any.whl |
Total release size: 478.6 kB
Release files / threvo_actions-0.3.0.tar.gz
| Download URL | threvo_actions-0.3.0.tar.gz |
|---|---|
| Size | 303.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55e1ac1acbb847ce57ff8e9ddf0250ef28b53196a1bbe45de8d126da71391657
|
|
BLAKE2b-256 checksum How to use checksums |
d810771d16ea73719c50d5bcccb63083b7669db1a4dee66cb26fc64e9234aca6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.
Transparency logRelease files / threvo_actions-0.3.0-py3-none-any.whl
| Download URL | threvo_actions-0.3.0-py3-none-any.whl |
|---|---|
| Size | 174.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa7dc33241b3f846ed083c4c47995791c0f4b67e326b13483806582e41c375e7
|
|
BLAKE2b-256 checksum How to use checksums |
4da5cc326de13cda088f4af7dbd9897cc75596bf911772e2f0352b81e492868a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.
Transparency logSecurity for threvo-actions 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for threvo_actions-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.