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

# InMemoryStorage

> Fast in-memory storage for development and testing

## Overview

`InMemoryStorage` provides a fast, ephemeral storage backend. Ideal for development, testing, and scenarios where persistence isn't required.

<Warning>
  Data is lost when the process terminates. Use a persistent storage for production.
</Warning>

## Basic Usage

```python theme={null}
from upsonic import Agent, Task
from upsonic.storage.memory import Memory
from upsonic.storage.in_memory import InMemoryStorage

storage = InMemoryStorage()

memory = Memory(
    storage=storage,
    session_id="session_001",
    user_id="user_123",
    full_session_memory=True,
    summary_memory=True,
    user_analysis_memory=True,
    model="anthropic/claude-sonnet-4-5"
)

agent = Agent("anthropic/claude-sonnet-4-5", memory=memory)

result1 = agent.do(Task("My name is Alice"))
result2 = agent.do(Task("What's my name?"))
print(result2)  # "Your name is Alice"
```

## Parameters

| Parameter | Type | Default | Description |
| - | - | - | - |
| `session_table` | `str \| None` | `"upsonic_sessions"` | Session table name (for compatibility) |
| `user_memory_table` | `str \| None` | `"upsonic_user_memories"` | User memory table name (for compatibility) |
| `knowledge_table` | `str \| None` | `"upsonic_knowledge"` | Knowledge document registry table name (used by KnowledgeBase) |
| `id` | `str \| None` | auto-generated | Storage instance ID |

## Storage Type

`InMemoryStorage` is a **synchronous** storage implementation using Python dictionaries.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.