Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

tenbri-openai-agents

Tenbri for the OpenAI Agents SDK: every tool call, handoff and approval of an agent becomes a signed, chained decision that anyone holding the stream's key fingerprint can verify offline.

pip install --pre tenbri-openai-agents
import tenbri

tenbri.init()  # TENBRI_STREAM=./audit/support TENBRI_APPROVER=person:alice
tenbri.instrument_openai_agents()

From then on every Runner.run, run_sync and run_streamed is recorded, by agent:<the agent's name>, and so is every RunState.approve and reject, with no hooks= to pass. tenbri.init() creates the stream and its keys on first use and flushes at exit; see the tenbri package for its settings and @tenbri.decision for your own functions.

Which action, which target, which policy

A tool call is the action of the tool's name. Declare the action in tenbri.toml (the action schemas tenbrid and tenbri schema check validate against) and the record takes its target and rule from there, filled from the tool's arguments:

[actions.issue_refund]
target = "stripe:{charge}"      # each {argument} is filled from the call; validated as *
policy = "policy:refund@14"     # the rule that allowed it: ref@version

init() reads ./tenbri.toml (or TENBRI_SCHEMA). A tool matches an action by its name or its last __ part, so the MCP tool mcp__billing__issue_refund is issue_refund. A plain dict in code says the same, and wins:

tenbri.instrument_openai_agents(
    actions={"issue_refund": {"target": "stripe:{charge}", "policy": "policy:refund@14"}}
)

Approvals

Answer interruptions the SDK's way; both answers are recorded before the run resumes:

result = await Runner.run(agent, "Refund 80 EUR on ch_2")
state = result.to_state()
for item in result.interruptions:
    state.approve(item)  # an approval entry by TENBRI_APPROVER, which the tool's intent names
result = await Runner.run(agent, state)

state.reject(item) records the call's intent and a refused outcome by the approver. The approver is TENBRI_APPROVER, init(approver=...), or instrument_openai_agents(approver=...): a principal, or a function of the ToolApprovalItem.

Advanced: TenbriRecorder

The one-liner is built on TenbriRecorder, the run hooks of one run on a stream you opened. What it records, below, is what the one-liner records.

from agents import Runner
from tenbri import AsyncTenbri
from tenbri_openai_agents import TenbriRecorder

log = await AsyncTenbri.open("s3://acme-audit/tenbri/support")
async with TenbriRecorder(log) as recorder:
    result = await Runner.run(agent, "Refund ch_123", hooks=recorder, run_config=recorder.run_config())
What happens What is recorded
A tool call An intent by agent:<name>, action the tool's name, durable before the tool runs; then the outcome ok, or error if the tool raised
A tool input guardrail rejects or trips, or a person rejects the call An intent and the outcome refused (by the person, for a rejection)
A handoff An intent and an outcome ok, action handoff, target agent:<next agent>
await recorder.approve(state, item, "person:alice") An approval entry; the tool's intent names it in approval
The run raises The open intents end in error (unknown when cancelled)

The SDK awaits its run hooks, so the guarantee is enforce: if the intent cannot be written, the run stops before the tool runs. fail_open=True lets the tool run instead and logs a warning.

Tool arguments, results and prompts are never written. Choose what is:

TenbriRecorder(
    log,
    tools=["issue_refund", "close_ticket"],                 # default: every tool
    target=lambda tool, args: f"stripe:{args['charge']}",   # action.target
    inputs=lambda tool, args: [{"ref": "policy:refund", "version": "14", "content": policy}],
    subject=customer_handle,                                # per-subject keys, for erasure
)
recorder.read("ticket:4821", "3", ticket_text)              # pinned to the next decision

Contents are pinned by keyed digest, keyed by the stream's local key store. Entries carry the SDK's trace id, so a decision and its trace find each other.

Use one recorder per run, or per conversation when a run resumes after approvals. Pass run_config=recorder.run_config(your_config): it is how the recorder hears that a tool raised (otherwise only the SDK's default error message tells). Use async with so a run that raises closes its open intents; a process that dies mid-action leaves its intent open, and the next writer session reconciles it as unknown.

examples/refunds.py runs end to end, with or without an OpenAI API key.

Metadata

Release files for tenbri-openai-agents 0.1.0b2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tenbri-openai-agents 0.1.0b2
File Size Uploaded Provenance Actions
tenbri_openai_agents-0.1.0b2.tar.gz 13.6 kB With provenance Details for tenbri_openai_agents-0.1.0b2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tenbri-openai-agents 0.1.0b2
File Interpreter ABI Platform Actions
tenbri_openai_agents-0.1.0b2-py3-none-any.whl Python 3 none any Details for tenbri_openai_agents-0.1.0b2-py3-none-any.whl

Total release size: 23.6 kB

Release files / tenbri_openai_agents-0.1.0b2.tar.gz

Download URL tenbri_openai_agents-0.1.0b2.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
154b25eaf2c2f73b8711e200356820ee67ba593aae392c8d3a02751447044515
BLAKE2b-256 checksum
How to use checksums
ebfd8ff520414191569b4339508f2acce561460c15e7770b3a080197e8503121
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 Oct 20, 2026.

Transparency log

Release files / tenbri_openai_agents-0.1.0b2-py3-none-any.whl

Download URL tenbri_openai_agents-0.1.0b2-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a37b27e323615840236df425980f5cca3eaaf0fe59ba8b45a39a7e48b7bc467
BLAKE2b-256 checksum
How to use checksums
724d75ff1e7f71debc0e6d0558ef0f77d11760c5d258bcaf427d664908c4faa0
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 Oct 20, 2026.

Transparency log

Security for tenbri-openai-agents 0.1.0b2

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 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tenbri_openai_agents-0.1.0b2.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page