Skip to content

Streaming protocol rework#172

Merged
vakovalskii merged 2 commits intomainfrom
streaming-protocol-rework
Feb 10, 2026
Merged

Streaming protocol rework#172
vakovalskii merged 2 commits intomainfrom
streaming-protocol-rework

Conversation

@virrius
Copy link
Copy Markdown
Member

@virrius virrius commented Feb 10, 2026

Streaming API

  • Introduced BaseStreamingGenerator and phase_id for per-step chunks.
  • New/updated methods: add_chunk(phase_id), add_content_delta, add_tool_result, add_tool_call(phase_id, tool); generators take agent_id.

Examples of the new chunk format. The id and model fields are set to agent-specific values so each of the agent’s actions can be distinguished.

Details
{
  "data": "data: {\"id\":\"1-reasoning\",\"choices\":[{\"delta\":{\"content\":null,\"function_call\":null,\"refusal\":null,\"role\":null,\"tool_calls\":[{\"index\":0,\"id\":null,\"function\":{\"arguments\":\" the\",\"name\":null},\"type\":\"function\"}]},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1770650312,\"model\":\"sgr_tool_calling_agent_3edad900-4883-48ac-b93b-1ad8fc8358b3\",\"object\":\"chat.completion.chunk\",\"service_tier\":null,\"system_fingerprint\":\"fp_f4ae844694\",\"usage\":null,\"provider\":\"OpenAI\"}\n\n",
  "index": 115
},

{
  "data": "data: {\"id\":\"4-action\",\"choices\":[{\"delta\":{\"content\":null,\"function_call\":null,\"refusal\":null,\"role\":null,\"tool_calls\":null},\"finish_reason\":\"tool_calls\",\"index\":0,\"logprobs\":null}],\"created\":1770650355,\"model\":\"sgr_tool_calling_agent_3edad900-4883-48ac-b93b-1ad8fc8358b3\",\"object\":\"chat.completion.chunk\",\"service_tier\":null,\"system_fingerprint\":\"fp_f4ae844694\",\"usage\":null}\n\n",
  "index": 1653
},
{
  "data": "data: {\"id\": \"4-action\", \"type\": \"tool_result\", \"message\": {\"role\": \"tool\", \"content\": \"{\\n  \\\"reasoning\\\": \\\"The research task is complete with a comprehensive report on the pricing of the BMW X6 2025 in Russia.\\\",\\n  \\\"completed_steps\\\": [\\n    \\\"Conducted web search for current prices of BMW X6 2025 in Russia.\\\",\\n    \\\"Extracted detailed pricing data from multiple sources.\\\",\\n    \\\"Compiled findings into a comprehensive report with citations.\\\"\\n  ],\\n  \\\"answer\\\": \\\"The prices for the BMW X6 2025 model in Russia vary significantly based on the model and features. The starting price for new models is approximately 9,700,000 rubles, with some listings reaching up to 19,271,000 rubles for higher-end configurations. Here are the key findings:\\\\n\\\\n1. **Base Prices**:\\\\n   - New BMW X6 models start at around **9,700,000 rubles** [1].\\\\n   - Listings for used models begin at approximately **9,800,000 rubles** [2].\\\\n\\\\n2. **Price Range**:\\\\n   - The price range for the BMW X6 2025 varies from **9,450,000 rubles** to **19,271,000 rubles**, depending on the specific model and additional features [1][5].\\\\n   - Specific examples include:\\\\n     - **BMW X6, 2025** priced at **16,700,000 rubles** in Moscow [2].\\\\n     - **BMW X6, 2025** at **18,585,000 rubles** [2].\\\\n     - **BMW X6, 2025** at **14,500,000 rubles** in Zhukovsky [2].\\\\n\\\\n3. **Market Availability**:\\\\n   - Multiple listings are available across various platforms, with a notable presence in major cities like Moscow and St. Petersburg [2][3].\\\\n   - The vehicles are available from both private sellers and authorized dealers, ensuring a wide selection for potential buyers [5].\\\\n\\\\n4. **Features**:\\\\n   - The BMW X6 2025 offers advanced technology, luxurious interiors, and various engine options, contributing to its pricing variations [5].\\\\n\\\\nIn conclusion, the BMW X6 2025 is positioned as a premium SUV with a wide price range catering to different buyer preferences in Russia. The combination of luxury, performance, and technology justifies its pricing in the competitive SUV market.\\\",\\n  \\\"status\\\": \\\"completed\\\"\\n}\", \"tool_call_id\": \"4-action\"}}\n\n",
  "index": 1654
},
Markdown, no raw LLM chunks. * Config: execution.streaming_generator: "openai" | "open_webui".

Registry & factory

  • StreamingGeneratorRegistry with auto-registration by name; AgentFactory resolves generator from config and passes it into the agent.

Agents & config

  • All agents pass phase_id into streaming calls; ExecutionConfig.streaming_generator added; docs and examples updated (EN/RU).

Documentation & compatibility

  • Framework docs (agents, configuration) and example configs updated for the new streaming options.
  • Core-modules rule and tool usage adjusted for the new API.

@virrius virrius self-assigned this Feb 10, 2026
@vakovalskii vakovalskii merged commit 774efbb into main Feb 10, 2026
2 checks passed
@virrius virrius deleted the streaming-protocol-rework branch March 10, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants