The default Agentix.Provider — a thin wrapper over ReqLLM.stream_text/3.
ReqLLM.stream_text/3 returns {:ok, %ReqLLM.StreamResponse{}} (not a bare
stream). The struct carries a lazy stream of %ReqLLM.StreamChunk{}, a
metadata_handle collected concurrently, and a cancel closure that actually
closes the socket. This adapter maps that onto the normalized
Agentix.Provider.Stream the agent consumes:
chunks— the lazy stream, wrapped so each chunk is accumulated as the agent forwards it as a live delta;cancel—StreamResponse's own closure, passed through unchanged (the agent invokes it on:cancelso the HTTP connection is freed);finalize— awaits the metadata handle and rebuilds the finalized assistant%ReqLLM.Message{}+ usage from the accumulated chunks, reusing ReqLLM's ownResponseBuilderso tool-call ids (assembled by ReqLLM, absent from individualStreamChunks) survive. Call it afterchunksis consumed.
Streaming pools are HTTP/1-only by default (Finch ALPN bug with mixed-protocol large bodies).