Framework-neutral agent control contract: interception points, agent context, verdict, and conformance test kit. Python wrapper over the canonical Rust core. Cooperative contract, not a security boundary: the host is fully trusted (see SECURITY.md).
Project description
agent-hooks (Python SDK)
Python implementation of
AGENT-HOOKS-0.1:
interception-point enums, AgentContext builder, Verdict types, host-side
InterceptionEmitter with the four composition profiles, the pluggable
identity-provider seam, and the Conformance Test Kit.
Trust model. agent-hooks is a cooperative contract, not a security boundary: the host framework is fully trusted, interceptors run in-process with full data access, and no complete-mediation claim is made. Read SECURITY.md and spec §1.4 before relying on it.
# The 0.1.0a1 artifact on PyPI implements a superseded draft — until
# 0.1.0a2 is published, install from source:
pip install "agent-hooks-sdk[ctk] @ git+https://github.com/responsibleai/agent-hooks.git#subdirectory=sdk/python"
# import name: agent_hooks
Host (framework adapter) usage
from agent_hooks import AgentContextBuilder, InterceptionBlocked, InterceptionEmitter
builder = AgentContextBuilder(agent_id="my-agent", framework="my-fw", session_id="s-1")
emitter = InterceptionEmitter().register(MyPolicy())
await emitter.emit(builder.agent_startup(tools_registered=["http_get"]))
ctx = builder.pre_tool_call(call_id="tc-1", name="http_get", args={"url": url})
try:
await emitter.emit(ctx)
except InterceptionBlocked as e:
return tool_error(e.result.verdict.reason)
result = invoke_tool(ctx["tool_call"]["args"]) # post-transform args
Interceptor usage
from agent_hooks import AgentContext, Decision, Verdict
class MyPolicy:
def intercept(self, ctx: AgentContext) -> Verdict:
if ctx["interception_point"] == "pre_tool_call" and ctx["tool_call"]["name"] == "rm":
return Verdict(decision=Decision.DENY, reason="dangerous")
return Verdict(decision=Decision.ALLOW)
Verdict.warn(...) (allow + recorded warning) and Verdict.escalate(...)
(liftable deny for the approval seam, §9) are the constructor shortcuts for
the other two §5 shapes.
Running the CTK against your framework
Implement agent_hooks.ctk.Harness (see
conformance/HARNESS.md),
then:
pytest --agent-hooks-harness=my_pkg:MyHarness
The vectors ship inside the wheel; pass --agent-hooks-vectors=<dir> only to
run a different vector set.
Project details
Release history Release notifications | RSS feed
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 agent_hooks_sdk-0.1.0a3.tar.gz.
File metadata
- Download URL: agent_hooks_sdk-0.1.0a3.tar.gz
- Upload date:
- Size: 173.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a527a42b23b748e298e9c6f5a80c824b04f57e52a100fd5ab7664e3b194feb62
|
|
| MD5 |
d0f8ecc3acb18f879cc3c24122fb71a9
|
|
| BLAKE2b-256 |
752276c1497ba3e56d6d14bccd9c532e80e693d900d8996c8abc854fc452b779
|
Provenance
The following attestation bundles were made for agent_hooks_sdk-0.1.0a3.tar.gz:
Publisher:
release.yml on responsibleai/agent-hooks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_hooks_sdk-0.1.0a3.tar.gz -
Subject digest:
a527a42b23b748e298e9c6f5a80c824b04f57e52a100fd5ab7664e3b194feb62 - Sigstore transparency entry: 2189437474
- Sigstore integration time:
-
Permalink:
responsibleai/agent-hooks@60647b160487cdefb5779301bcdaab65e05d73e8 -
Branch / Tag:
refs/tags/v0.1.0-alpha.3 - Owner: https://github.com/responsibleai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@60647b160487cdefb5779301bcdaab65e05d73e8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agent_hooks_sdk-0.1.0a3-cp310-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: agent_hooks_sdk-0.1.0a3-cp310-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 634.8 kB
- Tags: CPython 3.10+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
882e7d109bf4c4818c68325d9199e99237ebf74475f792ed91b93f807e15ac48
|
|
| MD5 |
760fcf1f72a9e71d9adb108259aa50cc
|
|
| BLAKE2b-256 |
ced16b862b959141fb9fb5693484b728817f9f25fdbc05c35ec2184505294ff1
|
Provenance
The following attestation bundles were made for agent_hooks_sdk-0.1.0a3-cp310-abi3-manylinux_2_34_x86_64.whl:
Publisher:
release.yml on responsibleai/agent-hooks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_hooks_sdk-0.1.0a3-cp310-abi3-manylinux_2_34_x86_64.whl -
Subject digest:
882e7d109bf4c4818c68325d9199e99237ebf74475f792ed91b93f807e15ac48 - Sigstore transparency entry: 2189437679
- Sigstore integration time:
-
Permalink:
responsibleai/agent-hooks@60647b160487cdefb5779301bcdaab65e05d73e8 -
Branch / Tag:
refs/tags/v0.1.0-alpha.3 - Owner: https://github.com/responsibleai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@60647b160487cdefb5779301bcdaab65e05d73e8 -
Trigger Event:
push
-
Statement type: