fix(streaming): log warning when tool input JSON is malformed#2054
Open
Ratansairohith wants to merge 1 commit intostrands-agents:mainfrom
Open
fix(streaming): log warning when tool input JSON is malformed#2054Ratansairohith wants to merge 1 commit intostrands-agents:mainfrom
Ratansairohith wants to merge 1 commit intostrands-agents:mainfrom
Conversation
Malformed tool input JSON was silently replaced with an empty dict, with no logging. The tool then ran with empty arguments and the model had no indication its JSON was invalid. Added a logger.warning() call before the fallback so operators can detect and diagnose this in production. Fixes strands-agents#2051
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.
Fixes #2051
Changes
src/strands/event_loop/streaming.py:logger.warning()in theexcept ValueErrorblock (line 282) that logs the tool name and raw input string when JSON parsing fails. The fallback to{}is preserved.tests/strands/event_loop/test_streaming.py:Test plan