Start here after you understand the normal session/tool flow. If you are new to Meerkat overall, read Examples: Sessions first.
Post-commit application reaction
Use a committed-fact point when the handler updates UI or telemetry but must never affect the operation it observes:HookInvocation.observation with
observation_type = "runtime_input_accepted" and typed input id, kind, and
handling mode. The operation has already committed. A denial-shaped response,
hook failure, or timeout cannot change it.
Observer hook (background)
Apost_tool_execution background hook that logs every tool call to a file. Background hooks run asynchronously and never block the agent loop.
- CLI
- JSON-RPC
- REST
- MCP
- Python
- TypeScript
Run-scoped hook override flags are not currently exposed on the normal
rkat run surface. Use the JSON-RPC, REST, MCP, or SDK examples below for per-run hook override testing.Guardrail hook (foreground)
Apre_tool_execution foreground hook that must approve each tool call before
it runs. If the hook returns deny, the tool is not dispatched and the current
run terminates with HookDenied. This is not an ordinary tool-error result
that lets the agent continue.
- CLI
- JSON-RPC
- REST
- MCP
- Python
- TypeScript
Run-scoped hook override flags are not currently exposed on the normal
rkat run surface. Use the JSON-RPC, REST, MCP, or SDK examples below for per-run hook override testing.In-process hook (Rust only)
Register a Rust closure directly — no subprocess, no serialization overhead. Only available in the Rust SDK.- Rust
- Rust
Gate a tool by provenance
Tool names are not sufficient authority when several MCP servers or bundles can publish the same logical operation. Apre_tool_execution hook can inspect
the winning tool definition’s typed provenance:
HookToolResult, so post-execution audit
hooks can attribute outputs to the exact selected source without re-resolving a
tool name.
HTTP hook
A hook that POSTs the invocation payload to a remote URL. Useful for centralized policy servers.- CLI
- JSON-RPC
- REST
- MCP
- Python
- TypeScript
Run-scoped hook override flags are not currently exposed on the normal
rkat run surface. Use the JSON-RPC, REST, MCP, or SDK examples below for per-run hook override testing.All 14 hook points
Foreground hooks halt loop progression until they return. Every hook in
background mode is limited to observe capability, including post points.
The six post-commit points are always dispatched asynchronously and require
observe, regardless of their configured execution mode.Disable a hook
Use thedisable list to turn off hooks defined in the realm config without removing them.
- CLI
- JSON-RPC
- REST
- MCP
- Python
- TypeScript
Run-scoped hook override flags are not currently exposed on the normal
rkat run surface. Use JSON-RPC, REST, MCP, or SDK/embedded surfaces for per-run hook override testing.Hook events
Ordinary foreground hooks report lifecycle events in the session event stream. These examples show possible outcomes for the foregroundsafety-gate hook,
not a single execution that both succeeds and fails.
audit-log may produce HookStarted when
actually launched. Capacity skips and later failures are recorded in the
in-process background dispatch ledger and tracing; a terminal HookCompleted
or HookFailed session event is not promised for that asynchronous work.
Post-commit reactions use a separate isolated dispatch path and do not promise
these normal lifecycle session events.
