Repository navigation
fix: replace deprecated retrieve tool with MemoryManager + BedrockKnowledgeBaseStore - #329
Open
karmendra8386 wants to merge 1 commit into
Open
karmendra8386 wants to merge 1 commit into
karmendra8386 wants to merge 1 commit into
Conversation
…wledgeBaseStore Follow-up to strands-agents#308 (the import-swap PR strands-agents#325 covered http_request/shell; these two samples needed the real rewrite the deprecation table prescribes for retrieve: MemoryManager + BedrockKnowledgeBaseStore(writable=False)). - kb_rag.py: retrieve_from_kb() now searches via MemoryManager and returns the same {status, content:[{text}]} contract; the analyzer agent gets the manager instead of tools=[retrieve]. - chat.py: the meeting-analysis agent builds a read-only KB store for the per-query KB ID and passes a MemoryManager; the search tool keeps the name 'retrieve' so the existing system prompt stays accurate. - Both use injection=False so retrieval stays agent-driven, as before. Verified locally: both files compile; the manager/store construct against the current SDK; retrieve_from_kb's return contract exercised with a stubbed search.
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.
Follow-up to #308 and #325. #325 swapped the deprecated
http_request/shellimports for vended equivalents; these two samples were left out there becauseretrievehas no vended equivalent — the tools repo deprecation table prescribesMemoryManager+BedrockKnowledgeBaseStore(writable=False)instead. This PR makes that change.Changes
multi-modal-email-assistant-agent/kb_rag.pyretrieve_from_kb()now searches via aMemoryManagerbacked by a read-onlyBedrockKnowledgeBaseStore(same KB ID, region,min_score, and 5-result limit as before) and returns the same{status, content: [{text}]}shape its caller already consumes.tools=[retrieve]; the env-var configuration the old tool needed is gone.genai-powered-financial-advisor-tools/application/chat.pyMemoryManagerinstead oftools=[retrieve].retrieve, so the existing system prompt ("Use the retrieve tool FIRST…") stays accurate with no prompt changes.Both use
injection=False, so retrieval stays agent-driven through the search tool, matching the old tool's behavior rather than adding automatic context injection.Verification
strands-agents1.57).retrieve_from_kb's return contract exercised locally with a stubbed search (entries joined intocontent[0].textas the caller expects).Retrievepath.Out of scope
email_assistant.pyin the same sample folder still imports the deprecatededitortool. Happy to include it here or as a separate change, whichever the maintainers prefer.