reagent-rs 0.2.0

A Rust library for building AI agents with MCP & custom tools
Documentation
1
2
3
4
5
6
7
8
9
10
use crate::{FlowFuture, invoke, Agent, Message};

pub fn reply_flow<'a>(agent: &'a mut Agent, prompt: String) -> FlowFuture<'a> {
    Box::pin(async move {
        agent.history.push(Message::user(prompt));
        let response = invoke(agent).await?;
        agent.notify(crate::NotificationContent::Done(true, response.message.content.clone())).await;
        Ok(response.message)
    })    
}