In what order do Claude Agent SDK hooks run when several match?

In no guaranteed order. When an event fires, every matching hook runs in parallel, and for permission decisions the most restrictive result applies, so one hook’s deny blocks the tool call whatever the others return. Anthropic’s docs say completion order is non-deterministic and tell you to write each hook to act independently, not to rely on another hook having run first.

That rules out chaining. A hook can’t count on reading what an earlier hook logged or rewrote, because the two can finish in either order. If one check needs another’s output, put both in a single callback, or split them across events so one runs at PreToolUse and the other at PostToolUse.

The docs’ own example registers three independent checks on PreToolUse: authorization, input validation, and audit logging. Each one is safe alone, and none depends on the others.

Parallel hooks also change how you test them. A hook that only observes can go anywhere, but one that blocks or rewrites needs its own test, because what a hook can check is limited to the tool call in front of it.

published

sources

keep reading

More on this.

Try Tessary on Cloud.

free · 10,000 traces a month · 1 GB · 30-day retention · $10 one-time credit for triage and RCA · no credit card