fix: save intermediate tool messages to prevent missing tool_result errors#459
fix: save intermediate tool messages to prevent missing tool_result errors#459ahmed-sekka wants to merge 1 commit into
Conversation
…rrors (2FastLabs#396) When BedrockLLMAgent uses tools, the intermediate toolUse/toolResult conversation messages were only kept in a local list and never persisted to storage. This caused subsequent requests to fail with Bedrock validation errors about missing tool_result blocks. Changes: - BedrockLLMAgent now collects intermediate tool messages in tool_conversation during both single and streaming responses - Orchestrator saves these intermediate messages to storage alongside user input and final response - When max_recursions is exhausted, toolUse blocks are stripped from the response to prevent saving orphaned toolUse without toolResult
|
Thanks for you PR, we will review it and provide feedback. thanks |
|
Hey @ahmed-sekka, the fix solves a real problem but there are two things that need to be addressed before this can merge.
|
Summary
Fixes #396
When
BedrockLLMAgentuses tools, the intermediatetoolUse/toolResultconversation messages were only kept in a local list and never persisted to storage. This caused subsequent requests to fail with Bedrock validation errors about missingtool_resultblocks.BedrockLLMAgentnow collects intermediate tool messages intool_conversationduring both single and streaming responsesOrchestratorsaves these intermediate messages to storage alongside user input and final responsemax_recursionsis exhausted,toolUseblocks are stripped from the response to prevent saving orphanedtoolUsewithouttoolResultTest plan
BedrockLLMAgenttool message collection (test_bedrock_llm_agent.py)Orchestratorintermediate message persistence (test_orchestrator.py)BedrockLLMAgent+DynamoDBStorageno longer raiseValidationException🤖 Generated with Claude Code