Controller

Trait Controller 

Source
pub trait Controller: Send + Sync {
    // Required methods
    fn controller_type(&self) -> &str;
    fn agent_id(&self) -> &str;
    fn start<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_running(&self) -> bool;
    fn cortical_ids(&self) -> &[CorticalID];
}
Expand description

Core controller trait

Implement this trait to create custom controllers that follow FEAGI conventions.

§Example

use feagi_agent::sdk::base::Controller;

struct MyController {
    // ... fields
}

#[async_trait::async_trait]
impl Controller for MyController {
    fn controller_type(&self) -> &str { "my-custom" }
    fn agent_id(&self) -> &str { &self.agent_id }
    async fn start(&mut self) -> Result<()> { /* ... */ }
    async fn stop(&mut self) -> Result<()> { /* ... */ }
    fn is_running(&self) -> bool { /* ... */ }
    fn cortical_ids(&self) -> &[CorticalID] { /* ... */ }
}

Required Methods§

Source

fn controller_type(&self) -> &str

Controller type identifier (e.g., “video”, “text”, “audio”)

Source

fn agent_id(&self) -> &str

Get the agent ID this controller manages

Source

fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start the controller (connect to FEAGI, begin operation)

Source

fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stop the controller gracefully

Source

fn is_running(&self) -> bool

Check if controller is currently running

Source

fn cortical_ids(&self) -> &[CorticalID]

Get cortical IDs this controller produces/consumes

Implementors§