pub struct ApprovalRequest {
pub task_id: Option<TaskId>,
pub call_id: Option<ToolCallId>,
pub id: ApprovalId,
pub request_kind: String,
pub reason: ApprovalReason,
pub summary: String,
pub metadata: MetadataMap,
}Expand description
A request sent to the host when a tool execution needs human approval.
The agent loop surfaces this to the user. Once the user responds, the
loop can re-submit the tool call via ToolExecutor::execute_approved.
Fields§
§task_id: Option<TaskId>Runtime task identifier associated with this approval request, if any.
call_id: Option<ToolCallId>The originating tool call id when this approval was raised from a tool invocation. Hosts can use this to resolve specific approvals.
id: ApprovalIdStable identifier so the executor can match the approval to its request.
request_kind: StringThe PermissionRequest::kind string that triggered the approval flow.
reason: ApprovalReasonWhy approval is needed.
summary: StringHuman-readable summary shown to the user.
metadata: MetadataMapArbitrary metadata carried from the original permission request.
Implementations§
Source§impl ApprovalRequest
impl ApprovalRequest
Sourcepub fn new(
id: impl Into<ApprovalId>,
request_kind: impl Into<String>,
reason: ApprovalReason,
summary: impl Into<String>,
) -> Self
pub fn new( id: impl Into<ApprovalId>, request_kind: impl Into<String>, reason: ApprovalReason, summary: impl Into<String>, ) -> Self
Builds an approval request with no task or call id.
Sourcepub fn with_task_id(self, task_id: impl Into<TaskId>) -> Self
pub fn with_task_id(self, task_id: impl Into<TaskId>) -> Self
Sets the associated task id.
Sourcepub fn with_call_id(self, call_id: impl Into<ToolCallId>) -> Self
pub fn with_call_id(self, call_id: impl Into<ToolCallId>) -> Self
Sets the associated tool call id.
Sourcepub fn with_metadata(self, metadata: MetadataMap) -> Self
pub fn with_metadata(self, metadata: MetadataMap) -> Self
Replaces the approval metadata.
Trait Implementations§
Source§impl Clone for ApprovalRequest
impl Clone for ApprovalRequest
Source§fn clone(&self) -> ApprovalRequest
fn clone(&self) -> ApprovalRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more