Fix tool calls on gateway#56
Merged
Merged
Conversation
Gateway will both stream a tool call and provide a full tool-call event after, which leads to duplicate tool calls in the stream, which then blow up in the validator. This duplication in the stream existed previously, but changes in how the stream is assembled in #55 cause it to break tool calling in the agent (no longer using an id-keyed dict to build up the parts). This diff is basically pure-agentic debugging, but I had a isomorphic change in my WIP agent branch, done at the gateway streaming layer.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
anbuzin
approved these changes
Apr 29, 2026
Contributor
Author
|
Actually I think my fix here isn't quite right; I should make it so that we actually prevent yielding out the duplicates. (Which my initial version did, but this doesn't) |
Contributor
Author
|
Updated to skip emitting duplicates from the gateway parser. (I also confirmed that we do need to handle both; gateway paths against non-streaming providers can emit tool-call without the streaming parts) |
msullivan
force-pushed
the
fix-tool-dupes
branch
from
April 29, 2026 19:02
679f43c to
76ee1dd
Compare
msullivan
force-pushed
the
fix-tool-dupes
branch
from
April 29, 2026 19:03
76ee1dd to
d8df626
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gateway will both stream a tool call and provide a full tool-call
event after, which leads to duplicate tool calls in the stream, which
then blow up in the validator.
This duplication in the stream existed previously, but changes in how
the stream is assembled in #55 cause it to break tool calling in the
agent (no longer using an id-keyed dict to build up the parts).
This diff is basically pure-agentic debugging, but I had a isomorphic
change in my WIP agent branch, done at the gateway streaming layer.