Skip to main content

AgentOutputStream

Type Alias AgentOutputStream 

Source
pub type AgentOutputStream = ReceiverStream<AgentOutput>;
Expand description

A stream of AgentOutput events from an agent session.

This wraps tokio::sync::mpsc::Receiver<AgentOutput> in a Stream for ergonomic use with StreamExt combinators:

use tokio_stream::StreamExt;

let mut stream = orch.take_output_stream("team", "agent").await?
    .expect("receiver not yet taken");

while let Some(event) = stream.next().await {
    match event {
        AgentOutput::Delta(text) => print!("{text}"),
        AgentOutput::TurnComplete => break,
        _ => {}
    }
}

Aliased Type§

pub struct AgentOutputStream { /* private fields */ }