
This course contains the use of artificial intelligence
Build AI agents that do more than answer questions. Create systems that retrieve knowledge, use tools, coordinate workflows, and handle real production challenges.
Welcome to Mastra AI Agents: TypeScript, RAG, MCP & Production Systems, a comprehensive, 80-lecture course that takes you from project setup and your first agent to advanced architectures for enterprise applications.
You will explore how to connect language models to tools, memory, documents, external services, and other agents. Along the way, you will learn how to validate responses, inspect execution, recover from failures, evaluate quality, and control access and costs.
Start with strong foundations
Understand the Mastra ecosystem, project architecture, and core building blocks. Configure model providers, write agent instructions, register your first agent, and inspect its behavior in Mastra Studio. Then make responses more dependable through structured output, typed results, streaming, error handling, and retries.
Give your agents useful tools and context
Build custom tools with Zod validation and connect external APIs. Explore dynamic instructions, request context, context-aware tools, execution options, and input and output processing. Learn how validation and authorization support safer tool execution.
Build conversations, memory, and knowledge retrieval
Work with threads, conversation state, short-term memory, and persistent memory. Develop retrieval-augmented generation (RAG) systems using document ingestion, preprocessing, chunking, embeddings, vector stores, metadata, and reranking. Learn patterns for producing grounded answers with supporting citations.
Orchestrate workflows and human decisions
Move beyond a single model call with conditional branches, parallel execution, loops, reusable sub-workflows, and persistent workflow state. Explore human-in-the-loop decisions, event-driven execution, and recovery strategies for workflows that encounter errors.
Connect services with Model Context Protocol
Understand MCP servers, transports, tools, resources, and prompts. Learn how to build and connect custom MCP servers, then examine the security boundaries and operational considerations involved in using them in production.
Coordinate multiple agents
Explore collaborating agents, handoffs, supervisor patterns, coordinated workflows, and delegation. Advance into context engineering, dynamic tool selection, planning and replanning, and model routing with fallback strategies.
Prepare for production operation
Study durable agents, background execution, scheduled agents, workspaces, sandboxed execution, and coding-agent harnesses. Address prompt injection, authentication, authorization, guardrails, resilience, token economics, and cost optimization.
Finally, learn how to assess agent behavior through evaluation, LLM-as-a-judge techniques, tool-call and trajectory evaluation, regression testing, observability, and service-level objectives.
Bring the concepts together through projects
The curriculum includes an AI Research Assistant Workflow Project, a production RAG system, a Research Team Capstone, a Final Production Capstone, and an Enterprise Autonomous Agent Capstone. These projects connect individual concepts into larger systems with clear responsibilities and operational boundaries.
Who this course is for
This course is designed for TypeScript and JavaScript developers, backend engineers, AI application developers, and technical architects who want to build agent applications with Mastra.
You should be comfortable with JavaScript or TypeScript, asynchronous programming, Node.js, and basic API usage. Previous Mastra experience is not required. Depending on your chosen providers and deployment services, practical exercises may require API credentials and incur usage charges.
By the end of the course, you will understand how to design, build, evaluate, and deploy Mastra-based agent systems—and how to make informed decisions about their reliability, security, and cost.