@mastra/core
Version:
293 lines (283 loc) • 70 kB
Markdown
---
name: mastra-core
description: Documentation for @mastra/core. Use when working with @mastra/core APIs, configuration, or implementation.
metadata:
package: "@mastra/core"
version: "1.50.1"
---
## When to use
Use this skill whenever you are working with @mastra/core to obtain the domain-specific knowledge.
## How to use
Read the individual reference documents for detailed explanations and code examples.
### Docs
- [Access control](references/docs-agent-builder-access-control.md) - Gate the Agent Builder with two roles — admin and member — using Mastra RBAC.
- [Browser](references/docs-agent-builder-browser.md) - Register browser providers and pin a default browser configuration for Agent Builder agents.
- [Channels](references/docs-agent-builder-channels.md) - Connect Builder-created agents to Slack and other channel providers without writing code.
- [Configuration](references/docs-agent-builder-configuration.md) - Configure the Agent Builder by toggling UI sections, pinning admin defaults, and constraining tool, agent, and workflow pickers.
- [Deploying](references/docs-agent-builder-deploying.md) - Swap local Agent Builder primitives for cloud-backed storage, filesystems, sandboxes, an EE license, auth, and a public channel URL for production.
- [Tool providers](references/docs-agent-builder-integrations.md) - Connect Builder-created agents to third-party apps by setting up connections on registered tool providers.
- [Memory](references/docs-agent-builder-memory.md) - Configure the default memory shape for Agent Builder agents, including observational memory, message history, and semantic recall.
- [Model policy](references/docs-agent-builder-model-policy.md) - Restrict which providers and models the Agent Builder exposes, pin a default model, and lock the picker.
- [Agent Builder overview](references/docs-agent-builder-overview.md) - Let teammates create, configure, and operate Mastra agents from a browser, with admin-pinned defaults, RBAC, and channel integrations.
- [Skill registries](references/docs-agent-builder-skill-registries.md) - Let the Agent Builder browse and install community skills from opt-in skill registries.
- [Workspace](references/docs-agent-builder-workspace.md) - Configure the default workspace for Agent Builder agents — filesystem, sandbox, and skills.
- [Modes](references/docs-agent-controller-modes.md) - Configure and switch between agent modes to give a single AgentController multiple personalities or capability sets.
- [AgentController overview](references/docs-agent-controller-overview.md) - Build interactive AI agents with multiple modes, persistent threads, tool approval, and model switching using the AgentController class.
- [Session](references/docs-agent-controller-session.md) - Understand the Session — the live state object on an AgentController — and the identity, thread, mode, grants, run, and display state it tracks.
- [Subagents](references/docs-agent-controller-subagents.md) - Spawn focused child agents from a parent conversation with constrained tools and isolated or forked threads.
- [Threads and state](references/docs-agent-controller-threads-and-state.md) - Manage persistent conversation threads and shared state across agent modes in an AgentController.
- [Tool approvals and permissions](references/docs-agent-controller-tool-approvals.md) - Gate tool execution with user approval flows and configure permission policies per-category or per-tool.
- [A2A](references/docs-agents-a2a.md) - Expose and call remote Mastra agents over the Agent-to-Agent protocol.
- [Agent Client Protocol (ACP)](references/docs-agents-acp.md) - Wrap ACP-compatible coding agents as Mastra tools or sub-agents.
- [Agent approval](references/docs-agents-agent-approval.md) - Learn how to require approvals, suspend tool execution, and automatically resume suspended tools while keeping humans in control of agent workflows.
- [Channels](references/docs-agents-channels.md) - Learn how to connect your Mastra agents to messaging platforms like Slack, Discord, and Telegram using the Chat SDK.
- [Code mode](references/docs-agents-code-mode.md) - Let an agent run multi-tool computations in a sandbox and return a single, more accurate response.
- [File-based agents](references/docs-agents-file-based-agents.md) - Define agents by file convention under src/mastra/agents, alongside agents created in code.
- [Guardrails](references/docs-agents-guardrails.md) - Built-in security and safety processors for content moderation, prompt injection prevention, PII redaction, and more.
- [Agent networks](references/docs-agents-networks.md) - Coordinate multiple agents, workflows, and tools using agent networks for complex, non-deterministic task execution.
- [Agents overview](references/docs-agents-overview.md) - Overview of agents in Mastra, detailing their capabilities and how they interact with tools, workflows, and external systems.
- [Processors](references/docs-agents-processors.md) - Learn how to use input and output processors to transform, validate, and control messages in Mastra agents.
- [SDK agents](references/docs-agents-sdk-agents.md) - Use Claude Agent SDK, Cursor Agent SDK, and OpenAI Agents SDK agents from Mastra.
- [Skills](references/docs-agents-skills.md) - Give agents reusable skills directly in code, without a full workspace.
- [Structured output](references/docs-agents-structured-output.md) - Learn how to generate structured data from agents using schemas and validation.
- [Supervisor agents](references/docs-agents-supervisor-agents.md) - Learn how to coordinate multiple agents with delegation hooks, iteration monitoring, message filtering, and task completion scoring.
- [Tools](references/docs-agents-using-tools.md) - Learn how to create tools and add them to agents to extend capabilities beyond text generation.
- [Browser overview](references/docs-browser-overview.md) - Give agents browser control through SDK providers, CLI tools, or cloud browser services.
- [Browser recording (beta)](references/docs-browser-recording.md) - Record browser sessions as Motion-JPEG AVI videos with optional agent captions.
- [Editor overview](references/docs-editor-overview.md) - Let non-technical team members iterate on agents, version every change, and run experiments without redeploying.
- [Prompts](references/docs-editor-prompts.md) - Build reusable, versioned instruction templates with template variables and display conditions.
- [Tools](references/docs-editor-tools.md) - Add and manage tools from code, integration providers, and MCP servers through the editor.
- [Custom scorers](references/docs-evals-custom-scorers.md)
- [Datasets overview](references/docs-evals-datasets-overview.md) - Manage versioned test data, run experiments against agents and workflows, and track results over time.
- [Running experiments](references/docs-evals-datasets-running-experiments.md) - Run experiments against agents or workflows, with scoring and result tracking.
- [Evals with memory](references/docs-evals-evals-with-memory.md) - Run scorers against memory-enabled agents — including observational memory in thread scope — using runEvals and dataset experiments.
- [Gates and verdicts](references/docs-evals-gates-and-verdicts.md) - Define hard requirements and quality thresholds for eval runs, with a computed pass/fail verdict.
- [Scorers overview](references/docs-evals-overview.md) - Overview of scorers in Mastra, detailing their capabilities for evaluating AI outputs and measuring performance.
- [Running scorers in CI](references/docs-evals-running-in-ci.md) - Learn how to run scorer experiments in your CI/CD pipeline using the runEvals function.
- [Background tasks](references/docs-long-running-agents-background-tasks.md) - Learn how to dispatch long-running tool calls in the background, keep the stream open until they complete, and orchestrate subagents asynchronously.
- [Durable agents](references/docs-long-running-agents-durable-agents.md) - Learn how to wrap agents with durable execution so streams survive disconnects, process restarts, and long-running turns.
- [Goals](references/docs-long-running-agents-goals.md) - Learn how to set a durable objective on an agent that is judged in the execution loop, so the agent keeps working until the goal is complete or the run budget is exhausted.
- [Schedules](references/docs-long-running-agents-schedules.md) - Run an agent on a cron schedule to deliver a recurring prompt, with optional thread delivery and lifecycle hooks.
- [Signal providers](references/docs-long-running-agents-signal-providers.md) - Learn what signal providers are and how to build one that monitors an external source and pushes notifications into agent threads.
- [Signals](references/docs-long-running-agents-signals.md) - Learn how to send real-time messages and context into a Mastra agent thread.
- [Memory processors](references/docs-memory-memory-processors.md) - Learn how to use memory processors in Mastra to filter, trim, and transform messages before they're sent to the language model to manage context window limits.
- [Multi-user threads](references/docs-memory-multi-user-threads.md) - Share one Mastra thread between multiple users by carrying speaker identity in the message body.
- [Observational Memory](references/docs-memory-observational-memory.md) - Learn how Observational Memory keeps your agent's context window small while preserving long-term memory across conversations.
- [Memory overview](references/docs-memory-overview.md) - Learn how Mastra's memory system works with working memory, message history, semantic recall, and observational memory.
- [Semantic recall](references/docs-memory-semantic-recall.md) - Learn how to use semantic recall in Mastra to retrieve relevant messages from past conversations using vector search and embeddings.
- [Storage](references/docs-memory-storage.md) - Configure storage for Mastra to persist conversations and other runtime state.
- [Working memory](references/docs-memory-working-memory.md) - Learn how to configure working memory in Mastra to store persistent user data, preferences.
- [Feedback](references/docs-observability-feedback.md) - Collect, list, and query human feedback records in Mastra observability.
- [Arthur exporter](references/docs-observability-integrations-exporters-arthur.md) - Send traces to Arthur AI using OpenTelemetry and OpenInference semantic conventions
- [Querying metrics](references/docs-observability-metrics-querying.md) - Read metric data from the Mastra observability store from code, HTTP, or the CLI.
- [Chunking and embedding documents](references/docs-rag-chunking-and-embedding.md) - Guide on chunking and embedding documents in Mastra for efficient processing and retrieval.
- [GraphRAG](references/docs-rag-graph-rag.md) - Guide on graph-based retrieval in Mastra's RAG systems for documents with complex relationships.
- [RAG (Retrieval-Augmented Generation) in Mastra](references/docs-rag-overview.md) - Overview of Retrieval-Augmented Generation (RAG) in Mastra, detailing its capabilities for enhancing LLM outputs with relevant context.
- [Retrieval, semantic search, reranking](references/docs-rag-retrieval.md) - Guide on retrieval processes in Mastra's RAG systems, including semantic search, filtering, and re-ranking.
- [Storing embeddings in a vector database](references/docs-rag-vector-databases.md) - Guide on vector storage options in Mastra, including embedded and dedicated vector databases for similarity search.
- [Auth0](references/docs-server-auth-auth0.md) - Documentation for the @mastra/auth-auth0 package, which authenticates Mastra applications using Auth0 authentication.
- [Clerk](references/docs-server-auth-clerk.md) - Documentation for the `@mastra/auth-clerk` package, which authenticates Mastra applications using Clerk authentication.
- [Composite Auth](references/docs-server-auth-composite-auth.md) - Documentation for the CompositeAuth class, which combines multiple authentication providers into a single auth handler.
- [Custom auth provider](references/docs-server-auth-custom-auth-provider.md) - Create custom authentication providers for specialized identity systems
- [Fine-Grained Authorization (FGA)](references/docs-server-auth-fga.md) - Add resource-level authorization to your Mastra application with FGA providers.
- [Firebase](references/docs-server-auth-firebase.md) - Documentation for the `@mastra/auth-firebase` package, which authenticates Mastra applications using Firebase Authentication.
- [JSON Web Token](references/docs-server-auth-jwt.md) - Documentation for JSON Web Token usage inside Mastra.
- [Simple Auth](references/docs-server-auth-simple-auth.md) - Documentation for the SimpleAuth class, which provides token-to-user mapping authentication for development and basic API key scenarios.
- [Supabase](references/docs-server-auth-supabase.md) - Documentation for the `@mastra/auth-supabase` package, which authenticates Mastra applications using Supabase Auth.
- [WorkOS](references/docs-server-auth-workos.md) - Documentation for the `@mastra/auth-workos` package, which authenticates Mastra applications using WorkOS authentication.
- [Custom adapters](references/docs-server-custom-adapters.md) - Create a custom server adapter for frameworks other than Hono or Express.
- [Custom API routes](references/docs-server-custom-api-routes.md) - Expose additional HTTP endpoints from your Mastra server.
- [Mastra client SDK](references/docs-server-mastra-client.md) - Learn how to set up and use the Mastra Client SDK
- [Server overview](references/docs-server-mastra-server.md) - Overview of the Mastra server, covering HTTP endpoints, middleware, authentication, and client integration.
- [Middleware](references/docs-server-middleware.md) - Apply custom middleware functions to intercept requests.
- [PubSub](references/docs-server-pubsub.md) - Learn how Mastra uses pub/sub to deliver events between components and when to configure a distributed backend for multi-process or multi-instance deployments.
- [Request context](references/docs-server-request-context.md) - Learn how to use Mastra's RequestContext to provide dynamic, request-specific configuration to agents.
- [Auth](references/docs-studio-auth.md) - Secure your Studio deployment with login screens, role-based access control, and permission-based UI rendering.
- [Deployment](references/docs-studio-deployment.md) - Learn how to deploy Studio on your own infrastructure or on Mastra platform
- [Observability](references/docs-studio-observability.md) - Use the metrics dashboard, traces view, and logs browser in Studio to monitor agent, workflow, and tool performance.
- [Studio](references/docs-studio-overview.md) - Learn how to use Studio to build, test, and manage your agents, workflows, and tools.
- [Voice in Mastra](references/docs-voice-overview.md) - Overview of voice capabilities in Mastra, including text-to-speech, speech-to-text, and real-time speech-to-speech interactions.
- [Speech-to-Speech capabilities in Mastra](references/docs-voice-speech-to-speech.md) - Overview of speech-to-speech capabilities in Mastra, including real-time interactions and event-driven architecture.
- [Speech-to-Text (STT)](references/docs-voice-speech-to-text.md) - Overview of Speech-to-Text capabilities in Mastra, including configuration, usage, and integration with voice providers.
- [Text-to-Speech (TTS)](references/docs-voice-text-to-speech.md) - Overview of Text-to-Speech capabilities in Mastra, including configuration, usage, and integration with voice providers.
- [Agents and tools](references/docs-workflows-agents-and-tools.md) - Learn how to call agents and tools from workflow steps and choose between execute functions and step composition.
- [Control flow](references/docs-workflows-control-flow.md) - Control flow in Mastra workflows allows you to manage branching, merging, and conditions to construct workflows that meet your logic requirements.
- [Error handling](references/docs-workflows-error-handling.md) - Learn how to handle errors in Mastra workflows using step retries, conditional branching, and monitoring.
- [Human-in-the-loop (HITL)](references/docs-workflows-human-in-the-loop.md) - Human-in-the-loop workflows in Mastra allow you to pause execution for manual approvals, reviews, or user input before continuing.
- [Workflows overview](references/docs-workflows-overview.md) - Workflows in Mastra help you orchestrate complex sequences of tasks with features like branching, parallel execution, resource suspension, and more.
- [Scheduled workflows](references/docs-workflows-scheduled-workflows.md) - Run a workflow on a cron schedule by declaring a `schedule` field on the workflow definition.
- [Snapshots](references/docs-workflows-snapshots.md) - Learn how to save and resume workflow execution state with snapshots in Mastra
- [Suspend and resume](references/docs-workflows-suspend-and-resume.md) - Suspend and resume in Mastra workflows allows you to pause execution while waiting for external input or resources.
- [Time travel](references/docs-workflows-time-travel.md) - Re-execute workflow steps from a specific point using time travel debugging in Mastra
- [Workflow state](references/docs-workflows-workflow-state.md) - Share values across workflow steps using global state that persists through the entire workflow run.
- [Filesystem](references/docs-workspace-filesystem.md) - Configure filesystem providers to give agents persistent file storage.
- [LSP inspection](references/docs-workspace-lsp.md) - Configure Language Server Protocol support for semantic code inspection in workspace files.
- [Overview](references/docs-workspace-overview.md) - Give agents filesystem access and code execution through workspaces.
- [Sandbox](references/docs-workspace-sandbox.md) - Configure sandbox providers to give agents command execution capabilities.
- [Search and indexing](references/docs-workspace-search.md) - Index workspace content for BM25 keyword search, vector semantic search, or hybrid mode.
- [Skills](references/docs-workspace-skills.md) - Teach agents reusable capabilities with the Agent Skills specification.
### Guides
- [AI SDK](references/guides-agent-frameworks-ai-sdk.md) - Use Mastra processors and memory with the Vercel AI SDK
- [Multi-agent systems](references/guides-concepts-multi-agent-systems.md) - Learn what multi-agent systems are, why teams use them, and how common patterns map to Mastra.
- [Streaming](references/guides-concepts-streaming.md) - Streaming in Mastra enables real-time, incremental responses from both agents and workflows, providing immediate feedback as AI-generated content is produced.
### Reference
- [Reference: Overview](references/reference.md) - Reference documentation on Mastra's APIs and tools
- [Reference: AcpAgent class](references/reference-acp-acp-agent.md) - API reference for the AcpAgent class, which wraps an ACP-compatible coding agent as a Mastra subagent.
- [Reference: createACPTool()](references/reference-acp-create-acp-tool.md) - API reference for createACPTool(), which wraps an ACP-compatible coding agent as a Mastra tool.
- [Reference: AgentController class](references/reference-agent-controller-agent-controller-class.md) - API reference for the AgentController class, the orchestrator for multi-mode agents with shared state, threads, and tool approvals.
- [Reference: Session class](references/reference-agent-controller-session.md) - API reference for the AgentController Session, which owns the per-conversation state for a single conversation: identity, threads, mode, model, run state, grants, and the display snapshot.
- [Reference: Agent class](references/reference-agents-agent.md) - Documentation for the `Agent` class in Mastra, which provides the foundation for creating AI agents with various capabilities.
- [Reference: Channels](references/reference-agents-channels.md) - API reference for the ChannelConfig agent channels object, which connects agents to messaging platforms like Slack, Discord, and Telegram.
- [Reference: createSkill()](references/reference-agents-createSkill.md) - API reference for createSkill(), a factory function for creating inline agent skills without a filesystem.
- [Reference: DurableAgent](references/reference-agents-durable-agent.md) - API reference for DurableAgent, which wraps an Agent with durable execution and resumable streams.
- [Reference: Agent.generate()](references/reference-agents-generate.md) - Documentation for the `Agent.generate()` method in Mastra agents, which enables non-streaming generation of responses with enhanced capabilities.
- [Reference: Agent.generateLegacy() (Legacy)](references/reference-agents-generateLegacy.md) - Documentation for the legacy `Agent.generateLegacy()` method in Mastra agents. This method is deprecated and will be removed in a future version.
- [Reference: Agent.getDefaultGenerateOptionsLegacy()](references/reference-agents-getDefaultGenerateOptions.md) - Documentation for the `Agent.getDefaultGenerateOptionsLegacy()` method in Mastra agents, which retrieves the default options used for generateLegacy calls.
- [Reference: Agent.getDefaultOptions()](references/reference-agents-getDefaultOptions.md) - Documentation for the `Agent.getDefaultOptions()` method in Mastra agents, which retrieves the default options used for stream and generate calls.
- [Reference: Agent.getDefaultStreamOptionsLegacy()](references/reference-agents-getDefaultStreamOptions.md) - Documentation for the `Agent.getDefaultStreamOptionsLegacy()` method in Mastra agents, which retrieves the default options used for streamLegacy calls.
- [Reference: Agent.getDescription()](references/reference-agents-getDescription.md) - Documentation for the `Agent.getDescription()` method in Mastra agents, which retrieves the agent's description.
- [Reference: Agent.getInstructions()](references/reference-agents-getInstructions.md) - Documentation for the `Agent.getInstructions()` method in Mastra agents, which retrieves the instructions that guide the agent's behavior.
- [Reference: Agent.getLLM()](references/reference-agents-getLLM.md) - Documentation for the `Agent.getLLM()` method in Mastra agents, which retrieves the language model instance and supports request-scoped model overrides.
- [Reference: Agent.getMemory()](references/reference-agents-getMemory.md) - Documentation for the `Agent.getMemory()` method in Mastra agents, which retrieves the memory system associated with the agent.
- [Reference: Agent.getMetadata()](references/reference-agents-getMetadata.md) - Documentation for the `Agent.getMetadata()` method in Mastra agents, which retrieves the metadata configured for the agent.
- [Reference: Agent.getModel()](references/reference-agents-getModel.md) - Documentation for the `Agent.getModel()` method in Mastra agents, which retrieves the language model that powers the agent.
- [Reference: .getSkill()](references/reference-agents-getSkill.md) - API reference for the Agent .getSkill() method, which retrieves a specific skill by name.
- [Reference: Agent.getTools()](references/reference-agents-getTools.md) - Documentation for the `Agent.getTools()` method in Mastra agents, which retrieves the tools that the agent can use.
- [Reference: Agent.getVoice()](references/reference-agents-getVoice.md) - Documentation for the `Agent.getVoice()` method in Mastra agents, which retrieves the voice provider for speech capabilities.
- [Reference: Agent.listAgents()](references/reference-agents-listAgents.md) - Documentation for the `Agent.listAgents()` method in Mastra agents, which retrieves the subagents that the agent can access.
- [Reference: Agent.listScorers()](references/reference-agents-listScorers.md) - Documentation for the `Agent.listScorers()` method in Mastra agents, which retrieves the scoring configuration.
- [Reference: .listSkills()](references/reference-agents-listSkills.md) - API reference for the Agent .listSkills() method, which returns metadata for all configured skills.
- [Reference: Agent.listSuspendedRuns()](references/reference-agents-listSuspendedRuns.md) - API reference for Agent.listSuspendedRuns(), which discovers suspended agent runs from storage so approvals survive restarts.
- [Reference: Agent.listTools()](references/reference-agents-listTools.md) - Documentation for the `Agent.listTools()` method in Mastra agents, which retrieves the tools that the agent can use.
- [Reference: Agent.listWorkflows()](references/reference-agents-listWorkflows.md) - Documentation for the `Agent.listWorkflows()` method in Mastra agents, which retrieves the workflows that the agent can execute.
- [Reference: Agent.network()](references/reference-agents-network.md) - Documentation for the `Agent.network()` method in Mastra agents, which enables multi-agent collaboration and routing.
- [Reference: chatRoute()](references/reference-ai-sdk-chat-route.md) - API reference for chatRoute(), a function to create chat route handlers for streaming agent conversations in AI SDK-compatible format.
- [Reference: networkRoute()](references/reference-ai-sdk-network-route.md) - API reference for networkRoute(), a function to create network route handlers for streaming network execution in AI SDK-compatible format.
- [Reference: toAISdkStream()](references/reference-ai-sdk-to-ai-sdk-stream.md) - API reference for toAISdkStream(), a function to convert Mastra streams to AI SDK-compatible streams.
- [Reference: withMastra()](references/reference-ai-sdk-with-mastra.md) - API reference for withMastra(), a function to use Mastra functionality in AI SDK.
- [Reference: workflowRoute()](references/reference-ai-sdk-workflow-route.md) - API reference for workflowRoute(), a function to create workflow route handlers for streaming workflow execution in AI SDK-compatible format.
- [Reference: workflowSnapshotToStream()](references/reference-ai-sdk-workflow-snapshot-to-stream.md) - API reference for workflowSnapshotToStream(), a function to convert a persisted workflow run into an AI SDK-compatible stream.
- [Reference: MastraAuthAuth0 class](references/reference-auth-auth0.md) - API reference for the MastraAuthAuth0 class, which authenticates Mastra applications using Auth0 authentication.
- [Reference: MastraAuthClerk class](references/reference-auth-clerk.md) - API reference for the MastraAuthClerk class, which authenticates Mastra applications using Clerk authentication.
- [Reference: MastraAuthFirebase class](references/reference-auth-firebase.md) - API reference for the MastraAuthFirebase class, which authenticates Mastra applications using Firebase Authentication.
- [Reference: MastraAuthGoogle and MastraRBACGoogle](references/reference-auth-google.md) - API reference for the MastraAuthGoogle and MastraRBACGoogle classes, which authenticate and authorize Mastra applications using Google Workspace.
- [Reference: MastraJwtAuth class](references/reference-auth-jwt.md) - API reference for the MastraJwtAuth class, which authenticates Mastra applications using JSON Web Tokens.
- [Reference: MastraAuthOkta and MastraRBACOkta](references/reference-auth-okta.md) - API reference for the MastraAuthOkta and MastraRBACOkta classes, which authenticate and authorize Mastra applications using Okta.
- [Reference: MastraAuthSupabase class](references/reference-auth-supabase.md) - API reference for the MastraAuthSupabase class, which authenticates Mastra applications using Supabase Auth.
- [Reference: MastraAuthWorkos class](references/reference-auth-workos.md) - API reference for the MastraAuthWorkos class, which authenticates Mastra applications using WorkOS authentication.
- [Reference: MastraBrowser class](references/reference-browser-mastra-browser.md) - API reference for MastraBrowser, the abstract base class for browser automation providers in Mastra.
- [Reference: ChannelProvider](references/reference-channels-channel-provider.md) - API reference for ChannelProvider, the interface that platform integrations implement to provision apps, route webhooks, and wire adapters to agents.
- [Reference: Agents API](references/reference-client-js-agents.md) - Learn how to interact with Mastra AI agents, including generating responses, streaming interactions, and managing agent tools using the client-js SDK.
- [Reference: buildBasePrompt()](references/reference-coding-agent-build-base-prompt.md) - API reference for buildBasePrompt(), which builds the shared base system prompt for a coding agent from a PromptContext.
- [Reference: createCodingAgent()](references/reference-coding-agent-create-coding-agent.md) - API reference for createCodingAgent(), a factory that builds a coding agent with portable defaults for workspace, task signal, error retries, and goal judge.
- [Reference: Configuration](references/reference-configuration.md) - Reference documentation on Mastra's configuration options
- [Reference: Mastra.addGateway()](references/reference-core-addGateway.md) - Add a gateway to the Mastra instance
- [Reference: Mastra.getAgent()](references/reference-core-getAgent.md) - Documentation for the `Agent.getAgent()` method in Mastra, which retrieves an agent by name.
- [Reference: Mastra.getAgentById()](references/reference-core-getAgentById.md) - Documentation for the `Mastra.getAgentById()` method in Mastra, which retrieves an agent by its ID.
- [Reference: Mastra.getDeployer()](references/reference-core-getDeployer.md) - Documentation for the `Mastra.getDeployer()` method in Mastra, which retrieves the configured deployer instance.
- [Reference: Mastra.getEditor()](references/reference-core-getEditor.md) - Documentation for the `Mastra.getEditor()` method in Mastra, which retrieves the configured editor instance.
- [Reference: Mastra.getGateway()](references/reference-core-getGateway.md) - Retrieve a registered gateway by its registration key
- [Reference: Mastra.getGatewayById()](references/reference-core-getGatewayById.md) - Retrieve a registered gateway by its unique ID
- [Reference: Mastra.getLogger()](references/reference-core-getLogger.md) - Documentation for the `Mastra.getLogger()` method in Mastra, which retrieves the configured logger instance.
- [Reference: Mastra.getMCPServer()](references/reference-core-getMCPServer.md) - Documentation for the `Mastra.getMCPServer()` method in Mastra, which retrieves a specific MCP server instance by ID and optional version.
- [Reference: Mastra.getMCPServerById()](references/reference-core-getMCPServerById.md) - Documentation for the `Mastra.getMCPServerById()` method in Mastra, which retrieves a specific MCP server instance by its intrinsic id property.
- [Reference: Mastra.getMemory()](references/reference-core-getMemory.md) - Documentation for the `Mastra.getMemory()` method in Mastra, which retrieves a registered memory instance by its registry key.
- [Reference: getScorer()](references/reference-core-getScorer.md) - Documentation for the `getScorer()` method in Mastra, which retrieves a specific scorer by its registration key.
- [Reference: getScorerById()](references/reference-core-getScorerById.md) - Documentation for the `getScorerById()` method in Mastra, which retrieves a scorer by its id property rather than registration key.
- [Reference: Mastra.getServer()](references/reference-core-getServer.md) - Documentation for the `Mastra.getServer()` method in Mastra, which retrieves the configured server configuration.
- [Reference: Mastra.getStorage()](references/reference-core-getStorage.md) - Documentation for the `Mastra.getStorage()` method in Mastra, which retrieves the configured storage instance.
- [Reference: Mastra.getTelemetry()](references/reference-core-getTelemetry.md) - Documentation for the `Mastra.getTelemetry()` method in Mastra, which retrieves the configured telemetry instance.
- [Reference: Mastra.getVector()](references/reference-core-getVector.md) - Documentation for the `Mastra.getVector()` method in Mastra, which retrieves a vector store by name.
- [Reference: Mastra.getWorkflow()](references/reference-core-getWorkflow.md) - Documentation for the `Mastra.getWorkflow()` method in Mastra, which retrieves a workflow by ID.
- [Reference: Mastra.listAgents()](references/reference-core-listAgents.md) - Documentation for the `Mastra.listAgents()` method in Mastra, which retrieves all configured agents.
- [Reference: Mastra.listGateways()](references/reference-core-listGateways.md) - List all registered gateways
- [Reference: Mastra.listLogs()](references/reference-core-listLogs.md) - Documentation for the `Mastra.listLogs()` method in Mastra, which retrieves all logs for a specific transport ID.
- [Reference: Mastra.listLogsByRunId()](references/reference-core-listLogsByRunId.md) - Documentation for the `Mastra.listLogsByRunId()` method in Mastra, which retrieves logs for a specific run ID and transport ID.
- [Reference: Mastra.listMCPServers()](references/reference-core-listMCPServers.md) - Documentation for the `Mastra.listMCPServers()` method in Mastra, which retrieves all registered MCP server instances.
- [Reference: Mastra.listMemory()](references/reference-core-listMemory.md) - Documentation for the `Mastra.listMemory()` method in Mastra, which returns all registered memory instances.
- [Reference: listScorers()](references/reference-core-listScorers.md) - Documentation for the `listScorers()` method in Mastra, which returns all registered scorers for evaluating AI outputs.
- [Reference: Mastra.listVectors()](references/reference-core-listVectors.md) - Documentation for the `Mastra.listVectors()` method in Mastra, which retrieves all configured vector stores.
- [Reference: Mastra.listWorkflows()](references/reference-core-listWorkflows.md) - Documentation for the `Mastra.listWorkflows()` method in Mastra, which retrieves all configured workflows.
- [Reference: Mastra class](references/reference-core-mastra-class.md) - Documentation for the `Mastra` class in Mastra, the core entry point for managing agents, workflows, MCP servers, and server endpoints.
- [Reference: MastraModelGateway](references/reference-core-mastra-model-gateway.md) - Base class and interface for creating custom model gateways
- [Reference: Mastra.removeWorkspace()](references/reference-core-removeWorkspace.md) - Documentation for the `Mastra.removeWorkspace()` method in Mastra, which removes a workspace from the runtime registry.
- [Reference: Mastra.setLogger()](references/reference-core-setLogger.md) - Documentation for the `Mastra.setLogger()` method in Mastra, which sets the logger for all components (agents, workflows, etc.).
- [Reference: Mastra.setStorage()](references/reference-core-setStorage.md) - Documentation for the `Mastra.setStorage()` method in Mastra, which sets the storage instance for the Mastra instance.
- [Reference: dataset.addItem()](references/reference-datasets-addItem.md) - Documentation for the `dataset.addItem()` method, which adds a single item to a dataset.
- [Reference: dataset.addItems()](references/reference-datasets-addItems.md) - Documentation for the `dataset.addItems()` method, which adds multiple items to a dataset in bulk.
- [Reference: DatasetsManager.compareExperiments()](references/reference-datasets-compareExperiments.md) - Documentation for the `DatasetsManager.compareExperiments()` method, which compares two or more experiments.
- [Reference: DatasetsManager.create()](references/reference-datasets-create.md) - Documentation for the `DatasetsManager.create()` method, which creates a new dataset.
- [Reference: Dataset class](references/reference-datasets-dataset.md) - Documentation for the `Dataset` class in Mastra, which provides the public API for interacting with a single dataset.
- [Reference: DatasetsManager](references/reference-datasets-datasets-manager.md) - Documentation for the `DatasetsManager` class in Mastra, which provides the public API for managing datasets.
- [Reference: DatasetsManager.delete()](references/reference-datasets-delete.md) - Documentation for the `DatasetsManager.delete()` method, which deletes a dataset by ID.
- [Reference: dataset.deleteExperiment()](references/reference-datasets-deleteExperiment.md) - Documentation for the `dataset.deleteExperiment()` method, which deletes an experiment by ID.
- [Reference: dataset.deleteItem()](references/reference-datasets-deleteItem.md) - Documentation for the `dataset.deleteItem()` method, which deletes a single item from a dataset.
- [Reference: dataset.deleteItems()](references/reference-datasets-deleteItems.md) - Documentation for the `dataset.deleteItems()` method, which deletes multiple items from a dataset in bulk.
- [Reference: DatasetsManager.get()](references/reference-datasets-get.md) - Documentation for the `DatasetsManager.get()` method, which retrieves an existing dataset by ID.
- [Reference: dataset.getDetails()](references/reference-datasets-getDetails.md) - Documentation for the `dataset.getDetails()` method, which retrieves the full dataset record from storage.
- [Reference: dataset.getExperiment()](references/reference-datasets-getExperiment.md) - Documentation for the `dataset.getExperiment()` method, which retrieves a specific experiment by ID.
- [Reference: dataset.getItem()](references/reference-datasets-getItem.md) - Documentation for the `dataset.getItem()` method, which retrieves a single item by ID.
- [Reference: dataset.getItemHistory()](references/reference-datasets-getItemHistory.md) - Documentation for the `dataset.getItemHistory()` method, which retrieves the full SCD-2 change history of a dataset item.
- [Reference: DatasetsManager.list()](references/reference-datasets-list.md) - Documentation for the `DatasetsManager.list()` method, which lists all datasets with pagination.
- [Reference: dataset.listExperimentResults()](references/reference-datasets-listExperimentResults.md) - Documentation for the `dataset.listExperimentResults()` method, which lists results for a specific experiment.
- [Reference: dataset.listExperiments()](references/reference-datasets-listExperiments.md) - Documentation for the `dataset.listExperiments()` method, which lists all experiments for a dataset.
- [Reference: dataset.listItems()](references/reference-datasets-listItems.md) - Documentation for the `dataset.listItems()` method, which lists items in a dataset with optional pagination and filtering.
- [Reference: dataset.listVersions()](references/reference-datasets-listVersions.md) - Documentation for the `dataset.listVersions()` method, which lists all versions of a dataset.
- [Reference: dataset.startExperiment()](references/reference-datasets-startExperiment.md) - Documentation for the `dataset.startExperiment()` method, which runs an experiment on a dataset and waits for completion.
- [Reference: dataset.startExperimentAsync()](references/reference-datasets-startExperimentAsync.md) - Documentation for the `dataset.startExperimentAsync()` method, which starts an experiment asynchronously.
- [Reference: dataset.update()](references/reference-datasets-update.md) - Documentation for the `dataset.update()` method, which updates dataset metadata and schemas.
- [Reference: dataset.updateItem()](references/reference-datasets-updateItem.md) - Documentation for the `dataset.updateItem()` method, which updates an existing item in a dataset.
- [Reference: AgentBuilderOptions](references/reference-editor-agent-builder-agent-builder-options.md) - Reference for AgentBuilderOptions, the configuration object passed to MastraEditor.builder.
- [Reference: BuilderAgentDefaults](references/reference-editor-agent-builder-builder-agent-defaults.md) - Reference for BuilderAgentDefaults, the admin-pinned defaults applied to every Agent Builder agent.
- [Reference: builder.configuration.agent.models](references/reference-editor-agent-builder-builder-models.md) - Reference for the Agent Builder model allowlist and default model admin input.
- [Reference: BlobStoreProvider](references/reference-editor-blob-store-provider.md) - Reference for BlobStoreProvider, the interface that registers a blob store implementation with MastraEditor.
- [Reference: BrowserProvider](references/reference-editor-browser-provider.md) - Reference for BrowserProvider, the interface that registers a browser implementation with MastraEditor.
- [Reference: FilesystemProvider](references/reference-editor-filesystem-provider.md) - Reference for FilesystemProvider, the interface that registers a filesystem implementation with MastraEditor.
- [Reference: MastraEditor class](references/reference-editor-mastra-editor.md) - Documentation for the MastraEditor class, the entry point for configuring the Mastra agent editor.
- [Reference: ProcessorProvider](references/reference-editor-processor-provider.md) - Reference for ProcessorProvider, the interface that registers a configurable processor with MastraEditor.
- [Reference: SandboxProvider](references/reference-editor-sandbox-provider.md) - Reference for SandboxProvider, the interface that registers a sandbox implementation with MastraEditor.
- [Reference: StorageBrowserRef](references/reference-editor-storage-browser-ref.md) - Reference for StorageBrowserRef and StorageBrowserConfig, the inline browser configuration attached to a stored agent.
- [Reference: StorageWorkspaceRef](references/reference-editor-storage-workspace-ref.md) - Reference for StorageWorkspaceRef, the discriminated union that points a stored agent at a workspace.
- [Reference: Answer relevancy scorer](references/reference-evals-answer-relevancy.md) - Documentation for the Answer Relevancy Scorer in Mastra, which evaluates how well LLM outputs address the input query.
- [Reference: Answer similarity scorer](references/reference-evals-answer-similarity.md) - Documentation for the Answer Similarity Scorer in Mastra, which compares agent outputs against ground truth answers for CI/CD testing.
- [Reference: Bias scorer](references/reference-evals-bias.md) - Documentation for the Bias Scorer in Mastra, which evaluates LLM outputs for various forms of bias, including gender, political, racial/ethnic, or geographical bias.
- [Reference: Completeness scorer](references/reference-evals-completeness.md) - Documentation for the Completeness Scorer in Mastra, which evaluates how thoroughly LLM outputs cover key elements present in the input.
- [Reference: Content similarity scorer](references/reference-evals-content-similarity.md) - Documentation for the Content Similarity Scorer in Mastra, which measures textual similarity between strings and provides a matching score.
- [Reference: Context precision scorer](references/reference-evals-context-precision.md) - Documentation for the Context Precision Scorer in Mastra. Evaluates the relevance and precision of retrieved context for generating expected outputs using Mean Average Precision.
- [Reference: createScorer](references/reference-evals-create-scorer.md) - Documentation for creating custom scorers in Mastra, allowing users to define their own evaluation logic using either JavaScript functions or LLM-based prompts.
- [Reference: Faithfulness scorer](references/reference-evals-faithfulness.md) - Documentation for the Faithfulness Scorer in Mastra, which evaluates the factual accuracy of LLM outputs compared to the provided context.
- [Reference: filterRun()](references/reference-evals-filter-run.md) - API reference for filterRun(), a utility that creates a prepareRun function to filter and limit scorer input data.
- [Reference: Hallucination scorer](references/reference-evals-hallucination.md) - Documentation for the Hallucination Scorer in Mastra, which evaluates the factual correctness of LLM outputs by identifying contradictions with provided context.
- [Reference: Keyword coverage scorer](references/reference-evals-keyword-coverage.md) - Documentation for the Keyword Coverage Scorer in Mastra, which evaluates how well LLM outputs cover important keywords from the input.
- [Reference: MastraScorer](references/reference-evals-mastra-scorer.md) - Documentation for the MastraScorer base class in Mastra, which provides the foundation for all custom and built-in scorers.
- [Reference: runEvals](references/reference-evals-run-evals.md) - Documentation for the runEvals function in Mastra, which enables batch evaluation of agents and workflows using multiple scorers.
- [Reference: Scorer utils](references/reference-evals-scorer-utils.md) - Utility functions for extracting data from scorer run inputs and outputs, including text content, reasoning, system messages, and tool calls.
- [Reference: Textual difference scorer](references/reference-evals-textual-difference.md) - Documentation for the Textual Difference Scorer in Mastra, which measures textual differences between strings using sequence matching.
- [Reference: Tone consistency scorer](references/reference-evals-tone-consistency.md) - Documentation for the Tone Consistency Scorer in Mastra, which evaluates emotional tone and sentiment consistency in text.
- [Reference: Toxicity scorer](references/reference-evals-toxicity.md) - Documentation for the Toxicity Scorer in Mastra, which evaluates LLM outputs for racist, biased, or toxic elements.
- [Reference: Trajectory accuracy scorers](references/reference-evals-trajectory-accuracy.md) - Documentation for the Trajectory Accuracy Scorers in Mastra, which evaluate whether an agent or workflow follows the expected sequence of actions.
- [Reference: PinoLogger](references/reference-logging-pino-logger.md) - Documentation for PinoLogger, which provides methods to record events at various severity levels.
- [Reference: Memory.deleteMessages()](references/reference-memory-deleteMessages.md) - Documentation for the `Memory.deleteMessages()` method in Mastra, which deletes multiple messages by their IDs.
- [Reference: Memory class](references/reference-memory-memory-class.md) - Documentation for the `Memory` class in Mastra, which provides a robust system for managing conversation history and thread-based message storage.
- [Reference: Observational Memory](references/reference-memory-observational-memory.md) - API reference for Observational Memory in Mastra — a three-tier memory system that uses Observer and Reflector agents to maintain long-term memory across conversations.
- [Reference: SerializedMemoryConfig](references/reference-memory-serialized-memory-config.md) - Reference for SerializedMemoryConfig, the JSON-serializable subset of Memory configuration stored on agent records.
- [Reference: Feedback](references/reference-observability-feedback.md) - API reference for observability feedback records, filters, and query methods.
- [Reference: DatadogBridge](references/reference-observability-tracing-bridges-datadog.md) - Datadog bridge for Tracing
- [Reference: OtelBridge](references/reference-observability-tracing-bridges-otel.md) - OpenTelemetry bridge for traces and logs
- [Reference: Configuration](references/reference-observability-tracing-configuration.md) - Tracing configuration types and registry functions
- [Reference: ConsoleExporter](references/reference-observability-tracing-exporters-console-exporter.md) - API reference for the ConsoleExporter
- [Reference: DatadogExporter](references/reference-observability-tracing-exporters-datadog.md) - Datadog LLM Observability exporter for Tracing
- [Reference: Tracing](references/reference-observability-tracing-instances.md) - Core Tracing classes and methods
- [Reference: Interfaces](references/reference-observability-tracing-interfaces.md) - Tracing type definitions and interfaces
- [Reference: SensitiveDataFilter](references/reference-observability-tracing-processors-sensitive-data-filter.md) - API reference for the SensitiveDataFilter processor
- [Reference: Span filtering](references/reference-observability-tracing-span-filtering.md) - Reference for excludeSpanTypes, spanFilter, and span filtering behavior
- [Reference: Spans](references/reference-observability-tracing-spans.md) - Span interfaces, methods, and lifecycle events
- [Reference: BatchPartsProcessor](references/reference-processors-batch-parts-processor.md) - Documentation for the BatchPartsProcessor in Mastra, which batches multiple stream parts together to reduce frequency of emissions.
- [Reference: CostGuardProcessor](references/reference-processors-cost-guard-processor.md) - API reference for CostGuardProcessor, a processor that enforces monetary cost limits on agent runs.
- [Reference: LanguageDetector](references/reference-processors-language-detector.md) - Documentation for the LanguageDetector in Mastra, which detects language and can translate content in AI responses.
- [Reference: MessageHistory](references/reference-processors-message-history-processor.md) - Documentation for the MessageHistory processor in Mastra, which handles retrieval and persistence of conversation history.
- [Reference: ModerationProcessor](references/reference-processors-moderation-processor.md) - Documentation for the ModerationProcessor in Mastra, which provides content moderation using LLM to detect inappropriate content across multiple categories.
- [Reference: PIIDetector](references/reference-processors-pii-detector.md) - Documentation for the PIIDetector in Mastra, which detects and redacts personally identifiable information (PII) from AI responses.
- [Reference: PrefillErrorHandler](references/reference-processors-prefill-error-handler.md) - Documentation for the PrefillErrorHandler processor in Mastra, which handles assistant-response prefill errors by appending a continue message and retrying.
- [Reference: Processor interface](references/reference-processors-processor-interface.md) - API reference for the Processor interface in Mastra, which defines the contract for transforming, validating, and controlling messages in agent pipelines.
- [Reference: PromptInjectionDetector](references/reference-processors-prompt-injection-detector.md) - Documentation for the PromptInjectionDet