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.0b3
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 | |
|---|---|---|---|---|
| agent_hooks_sdk-0.1.0b3.tar.gz | 233.5 kB | With provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| agent_hooks_sdk-0.1.0b3-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| agent_hooks_sdk-0.1.0b3-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| agent_hooks_sdk-0.1.0b3-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| agent_hooks_sdk-0.1.0b3-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| agent_hooks_sdk-0.1.0b3-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 4.1 MB
Release files / agent_hooks_sdk-0.1.0b3.tar.gz
| Download URL | agent_hooks_sdk-0.1.0b3.tar.gz |
|---|---|
| Size | 233.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a53fe5aec97ee6b08642398ea0ecc493b8dd7e08272f3927ff6876219fb2fec
|
|
BLAKE2b-256 checksum How to use checksums |
20bb1601e190adfd00cd6c00215be6f07498039ef122da3da6172ebd49458c30
|
| 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 22, 2026.
Transparency logRelease files / agent_hooks_sdk-0.1.0b3-cp310-abi3-win_amd64.whl
| Download URL | agent_hooks_sdk-0.1.0b3-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 676.5 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f92903b98196d255e23fd921df7ec957c3fc214461bd590c94aa7eeab9ea7920
|
|
BLAKE2b-256 checksum How to use checksums |
0392f8885f6f1f85c49c8016a7b6194ce1ab15dc544944c0e1d306b800b092e2
|
| 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 22, 2026.
Transparency logRelease files / agent_hooks_sdk-0.1.0b3-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | agent_hooks_sdk-0.1.0b3-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 855.6 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a471666a8f3d995a2b4c831c3790704b14bf5b7d595f82f5009c36ef25d05090
|
|
BLAKE2b-256 checksum How to use checksums |
9bb64a1e61a5c46e108c46e050448aea151c6fd902f60c1c03f6dcbd727b39b2
|
| 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 22, 2026.
Transparency logRelease files / agent_hooks_sdk-0.1.0b3-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | agent_hooks_sdk-0.1.0b3-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 817.4 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
9f1504625ccf8aff3a83c5bb0370221e0c7461e5ebcc37ae2adc98418cebd82a
|
|
BLAKE2b-256 checksum How to use checksums |
ef56ccbec5af101c8fb0df233f9ca3bd2c2cbc8d5dbfa94fb8e49f176d46b680
|
| 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 22, 2026.
Transparency logRelease files / agent_hooks_sdk-0.1.0b3-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | agent_hooks_sdk-0.1.0b3-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 758.5 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
910b9cc111109e9013aec511fc83271c4c58d316b73e2b68d24aa05e002eca27
|
|
BLAKE2b-256 checksum How to use checksums |
b7d98c44d3ddeed8548b6f0a31a786cfc25d24af3adc6cc327d63a85a517375e
|
| 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 22, 2026.
Transparency logRelease files / agent_hooks_sdk-0.1.0b3-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | agent_hooks_sdk-0.1.0b3-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 796.6 kB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
92083fc46bea28a868d4440b4be76d1bcb71137b598352b5f8c0a349d2d2e14d
|
|
BLAKE2b-256 checksum How to use checksums |
294a719078a56ea0a980d0ecedfca155cc76cdf541d13a6ed43657aeeb2ab22f
|
| 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 22, 2026.
Transparency logSecurity for agent-hooks-sdk 0.1.0b3
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.
Attestation for agent_hooks_sdk-0.1.0b3.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 22, 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.