Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions strands-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
"types": "./dist/src/session/s3-storage.d.ts",
"default": "./dist/src/session/s3-storage.js"
},
"./memory/stores/bedrock-knowledge-base": {
"types": "./dist/src/memory/stores/bedrock-knowledge-base-store.d.ts",
"default": "./dist/src/memory/stores/bedrock-knowledge-base-store.js"
},
"./telemetry": {
"types": "./dist/src/telemetry/index.d.ts",
"default": "./dist/src/telemetry/index.js"
Expand Down Expand Up @@ -140,6 +144,8 @@
"@ai-sdk/provider": "^3.0.0",
"@anthropic-ai/sdk": "^0.92.0",
"@aws-sdk/client-bedrock": "^3.943.0",
"@aws-sdk/client-bedrock-agent": "^3.943.0",
"@aws-sdk/client-bedrock-agent-runtime": "^3.943.0",
"@aws-sdk/client-s3": "^3.943.0",
"@aws-sdk/client-secrets-manager": "^3.943.0",
"@aws-sdk/client-sts": "^3.996.0",
Expand Down Expand Up @@ -193,6 +199,8 @@
"@a2a-js/sdk": "^0.3.10",
"@ai-sdk/provider": "^3.0.0",
"@anthropic-ai/sdk": "^0.92.0",
"@aws-sdk/client-bedrock-agent": "^3.943.0",
"@aws-sdk/client-bedrock-agent-runtime": "^3.943.0",
"@aws-sdk/client-s3": "^3.943.0",
"@aws/bedrock-token-generator": "^1.1.0",
"@google/genai": "^1.40.0",
Expand Down Expand Up @@ -231,6 +239,12 @@
"@aws-sdk/client-s3": {
"optional": true
},
"@aws-sdk/client-bedrock-agent": {
"optional": true
},
"@aws-sdk/client-bedrock-agent-runtime": {
"optional": true
},
"@google/genai": {
"optional": true
},
Expand Down
19 changes: 19 additions & 0 deletions strands-ts/src/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ import { ToolCaller } from './tool-caller.js'
import type { ToolCallerProxy } from './tool-caller.js'

import type { z } from 'zod'
import { MemoryManager } from '../memory/memory-manager.js'
import type { MemoryManagerConfig } from '../memory/index.js'
import { SessionManager } from '../session/session-manager.js'
import { Tracer } from '../telemetry/tracer.js'
import { Meter } from '../telemetry/meter.js'
Expand Down Expand Up @@ -198,6 +200,12 @@ export type AgentConfig = {
* Session manager for saving and restoring agent sessions
*/
sessionManager?: SessionManager
/**
* Memory manager for cross-session knowledge retrieval and storage.
* Manages one or more knowledge stores and exposes search/store tools.
* Accepts a {@link MemoryManager} instance or a {@link MemoryManagerConfig} object (auto-wrapped).
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: AgentConfig.sessionManager only accepts a SessionManager instance, while memoryManager accepts both MemoryManager | MemoryManagerConfig. This inconsistency could confuse users who expect the same pattern.

The config shorthand is nice for ergonomics, but since SessionManager doesn't offer this pattern, it raises the question: should this be consistent, or is there a deliberate reason for the difference?

Suggestion: Document in the PR description why the config-shorthand pattern was chosen here (presumably because MemoryManagerConfig is a simple data object unlike SessionManagerConfig which requires a storage instance). If this pattern is intended to be adopted for SessionManager too, note that as a follow-up.

memoryManager?: MemoryManager | MemoryManagerConfig
/**
* Custom trace attributes to include in all spans.
* These attributes are merged with standard attributes in telemetry spans.
Expand Down Expand Up @@ -287,6 +295,10 @@ export class Agent implements LocalAgent, InvokableAgent {
* The session manager for saving and restoring agent sessions, if configured.
*/
public readonly sessionManager?: SessionManager | undefined
/**
* The memory manager for cross-session knowledge retrieval and storage, if configured.
*/
public readonly memoryManager?: MemoryManager | undefined

private readonly _hooksRegistry: HookRegistryImplementation
private readonly _pluginRegistry: PluginRegistry
Expand Down Expand Up @@ -323,6 +335,12 @@ export class Agent implements LocalAgent, InvokableAgent {
this.id = config?.id ?? DEFAULT_AGENT_ID
if (config?.description !== undefined) this.description = config.description
this.sessionManager = config?.sessionManager
this.memoryManager =
config?.memoryManager instanceof MemoryManager
? config.memoryManager
: config?.memoryManager
? new MemoryManager(config.memoryManager)
: undefined

if (typeof config?.model === 'string') {
this.model = new BedrockModel({ modelId: config.model })
Expand Down Expand Up @@ -375,6 +393,7 @@ export class Agent implements LocalAgent, InvokableAgent {
this._conversationManager,
...retryStrategies,
...(config?.plugins ?? []),
...(this.memoryManager ? [this.memoryManager] : []),
...(config?.sessionManager ? [config.sessionManager] : []),
new ModelPlugin(this.model),
])
Expand Down
12 changes: 12 additions & 0 deletions strands-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,18 @@ export {
export { type McpServerConfig } from './mcp-config.js'
export type { ElicitationCallback, ElicitationContext } from './types/elicitation.js'

// Memory management
export { MemoryManager } from './memory/index.js'
export type {
MemoryEntry,
MemoryStore,
SearchOptions,
MemorySearchOptions,
MemoryStoreOptions,
MemoryToolConfig,
MemoryManagerConfig,
} from './memory/index.js'

// Session management
export { SessionManager } from './session/session-manager.js'
export type {
Expand Down
Loading
Loading