templates/template-deep-search/README.md
An AI research assistant that evaluates its own work. It searches, checks if the results actually answer your question, identifies what's missing, and keeps going until it gets there. Uses Exa for web search and page scraping. Inspired by OpenAI's deep research and Perplexity. Built with Mastra.
This template shows how Mastra's workflow primitives and agent orchestration come together: nested workflows, suspend/resume for human input, and multiple specialized agents coordinating on a single task.
<video controls width="640" height="360" src="https://res.cloudinary.com/mastra-assets/video/upload/v1772538573/template-deep-search_n1fhvs.mp4"></video>
This demo runs in Mastra Studio, but you can connect this workflow to your React, Next.js, or Vue app using the Mastra Client SDK or agentic UI libraries like AI SDK UI, CopilotKit, or Assistant UI.
npx create-mastra@latest --template deep-search to scaffold the project locally..env.example to .env and fill in your keys.npm run dev and open localhost:4111 to try it out.Open Studio and trigger the deep-search workflow with your research question. The workflow asks a few clarifying questions — answer them and resume. Watch the console as it searches, evaluates, and iterates until you get a sourced answer.
Swap in a different search provider, add your own evaluation criteria, or wire the workflow into your app using the Mastra Client SDK. The agents and workflow steps are all in src/ — edit them directly to fit your use case.
Mastra templates are ready-to-use projects that show off what you can build — clone one, poke around, and make it yours. They live in the Mastra monorepo and are automatically synced to standalone repositories for easier cloning.
Want to contribute? See CONTRIBUTING.md.