Expand description
Streaming tool support for long-running operations
This module provides traits and types for tools that produce streaming output.
§Security Considerations
- Backpressure: Streams MUST respect consumer pace (DoS prevention)
- Timeouts: Per-chunk timeouts in addition to total timeout
- Resource Limits: Maximum chunks per stream to prevent memory exhaustion
- Cancellation: Streams support graceful cancellation via Drop
§Example
ⓘ
use vex_llm::streaming_tool::{StreamingTool, ToolChunk};
let stream = tool.execute_stream(args);
pin_mut!(stream);
while let Some(chunk) = stream.next().await {
match chunk {
ToolChunk::Progress { percent, message } => println!("{}% - {}", percent, message),
ToolChunk::Complete { result } => println!("Done: {:?}", result.hash),
_ => {}
}
}Structs§
- Stream
Config - Configuration for streaming tool execution
Enums§
- Tool
Chunk - A chunk of streaming output from a tool.
Traits§
- Streaming
Tool - Trait for tools that produce streaming output.
Type Aliases§
- Tool
Stream - Type alias for a boxed async stream of tool chunks