Skip to main content
Pre-release

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

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.

pip install --pre "agent-hooks-sdk[ctk]"
# 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

Host declaration

A host can load its configuration, declared surface and interceptor bindings from a host declaration document (spec §7.7) instead of calling the setters. The document is a versioned contract of its own, agent-hooks-declaration/1.0, separate from the wire version. The host registers in code what the document may reference: kind resolvers, custom identity providers, approval resolvers and redactors, plus the surface its code supports.

from agent_hooks import HostRegistry, HostSurface, InterceptionEmitter

registry = (
    HostRegistry(HostSurface.from_capabilities(["model_calls", "tool_calls", "host_declaration"]))
    .kind("com.example.egress", lambda config, ctx: EgressGuard(**config))
    .approval_resolver("operator-queue", OperatorQueue())
)
emitter = InterceptionEmitter.from_declaration_path("agent-hooks.declaration.json", registry)

from_declaration_json(text, registry), from_declaration_value(obj, registry) and from_declaration(HostDeclaration.builder().mode("enforce").bind(...).build(), registry) build the same emitter from JSON text, a parsed value or code; equal documents yield byte-identical records. A document that names anything the registry cannot honour is refused before any emission with DeclarationError, which carries .code (declaration_error:<class>), .findings (JSON pointer and detail) and, for an unsupported version, .accepted. The emitter is then sealed: register and the configuration setters raise EmitterSealed; the record sink and take_records stay open. Every record stamps declaration with the contract version, and emitter.declaration holds the resolved document whose canonical_json() is the equivalence oracle.

DECLARATION_VERSION and SUPPORTED_DECLARATION_VERSIONS name the contract versions this SDK writes and accepts; they sit next to SPEC_VERSION.

Interceptor usage

from agent_hooks import AgentContext, Verdict


class MyPolicy:
    def intercept(self, ctx: AgentContext) -> Verdict:
        if ctx["interception_point"] == "pre_tool_call" and ctx["tool_call"]["name"] == "rm":
            return Verdict.deny(reason="dangerous")
        return Verdict.allow()

Verdict.allow(), Verdict.deny(...), Verdict.warn(...) (allow + recorded warning) and Verdict.escalate(...) (liftable deny for the approval seam, §9) are the constructor shortcuts for the §5 shapes.

Running the CTK against your framework

Implement agent_hooks.ctk.Harness (see conformance/HARNESS.md). A harness that declares Capability.HOST_DECLARATION also implements setup_declared(scenario, document, registry) and builds its emitter with InterceptionEmitter.from_declaration_value(document, registry); one that does not skips the declaration/* vectors with a stated reason. 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.

Metadata

Release files for agent-hooks-sdk 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 agent-hooks-sdk 0.1.0b2
File Size Uploaded Provenance
agent_hooks_sdk-0.1.0b2.tar.gz 224.4 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for agent-hooks-sdk 0.1.0b2
File
agent_hooks_sdk-0.1.0b2-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
agent_hooks_sdk-0.1.0b2-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details
agent_hooks_sdk-0.1.0b2-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details
agent_hooks_sdk-0.1.0b2-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
agent_hooks_sdk-0.1.0b2-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 4.0 MB

Release files / agent_hooks_sdk-0.1.0b2.tar.gz

Download URL agent_hooks_sdk-0.1.0b2.tar.gz
Size 224.4 kB
Tags Source
SHA-256 checksum
How to use checksums
65a09039b7674e304df45aaffbbb4b2bc670faa35dd025885efba1f9954a8a92
BLAKE2b-256 checksum
How to use checksums
d98cbec0b70f321398acf05758fa267ee9dd4abc19c15ddf7e87c4530ccb48bb
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 13, 2026.

Transparency log

Release files / agent_hooks_sdk-0.1.0b2-cp310-abi3-win_amd64.whl

Download URL agent_hooks_sdk-0.1.0b2-cp310-abi3-win_amd64.whl
Size 656.0 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
30ff4fcc9c532ac018e6d9c13a6750f3029312fe4e953849dae40f177c78a6ef
BLAKE2b-256 checksum
How to use checksums
7556b56f9f2531792d5dc4f0a5fbcff6ac96223b5cca7eedb94981f89eefda33
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 13, 2026.

Transparency log

Release files / agent_hooks_sdk-0.1.0b2-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL agent_hooks_sdk-0.1.0b2-cp310-abi3-manylinux_2_28_x86_64.whl
Size 837.0 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
6f074282bafe9f470141aff9b92d82986f0cdfd2d56056754ff42ae0e0c916f5
BLAKE2b-256 checksum
How to use checksums
446ba47e684d828ad0e1fbd8db729b7cd215858cfa30d4307e750b19a25e45d0
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 13, 2026.

Transparency log

Release files / agent_hooks_sdk-0.1.0b2-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL agent_hooks_sdk-0.1.0b2-cp310-abi3-manylinux_2_28_aarch64.whl
Size 798.0 kB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
ad927aa9c0a9a8c523fd2bfa2d331b51c5cef2a4c5c3a7a8f0a0d313a456d3c2
BLAKE2b-256 checksum
How to use checksums
c61ad26203019c0ec167552c9a2770e2e03fffc851eb74578592de2dca5f1c1b
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 13, 2026.

Transparency log

Release files / agent_hooks_sdk-0.1.0b2-cp310-abi3-macosx_11_0_arm64.whl

Download URL agent_hooks_sdk-0.1.0b2-cp310-abi3-macosx_11_0_arm64.whl
Size 738.1 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
04174e1045e8142086f358e4023229cbf36a25594fd4c4b9f49d7c54e48a668c
BLAKE2b-256 checksum
How to use checksums
9adc9da81e5e1ce44314cf6817b111e07db1df2934e5cc680384183fd088e200
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 13, 2026.

Transparency log

Release files / agent_hooks_sdk-0.1.0b2-cp310-abi3-macosx_10_12_x86_64.whl

Download URL agent_hooks_sdk-0.1.0b2-cp310-abi3-macosx_10_12_x86_64.whl
Size 777.4 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
41a941d014baeaa9a1a2851264bba9ee72492d70800a741cc3ad688eabe933cf
BLAKE2b-256 checksum
How to use checksums
ee60db0afa1fc87a0ab21669085a5d1f7dfa05dba2c1ce7a8e4eb54e3d99ae4c
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 13, 2026.

Transparency log

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

Select from 6 files

Attestation for agent_hooks_sdk-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 13, 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