Repository navigation
Conversation
The docstring of process_turn_with_llm documents {memoryStrategyId} as a
supported template variable, and every default namespace the SDK creates
in memory/constants.py uses it, but _retrieve_memories_for_llm only
passed actorId, sessionId and strategyId to str.format(), so any
namespace using the documented variable raised KeyError before the
search request was even built.
Fixes aws#759
yqecea
requested a deployment
to
manual-approval
November 28, 2026 09:13 — with
GitHub Actions
Waiting
yqecea
requested a deployment
to
manual-approval
November 28, 2026 09:13 — with
GitHub Actions
Waiting
yqecea
requested a deployment
to
manual-approval
November 28, 2026 09:13 — with
GitHub Actions
Waiting
yqecea
requested a deployment
to
manual-approval
November 28, 2026 09:13 — with
GitHub Actions
Waiting
yqecea
requested a deployment
to
manual-approval
November 28, 2026 09:13 — with
GitHub Actions
Waiting
yqecea
requested a deployment
to
manual-approval
November 28, 2026 09:13 — with
GitHub Actions
Waiting
yqecea
requested a deployment
to
manual-approval
November 28, 2026 09:13 — with
GitHub Actions
Waiting
yqecea
requested a deployment
to
manual-approval
November 28, 2026 09:13 — with
GitHub Actions
Waiting
yqecea
requested a deployment
to
manual-approval
November 28, 2026 09:13 — with
GitHub Actions
Waiting
This branch is waiting to be deployed
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.
Summary
MemorySessionManager.process_turn_with_llm(andprocess_turn_with_llm_async, plus theMemorySessionwrappers) raiseKeyError: 'memoryStrategyId'when aretrieval_confignamespace contains{memoryStrategyId}.The docstring of both methods documents
{memoryStrategyId}as a template variable resolved at runtime, and every default namespace the SDK creates uses it (memory/constants.py, e.g./strategies/{memoryStrategyId}/actors/{actorId}/). So passing the namespace of a strategy created with the SDK fails before any search request is built.Root cause
_retrieve_memories_for_llmresolves namespaces withnamespace.format(actorId=..., sessionId=..., strategyId=...)but never passesmemoryStrategyId, sostr.formatraisesKeyErroron the documented variable.Fix
Pass
memoryStrategyId=config.strategy_id or ""alongside the existingstrategyId, keeping both spellings working during the field-name deprecation.Tests
New regression test
test_process_turn_with_llm_resolves_memory_strategy_idusing the exact default namespace shape withstrategy_idset, assertingsearch_long_term_memoriesreceives the fully resolved namespace.Red-green verified: the test fails with
KeyError: 'memoryStrategyId'on unpatchedmainand passes with the fix. Full memory unit suite (test_session.py+test_client.py): 283 passed.ruff checkandruff formatclean.Fixes #759