tenet-claude-agent-sdk
Tenet Guardrails for the Claude Agent SDK.
It provides hook callbacks that judge the user's prompt and every tool call, before and after it
runs, with the Tenet judge. It is built on tenet-client.
pip install tenet-claude-agent-sdk
export TENET_API_KEY="sk_tenet_..."
Quickstart
from claude_agent_sdk import ClaudeAgentOptions, ClaudeSDKClient
from tenet_client import TenetCloudJudgeClient
from tenet_claude_agent_sdk import TenetHooks
judge = TenetCloudJudgeClient.from_env() # once per process
judge.warmup()
tenet = TenetHooks(judge)
options = ClaudeAgentOptions(
mcp_servers={"hr": hr_server},
hooks=tenet.hooks(),
)
async with ClaudeSDKClient(options=options) as client:
await client.query("find senior Python engineers in NYC")
async for message in client.receive_response():
print(message)
| Hook | Tenet phase | Held outcome (block, review, judge down) |
|---|---|---|
UserPromptSubmit |
agent_input |
the prompt is blocked before Claude sees it |
PreToolUse |
tool_pre |
permissionDecision: "deny", with the reason; Claude reads it and can recover |
PostToolUse |
tool_post |
the turn ends (continue: false) before Claude reasons over the result |
Stop (opt-in) |
agent_output |
Claude is sent back once to revise its reply |
Hooks run in every permission mode, bypassPermissions included. When the judge allows a call,
the hook returns {} rather than "allow", so your own permission rules and can_use_tool still
apply.
Outcomes and defaults
TenetHooks(
judge,
on_block="deny",
on_review="deny", # "ask": route the call to can_use_tool / the permission prompt
on_unavailable="deny", # judge unreachable or timed out: fail closed
tool_matcher="mcp__hr__.*", # judge only these tools; None = every tool
surface_by_tool={"mcp__hr__send_outreach": "candidate_outreach"},
check_final_reply=False, # True: also judge the final reply on Stop
)
Use on_review="ask" to put a person in the loop. The call goes to the SDK's permission flow,
with the verdict's reason, and your can_use_tool callback decides. "ask" only applies to
PreToolUse; other hooks treat it as "deny".
To combine Tenet with your own hooks, pass them in: tenet.hooks(my_hooks). Tenet's matchers are
added after yours.
Gotchas
PreToolUseis where you stop data.PostToolUseruns after the tool has run. The SDK cannot reliably replace a built-in tool's result, so a held result ends the turn rather than rewriting it.Stopfires after the reply exists. If you stream messages to your user, they may already have seen it. Leavecheck_final_replyoff unless you buffer the reply until the run completes.- Tool phases carry the user's ask from the same session's
UserPromptSubmit. If you turncheck_promptsoff, the judge only sees the tool arguments. - Construct the judge client once. It holds the token cache and connection pool.
Tested against claude-agent-sdk 0.2.187+ (0.2.x) and tenet-client 0.7.7+.
Metadata
Release files for tenet-claude-agent-sdk 0.1.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 |
|---|---|---|---|---|
| tenet_claude_agent_sdk-0.1.0.tar.gz | 10.6 kB | With provenance | Details for tenet_claude_agent_sdk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tenet_claude_agent_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for tenet_claude_agent_sdk-0.1.0-py3-none-any.whl |
Total release size: 22.2 kB
Release files / tenet_claude_agent_sdk-0.1.0.tar.gz
| Download URL | tenet_claude_agent_sdk-0.1.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e2f0352b2d192ff394833c84947a57a8418f93f68f19a3af63ef95e386686f4d
|
|
BLAKE2b-256 checksum How to use checksums |
4bf3a3c56acb6d6a38fbf20c64191a6426a1cd44c8db00a71c2d4320afbe25fb
|
| 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 Nov 24, 2026.
Transparency logRelease files / tenet_claude_agent_sdk-0.1.0-py3-none-any.whl
| Download URL | tenet_claude_agent_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8db7d9b8979a78c9332be4ba08d9bf52d6637f5d26d82a0f1a2dfc2e82ad7764
|
|
BLAKE2b-256 checksum How to use checksums |
29e2757e3ad1f416bd48f23c49378ef2ff10f24ff36ae540fc5632c6ca3fee91
|
| 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 Nov 24, 2026.
Transparency logSecurity for tenet-claude-agent-sdk 0.1.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 tenet_claude_agent_sdk-0.1.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 Nov 24, 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.