Skip to slide
Chapter 12 · Observability, Hooks, and the Agent SDK
85 / 142

CHAPTER 12 · Observability, Hooks, and the Agent SDK · 2 / 5

How it works: a hook manager plus a budget meter

Two pieces that wrap the loop. A HookManager registers handlers per event and fires them at the right moments; a PreToolUse hook can veto a tool call. A Budget tracks turns and estimated cost (reusing Chapter 4's estimator) and raises a stop when a cap is hit. Both are deterministic and live entirely in the harness.

← → arrow keys work too