pub fn tool_loop_stream<Ctx: LoopDepth + Send + Sync + 'static>(
provider: Arc<dyn DynProvider>,
registry: Arc<ToolRegistry<Ctx>>,
params: ChatParams,
config: ToolLoopConfig,
ctx: Arc<Ctx>,
) -> ChatStreamExpand description
Streaming variant of tool_loop.
Yields StreamEvents from each iteration. Between iterations
(when executing tools), no events are emitted. The final
StreamEvent::Done carries the stop reason from the last
iteration.
§Depth Tracking
If Ctx implements LoopDepth, nested calls are tracked automatically.
When config.max_depth is set and the context’s depth exceeds the limit,
yields Err(LlmError::MaxDepthExceeded) immediately.
§Events
If config.on_event is set, the callback will be invoked with
ToolLoopEvents at key points during execution, same as tool_loop.
Uses Arc for provider, registry, and context since they must outlive
the returned stream.