# Practical ways to use the Claude Agent SDK
๐ Control tool access with graduated permissions to balance safety and productivity.
Permission Settings uses `allowed_tools` / `disallowed_tools` / `permission_mode` to control agent tool usage at multiple levels for safe operation.
๐ Title: Setting Permissions
๐ URL:
๐งฉ Overview
Evaluation order: hooks โ deny rules โ permission mode โ allow rules โ canUseTool. `disallowed_tools` supports scoped denials (e.g., `Bash(rm *)`) that block even `bypassPermissions`, serving as the last line of defense.
๐ How to use it
Set `allowed_tools` for auto-approved tools, `disallowed_tools` for blocked tools (supports scoped denials like `"Bash(rm *)"`), and `permission_mode` for the overall mode (`default` / `acceptEdits` / `dontAsk` / `plan` / `bypassPermissions`).
๐ Practical usage
- Build a read-only lockdown with `allowedTools: ["Read","Glob","Grep"]` + `permissionMode: "dontAsk"` that instantly rejects anything else.
- Start with `default`, review initial approach, then dynamically switch to `acceptEdits` to speed up prototyping iteration.
- Use `plan` mode to have Claude execute only read-only tools and produce a plan without modifying source. Perfect for code review or pre-change approval flows.
- In CI/isolated environments, use `bypassPermissions` with `disallowed_tools=["Bash(rm -rf /)"]` as a safety net.
๐ก Use cases
๐ Read-only code analysis agents
๐ Pre-change approval flows with plan mode
๐ Dynamic trust level escalation
โ ๏ธ Watch out
`allowed_tools` does NOT restrict `bypassPermissions`. Always use `disallowed_tools` to block dangerous operations. Sub-agents inherit parent permission modes and cannot override them.
#
ClaudeAgentSDK# #
AI#