Hedera Hook Creation
Installation
SKILL.md
Creating Hedera Agent Kit Hooks
Hooks are non-blocking extensions that run around the BaseTool lifecycle. They observe and can enrich execution: log calls, write audit trails, track metrics, persist state on Context. They do not block tool execution — that's the job of policies (see agent-kit-policy skill).
Hooks fire only for tools that extend
BaseTool. A tool that implements theToolinterface directly without extendingBaseToolbypasses the hook system entirely.
When to write a hook vs. a policy
| If you want to… | Use |
|---|---|
| Log/audit/track tool calls | Hook |
Enrich Context (counters, session state) |
Hook |
| Stop a call from happening when a condition holds | Policy (see agent-kit-policy) |
| Reject specific tool methods | Policy |
Built-in hooks include HcsAuditTrailHook and HolAuditTrailHook (HCS-backed audit trails) — both live in @hashgraph/hedera-agent-kit/hooks.