Skip to content

createLoadMemoryTool

function createLoadMemoryTool(): Tool<{
query: string;
},
| {
memories: never[];
note: string;
}
| {
memories: object[];
note?: undefined;
}>;

Creates a tool that lets the agent search long-term memory. The LLM decides when to call this based on the conversation.

The tool accesses memoryService and session via experimental_context injected by Runtime.wrapToolsWithEnforcement / withToolExecutionMetadata.

Usage: const agent: AgentConfig = { tools: { …otherTools, loadMemory: createLoadMemoryTool() }, };

Tool<{ query: string; }, | { memories: never[]; note: string; } | { memories: object[]; note?: undefined; }>