Skip to main content

SubagentBackend

Trait SubagentBackend 

Source
pub trait SubagentBackend: Send + Sync {
    // Required methods
    fn enqueue_subagent<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run: NewRun,
        launch: &'life1 SubagentLaunch,
    ) -> Pin<Box<dyn Future<Output = Result<RunRecord, AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn enqueue_notice<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        run: NewRun,
        child: &'life1 RunRecord,
        launch: &'life2 SubagentLaunch,
    ) -> Pin<Box<dyn Future<Output = Result<RunRecord, AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn steer<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        app_name: &'life1 str,
        user_id: &'life2 str,
        session_id: &'life3 str,
        text: &'life4 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SteerReceipt>, AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             Self: 'async_trait;
    fn cancel<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn changed<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _record: &'life1 SubagentRecord,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait { ... }
}
Available on crate features background and server only.
Expand description

Where a DurableSubagents host enqueues, steers and cancels runs, and reports status: straight to the run store and the runners (RunStoreBackend), or through a kernel’s process table, which records each sub-agent as a process (adk-kernel).

Required Methods§

Source

fn enqueue_subagent<'life0, 'life1, 'async_trait>( &'life0 self, run: NewRun, launch: &'life1 SubagentLaunch, ) -> Pin<Box<dyn Future<Output = Result<RunRecord, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Enqueues a run of sub-agent launch: its first, or a follow-up.

§Errors

The store’s error, or the backend’s refusal (a freeze, a quota).

Source

fn enqueue_notice<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, run: NewRun, child: &'life1 RunRecord, launch: &'life2 SubagentLaunch, ) -> Pin<Box<dyn Future<Output = Result<RunRecord, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Enqueues the run of the parent’s session that tells it about child, a run of sub-agent launch.

§Errors

The store’s error, or the backend’s refusal.

Source

fn steer<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, app_name: &'life1 str, user_id: &'life2 str, session_id: &'life3 str, text: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<Option<SteerReceipt>, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait,

Queues text on the steering inbox of the turn of session session_id that runs here, or None when none does.

§Errors

The steering path’s error: an input guardrail or plugin refused the message.

Source

fn cancel<'life0, 'life1, 'async_trait>( &'life0 self, run_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Cancels run run_id: at once when it is queued or parked, at its next checkpoint when it runs.

§Errors

The store’s error.

Provided Methods§

Source

fn changed<'life0, 'life1, 'async_trait>( &'life0 self, _record: &'life1 SubagentRecord, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Reports that a sub-agent’s status changed. The default does nothing.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§