Repository navigation
Conversation
…f by the token limit The non-streaming branch of SageMakerAIModel.stream replaced finish_reason "length" with "tool_calls" whenever the message carried a tool call, so the agent ran the tool on truncated arguments. The streaming branch already passes "length" through, which maps to max_tokens. Signed-off-by: Christopher Krah <48338417+chrikrah@users.noreply.github.com>
liramon2
approved these changes
Oct 30, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
Yes, |
This branch has not been deployed
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.
Human Overview
Truncated SageMaker tool calls stop as
max_tokens.Description
Unstreamed,
sagemaker.py:596replaces inheritedmax_tokensforfinish_reason: lengthwithtool_calls, so the tool runs on truncated arguments, bypassingrecover_message_on_max_tokens_reached.Related Issues
Refs #5428
Documentation PR
None needed.
Type of Change
Bug fix
Testing
hatch run prepareAdditional Details
Output
Checklist
I have read the CONTRIBUTING document
I have reviewed and understand every line of code in this PR, and I can explain why it works
My change is focused and reasonably small; I have split unrelated work into separate PRs
I have added any necessary tests that prove my fix is effective or my feature works
I have updated the documentation accordingly
I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
My changes generate no new warnings
Any dependent changes have been merged and published
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
@liramon2,
stopbeside a tool call still becomestool_use. Right for your endpoints?