Skip to content

Fix tool calls on gateway#56

Merged
msullivan merged 2 commits into
mainfrom
fix-tool-dupes
Apr 29, 2026
Merged

Fix tool calls on gateway#56
msullivan merged 2 commits into
mainfrom
fix-tool-dupes

Conversation

@msullivan

Copy link
Copy Markdown
Contributor

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.

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.
@vercel

vercel Bot commented Apr 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
py-ai Ready Ready Preview, Comment Apr 29, 2026 7:03pm

Request Review

@msullivan

msullivan commented Apr 29, 2026

Copy link
Copy Markdown
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)

@msullivan

Copy link
Copy Markdown
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
msullivan merged commit 1275df4 into main Apr 29, 2026
6 checks passed
@msullivan
msullivan deleted the fix-tool-dupes branch April 29, 2026 19:13
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.

2 participants