llm-recorder package in Mastra codebase. Ramu Narasinga identified an internal Mastra package called _llm-recorder that records and replays real LLM API responses for deterministic tests, working like test snapshots that auto-record on first run and replay thereafter. The package uses Mock Service Worker for HTTP interception, supports SSE streaming with chunk timing, matches requests by MD5 hash of URL and body rather than order, and covers OpenAI, Anthropic, Google and OpenRouter APIs. It is currently internal to the TypeScript agent framework, with no announced date for a public release. In this article, we review recordings folder found in core package in Mastra codebase. You will learn: Mastra is a TypeScript framework for building AI agents and applications. Create your first agent with a single command and start building. You can follow this Quickstart guide https://mastra.ai/docs quickstart to get started. Following are the usecases https://mastra.ai/docs use-cases I found for this framework Embed agents in your product Customer-facing assistants Software factories Internal copilots Regulated and back-office operations Data analysis agents Content automation DevOps and engineering automation Sales and go-to-market workflows Learn more about these usecases https://mastra.ai/docs use-cases . I found a package named llm-recorder in Mastra codebase https://github.com/mastra-ai/mastra/tree/c42d9b40ddcd7481d62f8e6b0a67aa1854e11969/packages/ llm-recorder . How? well, I first came across the folder named recordings in the core package https://github.com/mastra-ai/mastra/tree/main/packages/core/ recordings . I searched for recording across the entire codebase https://github.com/search?q=repo%3Amastra-ai%2Fmastra+ recordings &type=code and found the below results: This helped me locate this package, llm-recorder. LLM response recording and replay for tests. Works like test snapshots - auto-records on first run, replays deterministically thereafter. This is currently an internal package in Mastra. It will become a public package in the future. I don't know when this will be a public package. Recording/Replay: Record real LLM API responses and replay them in tests MSW-based: Uses Mock Service Worker for reliable HTTP interception Streaming Support: Captures and replays SSE streaming responses with chunk timing Contract Validation: Detect API schema drift in nightly tests Multi-provider: Supports OpenAI, Anthropic, Google, and OpenRouter APIs Content-based Matching: Requests matched by MD5 hash of URL + body, not order There are 4 usage examples provided in the llm-recorder README https://github.com/mastra-ai/mastra/blob/c42d9b40ddcd7481d62f8e6b0a67aa1854e11969/packages/ llm-recorder/README.md?plain=1 L57 . Suite-wide via Vite plugin Per-file via enableAutoRecording Per-describe via useLLMRecording Per-test via withLLMRecording Hey, my name is Ramu Narasinga. I spent 4+ years studying OSS codebases and wrote 400+ articles on what makes the production-grade. Need help with a project? drop me an email - ramu.narasinga@gmail.com mailto:ramu.narasinga@gmail.com or book a meeting https://thinkthroo.com/contact .