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

# Use in-memory storage

The `local` backend keeps sessions in process memory. It needs no external service and never touches disk — when the process exits, sessions are gone. It is the default backend of `ShortTermMemory`.

## When to use

* Local development and debugging;
* Unit tests, example scripts, and other ephemeral scenarios;
* When sessions don't need to survive across processes or restarts.

## Usage

```python lines theme={null}
from veadk import Agent, Runner
from veadk.memory.short_term_memory import ShortTermMemory

stm = ShortTermMemory(backend="local")  # local is the default; same as omitting backend

agent = Agent(name="demo")
runner = Runner(agent=agent, short_term_memory=stm, app_name="memory_demo")
```

Because `local` is the default, the following are all equivalent:

```python lines theme={null}
ShortTermMemory()                    # uses the default backend
ShortTermMemory(backend="local")     # explicit
# or pass no short_term_memory to the Runner at all — it falls back to a local one
```

<Note>
  If the `Runner` receives no `short_term_memory` or `session_service`, it automatically creates a `local` instance as a fallback, so running an agent locally needs no extra configuration.
</Note>

## Parameters

`local` has no backend-specific settings. Use the common `ShortTermMemory` parameters below; most have no effect on `local`.

### ShortTermMemory constructor parameters (local)

| Parameter | Type | Default | Effective for local | Description |
| :- | :- | :- | :- | :- |
| `backend` | `str` | `"local"` | Yes | Set to `"local"` or leave empty to select this backend. |
| `db_url` | `str` | `""` | Yes (override) | Once set, `backend` is ignored and a database backend is used instead. Leave unset to stay in memory. |
| `backend_configs` | `dict` | `{}` | No | Not read by `local`. |
| `db_kwargs` | `dict` | `{}` | No | Used only by database backends. |
| `local_database_path` | `str` | `/tmp/veadk_local_database.db` | No | Used only by `sqlite`. |
| `after_load_memory_callback` | `Callable \| None` | `None` | Yes | Callback invoked after a session is loaded; receives the loaded `Session`. |

<Warning>
  The `local` backend does not persist to disk; all session data is lost when the process exits. Do not use it in production for sessions that must survive. For persistence use [SQLite](/productions/veadk/archives/1.0.8/en/components/session/sqlite), [MySQL](/productions/veadk/archives/1.0.8/en/components/session/mysql), or [PostgreSQL](/productions/veadk/archives/1.0.8/en/components/session/postgresql).
</Warning>

## Environment variables

The `local` backend reads no environment variables.
