← Table of Contents · Page 254 of 868

LIFECYCLE HOOKS

Part 8 of 11

PRACTICE LAB CONNECTION Add pre-execution, post-execution, and approval hooks to the Resume Review Agent lab in Chapter 67, and test the prompts below against them. Start with a small hook registry, a list of functions attached to named points, and a function that runs all hooks for a given point in order. Write one pre-execution hook that blocks any file path outside the resumes folder. Write one post-execution hook that logs each tool call as a structured line. Write one approval hook that asks you, in the terminal, for permission before the agent writes a final report file. Then deliberately try to make the agent violate each rule, and confirm that the hooks stop it.
Advertisement
Read Aloud:
0:00 / 0:00