CLAUDE CODE AGENTS: ADVANCED ORCHESTRATION - Chapter 2, Exercise 1 A Concrete Case for a Runtime-Built Tool Allowlist ==================================================================================== QUESTION: Explain a concrete scenario where an agent's tool allowlist genuinely needs to be built at runtime rather than fixed in a hand-written definition file. SOLUTION / EXPLANATION: A hand-written definition file fixes the tool allowlist once, at the time the file is written - the same agent always gets exactly the same tools, regardless of who's using it or in what context. This chapter names exactly the kind of scenario where that fixed approach breaks down: an agent whose appropriate tool access genuinely depends on who's running it. A concrete example: a documentation-review agent used across a team where some members are trusted senior contributors allowed to directly commit small documentation fixes themselves, while newer contributors are only allowed to suggest changes for someone else to apply. A single hand-written definition file can't represent both of these cases at once - it would either grant Edit access to everyone (over-permissioning newer contributors) or deny it to everyone (removing a genuine, deserved convenience from trusted senior contributors). Building the tool allowlist programmatically solves this directly: at the moment the agent is launched, code can check the current user's actual permission level and construct the tools list conditionally - including Edit access only if the user is a trusted contributor, and using a read-only allowlist otherwise. The same underlying agent role (reviewing and improving documentation) is preserved, but its actual tool access correctly reflects who is running it in each specific case, which a single static file has no way to represent. -------------------------------------------------------------------------- WHY THIS WORKS AS AN ANSWER: It identifies a concrete, realistic condition (differing user permission levels) that a fixed file structurally cannot represent, and explains specifically how building the allowlist at runtime resolves that limitation by checking the actual condition at launch time rather than baking one fixed answer into a static definition.