Loading...
    • Developer Guide
    • API Reference
    • MCP
    • Resources
    • Release Notes
    Search...
    ⌘K
    First steps
    Intro to ClaudeQuickstart
    Models & pricing
    Models overviewChoosing a modelWhat's new in Claude 4.6Migration guideModel deprecationsPricing
    Build with Claude
    Features overviewUsing the Messages APIHandling stop reasonsPrompting best practices
    Context management
    Context windowsCompactionContext editing
    Capabilities
    Prompt cachingExtended thinkingAdaptive thinkingEffortFast mode (research preview)Streaming MessagesBatch processingCitationsMultilingual supportToken countingEmbeddingsVisionPDF supportFiles APISearch resultsStructured outputs
    Tools
    OverviewHow to implement tool useFine-grained tool streamingBash toolCode execution toolProgrammatic tool callingComputer use toolText editor toolWeb fetch toolWeb search toolMemory toolTool search tool
    Agent Skills
    OverviewQuickstartBest practicesSkills for enterpriseUsing Skills with the API
    Agent SDK
    OverviewQuickstartTypeScript SDKTypeScript V2 (preview)Python SDKMigration Guide
    Streaming InputStream responses in real-timeHandling stop reasonsHandling PermissionsUser approvals and inputControl execution with hooksSession ManagementFile checkpointingStructured outputs in the SDKHosting the Agent SDKSecurely deploying AI agentsModifying system promptsMCP in the SDKCustom ToolsSubagents in the SDKSlash Commands in the SDKAgent Skills in the SDKTracking Costs and UsageTodo ListsPlugins in the SDK
    MCP in the API
    MCP connectorRemote MCP servers
    Claude on 3rd-party platforms
    Amazon BedrockMicrosoft FoundryVertex AI
    Prompt engineering
    OverviewPrompt generatorUse prompt templatesPrompt improverBe clear and directUse examples (multishot prompting)Let Claude think (CoT)Use XML tagsGive Claude a role (system prompts)Chain complex promptsLong context tipsExtended thinking tips
    Test & evaluate
    Define success criteriaDevelop test casesUsing the Evaluation ToolReducing latency
    Strengthen guardrails
    Reduce hallucinationsIncrease output consistencyMitigate jailbreaksStreaming refusalsReduce prompt leakKeep Claude in character
    Administration and monitoring
    Admin API overviewData residencyWorkspacesUsage and Cost APIClaude Code Analytics APIZero Data Retention
    Console
    Log in
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    Guides

    Configure permissions

    Control how your agent uses tools with permission modes, hooks, and declarative allow/deny rules.

    The Claude Agent SDK provides permission controls to manage how Claude uses tools. Use permission modes and rules to define what's allowed automatically, and the canUseTool callback to handle everything else at runtime.

    This page covers permission modes and rules. To build interactive approval flows where users approve or deny tool requests at runtime, see Handle approvals and user input.

    How permissions are evaluated

    When Claude requests a tool, the SDK checks permissions in this order:

    1. 1

      Hooks

      Run hooks first, which can allow, deny, or continue to the next step

    2. 2

      Permission rules

      Check rules defined in settings.json in this order: deny rules first (block regardless of other rules), then allow rules (permit if matched), then ask rules (prompt for approval). These declarative rules let you pre-approve, block, or require approval for specific tools without writing code.

    3. 3

      Permission mode

      Apply the active permission mode (bypassPermissions, acceptEdits, dontAsk, etc.)

    4. 4

      canUseTool callback

      If not resolved by rules or modes, call your canUseTool callback for a decision

    Permission evaluation flow diagram

    This page focuses on permission modes (step 3), the static configuration that controls default behavior. For the other steps:

    • Hooks: run custom code to allow, deny, or modify tool requests. See Control execution with hooks.
    • Permission rules: configure declarative allow/deny rules in settings.json. See Permission settings.
    • canUseTool callback: prompt users for approval at runtime. See Handle approvals and user input.

    Permission modes

    Permission modes provide global control over how Claude uses tools. You can set the permission mode when calling query() or change it dynamically during streaming sessions.

    Available modes

    The SDK supports these permission modes:

    ModeDescriptionTool behavior
    defaultStandard permission behaviorNo auto-approvals; unmatched tools trigger your canUseTool callback
    acceptEditsAuto-accept file editsFile edits and filesystem operations (mkdir, rm, mv, etc.) are automatically approved
    bypassPermissionsBypass all permission checksAll tools run without permission prompts (use with caution)
    planPlanning modeNo tool execution; Claude plans without making changes

    Subagent inheritance: When using bypassPermissions, all subagents inherit this mode and it cannot be overridden. Subagents may have different system prompts and less constrained behavior than your main agent. Enabling bypassPermissions grants them full, autonomous system access without any approval prompts.

    Set permission mode

    You can set the permission mode once when starting a query, or change it dynamically while the session is active.

    Mode details

    Accept edits mode (acceptEdits)

    Auto-approves file operations so Claude can edit code without prompting. Other tools (like Bash commands that aren't filesystem operations) still require normal permissions.

    Auto-approved operations:

    • File edits (Edit, Write tools)
    • Filesystem commands: mkdir, touch, rm, mv, cp

    Use when: you trust Claude's edits and want faster iteration, such as during prototyping or when working in an isolated directory.

    Bypass permissions mode (bypassPermissions)

    Auto-approves all tool uses without prompts. Hooks still execute and can block operations if needed.

    Use with extreme caution. Claude has full system access in this mode. Only use in controlled environments where you trust all possible operations.

    Plan mode (plan)

    Prevents tool execution entirely. Claude can analyze code and create plans but cannot make changes. Claude may use AskUserQuestion to clarify requirements before finalizing the plan. See Handle approvals and user input for handling these prompts.

    Use when: you want Claude to propose changes without executing them, such as during code review or when you need to approve changes before they're made.

    Related resources

    For the other steps in the permission evaluation flow:

    • Handle approvals and user input: interactive approval prompts and clarifying questions
    • Hooks guide: run custom code at key points in the agent lifecycle
    • Permission rules: declarative allow/deny rules in settings.json

    Was this page helpful?

    • How permissions are evaluated
    • Permission modes
    • Available modes
    • Set permission mode
    • Mode details
    • Related resources