Skip to main content
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

The output is chat_01, confirming that the session was created and read back. This example does not call a model. For conversations, pass the same stm to Runner(short_term_memory=stm, agent=agent) and keep the app, user, and session identifiers consistent Because local is the default, the following select in-memory storage; separate instances do not share sessions:
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.

Parameters

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

ShortTermMemory constructor parameters (local)

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, MySQL, or PostgreSQL.

Environment variables

The local backend reads no environment variables.
Last modified on September 19, 2026