Skip to main content

SerializedMemoryConfig

SerializedMemoryConfig is the JSON-serializable subset of Memory configuration that lives on a stored agent record. The runtime hydrates it back into a Memory instance by resolving the vector and embedder IDs against the configured Mastra instance.

It is the type used by BuilderAgentDefaults.memory and by EditorAgentNamespace.create({ memory }).

Usage example
Direct link to Usage example

src/mastra/index.ts
import { MastraEditor } from '@mastra/editor'

new MastraEditor({
builder: {
enabled: true,
configuration: {
agent: {
memory: {
observationalMemory: true,
options: { lastMessages: 50 },
},
},
},
},
})

Properties
Direct link to Properties

vector?:

string | false
Vector store identifier. The vector instance must be registered with the Mastra instance to resolve from this ID. Set to `false` to disable vector search.

embedder?:

string
Embedding model ID in the format `"provider/model"` (for example, `"openai/text-embedding-3-small"`).

embedderOptions?:

Omit<MastraEmbeddingOptions, 'telemetry'>
Options passed to the embedder. Telemetry options are stripped.

options?:

SerializedMemoryOptions
Configuration for memory behaviors. Omits non-serializable fields like working memory and threads.
SerializedMemoryOptions

readOnly?:

boolean
Treat memory as read-only — no new messages are stored.

lastMessages?:

number | false
Number of recent messages to include in context, or `false` to disable.

semanticRecall?:

boolean | SemanticRecall
Semantic recall configuration. See the Memory class reference for the full shape.

generateTitle?:

boolean | { model: ModelRouterModelId; instructions?: string }
Title generation configuration. Pass an object with `model` (in `"provider/model"` form) and optional `instructions`.

observationalMemory?:

boolean | SerializedObservationalMemoryConfig
Long-lived fact extraction. Pass `true` to enable with defaults, or an object to override observer/reflector models, scope, and activation behavior.

SerializedObservationalMemoryConfig
Direct link to serializedobservationalmemoryconfig

model?:

string
Model ID used by both the Observer and Reflector (for example, `"google/gemini-2.5-flash"`).

scope?:

'resource' | 'thread'
Whether observations are scoped to a resource or a single thread.

activateAfterIdle?:

ObservationalMemoryActivationTTL
Inactivity TTL before forcing buffered observation activation.

activateOnProviderChange?:

boolean
Force-activate buffered observations when the actor model changes.

shareTokenBudget?:

boolean
Share the token budget between messages and observations.

temporalMarkers?:

boolean
Persist inline temporal gap markers for long pauses between messages.

retrieval?:

boolean | { vector?: boolean; scope?: 'thread' | 'resource' }
Experimental. Enable retrieval-mode observation groups as durable pointers to raw message history.

observation?:

SerializedObservationalMemoryObservationConfig
Observer-step configuration (model, token thresholds, buffering).

reflection?:

SerializedObservationalMemoryReflectionConfig
Reflector-step configuration (model, observation token thresholds, buffering).
On this page