Skip to content
Open
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
19 changes: 19 additions & 0 deletions strands-ts/src/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,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 @@ -199,6 +201,12 @@ export type AgentConfig = {
* Session manager for saving and restoring agent sessions
*/
sessionManager?: SessionManager
/**
* Memory manager for cross-session memory retrieval and storage.
* Manages one or more memory stores and exposes search/add tools.
* Accepts a {@link MemoryManager} instance or a {@link MemoryManagerConfig} object (auto-wrapped).
*/
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 @@ -288,6 +296,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 memory retrieval and storage, if configured.
*/
public readonly memoryManager?: MemoryManager | undefined

private readonly _hooksRegistry: HookRegistryImplementation
private readonly _pluginRegistry: PluginRegistry
Expand Down Expand Up @@ -324,6 +336,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 @@ -376,6 +394,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
13 changes: 13 additions & 0 deletions strands-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,16 @@ export type { StreamType, StreamChunk, FileInfo, OutputFile, ExecutionResult } f
// Multi-agent orchestration
export { Graph } from './multiagent/index.js'
export { Swarm } from './multiagent/index.js'

// Memory management
export { MemoryManager } from './memory/index.js'
export type {
MemoryEntry,
MemoryStore,
MemoryStoreConfig,
SearchOptions,
SearchMemoryOptions,
AddMemoryOptions,
MemoryToolConfig,
MemoryManagerConfig,
} from './memory/index.js'
Loading
Loading