fetchium-core 1.0.0

Fetchium core library — search, extract, rank, validate, cache
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Agent trait for AMRS agents (PRD §8.8).

use crate::error::FetchiumError;
use crate::research::amrs::channel::{AgentReceiver, AgentSender, AgentType};
use async_trait::async_trait;

/// Trait that all AMRS agents implement.
#[async_trait]
pub trait Agent: Send + Sync {
    /// The type identifier of this agent.
    fn agent_type(&self) -> AgentType;

    /// Run the agent's main loop.
    ///
    /// Receives instructions via `rx`, sends results back via `tx`.
    /// Should exit cleanly when `AgentMessage::Shutdown` is received or `rx` closes.
    async fn run(&self, rx: AgentReceiver, tx: AgentSender) -> Result<(), FetchiumError>;
}