Skip to content

AWS Bedrock invoke_agent function raise error when inputText is unicode, particularly Vietnamese #4650

@TrietNguyenRenova

Description

@TrietNguyenRenova

Describe the bug

I tried to invoke the AWS Bedrock Agent by using boto3 package. The code snippet was really simple, but it prompted me this error botocore.exceptions.EventStreamError: An error occurred (accessDeniedException) when calling the InvokeAgent operation: Bedrock was unable to assume the specified role. Provide necessary permissions to Bedrock and retry the request.

After I changed the value of inputText parameter from Unicode to Ascii format, the issue was solved. But this was not consistent. Please refer to the snapshots samples

Image Image Image Image

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

I expect it to return the response from Bedrock Agent similar to the one I tested in AWS Console

Current Behavior

Please trace back to the Describe the bug section. I included every detail log snapshot

Reproduction Steps

  • Use Python version 3.10.12 in WSL2
  • Packages used detail
Image
  • Codebase was captured in the above screenshot

Possible Solution

Currently I am still finding a solution because my input is plain Vietnamese. But through some sample use cases as described above, I do not think decoding the unicode value is the right solution

Additional Information/Context

No response

SDK version used

1.40.62

Environment details (OS name and version, etc.)

WSL2 in Window

Metadata

Metadata

Assignees

Labels

bedrockbugThis issue is a confirmed bug.p3This is a minor priority issueresponse-requestedWaiting on additional information or feedback.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions