pub struct PendingApproval {
pub request: ApprovalRequest,
}Expand description
Handle for a pending approval interrupt.
Wraps an ApprovalRequest and provides ergonomic resolution methods
so callers can resolve the interrupt directly instead of searching for
the matching method on LoopDriver.
§Example
match driver.next().await? {
LoopStep::Interrupt(LoopInterrupt::ApprovalRequest(pending)) => {
println!("Needs approval: {}", pending.request.summary);
pending.approve(driver)?;
}
_ => {}
}Fields§
§request: ApprovalRequestThe underlying approval request details.
Implementations§
Source§impl PendingApproval
impl PendingApproval
Sourcepub fn approve<S: ModelSession>(
self,
driver: &mut LoopDriver<S>,
) -> Result<(), LoopError>
pub fn approve<S: ModelSession>( self, driver: &mut LoopDriver<S>, ) -> Result<(), LoopError>
Approve the pending tool call.
Sourcepub fn deny<S: ModelSession>(
self,
driver: &mut LoopDriver<S>,
) -> Result<(), LoopError>
pub fn deny<S: ModelSession>( self, driver: &mut LoopDriver<S>, ) -> Result<(), LoopError>
Deny the pending tool call.
Sourcepub fn deny_with_reason<S: ModelSession>(
self,
driver: &mut LoopDriver<S>,
reason: impl Into<String>,
) -> Result<(), LoopError>
pub fn deny_with_reason<S: ModelSession>( self, driver: &mut LoopDriver<S>, reason: impl Into<String>, ) -> Result<(), LoopError>
Deny the pending tool call with a reason.
Sourcepub fn approve_with_patched_input<S: ModelSession>(
self,
driver: &mut LoopDriver<S>,
input: Value,
) -> Result<(), LoopError>
pub fn approve_with_patched_input<S: ModelSession>( self, driver: &mut LoopDriver<S>, input: Value, ) -> Result<(), LoopError>
Approve the pending tool call with a patched input.
The model’s original tool input is replaced with input before the
tool executes. The transcript still records the call as the model
emitted it; only the executor sees the patched payload. This mirrors
the PermissionResultAllow(updated_input=...) pattern from the
Anthropic Agent SDK and is intended for hosts that want to sanitise,
restrict, or augment arguments before tool execution without forcing
the model to re-issue the call.
Trait Implementations§
Source§impl Clone for PendingApproval
impl Clone for PendingApproval
Source§fn clone(&self) -> PendingApproval
fn clone(&self) -> PendingApproval
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PendingApproval
impl Debug for PendingApproval
Source§impl Deref for PendingApproval
impl Deref for PendingApproval
Source§type Target = ApprovalRequest
type Target = ApprovalRequest
Source§fn deref(&self) -> &ApprovalRequest
fn deref(&self) -> &ApprovalRequest
Source§impl<'de> Deserialize<'de> for PendingApproval
impl<'de> Deserialize<'de> for PendingApproval
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for PendingApproval
impl PartialEq for PendingApproval
Source§fn eq(&self, other: &PendingApproval) -> bool
fn eq(&self, other: &PendingApproval) -> bool
self and other values to be equal, and is used by ==.