Mastra + MemorySync
Memory on Mastra’s native processor pipeline: recall before each call, persistence after it, per-call identity.
Overview
Install memorysync-mastra and add the processors to any Agent: recalled context is injected as a system message before each generate or stream call and the exchange persists verbatim after it. Identity resolves per call from four sources (static config, your own resolver, RequestContext, memory.resource), a zero-config wrapper merges the processors into existing configs, and five structured tools give agents explicit memory. Runs on current @mastra/core 1.x.
Setup status and requirements
- Supported version
- memorysync-mastra 1.0.0 (npm)
- Last setup review
- 2026-08-23
- Permissions
- A MemorySync API key with read and write scopes.
- Limits
- Requires @mastra/core 1.42+ (Node 20+ for the package; current @mastra/core itself requires Node 22+). JavaScript/TypeScript only — Python agents use the LangChain, LangGraph or CrewAI integrations.
Capabilities
- Native inputProcessors/outputProcessors — no model wrapping required
- Four identity sources: static, resolver, RequestContext, memory.resource
- No resolved user means no write — a wrong-scope persist is refused loudly
- Streaming-safe: persists once on finish; a failed stream stores nothing
- Recall modes: query, profile, or full
- Five never-throw agent tools with a read-only mode
- CI-tested against a real Agent on the latest @mastra/core 1.x
Quick Start
import { Agent } from "@mastra/core/agent";import { openai } from "@ai-sdk/openai";import { withMemorySync } from "memorysync-mastra";const agent = new Agent(withMemorySync({id: "assistant",name: "Assistant",instructions: "You are a helpful assistant.",model: openai("gpt-4o-mini"),},{ userId: "customer-7" },));const { text } = await agent.generate("Book my usual trip.");
Use Cases
Mastra agents that remember users across threads and deploys
Multi-user agent servers with per-request identity
Agents with explicit memory tools
Explore More
Built for production AI systems
Build AI systems that remember
MemorySync provides the infrastructure layer for persistent memory, adaptive retrieval, and enterprise AI intelligence.
Start free. No credit card required.