MemoryRouter
Mastra memory

Mastra memory: strong primitives, your infrastructure

Mastra thinks about memory in layers: an observation log, working memory that persists facts about a user, and semantic recall over past messages using embeddings.

Mastra. Sources checked 2026-09-25.

How Mastra handles memory today

The docs describe observational memory as a long-term observation log maintained by background agents to keep the context window small, working memory that persists facts across conversations, and semantic recall that embeds messages and queries a vector store for similar ones.

Semantic recall means you choose and operate a vector store, tune embeddings, and keep a migration path when you change either. That is a real ongoing cost at production scale.

What Mastra forgets

Embeddings are easy. Changing them is not.

The fix with MemoryRouter

MemoryRouter takes the storage and ranking layer off your plate: per-user vaults, semantic and time-based recall, and an API your Mastra agent calls like any other tool.

  1. 1

    Register the vault key per user

    One vault per end user in your product, keyed per request. The isolation model matches how you bill and how you delete data.

  2. 2

    Expose memory as agent tools

    Wrap the search and store endpoints as Mastra tools, and let the agent call them alongside its other tools. Working memory stays in Mastra for session facts.

    Tool surface

    # Tools: memory_search, memory_store, memory_date_search
    # docs.memoryrouter.ai/api-reference
  3. 3

    Keep semantic recall for conversation

    Where Mastra’s recall serves the live conversation, the vault serves the record that outlives it. Both layers can coexist.

Start a MemoryRouter vault

Per-user vaults and a memory API for your agents. 14-day free trial.

Related

Mastra memory FAQ

Sources

Sources checked 2026-09-25. Tool behavior changes; check the vendor docs before relying on a detail.

Start free