CHAPTER 12 · Observability, Hooks, and the Agent SDK · 4 / 5
Connecting to the bigger picture
This chapter closes Part III by adding the control plane around everything you built: the PreToolUse hook complements Chapter 7's approval policy, the Budget replaces Chapter 2's crude max_turns and consumes Chapter 4's estimator, and PreCompact archives the transcript before Chapter 5's compactor runs. The session-log idea is the observability that Chapter 16's governance section requires. In the capstone, the loop fires hooks around every tool call and checks the budget every turn, which is what makes the little harness safe to run.