calm-artist-7206
09/23/2025, 5:53 PMstatus/error channel to send to FE, but that channel is not available to LLM nor Agent, so... I don't know. š¤·āāļø
Do we want to support LLM streaming? Specially these days with the slow GPT-5, it would enhance the UX significantly, I feel. And it's a staple out there, IMHO.straight-sundown-84319
09/23/2025, 6:01 PMchilly-france-44439
09/23/2025, 6:11 PMchilly-france-44439
09/23/2025, 6:12 PMon_event pass to the agent; what if we have an on_token callback pass to the Agent? And inside .completion, we implement llm streaming, and call on_token callback, but the agent treat it as non-streaming call.
In server scenario, that on_token could just stream tokens back to FE via websocket, wdyt?wide-doctor-37830
09/23/2025, 6:17 PMchilly-france-44439
09/23/2025, 6:18 PMnutritious-balloon-65098
09/23/2025, 6:18 PMnutritious-balloon-65098
09/23/2025, 6:22 PMraise ValueError("Streaming is not supported"), creating poor UX especially with slower models like GPT-5.
2. Architecture Analysis: Thoroughly analyzed the current event-driven architecture, understanding how Agent.step() ā LLM.completion() ā on_event callbacks work.
3. Proposed Solution: A dual-callback approach that:
⦠Adds on_token callback alongside existing on_event
⦠Preserves the current event ontology and agent structure
⦠Enables streaming without breaking changes
⦠Allows direct WebSocket integration for server scenarios
4. Implementation Plan: Four-phase rollout covering core infrastructure, agent integration, conversation layer, and documentation.
5. Technical Considerations: Addresses retry logic, error handling, performance, and backward compatibility.
šÆ Key Benefits of the Proposed Approach
⢠Zero Breaking Changes: Purely additive API that maintains backward compatibility
⢠Clean Architecture: Separates streaming concerns from event processing
⢠Server-Ready: Direct WebSocket integration capability
⢠Preserves Existing Patterns: Leverages the existing callback architecture
The issue is now available for the development team to review, discuss, and prioritize. It provides a comprehensive technical foundation for implementing token streaming while respecting the existing architecture and maintaining the high code quality standards of the project.
<sub>View full conversation</sub>calm-artist-7206
09/23/2025, 6:39 PM