echo_agent 0.2.0

Production-grade AI Agent framework for Rust — ReAct engine, multi-agent, memory, streaming, MCP, IM channels, workflows
Documentation
//! Streaming execution entry points — delegates to `run_stream_channel`.
//!
//! Returns `BoxStream<'static>` — callers do not need to hold the agent lock.

use super::super::super::ReactAgent;
use super::super::types::{StreamInit, StreamMode};
use crate::agent::AgentEvent;
use crate::error::Result;

impl ReactAgent {
    #[tracing::instrument(skip(self), fields(agent = %self.config.agent_name, model = %self.config.model_name, mode = %mode))]
    pub(crate) async fn run_stream(
        &self,
        input: &str,
        mode: StreamMode,
    ) -> Result<futures::stream::BoxStream<'static, Result<AgentEvent>>> {
        self.clear_read_files();
        self.run_stream_channel(
            StreamInit {
                text: input.to_string(),
                message: None,
                label: String::new(),
            },
            mode,
        )
        .await
    }

    #[tracing::instrument(skip(self), fields(agent = %self.config.agent_name, model = %self.config.model_name, mode = %mode))]
    pub(crate) async fn run_stream_with_message(
        &self,
        message: crate::llm::types::Message,
        mode: StreamMode,
    ) -> Result<futures::stream::BoxStream<'static, Result<AgentEvent>>> {
        self.clear_read_files();
        let text = message.content.as_text().unwrap_or_default();
        self.run_stream_channel(
            StreamInit {
                text,
                message: Some(message),
                label: "(multimodal)".to_string(),
            },
            mode,
        )
        .await
    }
}