StreamingTool

Trait StreamingTool 

Source
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§

Source

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 Complete or Error chunk before ending
  • Respect the provided configuration limits
  • Be cancellable (stop when dropped)

Provided Methods§

Source

fn stream_config(&self) -> StreamConfig

Get the default stream configuration for this tool

Implementors§