Skip to main content

AsyncTaskLifecycle

Trait AsyncTaskLifecycle 

Source
pub trait AsyncTaskLifecycle: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 TaskId,
        context_id: &'life2 ContextId,
    ) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 TaskId,
        history_length: Option<u32>,
    ) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 TaskId,
        state: TaskState,
        message: Option<Message>,
    ) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn cancel<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 TaskId,
    ) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 TaskId,
    ) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Async task lifecycle management: the core CRUD capability over individual tasks.

A handler implements this trait if it can create, read, mutate, and cancel tasks. Listing/querying across tasks is a separate capability — see AsyncTaskQuery. Convenience wrappers that validate request parameters live on AsyncTaskLifecycleExt, which is blanket-implemented for every AsyncTaskLifecycle.

Required Methods§

Source

fn create<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 TaskId, context_id: &'life2 ContextId, ) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create a new task in the given context.

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, history_length: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a task by ID with optional history length limit.

Source

fn update_status<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, state: TaskState, message: Option<Message>, ) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update task status, optionally appending a message to history.

Source

fn cancel<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cancel a task.

Source

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check whether a task exists.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§