pub enum LoopInterrupt {
ApprovalRequest(PendingApproval),
AuthRequest(PendingAuth),
AwaitingInput(InputRequest),
}Expand description
An interrupt that pauses the agent loop until the host resolves it.
The loop returns an interrupt inside LoopStep::Interrupt whenever it
cannot proceed autonomously. Each variant carries a handle with
resolution methods so callers can resolve the interrupt directly.
§Example
use agentkit_loop::{LoopInterrupt, LoopStep};
match driver.next().await? {
LoopStep::Interrupt(LoopInterrupt::ApprovalRequest(pending)) => {
println!("Tool {} needs approval: {}", pending.request.request_kind, pending.request.summary);
pending.approve(driver)?;
}
LoopStep::Interrupt(LoopInterrupt::AuthRequest(pending)) => {
println!("Auth required from provider: {}", pending.request.provider);
pending.cancel(driver)?;
}
LoopStep::Interrupt(LoopInterrupt::AwaitingInput(pending)) => {
println!("Waiting for input: {}", pending.reason);
// ... call pending.submit(driver, items)
}
LoopStep::Finished(result) => {
println!("Turn finished: {:?}", result.finish_reason);
}
}Variants§
ApprovalRequest(PendingApproval)
A tool call requires explicit approval before it can execute.
AuthRequest(PendingAuth)
A tool call requires authentication credentials.
AwaitingInput(InputRequest)
The driver has no pending input and needs the host to supply some.
Trait Implementations§
Source§impl Clone for LoopInterrupt
impl Clone for LoopInterrupt
Source§fn clone(&self) -> LoopInterrupt
fn clone(&self) -> LoopInterrupt
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LoopInterrupt
impl Debug for LoopInterrupt
Source§impl<'de> Deserialize<'de> for LoopInterrupt
impl<'de> Deserialize<'de> for LoopInterrupt
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for LoopInterrupt
impl PartialEq for LoopInterrupt
Source§impl Serialize for LoopInterrupt
impl Serialize for LoopInterrupt
impl Eq for LoopInterrupt
impl StructuralPartialEq for LoopInterrupt
Auto Trait Implementations§
impl Freeze for LoopInterrupt
impl RefUnwindSafe for LoopInterrupt
impl Send for LoopInterrupt
impl Sync for LoopInterrupt
impl Unpin for LoopInterrupt
impl UnsafeUnpin for LoopInterrupt
impl UnwindSafe for LoopInterrupt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more