Skip to main content

Module streaming

Module streaming 

Source
Expand description

Streaming session for programmatic stdin/stdout interaction with agents.

A StreamingSession wraps a running agent subprocess with piped stdin and stdout, allowing callers to send NDJSON messages to the agent and read unified events back.

§Examples

use zag_agent::builder::AgentBuilder;

let mut session = AgentBuilder::new()
    .provider("claude")
    .exec_streaming("initial prompt")
    .await?;

// Send a user message
session.send_user_message("do something").await?;

// Read events
while let Some(event) = session.next_event().await? {
    println!("{:?}", event);
}

session.wait().await?;

Structs§

StreamingSession
A live streaming session connected to an agent subprocess.