Trait RunnableAgent

Source
pub trait RunnableAgent:
    Send
    + Sync
    + 'static
    + Debug {
    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn id(&self) -> Uuid;
    fn run<'async_trait>(
        self: Arc<Self>,
        task: Task,
        tx_event: Sender<Event>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn memory(&self) -> Option<Arc<RwLock<Box<dyn MemoryProvider>>>>;

    // Provided method
    fn spawn_task(
        self: Arc<Self>,
        task: Task,
        tx_event: Sender<Event>,
    ) -> JoinHandle<Result<(), Error>> { ... }
}
Expand description

Trait for agents that can be executed within the system

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn description(&self) -> &'static str

Source

fn id(&self) -> Uuid

Source

fn run<'async_trait>( self: Arc<Self>, task: Task, tx_event: Sender<Event>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,

Source

fn memory(&self) -> Option<Arc<RwLock<Box<dyn MemoryProvider>>>>

Provided Methods§

Source

fn spawn_task( self: Arc<Self>, task: Task, tx_event: Sender<Event>, ) -> JoinHandle<Result<(), Error>>

Implementors§