NAME
Claude::Agent::Permission - Permission handling for Claude Agent SDK
SYNOPSIS
use Claude::Agent::Permission;
# In a can_use_tool callback:
my $options = Claude::Agent::Options->new(
can_use_tool => sub {
my ($tool_name, $input, $context) = @_;
if ($tool_name eq 'Bash' && $input->{command} =~ /rm/) {
return Claude::Agent::Permission->deny(
message => "Delete commands not allowed"
);
}
return Claude::Agent::Permission->allow(
updated_input => $input
);
},
);
DESCRIPTION
This module provides permission handling utilities for the Claude Agent SDK, including factory methods for creating permission responses.
PERMISSION MODES
default - Normal permission behavior
acceptEdits - Auto-accept file edits
bypassPermissions - Bypass all permission checks
dontAsk - Auto-deny unless explicitly allowed
PERMISSION CLASSES
Claude::Agent::Permission::Result - Base result class
Claude::Agent::Permission::Result::Allow - Allow result
Claude::Agent::Permission::Result::Deny - Deny result
Claude::Agent::Permission::Context - Callback context
CLASS METHODS
allow
my $result = Claude::Agent::Permission->allow(
updated_input => $input,
);
Create an "allow" permission result.
Arguments
updated_input - The (optionally modified) input to pass to the tool
updated_permissions - Optional permissions update
deny
my $result = Claude::Agent::Permission->deny(
message => "Not allowed",
);
Create a "deny" permission result.
Arguments
message - Reason for denial (shown to Claude)
interrupt - Optional, if true interrupts the entire query
AUTHOR
LNATION, <email at lnation.org>
LICENSE
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under The Artistic License 2.0 (GPL Compatible).