Skip to main content

ApprovalResolution

Trait ApprovalResolution 

Source
pub trait ApprovalResolution:
    Debug
    + Send
    + Sync {
    // Required method
    fn resolving<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        request: &'life1 ApprovalRequest,
        decision: &'life2 ApprovalDecision,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
}
Expand description

Core traits and types.

Always available regardless of feature flags. Includes:

  • Agent - The fundamental trait for all agents
  • Tool / Toolset - For extending agents with capabilities
  • Session / State - For managing conversation context
  • Event - For streaming agent responses
  • AdkError / Result - Unified error handling Work a decided request’s outcome waits for: it runs once the decision that resolved the request is recorded, and before the outcome reaches the held call or wakes a run parked on it.

A host uses it for what the call it lets run must already see, such as the standing rule “Always allow” makes, which the resumed turn’s next call is checked against (spec 3.3 §7.2). A hook reports its own failures; the outcome applies whatever it does.

§Example

use adk_core::{
    ApprovalDecision, ApprovalRequest, ApprovalResolution, ApprovalState, async_trait,
};

#[derive(Debug)]
struct GrantOnApproval;

#[async_trait]
impl ApprovalResolution for GrantOnApproval {
    async fn resolving(&self, request: &ApprovalRequest, decision: &ApprovalDecision) {
        if request.state == ApprovalState::Approved {
            tracing::info!(approval.id = %request.id, approver = %decision.approver.id, "approved");
        }
    }
}

Required Methods§

Source

fn resolving<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, request: &'life1 ApprovalRequest, decision: &'life2 ApprovalDecision, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Runs for request, just resolved by decision, before its outcome applies.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§