Agent.getMemory()
The .getMemory() method retrieves the memory system associated with an agent. This method is used to access the agent's memory capabilities for storing and retrieving information across conversations.
Usage exampleUsage example的直接链接
await agent.getMemory()
ParametersParameters的直接链接
options?:
{ requestContext?: RequestContext }
= {}
Optional configuration object containing request context.
{ requestContext?: RequestContext }
requestContext?:
RequestContext
Request Context for dependency injection and contextual information.
ReturnsReturns的直接链接
memory:
Promise<MastraMemory | undefined>
A promise that resolves to the memory system configured for the agent, or undefined if no memory system is configured.
Extended usage exampleExtended usage example的直接链接
await agent.getMemory({
requestContext: new RequestContext(),
})