Skip to main content
Pre-release

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

tenbri-claude-agent-sdk

Tenbri for the Claude Agent SDK: every tool call your agent makes becomes a signed, chained decision in a Tenbri stream.

pip install --pre tenbri-claude-agent-sdk
import tenbri

tenbri.init()  # TENBRI_STREAM=./audit/support TENBRI_AGENT=agent:support TENBRI_APPROVER=person:alice
tenbri.instrument_claude_agent_sdk()

From then on every query() and ClaudeSDKClient session the process starts is recorded, with no change to your options: Tenbri's hooks go next to yours and your can_use_tool is wrapped. 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_claude_agent_sdk(
    actions={"issue_refund": {"target": "stripe:{charge}", "policy": "policy:refund@14"}}
)

File and web tools with no action record their path or URL as the target.

Approvals

A tool your can_use_tool allows is recorded as approved by TENBRI_APPROVER (or init(approver=...), or instrument_claude_agent_sdk(approver=...): a principal, or a function of (tool, tool_input, context) returning one). With no approver, an allowance is your own code's decision and no approval entry is written. Who acts is TENBRI_AGENT, or the innermost with tenbri.agent("agent:..."): around the session's start, or agent=.

Advanced: TenbriHooks

The one-liner is built on TenbriHooks, one session's hooks on a stream you opened. Use it to record some sessions and not others, or to see every option. What it records, below, is what the one-liner records.

from claude_agent_sdk import ClaudeAgentOptions, query
from tenbri import AsyncTenbri
from tenbri_claude_agent_sdk import TenbriHooks

log = await AsyncTenbri.open("./audit/support", create=True)
options = TenbriHooks(log, "agent:support", approver="person:alice").instrument(
    ClaudeAgentOptions(can_use_tool=ask_a_human)
)
async for message in query(prompt=prompt(), options=options):
    ...

What is recorded

SDK event Entry
PreToolUse An intent: principal = your agent, action.type = the tool name, action.target from the tool input (file path, URL), the input pinned by its keyed digest. Durable before the tool runs.
can_use_tool allows, with an approver An approval by that person, for the same action
PostToolUse Outcome ok, naming the approval if there was one
PostToolUseFailure Outcome error; unknown when interrupted
can_use_tool denies, or PermissionDenied Outcome refused

Each entry carries the trace of the active OpenTelemetry span (install opentelemetry-api). An intent left open (the process died mid-action) is reconciled as unknown by the next writer.

Nothing of the prompt, the tool input or the tool output is stored: the input is pinned by its keyed digest (claude:tool_input@<tool_use_id>), keyed by the stream's local key store, so whoever holds the input and the key can prove what the agent sent.

Options

  • tools: names to record, or a predicate of the name. All by default.
  • describe(tool, tool_input): the intent's fields: target, inputs (what the call read, {ref, version, digest}), rule, subject, or action to rename it. The default records the target of file and web tools.
  • approver: who approves through can_use_tool, a principal or a function of (tool, tool_input, context) returning one; None (the default) when your own code decides and no person approves.
  • fail_open: by default the adapter fails closed: a tool whose intent is not durable within timeout seconds (default 2) is denied. With fail_open=True it runs anyway, unrecorded, and a warning is logged.

TenbriHooks adds its hooks next to yours and wraps your can_use_tool; can_use_tool itself needs a streamed prompt (an async iterable), as the SDK requires. See examples/refund_agent.py.

Metadata

Release files for tenbri-claude-agent-sdk 0.1.0b5

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-claude-agent-sdk 0.1.0b5
File Size Uploaded Provenance
tenbri_claude_agent_sdk-0.1.0b5.tar.gz 12.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tenbri-claude-agent-sdk 0.1.0b5
File Interpreter ABI Platform
tenbri_claude_agent_sdk-0.1.0b5-py3-none-any.whl Python 3 none any Details

Total release size: 20.6 kB

Release files / tenbri_claude_agent_sdk-0.1.0b5.tar.gz

Download URL tenbri_claude_agent_sdk-0.1.0b5.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d62ed59d07637ef5dd830d6b05cce57f7944737ab692d27c17994c83ba6680bc
BLAKE2b-256 checksum
How to use checksums
510a6321651c7049156ae6cdddbb0e581989fb6655d29d6038055f66e3f9e00b
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 log

Release files / tenbri_claude_agent_sdk-0.1.0b5-py3-none-any.whl

Download URL tenbri_claude_agent_sdk-0.1.0b5-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c90b39eb2c49943dfddc93d3b60973fa48e1d02b11d916aede60ec778150f425
BLAKE2b-256 checksum
How to use checksums
72a0084c1d7d518b7870ac7cb0c3a5b611f73a12a471f01855e1576f3871023c
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 log

Security for tenbri-claude-agent-sdk 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 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tenbri_claude_agent_sdk-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 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