Skip to main content

Overview

The SDK uses a three-tier permission system to control tool access. Rules are checked in priority order:

The Three Tiers

Session Rules

  • Scope: Single agent instance
  • Lifetime: In-memory only, lost when agent shuts down
  • Use case: Temporary permissions for specific tasks

Local Rules

  • Scope: All agents of the same type
  • Lifetime: Persisted to disk, survives restarts

Global Rules

  • Scope: All agents across the runtime
  • Lifetime: Persisted to disk, survives restarts

Priority and Fallthrough

Rules are checked in order. If no rule matches at any tier, the system asks the user (interactive mode) or denies (non-interactive mode).

Permission Rules

Setting Rules Programmatically

Persistence

  • Global rules: Saved to disk at runtime shutdown
  • Local rules: Saved to disk at agent shutdown
  • Session rules: Never saved (in-memory only)
Default storage: ~/.picrust/permissions/

Real-World Examples

Safe Read-Only Agent

Development Assistant

Limitations

  • Session rules are not persisted — they disappear when the agent shuts down.
  • No partial matching — rules are prefix-based or exact match only (no regex).
  • No user-specific rules — all rules apply to all users of the application.

Next Steps

Handling Requests

UI patterns for permissions

Dangerous Skip Mode

Bypassing permissions

Hooks

Security hooks