This release is a pre-release and may not be stable for production use.
tenbri (Python)
Python bindings for Tenbri. The open-source Agent
Decision Record: every decision signed, chained and provable. The same Rust core as the tenbri CLI and tenbrid,
as an abi3 wheel for Python 3.10 and later.
pip install --pre tenbri
Quick start
import tenbri
tenbri.init() # TENBRI_STREAM, TENBRI_AGENT...: see below
@tenbri.decision("issue_refund", target="stripe:{charge}", policy="policy:refund@14")
def refund(charge: str, amount: int) -> None:
if amount > 500:
raise tenbri.Refused("over the ceiling") # recorded as refused
... # issue the refund
Each call of refund is a decision: its intent is durable before the function runs (if it cannot
be written, the function does not run), then its outcome follows: ok, refused when it raises
tenbri.Refused, error for any other exception (which propagates), unknown when cancelled.
Sync and async functions alike.
targetandsubjectare templates of the function's arguments ("stripe:{charge}","{order.id}") or functions of them;policy("ref@version") is the rule that allowed it;inputspins what the decision relied on,(ref, version, content)tuples or a function of the arguments returning them, by keyed digest.- Who acts:
principal=, else the innermostwith tenbri.agent("agent:billing"):, elseinit(agent=...). Nothing is guessed: with none, the call raises. - With an agent framework, one more line records every tool call:
tenbri.instrument_claude_agent_sdk(),tenbri.instrument_openai_agents()ortenbri.instrument_langchain()(installtenbri-claude-agent-sdk,tenbri-openai-agentsortenbri-langgraph).
init() opens the process's default stream, creating it and its keys on first use, and closes it
(flushing) at exit; with tenbri.init(...): scopes it to a block. Creating a stream (here or with
Tenbri.open(..., create=True)) records its pin in <keys>/pins, as tenbri init does, so
tenbri verify <stream> on this machine needs no --key. Every argument defaults to an
environment variable:
| Argument | Variable | |
|---|---|---|
stream |
TENBRI_STREAM |
A directory, file://..., s3://bucket/prefix or r2://bucket/prefix |
keys |
TENBRI_KEYS |
The keys directory, apart from the stream; default ~/.config/tenbri/keys |
agent |
TENBRI_AGENT |
Who acts when nothing narrower says: agent:support |
approver |
TENBRI_APPROVER |
Who answers the frameworks' approval prompts: person:alice |
schema |
TENBRI_SCHEMA |
The action schemas; default ./tenbri.toml when there is one |
fail_open |
Run actions, unrecorded and with a warning, when their intent cannot be written. Default: block them |
Input digests are keyed by the stream's local key store (per subject, so erasing a subject's key
leaves its digests unconfirmable): no secret in code. digest_key= keys them yourself instead.
Advanced: the stream itself
init() and @decision are built on this; use it to hold several streams, or to see every call.
from tenbri import Refused, Tenbri
# A directory, file://..., s3://bucket/prefix or r2://bucket/prefix. create=True makes the stream
# and its keys (in $TENBRI_KEYS, else ~/.config/tenbri/keys) when there is none.
log = Tenbri.open("./audit/support", create=True)
print("pin this:", log.fingerprint)
with log.run("agent:support-assistant") as run:
# Reads are pinned to the next decision's inputs, with a keyed digest of what was read.
run.read("policy:refund", "14", b"refunds under 50 EUR are automatic")
# The intent is durable before the block runs; the outcome follows: ok, refused or error.
with run.decision("issue_refund", "stripe:ch_123"):
pass # issue the refund here; raise Refused(...) when your policy says no
report = log.verify(log.fingerprint)
print(report.ok, report.entries)
for m in log.query(inputs=["policy:refund@14"]):
print(m.verification, m.entry["action"])
log.close()
log.decision is also a decorator; target may be computed from the arguments:
@log.decision("issue_refund", target=lambda charge, amount: f"stripe:{charge}", principal="agent:billing")
def refund(charge: str, amount: int) -> None: ...
With asyncio, AsyncTenbri has the same methods as coroutines, async with decisions and
decorators of async functions. Nothing blocks the event loop, and concurrent appends share one
group commit.
from tenbri import AsyncTenbri
async with await AsyncTenbri.open("s3://acme-audit/tenbri/support") as log:
intent = await log.intent(action={"type": "reply_ticket"}, principal="agent:support")
await log.outcome(intent, "ok")
- Low level:
log.intent(draft, **fields),log.outcome(intent, status, **fields)andlog.append(entry)take format v1 drafts as dicts and return entries as stored. - Idempotent retries: give a draft an
id(tenbri.new_id()); appending the same entry again returns the original. Every write error carries theidit was writing. - Errors are typed, one per stable code shared with tenbrid:
TenbriErrorand its subclasses (StoreUnavailableErrorisTENBRI_STORE_UNAVAILABLE, ...), with.code,.reason(the format's error code) and.id. - Read-only: without the stream's keys, a stream opens read-only;
verifyandquerywork, writes raiseNoSessionKeyError. verify(key)is onlyokagainst a pinned key: without one it shows that the stream agrees with its own genesis key, which proves nothing about who wrote it.
Metadata
Release files for tenbri 0.1.0b5
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 | |
|---|---|---|---|---|
| tenbri-0.1.0b5.tar.gz | 163.6 kB | With provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| tenbri-0.1.0b5-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| tenbri-0.1.0b5-cp310-abi3-musllinux_1_2_x86_64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ x86-64 | Details |
| tenbri-0.1.0b5-cp310-abi3-musllinux_1_2_aarch64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ ARM64 | Details |
| tenbri-0.1.0b5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| tenbri-0.1.0b5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| tenbri-0.1.0b5-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| tenbri-0.1.0b5-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 29.8 MB
Release files / tenbri-0.1.0b5.tar.gz
| Download URL | tenbri-0.1.0b5.tar.gz |
|---|---|
| Size | 163.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3abba23aabfb74f3e416b2d8dbce4ff59499076cbb4fb414178757e71d0ffbc7
|
|
BLAKE2b-256 checksum How to use checksums |
6732b213579022a9c2a556bd94de40077374995ea9a6ac550c98ef0d8a8257de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 20, 2026.
Transparency logRelease files / tenbri-0.1.0b5-cp310-abi3-win_amd64.whl
| Download URL | tenbri-0.1.0b5-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0a0aaf7981ad1b360eecbc83e959cbb6e208a62f1632d4cb9032899f3a527908
|
|
BLAKE2b-256 checksum How to use checksums |
8312b24ff398493147bb24e09ce026bf2be1996ac24e3fa9133429f835d3f36a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 20, 2026.
Transparency logRelease files / tenbri-0.1.0b5-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | tenbri-0.1.0b5-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1e5d784d1e87a93dfd3ef785bdf533dcd8df65cb1677989701c8336644be17cb
|
|
BLAKE2b-256 checksum How to use checksums |
9ac83a632931927846649172ae9cb96ed98f808408e668e1379bbde26344ab07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 20, 2026.
Transparency logRelease files / tenbri-0.1.0b5-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | tenbri-0.1.0b5-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8f09f9d6d46eb5156039e0cc8218350a747722314e0214638f36a0c27ff23650
|
|
BLAKE2b-256 checksum How to use checksums |
a0979c5439b952f2371a1ecde570fbd555a5cd412c72caf8b7b80a5601071a95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 20, 2026.
Transparency logRelease files / tenbri-0.1.0b5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | tenbri-0.1.0b5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4f640fc79b226bb0bdf8ff492576cceb20139e5a9777a89b5ebf0c9ad6d86f95
|
|
BLAKE2b-256 checksum How to use checksums |
143844fe203b9c82734e88698393bd27ae35413f946070f85db7706654611c50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 20, 2026.
Transparency logRelease files / tenbri-0.1.0b5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | tenbri-0.1.0b5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
3a097bedc0c956568f0622b6ab7dbc1f469842364d80218b11e6312caa6f1c7c
|
|
BLAKE2b-256 checksum How to use checksums |
ea922f50b893a812e9903e27882b2f22bce776d42415410eabce0ee44b159059
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 20, 2026.
Transparency logRelease files / tenbri-0.1.0b5-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | tenbri-0.1.0b5-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fb0ba80bf9a635d0623ed7855dc4ef3375ded23994427a50ee7330c762cbe080
|
|
BLAKE2b-256 checksum How to use checksums |
5ca94c2a048ed33ad5aaaec3b61b7ae150d4304e7ecff7f868d9cb32210d567c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 20, 2026.
Transparency logRelease files / tenbri-0.1.0b5-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | tenbri-0.1.0b5-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
09d1c2bfb2c4b35357fcbe582cc5df15cbf249e71504d6eeeed4bc86ff0337cc
|
|
BLAKE2b-256 checksum How to use checksums |
0208024eb36c2f7510169a47b0d5a523b3b7580b53e5f461e1fd0c5325c42577
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 20, 2026.
Transparency logSecurity for tenbri 0.1.0b5
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
All 8 files in this release have been uploaded with provenance metadata.
Attestation for tenbri-0.1.0b5.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 Oct 20, 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.