Uh oh!
There was an error while loading. Please reload this page.
feat: stream partial tool arguments - #10925
Conversation
Accumulate tool-input-delta events into state.raw during streaming, allowing consumers to access partial tool arguments before the full tool call completes. Follows the same pattern as text-delta handling.
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
QuentinRomeroLauro
commented
Jan 28, 2026
need this 🙏 |
| case "tool-input-delta": { | ||
| const match = toolcalls[value.id] | ||
| if (match && match.state.status === "pending") { | ||
| match.state.raw += value.delta | ||
| await Session.updatePart({ part: match, delta: value.delta }) | ||
| } | ||
| break |
There was a problem hiding this comment.
this kinda makes me wary of performance concerns if it emits the full thing every time and does a write each time too
There was a problem hiding this comment.
I know bash tool actually has performance issues because of this type of thing
There was a problem hiding this comment.
I was thinking a similar thing - I implemented it this way to match existing text-delta and reasoning-delta patterns.
case"text-delta":
if(currentText){currentText.text+=value.textif(value.providerMetadata)currentText.metadata=value.providerMetadataif(currentText.text)awaitSession.updatePart({part: currentText,delta: value.text,})}breakFwiw, the AI SDK has tool input deltas and doesn't send back the full part, just the delta. Happy to implement this way if you prefer
There was a problem hiding this comment.
@rekram1-node would appreciate any feedback or a decision you have on this point!
f1ae801 to
08fa7f7CompareClosing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
What does this PR do?
Exposes partial tool arguments during streaming by populating
state.rawwith accumulated deltas. Previously,tool-input-deltaevents were ignored and consumers had to wait for the full tool call to complete before seeing any arguments.Fixes#9737
How did you verify your code works?
text-deltahandling