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

# In-Memory Storage for Agents

> Store agent sessions and run history in the current Python process with InMemoryDb.

`InMemoryDb` stores an Agent's sessions and run history in the current Python process. Data is lost when the process exits.

## Usage

Install dependencies:

```shell theme={null}
uv pip install agno openai
```

```python theme={null}
from agno.agent import Agent
from agno.db.in_memory import InMemoryDb

db = InMemoryDb()

agent = Agent(db=db, add_history_to_context=True)

agent.print_response("Give me an easy dinner recipe")
agent.print_response("Which ingredients did you just recommend?")
```
