feat(memory): AgentCoreMemory plugin for Strands SDK#142
Open
aidandaly24 wants to merge 1 commit intofeat/agentcore-memoryfrom
Open
feat(memory): AgentCoreMemory plugin for Strands SDK#142aidandaly24 wants to merge 1 commit intofeat/agentcore-memoryfrom
aidandaly24 wants to merge 1 commit intofeat/agentcore-memoryfrom
Conversation
Implements the AgentCoreMemory plugin providing LTM extraction (store conversation messages as events) and LTM injection (retrieve insights into system prompt) for Strands TypeScript SDK agents. - Plugin implements Strands Plugin interface (SDK >=0.7.0) - Extraction: MessageAddedEvent buffering, batched flush with Promise.allSettled + clientToken idempotent retries - Injection: BeforeInvocationEvent strip/retrieve/inject into systemPrompt - search_memory tool factory (opt-in via searchTool: true) - Multi-agent helpers: withActor(), withMetadataProvider() - 89 unit tests, integration test scaffold - Export path: bedrock-agentcore/experimental/memory/strands
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.
Description
Implements the
AgentCoreMemoryplugin for the Strands TypeScript SDK, providing LTM extraction (store conversation messages as memory events) and LTM injection (retrieve insights into the agent's system prompt). This is the TypeScript equivalent of the Python SDK's memory integration, designed from the ground up to avoid the accumulation bug documented in #420.What's included
AgentCoreMemory— Strands Plugin (SDK >=0.7.0) with:MessageAddedEvent→ buffer messages → batched flush viacreateEvent()withPromise.allSettled+clientTokenidempotent retriesBeforeInvocationEvent→ strip stale<agentcore_memory>sentinel → retrieve fresh LTM per namespace in parallel → format → inject intosystemPromptsearch_memorytool: opt-in viasearchTool: true, registered throughgetTools()withActor(actorId),withMetadataProvider(fn)createSearchMemoryTool— standalone tool factory for advanced composabilitybedrock-agentcore/experimental/memory/strandsKey design decisions
batchSize: 10,batchTimeoutMs: 5000msextraction:/injection:naming — replacesstoreMessages:/injectContext:per team reviewautomatic+searchToolbooleans — replacesmode: 'tool'per team reviewinitAgent()+getTools(), one-line registration viaplugins: [memoryPlugin]API shape
Related Issues
Design doc: https://quip-amazon.com/odNFAWZ9XaS9
Type of Change
New feature
Testing
Unit tests (489/489 pass)
npm run checkpasses (lint, format, type-check, build, tests)E2E testing (deployed agent)
Deployed a real TypeScript agent to AgentCore with the plugin and verified:
Test project:
~/workplace/cli-typescript/memorytest/npm run checkChecklist
Note:
@strands-agents/sdkpeer dependency bumped from>=0.1.0to>=0.7.0for the Plugin interface. Existing browser/code-interpreter integrations usetool()which exists in both versions, so this is backward compatible for those subpaths.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.