Python: Improve AG-UI tool call argument protocol conformance - #6342
Merged
moonbox3 merged 1 commit intoJul 10, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds safeguards to prevent TOOL_CALL_ARGS events from being incorrectly associated with the “current” tool call when IDs mismatch, with regression tests covering the expected behavior.
Changes:
- Ignore
TOOL_CALL_ARGSwhentoolCallIddoesn’t match the active tool call ID (and log a warning). - Update tool-call end handling to conditionally clear current tool state based on matching IDs.
- Add tests to ensure mismatched IDs don’t rebind arguments or execute the wrong client tool.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| python/packages/ag-ui/agent_framework_ag_ui/_event_converters.py | Adds toolCallId mismatch checks for TOOL_CALL_ARGS and conditional state reset on TOOL_CALL_END. |
| python/packages/ag-ui/tests/ag_ui/test_event_converters.py | Adds regression test ensuring mismatched TOOL_CALL_ARGS don’t attach to the wrong tool call. |
| python/packages/ag-ui/tests/ag_ui/test_ag_ui_client.py | Adds client-level regression test ensuring mismatched args don’t cause execution of the current tool. |
Contributor
|
Please link the PR to an open issue |
moonbox3
approved these changes
Jul 9, 2026
White-Mouse
force-pushed
the
codex/agui-tool-call-args-conformance
branch
from
July 10, 2026 05:48
15545ac to
96a2522
Compare
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
moonbox3
enabled auto-merge
July 10, 2026 06:54
eavanvalkenburg
approved these changes
Jul 10, 2026
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.
Motivation & Context
AG-UI
TOOL_CALL_ARGSevents carry a tool-call identifier. The converter previously attached every argument fragment to the currently active call without checking that identifier. Out-of-order or malformed events could therefore associate arguments with a different tool call.Description & Review Guide
TOOL_CALL_END.Validation completed from
python/:uv run pytest -q packages/ag-ui/tests/ag_ui/test_event_converters.py packages/ag-ui/tests/ag_ui/test_ag_ui_client.py(45 passed)uv run ruff check ...uv run ruff format --check ...uv run poe pyright -P ag-uiuv run poe test-typing -P ag-uiRelated Issue
Not linked yet.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.