GetAgentMemory
Source:
src/AWS/Bedrock/GetAgentMemory.ts
Runtime binding for bedrock-agent-runtime:GetAgentMemory — retrieve the
session summaries an agent has stored for a memory id.
Bind an AgentAlias inside a function runtime to get a callable
that reads the agent’s long-term memory. The binding grants the function
bedrock:GetAgentMemory scoped to exactly that alias. The agent must have
memory enabled (see Agent’s memoryConfiguration prop); summaries are
generated asynchronously after a session ends.
Reading Agent Memory
Section titled “Reading Agent Memory”// initconst getAgentMemory = yield* Bedrock.GetAgentMemory(alias);
// runtimeconst result = yield* getAgentMemory({ memoryType: "SESSION_SUMMARY", memoryId: userId, maxItems: 10,});const summaries = (result.memoryContents ?? []).map( (memory) => memory.sessionSummary?.summaryText,);