Skip to main content
The Tool Approvals and Access Control system provides a human-in-the-loop mechanism for authorizing high-risk operations. It intercepts tool executions, secret accesses, and sensitive channel operations, requiring explicit permission from an operator via the CLI or Web Console when security policies or tool configurations demand it.

Approval Workflow Implementation

The approval workflow is integrated into the agent run lifecycle within the palyrad daemon. When a tool proposal is evaluated, the system determines if the action requires manual intervention.

Tool Proposal Security Evaluation

Before execution, every tool call is passed through evaluate_tool_proposal_security crates/palyra-daemon/src/application/run_stream/tool_flow.rs#121-134. This function returns a ToolProposalSecurityEvaluation containing:
  • skill_gate_decision: The result of policy evaluation.
  • proposal_approval_required: A boolean indicating if the specific tool/input combination requires human review.
  • approval_subject_id: A unique identifier for the specific tool instance or resource being accessed.

The await_tool_approval_response Loop

If approval is required, the daemon enters an asynchronous wait state using await_tool_approval_response crates/palyra-daemon/src/application/run_stream/tool_flow.rs#24-28. This function suspends the tool execution task and monitors for an ApprovalDecision event. The process is governed by a timeout defined by TOOL_APPROVAL_RESPONSE_TIMEOUT crates/palyra-daemon/src/application/run_stream/tool_flow.rs#28.

Data Flow: Tool Proposal to Decision

The following diagram illustrates the transition from a “Natural Language Space” request to the “Code Entity Space” of approval management. Tool Approval Sequence Sources: crates/palyra-daemon/src/application/run_stream/tool_flow.rs#53-101, crates/palyra-daemon/src/application/run_stream/tool_flow.rs#121-162

Key Data Structures

ApprovalSubjectType

Categorizes the resource or action requiring approval.
  • Tool: Standard tool execution.
  • ChannelSend: Sending messages to external platforms.
  • SecretAccess: Reading sensitive data from the Vault.
  • BrowserAction: High-risk browser automation steps.
  • NodeCapability: Execution on remote nodes.
  • DevicePairing: Authorizing new device connections.
Sources: crates/palyra-cli/src/args/approvals.rs#86-93

ApprovalDecision

Represents the final state of an approval request: Sources: crates/palyra-cli/src/args/approvals.rs#64-69

The Approvals gRPC Service

The ApprovalsService is the primary interface for administrative tools (CLI) to interact with the approval queue. It is defined in the gateway_v1 protobuf namespace.
MethodRole
ListApprovalsRetrieves pending and historical approval records with filters for subject_type and principal.
GetApprovalFetches detailed context for a specific ULID-identified approval.
ExportApprovalsStreams approval history in NDJSON or JSON format for auditing.
DecideApproval(Via Operator Runtime) Submits the final Allow/Deny decision.
Sources: crates/palyra-cli/src/commands/approvals.rs#28-129

CLI Approval Commands

The palyra CLI provides the approvals command group for managing the queue from the terminal. The decide command supports different Approval Scopes:
  1. Once: Applies only to the current request.
  2. Session: Authorizes the same action for the duration of the current session.
  3. Timeboxed: Authorizes the action for a specific duration (TTL).
Sources: crates/palyra-cli/src/args/approvals.rs#77-83

Web Console Approvals Section

The Web Console provides a React-based interface for visual approval management. It uses the ApprovalsSection component to render the review queue and detail panels. Implementation Components: Code Entity Mapping Sources: apps/web/src/console/sections/ApprovalsSection.tsx#13-28, crates/palyra-control-plane/src/client.rs#408-415

Access Control and Rate Limiting

The system enforces strict access control on who can view or decide approvals.

Permissions

Approval operations require specific permissions managed by the AccessRegistry:

Rate Limiting

The daemon implements rate limiting for API-driven interactions. The AppState tracks these limits in memory: Sources: crates/palyra-daemon/src/access_control.rs#103-134, crates/palyra-daemon/src/app/runtime.rs#65-69