Mastra

Build AI agents with a modern TypeScript stack

From the team behind Gatsby, Mastra is a framework for building AI-powered apps and agents with workflows, memory, streaming, evals, tracing, and Studio, an interactive UI for dev and testing. Start building: npm create mastra@latest

Discussion

Alex from Mastra here (OSS TypeScript AI framework), excited to announce Observational Memory! 🎉

How to get started:

Mastra - Releasing today with full support. Give your Mastra agent human-like memory here.

Other agent frameworks - Adapters for LangChain, Vercel AI SDK, and more coming soon.

Your coding agent - Plugins for OpenCode ( PR), etc in the works.

What problem does Observational Memory solve?

If you've built AI agents, you know the memory problem:

RAG retrieves context every turn - but it invalidates your prompt cache, adds latency, and costs add up fast.

Compaction summarizes when context gets long - but it's lossy and irreversible. Critical details vanish mid-task. Your agent forgets what file it was working on.

Long context seems like the answer - until you see the bill and notice performance degrading at the extremes.

Every option forces a tradeoff: memory vs. cost vs. coherence - pick two!

We built Observational Memory to break that tradeoff.

The idea is deceivingly simple: agent memory should work like human memory. You don't remember every character of every file you read. You remember what happened, what you learned, what mattered. Details fade. Important things stick.

OM implements this with two background agents that run as your agent's subconscious. The Observer watches conversations and compresses them into dense, timestamped observations (6-40x token reduction). The Reflector periodically reorganizes long-term memory - combining related items, dropping what's no longer relevant.

The result: a stable, prompt-cacheable context window that scores 95% on LongMemEval - the highest ever recorded. 😱 In our research paper, we outline how we beat the "oracle" (a model given only the conversations containing the answers) - TL;DR dense observations outperform raw context.

Can't wait for you to try it out and, in the meantime, if you have any questions, drop them below and we'll answer them!