pub trait StreamingTool: Tool {
// Required method
fn execute_stream(&self, args: Value, config: StreamConfig) -> ToolStream;
// Provided method
fn stream_config(&self) -> StreamConfig { ... }
}Expand description
Trait for tools that produce streaming output.
§Security
Implementors MUST:
- Respect cancellation (check for stream drop)
- Limit output size (respect StreamConfig)
- Hash only the final result (not intermediate chunks)
- Sanitize all output data
Required Methods§
Sourcefn execute_stream(&self, args: Value, config: StreamConfig) -> ToolStream
fn execute_stream(&self, args: Value, config: StreamConfig) -> ToolStream
Execute with streaming output
Returns a stream of ToolChunk values. The stream MUST:
- Emit at least one
CompleteorErrorchunk before ending - Respect the provided configuration limits
- Be cancellable (stop when dropped)
Provided Methods§
Sourcefn stream_config(&self) -> StreamConfig
fn stream_config(&self) -> StreamConfig
Get the default stream configuration for this tool