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

# 04.1 overview

# Memory Overview

Memory enables BindAI agents to remember information across conversations and executions.

Without memory, every interaction is independent. With memory enabled, an agent can retain context, remember previous discussions, and build more natural long-term conversations.

Memory is one of the core building blocks of BindAI and integrates seamlessly with agents, workflows, and projects.

***

# What is Memory?

Memory stores information that an agent can retrieve later.

Examples include:

* previous conversations
* user preferences
* important facts
* long-term context
* execution history

Instead of requiring the user to repeat information every time, the agent can recall it from memory.

***

# Why Memory Matters

Consider the following conversation.

```text theme={null}
User:
My name is Alice.

Assistant:
Nice to meet you, Alice.
```

Later:

```text theme={null}
User:
What's my name?
```

Without memory, the assistant cannot answer reliably.

With memory enabled:

```text theme={null}
Assistant:
Your name is Alice.
```

Memory allows conversations to feel continuous instead of isolated.

***

# Memory Architecture

A simplified view of the memory flow:

```text theme={null}
User

↓

Agent

↓

Memory

↓

Language Model

↓

Response
```

During execution:

1. Previous memories are loaded.
2. The language model receives them as context.
3. A response is generated.
4. New conversation data is stored back into memory.

***

# Conversation Memory

The most common form of memory stores previous messages.

Example:

```text theme={null}
User:
I live in London.

Assistant:
Great.
```

Later:

```text theme={null}
User:
What's my city?
```

The memory provides the earlier conversation so the model can answer correctly.

***

# Long-Term Memory

Memory is not limited to a single conversation.

Depending on the provider, information may persist across:

* multiple chats
* multiple sessions
* application restarts
* different workflow executions

This enables assistants that improve over time.

***

# Memory Providers

BindAI separates memory behavior from storage.

Examples include:

* in-memory storage
* databases
* Redis
* vector databases
* cloud storage

Applications can swap providers without changing agent logic.

***

# Memory Lifecycle

A typical execution looks like this:

```text theme={null}
Load Memory

↓

Build Prompt

↓

Generate Response

↓

Store New Messages
```

This process happens automatically whenever memory is enabled.

***

# Agent Integration

Every BindAI agent includes memory support.

```python theme={null}
agent.use_memory(
    memory,
)
```

Once configured, the execution pipeline automatically loads and saves messages.

***

# Workflow Integration

Memory also works inside workflows.

For example:

```text theme={null}
Start

↓

Agent A

↓

Memory Updated

↓

Agent B

↓

Memory Available

↓

End
```

Later workflow steps can access information produced earlier in the execution.

***

# Memory vs Knowledge

Although related, Memory and Knowledge solve different problems.

| Memory                      | Knowledge                    |
| --------------------------- | ---------------------------- |
| Stores conversation history | Stores external information  |
| Changes during execution    | Usually static               |
| User-specific               | Shared documents or datasets |
| Personal context            | General reference material   |

Use Memory to remember interactions.

Use Knowledge to retrieve facts from documents.

***

# Memory vs Variables

Workflow variables exist only during execution.

Memory persists beyond execution.

| Variables               | Memory                      |
| ----------------------- | --------------------------- |
| Temporary               | Persistent                  |
| Workflow scope          | Conversation scope          |
| Cleared after execution | Retained between executions |

***

# Benefits

Using memory provides several advantages:

* more natural conversations
* personalized responses
* reduced repetition
* better contextual understanding
* improved multi-step interactions

***

# Best Practices

* Store only useful information.
* Avoid saving unnecessary data.
* Choose an appropriate provider for your workload.
* Keep memory focused on user context.
* Use Knowledge for documents instead of Memory.
* Regularly review retention requirements for production systems.

***

# Summary

Memory gives BindAI agents continuity across conversations.

By loading previous interactions before generation and storing new ones afterward, agents can remember users, maintain context, and deliver more personalized experiences without additional application logic.

***

# Next Steps

Continue with **Memory Providers** to learn about the available storage backends and how to configure them.
