Thanks to visit codestin.com
Credit goes to github.com

Skip to content

perf: send only the current round's output at tool-call boundaries - #29854

Open
Classic298 wants to merge 1 commit into
open-webui:devfrom
Classic298:perf/tool-round-output-items
Open

perf: send only the current round's output at tool-call boundaries#29854
Classic298 wants to merge 1 commit into
open-webui:devfrom
Classic298:perf/tool-round-output-items

Conversation

@Classic298

Copy link
Copy Markdown
Member

Every tool-call round re-sent the whole assistant message so far, all earlier rounds' text, reasoning, calls and tool results, twice over the websocket as a chat:completion snapshot, so agentic runs grew with the square of the round count: 45 MB Redis publishes stalling the instance for 400 ms (#29833).

The two boundary emits now send only the items of the response that just ended, one response.output_item.done event each with its absolute index, which the browser and the channel emitter already apply. Earlier rounds never change after their own boundary, so they are never re-sent; the final done snapshot, the approval pauses and the code-interpreter loop keep their snapshots. A continuation round's response.completed drops its round-only output, which wiped the earlier rounds from the channel emitter state, and the channel emitter now writes tool items before the first text token, as the snapshots used to give it.

Boundary payload, 3 tool rounds with 4 calls, chat-completions upstream:

tool result before after
4 KiB 51.6 KiB 18.7 KiB
400 KiB 4.30 MiB 1.18 MiB

Fixes #29833

Contributor License Agreement

Every tool-call round re-sent the whole assistant message so far, all earlier
rounds' text, reasoning, calls and tool results, twice over the websocket as a
chat:completion snapshot, so agentic runs grew with the square of the round
count: 45 MB Redis publishes stalling the instance for 400 ms (open-webui#29833).

The two boundary emits now send only the items of the response that just
ended, one response.output_item.done event each with its absolute index, which
the browser and the channel emitter already apply. Earlier rounds never change
after their own boundary, so they are never re-sent; the final done snapshot,
the approval pauses and the code-interpreter loop keep their snapshots. A
continuation round's response.completed drops its round-only output, which
wiped the earlier rounds from the channel emitter state, and the channel
emitter now writes tool items before the first text token, as the snapshots
used to give it.

Boundary payload, 3 tool rounds with 4 calls, chat-completions upstream:

| tool result | before | after |
| --- | --- | --- |
| 4 KiB | 51.6 KiB | 18.7 KiB |
| 400 KiB | 4.30 MiB | 1.18 MiB |

Fixes open-webui#29833
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.

1 participant