Skip to main content

AskUser

Trait AskUser 

Source
pub trait AskUser: Send + Sync {
    // Required method
    fn ask<'life0, 'life1, 'async_trait>(
        &'life0 self,
        prompt: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

The mid-session user-input seam: the loop hands a prompt to the host, which surfaces it (emit UserInputRequested), blocks for the user’s reply (while respecting cancellation and a bound), and returns the text — or an Err describing why no answer is coming (timeout, cancellation, no listener). An Err is fed back to the model as a tool error so it can proceed without the answer rather than the loop wedging.

Optional by design: when no asker is wired (most tests, the foreman/external fallbacks), the ask_user tool is simply not offered to the model.

Required Methods§

Source

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

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§