← Back to Leaderboard
Aresponsibleai

responsibleai/agent-hooks

Cross-language SDK and conformance kit for enforcing agent controls across hosts

Engineering Health (Methodology)
A · 80/100
Maintenance Activity
● Updated today
Latest Release
Rolling commits (main)
Commercial License Check
MIT · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption14/25
Release Cadence11/20
License Clarity20/20
API
Total Stars
★ 31
24h Growth
+0
7d Growth
+1
Forks
11

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

responsibleai/agent-hooks Star History (2026-07-23 - 2026-12-04) ALL-TIME STAR HISTORY (2026-07 – 2026-12) +30 in 134d · avg +0/day 35 18 0 2026-07-23: ★ 12026-08-01: ★ 12026-08-15: ★ 12026-08-29: ★ 102026-09-12: ★ 132026-09-26: ★ 142026-10-10: ★ 192026-10-24: ★ 202026-11-02: ★ 232026-11-11: ★ 262026-11-20: ★ 282026-11-29: ★ 312026-12-04: ★ 31 ★ 31 07-23 09-28 12-04

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

Agent Hooks defines the enforcement boundary between an agent host and its controls. The host builds a versioned context, emits it at an interception point, and applies the resulting verdict. An emitter can be built from a JSON host declaration supplied as a file or value, or from a builder that uses the same loader. Direct constructors and setters remain conformant but produce an unsealed emitter without a declaration. The emitter rejects a context with a mismatched spec version.

The canonical implementation in sdk/rust/core handles RFC 8785 canonical JSON, jcs-sha256 context identity over a validated I-JSON domain, wire-verdict validation, transform paths and strictest-verdict aggregation. Python, TypeScript and Go bind that core but own host dispatch and timeouts. C# implements the runtime independently in managed .NET 8; shared golden fixtures check canonical JSON and identity outputs byte for byte and compare resolved declarations across all five SDKs.

Key Capabilities & Differentiators

Eight interception points cover session startup and shutdown, ingress and egress, and both sides of model and tool calls. In enforce mode, allow proceeds, transform rewrites the point-specific field before proceeding, and deny blocks. For example, before a model call the rewrite target is messages; after a tool call it is tool_result.value. Startup and shutdown have no rewrite target. Hosted transports may return a bare verdict or an envelope with provider extensions, but only the verdict governs enforcement.

Four composition profiles cover first-deny and run-all sequencing, plus strictest and unanimous parallel aggregation. An approval resolver can lift an eligible deny by returning the identity of the context shown for review; if configured, redaction precedes identity calculation. With no resolver the deny stands. Each emission produces a payload-free record, and evaluate_only generates records without applying verdicts. The conformance kit runs all released vectors applicable to the host's declared surface, rather than awarding a universal conformance tier.

Trade-offs & Limitations

Compared with framework-native middleware, the benefit is a common contract and shared test vectors across hosts, not automatic coverage. Each host must wire the call sites and honor the outcome. For a single runtime with adequate native hooks, that extra adapter and versioning work may not pay off. A standalone policy engine supplies rules and decisions that this SDK does not; it can sit behind an interceptor rather than compete with the contract.

The trusted host and in-process interceptors are a consequential boundary: interceptors have full data access, approval redaction does not isolate them, and the eight points do not guarantee complete mediation. Payload-free records reduce what the SDK records, not what a control sees. Fail-closed enforcement can turn invalid verdicts, interceptor timeouts or zero registered interceptors into denials. The per-binding on_error: continue exception is draft-only and does not belong in a released 0.1 design. Conformance tests declared behavior; it is not security certification.

Hardware & Deployment Guide

Treat this MIT-licensed project as a Beta SDK embedded in a framework, runtime or gateway, not as a turnkey API service. Pin the SDK package, wire spec agent-hooks/0.1 and declaration agent-hooks-declaration/1.0 explicitly: these are separate version axes, and the host has no default spec. The root workspace declares Node.js 22 or newer for repository tooling; that is not a requirement for every SDK. C# targets .NET 8 and does not load the Rust native library.

An in-process deployment can run without a network dependency from the contract itself; backing policy and approval services determine whether the full path stays local. Budget for context processing, concurrent invocations and record buffering, then measure control latency and timeout behavior in the real host. Run the 0.1 conformance harness against the exact surface being shipped. The listed Stack #255 C# builds are managed-package previews, not official releases or nuget.org publications; verify package availability before making a registry install part of the rollout.

Interception surface: Eight points span session startup and shutdown, input and output, and both sides of model and tool calls.
Scoped rewrites: A pre-tool transform targets tool_call.args; a post-tool transform targets tool_result.value; lifecycle points have no rewrite target.
Cross-language parity: Python, TypeScript and Go bind the Rust core; managed .NET 8 implements the contract independently and is checked against shared fixtures.
Composition: Four sequential or parallel profiles define how multiple verdicts combine; each interception record identifies the active profile.
Approval binding: The resolver echoes the identity of the context presented for approval, computed after redaction when a redactor is configured.
Conformance scope: The kit tests every applicable vector for the host's declared surface; claims name a released spec, never the draft.
Best For

Framework, runtime and gateway teams that control their agent loops and need consistent policy, approval and rewrite behavior across multiple hosts.

Skip If

You need a ready-made policy service, isolation for untrusted controls, guaranteed interception of every action, or only passive telemetry.

Reviewed on 2026-12-02 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

API
from agent_hooks import HostRegistry, HostSurface, InterceptionEmitter

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

Comparison vs. Top Coding, Skills & MCP Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
agent-hooks ★31+1RustMITCross-language SDK and conformance kit for enforcing agent controls across hosts
headroom81.5k+455PythonApache-2.0Local context compression for LLMs via a Python library, proxy, and MCP server
goose57.3k+219RustApache-2.0Rust coding agent with MCP tools and local or hosted models, embeddable via ACP
OpenSpec76.4k+468TypeScriptMITA CLI and agent-skill layer for keeping AI coding aligned with versioned specs

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/responsibleai/agent-hooks.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

responsibleai/agent-hooks Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about agent-hooks

How do I integrate Agent Hooks into an existing agent host?

Choose the wire version explicitly, construct an emitter and matching context builder, and wire emissions into the agent loop. Register the controls, then test that the host applies transforms before proceeding and stops on deny. A versioned JSON declaration can describe the surface and bindings, but loading it does not insert hooks into an existing runtime.

What hardware and runtime overhead should I budget for?

Agent Hooks does not run model inference and has no documented GPU or VRAM requirement of its own. Measure CPU time for context validation and canonicalization, memory for concurrent contexts and buffered records, and end-to-end latency for the controls you actually register. Keep the model's resource budget separate; an approval resolver or remote policy service can dominate the wait even when the SDK work is small.

Can we use it commercially in a self-hosted product?

Yes. The MIT license permits commercial use and self-hosted integration; preserve the applicable copyright and permission notices when redistributing. That permission does not cover the licenses of external controls or establish data-handling compliance. Review which in-process controls see full contexts and what any external resolver receives.

When is this a better fit than framework-native hooks or a standalone policy engine?

Use framework-native hooks if one host already has the interception points and enforcement semantics you need. Choose Agent Hooks when several hosts need comparable verdict handling, versioned declarations and a shared conformance suite. A policy engine can sit behind an interceptor to supply decisions; a sandbox is still needed if the goal is to isolate untrusted code. Neither is replaced by the contract.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining responsibleai/agent-hooks? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature responsibleai/agent-hooks on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare