CTRLRun
Transaction safety for AI-agent actions.
Agents can retry. Your refund shouldn't.
CTRLRun is open-source infrastructure for controlling consequential AI-agent actions.
You decide, per action, what an agent can do autonomously, what requires human approval, and what is blocked.
CTRLRun binds approvals to the exact action, blocks duplicate execution attempts for the same logical effect, stops blind retries when an execution outcome is uncertain, and records what actually happened.
Autonomy belongs to the action, not the agent.
The problem
Agents are getting write access to the real world: refunds, emails, deploys, permission grants, record changes. Frameworks already let you approve or deny a tool call. That is not the hard part.
The hard part is what happens at the boundary between intention and effect:
- A refund commits at Stripe, the response times out, the agent retries. Did you just refund twice?
- A human approves a €500 refund. The agent changes it to €5,000 before executing. Should that approval still count?
- Two agents pick up the same task and issue the same refund. Which one wins?
- A call timed out. Your framework marks it failed and retries. It wasn't failed. It was unknown.
CTRLRun owns that boundary.
Quick start
pip install ctrlrun
ctrlrun demo
ctrlrun demo runs the four failure scenarios below in well under a second, with no external services.
Protect your first action:
import ctrlrun
@ctrlrun.protect("stripe.refund", effect="refund:{payment_id}")
def refund(payment_id: str, amount: int, currency: str = "EUR"):
return stripe.refunds.create(payment_intent=payment_id, amount=amount)
Configure autonomy per action in ctrlrun.yaml:
schema: ctrlrun.policy/v1
actions:
customer.read:
decision: allow
stripe.refund:
rules:
- when: { amount_gte: 0, amount_lte: 50000 } # up to €500.00
decision: allow
- when: { amount_gte: 0, amount_lte: 500000 } # up to €5,000.00
decision: approve
- decision: deny
Amounts are integer minor units — cents, not euros. Floats are rejected outright, because 0.1 and 0.10 are the same money and different hashes.
Now the same agent can refund €100 on its own, must get a human to approve €2,000, and cannot refund €20,000 at all. Neither can it refund a negative amount, which is a charge wearing a refund's name — an upper bound alone is not a range. Unknown actions are denied. CTRLRun fails closed.
What ctrlrun demo shows
$ ctrlrun demo
CTRLRun demo — four ways an agent action goes wrong, and what stops it.
Policy: refunds up to €1,000 are autonomous, up to €10,000 need a human, above that are denied.
1. Duplicate effect after a lost response
refund €500 → remote commits → response lost → effect: AMBIGUOUS
agent retries the same refund
✗ BLOCKED — effect may already have committed; blind retry refused
remote refund calls: 1
only a human moves it on: ctrlrun resolve refund:txn_1 --committed|--failed
2. Approval mutation
agent proposes refund €2,000 → human approves apr_0aa78e0380ba55d77a601dc782f57095 (bound to the action hash)
agent executes refund €5,000 →
✗ BLOCKED — approved action ≠ requested action (mismatch)
3. Concurrent agents, same effect
Agent A reserve refund:txn_123 → ACQUIRED → executes
Agent B reserve refund:txn_123 →
✗ BLOCKED — already reserved (in_progress)
4. Approval replay
approval apr_dbc8bc6f06690cdf2e2c55a4e591ef3b used once → consumed
same approval presented again →
✗ BLOCKED — single-use approval already consumed
Receipts (7): .ctrlrun/demo/receipts.jsonl
Events: .ctrlrun/demo/events.jsonl
Read them: CTRLRUN_STATE=.ctrlrun/demo/state.db ctrlrun receipts
Approval ids are generated per run; everything else is byte-for-byte what the demo prints.
Note scenario 1: remote refund calls: 1. The refund committed at the remote, the response was lost, and the retry was refused — so the customer was refunded once, not twice. Nothing but a human resolving the effect moves it on.
Every executed action produces a portable JSON receipt: who, what, arguments, decision, approval, effect key, and result (committed, failed, or ambiguous).
What CTRLRun is not
CTRLRun does not host models, plan, prompt, retrieve, route, remember, or orchestrate. It is not a guardrail library, an IAM system, a workflow engine, or a compliance product. If an agent only reads and answers, you don't need CTRLRun. The moment it can send, pay, refund, delete, deploy, grant, revoke, approve, submit, purchase, or cancel, you do.
CTRLRun cannot guarantee exactly-once execution against external systems it doesn't control. It guarantees that it will not knowingly execute the same logical effect twice, and that it will never treat an unknown outcome as a failure.
Documentation
| Doc | Purpose |
|---|---|
docs/SPEC-v0.1.md |
The v0.1 contract: models, invariants, acceptance tests |
docs/ARCHITECTURE.md |
Kernel design and key decisions |
docs/ROADMAP.md |
v0.1 → v1.0 |
docs/THREAT_MODEL.md |
What CTRLRun defends against and what it doesn't |
docs/CLAIMS.md |
Every claim above, mapped to the code and the test that proves it |
SECURITY.md |
Reporting a vulnerability |
VISION.md |
Where this can go — not a build spec |
License
Apache-2.0. The enforcement kernel is and will remain fully open source.
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 ctrlrun-0.1.0.tar.gz.
File metadata
- Download URL: ctrlrun-0.1.0.tar.gz
- Upload date:
- Size: 122.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc6fc2d209bc6e1e23c80c3ded8a00ee783bb123382a1509c324621273de4008
|
|
| MD5 |
76c249b9e58ab9bb7b48ef96431b269e
|
|
| BLAKE2b-256 |
350a886883fc01ec973441a982834185facdf8909a8eb85d8233903df8590b27
|
Provenance
The following attestation bundles were made for ctrlrun-0.1.0.tar.gz:
Publisher:
publish.yml on CTRLRun/ctrlrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ctrlrun-0.1.0.tar.gz -
Subject digest:
fc6fc2d209bc6e1e23c80c3ded8a00ee783bb123382a1509c324621273de4008 - Sigstore transparency entry: 2699022768
- Sigstore integration time:
-
Permalink:
CTRLRun/ctrlrun@510f611358b3e73cffdc07310bce76b432caf947 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CTRLRun
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@510f611358b3e73cffdc07310bce76b432caf947 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ctrlrun-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ctrlrun-0.1.0-py3-none-any.whl
- Upload date:
- Size: 56.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db7f54ec6012d6ee200c22d2c4fde831c912e5ae4960174aa05036c9e0022b2a
|
|
| MD5 |
fbaf708f564ecb9161d75b386912587a
|
|
| BLAKE2b-256 |
548eb84791d7edfc76780b83573f564bef1585b25f1235ba8d9eaaf37e646c4a
|
Provenance
The following attestation bundles were made for ctrlrun-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on CTRLRun/ctrlrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ctrlrun-0.1.0-py3-none-any.whl -
Subject digest:
db7f54ec6012d6ee200c22d2c4fde831c912e5ae4960174aa05036c9e0022b2a - Sigstore transparency entry: 2699022889
- Sigstore integration time:
-
Permalink:
CTRLRun/ctrlrun@510f611358b3e73cffdc07310bce76b432caf947 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CTRLRun
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@510f611358b3e73cffdc07310bce76b432caf947 -
Trigger Event:
push
-
Statement type: