YOU ARE VIEWING ONE ITEM FROM THE AICRIER FEED

Mastra publishes Vitest guide for stateful agents

AICrier tracks AI developer news across Product Hunt, GitHub, Hacker News, YouTube, X, arXiv, and more. This page keeps the article you opened front and center while giving you a path into the live feed.

// WHAT AICRIER DOES

7+

TRACKED FEEDS

24/7

SCRAPED FEED

Short summaries, external links, screenshots, relevance scoring, tags, and featured picks for AI builders.

Mastra publishes Vitest guide for stateful agents
OPEN LINK ↗
// 56m agoTUTORIAL

Mastra publishes Vitest guide for stateful agents

The TypeScript agent framework walks through testing five core memory behaviors—in-thread recall, cross-thread recall, updates, abstention, and user isolation—using @mastra/evals/vitest, seeded working memory, and unique thread and resource IDs. The guide pairs response gates and multi-turn LLM judges with direct assertions on stored memory via memory.settled(), then carries the same scorers into datasets, experiments, and live production traffic.

// ANALYSIS

Testing stateless prompts is straightforward, but adding memory turns agent evaluation into a state-management minefield where leftover context silently makes broken tests pass. Mastra's guide stands out because it treats memory regressions like database isolation bugs rather than prompt-tweaking problems.

  • –Asserting on persisted storage catches silent write failures: calling `await memory.settled()` and reading back `getWorkingMemory()` verifies the agent actually saved an updated fact for future threads, not just echoed it in the current reply.
  • –Seeding state beats slow multi-turn test setup: pre-populating profiles with `updateWorkingMemory()` or forking realistic conversations via `cloneThread()` with fresh `resourceId`s avoids paying multi-turn LLM latency just to reach a test scenario.
  • –Combining zero-LLM gates with targeted judges closes blind spots: deterministic `checks.includes` and `checks.excludes` gates keep CI fast, while `createMultiTurnJudgeScorer` catches subtler failures like re-asking for known details or fabricating an answer instead of abstaining.
  • –One scorer pipeline spans local CI to production: unlike split stacks that combine Vitest with separate hosted eval tools such as Braintrust or LangSmith, Mastra reuses the same `createScorer` recall check across Vitest, tool-mocked dataset experiments (`unmockedToolPolicy: 'deny'`), and sampled live-traffic scoring.
  • –Practical CI tradeoffs remain: disabling `fileParallelism` and raising `testTimeout` to 120 seconds prevents concurrent memory collisions, though teams running live-model recall suites on every PR still have to budget for API cost and slower pipelines.
// TAGS
mastravitestagentagent-memoryevaluationtestingframework

DISCOVERED

56m ago

2026-12-03

PUBLISHED

1h ago

2026-12-03

RELEVANCE

8/ 10

AUTHOR

mastra