> ## Documentation Index
> Fetch the complete documentation index at: https://ago.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Memory

> Enable agents to remember user information across conversations

Agent Memory allows your AI agents to remember important information about users across multiple conversations. This creates more personalized and contextual interactions without users needing to repeat themselves.

## Overview

When enabled, Agent Memory automatically:

* **Extracts facts** from conversations (preferences, issues, context)
* **Stores memories** per user across all their conversations
* **Retrieves relevant memories** when responding to provide context
* **Updates memories** when information changes

## Use Cases

### Customer Support

* Remember past issues and resolutions
* Track customer preferences (communication channel, timing)
* Maintain context about subscription level or account type

### Personal Assistants

* Remember user preferences and habits
* Track ongoing projects or tasks
* Maintain context about user's situation

***

## Enabling Agent Memory

### Via Admin Interface

1. Navigate to **AI Studio** → **Agent Memory**
2. Toggle **Enable** to activate memory
3. Configure the number of memories per conversation (1-100)
4. Optionally customize memory categories

> **ℹ️ NOTE**: Agent Memory can also be configured via API. See the [Public API v1 Reference](../api/public-api-v1) for endpoint details.

### Configuration Options

| Setting                           | Default | Description                                                   |
| --------------------------------- | ------- | ------------------------------------------------------------- |
| Enable Memory                     | Off     | Turns the memory feature on or off                            |
| Maximum Memories per Conversation | 50      | How many memories are included in the agent's context (1-100) |

***

## Memory Categories

Memories are automatically categorized to help organize and retrieve relevant information:

### Default Categories

| Category       | Description                                 | Examples                                  |
| -------------- | ------------------------------------------- | ----------------------------------------- |
| **ISSUE**      | Problems, complaints, errors, bugs          | "Order #12345 arrived damaged"            |
| **PREFERENCE** | Communication, timing, language preferences | "Prefers email over phone"                |
| **PRODUCT**    | Products or services mentioned              | "Uses Premium subscription tier"          |
| **CONTEXT**    | Account info, business context              | "Customer since 2022, enterprise account" |
| **RESOLUTION** | Solutions and outcomes                      | "Refund processed for order #12345"       |

### Customizing Categories

You can customize the memory categories to match your use case:

1. Navigate to **AI Studio** → **Agent Memory**
2. Enable memory if not already enabled
3. Edit the **Memory Categories** section
4. Define your custom categories in markdown format
5. Click **Save Categories**

Example custom category definition:

```markdown theme={null}
### MEDICAL_HISTORY
- Past diagnoses and conditions
- Medications and allergies
- Example: "Allergic to penicillin"

### APPOINTMENT
- Scheduled visits and follow-ups
- Preferred appointment times
- Example: "Prefers morning appointments"
```

***

## How It Works

### Memory Extraction

After each conversation, the system:

1. Analyzes user messages for extractable facts
2. Categorizes facts based on defined categories
3. Compares with existing memories
4. Adds new facts, updates changed ones, removes outdated ones

### Memory Retrieval

When a user starts a conversation:

1. System retrieves all memories for that user
2. Most recent memories are prioritized
3. Memories are included in the agent's context
4. Agent uses memories naturally without explicitly mentioning them

### Memory Lifecycle

```
User Message → Extract Facts → Compare with Existing → Add/Update/Delete → Store
                                                                            ↓
New Conversation ← Include in Context ← Retrieve Memories ←────────────────┘
```

***

## Best Practices

### Do

* **Start with defaults** - The default categories work well for most support scenarios
* **Be specific** - Custom categories should have clear, non-overlapping definitions
* **Test extraction** - Review extracted memories to maintain quality
* **Set appropriate limits** - More memories = more context but higher token usage

### Don't

* **Over-customize** - Too many categories can confuse the extraction
* **Store sensitive data** - Avoid extracting PII or sensitive information
* **Ignore privacy** - Make sure users know their information is being remembered

***

## Privacy Considerations

### Data Storage

* Memories are stored per user and per tenant
* Memories are associated with the user's unique identifier
* All memory data follows your tenant's data retention policies

### User Control

Consider implementing:

* User-facing memory management (view/delete their memories)
* Clear communication about what information is remembered
* Opt-out mechanisms where required

### Compliance

* Review memories for compliance with GDPR, CCPA, or other regulations
* Implement data retention policies for memories
* Provide data export/deletion capabilities as required

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Memories Not Being Extracted">
    1. Verify memory is enabled in settings
    2. Check that conversations have sufficient content
    3. Review extraction model configuration in the admin interface
  </Accordion>

  <Accordion title="Irrelevant Memories Retrieved">
    1. Consider reducing the maximum memories per conversation setting
    2. Review and customize category definitions
    3. Delete outdated or incorrect memories via the admin interface
  </Accordion>

  <Accordion title="High Token Usage">
    1. Reduce the maximum memories per conversation setting
    2. Review if all categories are necessary
    3. Consider more specific category definitions

    ***
  </Accordion>
</AccordionGroup>

## Related

* [Agents](../agent/agents) — Agent configuration reference
* [Agent Best Practices](../guides/agent-best-practices) — Design patterns
