Fix output format for AWS Bedrock#4217
Open
DenDark77 wants to merge 6 commits intobrowser-use:mainfrom
Open
Conversation
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.
Fix: AWS Bedrock Nova validation for browser-use action schemas
Problem
Issue: #3371
AWS Bedrock’s
converse()API does not properly handle browser-use’s complex union-type action schemas, especially when using Nova Lite models.Expected behavior
The agent should be able to call actions (e.g.
click,input,navigate) with the correct field names.Actual behavior
{"click": {"element": 9}}instead of{"click": {"index": 9}}.done) appears in the schema sent to Bedrock.anyOf/oneOfare not converted correctly for the Bedrock API.Example error
The model returns
elementinstead ofindexforclick, and the full union of action types is not represented in the schema, leading to many Pydantic validation errors.Fix
Use SchemaOptimizer to resolve the problem with
$refand$defsso that the schema sent to Bedrock correctly represents all action types and field names.Verification
After applying the fix, the agent runs without these validation errors:
Actions like
clicknow use the correctindexfield and execute successfully.Summary by cubic
Fix AWS Bedrock Nova/Nova Lite structured output by sending the full optimized JSON schema for actions. This restores correct field names and stops validation errors.
Bug Fixes
Refactors
Written for commit 9a62f5e. Summary will update on new commits.