Skip to main content

Overview

Permission requests are a critical security feature in ACP. Before executing potentially sensitive operations, the agent requests permission from the user through the client.

When Permissions are Requested

The agent calls requestPermission when:
  • Writing files
  • Executing terminal commands
  • Reading sensitive files
  • Making external API calls
  • Any other operation requiring user approval
The specific permission behavior depends on the agent’s current session mode.

Request Flow

Request Structure

The requestPermission method receives:

Response Structure

The client must respond with:
If the client sends a session/cancel notification while a permission request is pending, it MUST respond with { outcome: { outcome: "cancelled" } }.

Permission Option Types

Allow

Allow the operation to proceed as requested.

Deny

Reject the operation.

Apply Patch

For file write operations, the agent may offer alternative patches.

Modify Request

For commands, the agent may offer modified versions.

Implementation Examples

Basic CLI Implementation

Here’s a simple command-line permission UI:
src/examples/client.ts:11-43

GUI Implementation Pattern

For a graphical client:

UI Design Patterns

Displaying Tool Call Information

Permission Option Buttons

Showing Alternative Patches

For apply_patch options:

Handling Cancellation

When the user cancels the prompt:

Security Considerations

Path Validation

Always validate file paths are within allowed directories:

Command Validation

For terminal commands, warn about dangerous operations:

User Preferences

Implement “always allow” / “always deny” preferences:

Testing

Test your permission UI with various scenarios:

See Also