Study FAQ
How should I enforce an approval boundary for Claude Agent SDK tools?
Also asked as 2
- How can I limit an Agent SDK task to approved capabilities and gate sensitive actions?
- Which controls should a Claude Agent SDK application use before allowing a tool to make a change?
Answer
Start by exposing only the capabilities the Claude Agent SDK task needs, then enforce approval or denial before each consequential action. Give a read-only investigation retrieval tools and read-scoped service credentials. For a permitted write, verify the exact proposed operation, caller identity and approval at the service that performs the write.
The SDK’s allowed_tools (Python) or allowedTools (TypeScript) pre-approves matching calls that reach the allow-rule step. A matching deny or ask rule can take precedence. Other calls may be available and can run if they require no prompt. Use explicit tool exclusions and deny rules for capabilities the agent should never use, and isolate credentials, paths, and network access at the execution boundary. For headless tasks, dontAsk denies calls that would otherwise prompt, subject to the installed configuration. Check the effective tool set and exercise an expected denial before trusting a deployment. A permission bypass is appropriate only in an isolated environment with no access to sensitive files, credentials, or external services.
When an interactive reviewer must decide, show the operation’s target and impact. A host approval callback sees only calls that reach its decision step. Keep operations that need review out of automatic approvals, and verify approval in the executor or in a pre-tool hook that can block the call. After denial, report the missing authority and use an approved read-only path or stop. Apply the same downstream authorization to delegated calls.
Configure Agent SDK permissions · Design tool execution boundaries
Full explanation
Claude Agent Loops, Sessions, and Runtime Controls
Study guide · CCAR-F
Read the full explanation