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 exampleDirect link to Usage example
await agent.getMemory();
ParametersDirect link to Parameters
options?:
{ runtimeContext?: RuntimeContext }
= {}
Optional configuration object containing runtime context.
ReturnsDirect link to Returns
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 exampleDirect link to Extended usage example
await agent.getMemory({
runtimeContext: new RuntimeContext(),
});
Options parametersDirect link to Options parameters
runtimeContext?:
RuntimeContext
= new RuntimeContext()
Runtime context for dependency injection and contextual information.