-
Notifications
You must be signed in to change notification settings - Fork 1k
Python: Fix ag-ui state handling issues #2289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: Fix ag-ui state handling issues #2289
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes state handling issues in the Python ag-ui package that were causing UI flickering - text would briefly appear and then disappear due to incorrect timing of MessageSnapshotEvent emissions and improper state context injection during agent execution.
Key Changes:
- Fixed timing of MessagesSnapshotEvent emission to prevent incomplete snapshots that cause UI flicker
- Improved state context injection logic to only inject on new user turns, not during mid-execution tool calls
- Added comprehensive logging throughout the stream processing pipeline for better debugging
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
python/packages/ag-ui/agent_framework_ag_ui_examples/agents/recipe_agent.py |
Added require_confirmation=False parameter to recipe agent configuration |
python/packages/ag-ui/agent_framework_ag_ui/_orchestrators.py |
Fixed state context injection logic and MessagesSnapshotEvent timing; added extensive logging |
python/packages/ag-ui/agent_framework_ag_ui/_message_adapters.py |
Added new agui_messages_to_snapshot_format function to normalize message format for snapshots |
python/packages/ag-ui/agent_framework_ag_ui/_events.py |
Added text accumulation tracking and logic to skip intermediate snapshots for predictive tools; enhanced logging |
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||||||||||||
Motivation and Context
In the current code we're not sending the MessageSnapshotEvent at the proper time which was causing the UI to to handle weird state values, quickly showing some text and then having it disappear. These fixes were tested with the dojo app along with the getting started MAF Python scripts.
Description
Fix state problems.
Bump package to 1.0.0b251117 for a release.
Contribution Checklist