fix(backend): default max_tokens for Anthropic model validation#1549
Merged
Wendong-Fan merged 6 commits intoeigent-ai:mainfrom Apr 11, 2026
Merged
Conversation
Anthropic Messages API requires a positive integer max_tokens. The BYOK form does not expose this field, so validation could send an invalid or missing value and Anthropic returned 400. Ensure validate_model_with_details and create_agent merge model_config_dict with a default of 4096 for platform anthropic when max_tokens is absent or invalid. Co-authored-by: emag165 <emag165@users.noreply.github.com>
Wendong-Fan
requested changes
Apr 11, 2026
Contributor
Wendong-Fan
left a comment
There was a problem hiding this comment.
thanks @emag165 for reporting this issue and doing the fix, please create one issue and link this PR to the issue to follow our contribution guideline. for the default value, i think we'd better set one max value all anthropic model support to allow long-horizon task execution which may require mode output token, the current code seems AI generated and have some unnecessary check logic which makes the code redundant, we just need to set the default value for Anthropic model, since it's built-in logic, no additional check needed
Collaborator
|
@emag165 thanks for your pr, I've submitted a commit to minimize the implementation of this fix; feel free to review it. |
Wendong-Fan
approved these changes
Apr 11, 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.
Anthropic Messages API requires a positive integer max_tokens. The BYOK form does not expose this field, so validation could send an invalid or missing value and Anthropic returned 400.
Ensure validate_model_with_details and create_agent merge model_config_dict with a default of 4096 for platform anthropic when max_tokens is absent or invalid.
Related Issue
Closes #
Description
Testing Evidence (REQUIRED)
What is the purpose of this pull request?
Contribution Guidelines Acknowledgement