- Newest
- Most votes
- Most comments
This issue you're experiencing with AWS Bedrock Agents appears to be a bug in how the conversation history is managed after tool calls, particularly with the Llama 3.1 models.
Based on similar reported issues, there seems to be a problem with how the agent handles the conversation state after tool invocations. The original user message is being incorrectly replaced with the tool_result content, which disrupts the conversation flow and causes the agent to lose context.
Here are some potential approaches to address this issue:
-
Session Attributes Management: Try implementing better session attributes management to maintain the conversation state. The session attributes from Lambda functions called within action groups might not be properly visible to Lex/Bedrock.
-
Version Control: Ensure you're testing with the correct version of your agent. When testing from the AWS Console UI, you're using the DRAFT version by default, while SDK calls use the version specified in the agent alias. This could explain different behaviors between testing environments.
-
Force Agent Preparation: After creating a new agent version, force an agent "prepare" and then update the alias to target the new version. This has helped some users with similar issues.
-
Context Management: Implement better context management to maintain the conversation state between turns.
-
Report the Bug: Since this appears to be a bug with the Bedrock service, consider opening a support ticket with AWS Support with your detailed description of the issue. Service teams don't typically monitor re:Post for bug reports.
The issue seems particularly problematic with certain Claude models, as you've noted with Claude Sonnet 3.5, 3.7, and 4.5. This is likely a bug in how the Bedrock service manages conversation history and tool calls rather than an issue with your implementation.
Sources
Llama 3.1 Converse calls not properly escaping quotes in tool calls | AWS re:Post
Lex BedrockAgentIntent controlling Fulfilled | AWS re:Post
BedRock Agent ignoring lambda provided to answer questions | AWS re:Post
answered a year ago
Relevant content
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 7 months ago
