# Agent.getMemory()
[EN] Source: https://mastra.ai/reference/agents/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 example

```typescript copy
await agent.getMemory();
```

## Parameters

<PropertiesTable
  content={[
    {
      name: "options",
      type: "{ runtimeContext?: RuntimeContext }",
      isOptional: true,
      defaultValue: "{}",
      description: "Optional configuration object containing runtime context.",
    },
  ]}
/>

## Returns

<PropertiesTable
  content={[
    {
      name: "memory",
      type: "Promise<MastraMemory | undefined>",
      description:
        "A promise that resolves to the memory system configured for the agent, or undefined if no memory system is configured.",
    },
  ]}
/>

## Extended usage example

```typescript copy
await agent.getMemory({
  runtimeContext: new RuntimeContext(),
});
```

### Options parameters

<PropertiesTable
  content={[
    {
      name: "runtimeContext",
      type: "RuntimeContext",
      isOptional: true,
      defaultValue: "new RuntimeContext()",
      description:
        "Runtime context for dependency injection and contextual information.",
    },
  ]}
/>

## Related

- [Agent memory](/docs/agents/agent-memory)
- [Runtime Context](/docs/server-db/runtime-context)


---
title: "Reference: Agent.getModel() | Agents"
description: "Documentation for the `Agent.getModel()` method in Mastra agents, which retrieves the language model that powers the agent."
---