UNPKG

@mastra/core

Version:

Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.

292 lines (282 loc) 56.8 kB
--- name: mastra-core description: Documentation for @mastra/core. Use when working with @mastra/core APIs, configuration, or implementation. metadata: package: "@mastra/core" version: "1.36.0" --- ## 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 - [A2A](references/docs-agents-a2a.md) - Expose and call remote Mastra agents over the Agent-to-Agent protocol. - [ACP](references/docs-agents-acp.md) - Wrap ACP-compatible coding agents as Mastra tools or sub-agents. - [Voice](references/docs-agents-adding-voice.md) - Learn how to add voice capabilities to your Mastra agents for text-to-speech and speech-to-text interactions. - [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. - [Background tasks](references/docs-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. - [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. - [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. - [Response Caching](references/docs-agents-response-caching.md) - Cache identical agent calls to skip the LLM, return responses instantly, and avoid duplicate spend. - [Signals](references/docs-agents-signals.md) - Learn how to send real-time context into a Mastra agent thread. - [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. - [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. - [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. - [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. - [Arthur exporter](references/docs-observability-tracing-exporters-arthur.md) - Send traces to Arthur AI using OpenTelemetry and OpenInference semantic conventions - [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. - [Request context](references/docs-server-request-context.md) - Learn how to use Mastra's RequestContext to provide dynamic, request-specific configuration to agents. - [Background task streaming](references/docs-streaming-background-task-streaming.md) - Learn how to subscribe to background task lifecycle events with `BackgroundTaskManager.stream()` to monitor task status across agents, threads, and runs. - [Streaming events](references/docs-streaming-events.md) - Learn about the different types of streaming events in Mastra, including text deltas, tool calls, step events, and how to handle them in your applications. - [Tool streaming](references/docs-streaming-tool-streaming.md) - Learn how to use tool streaming in Mastra, including handling tool calls, tool results, and tool execution events during streaming. - [Workflow streaming](references/docs-streaming-workflow-streaming.md) - Learn how to use workflow streaming in Mastra, including handling workflow execution events, step streaming, and workflow integration with agents and tools. - [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 & 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. ### Reference - [Reference: Overview](references/reference.md) - Reference documentation on Mastra's APIs and tools - [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 agent channels, which connect agents to messaging platforms like Slack, Discord, and Telegram. - [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: 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: 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: 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: MastraJwtAuth class](references/reference-auth-jwt.md) - API reference for the MastraJwtAuth class, which authenticates Mastra applications using JSON Web Tokens. - [Reference: MastraAuthOkta & 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: 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: 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 for creating custom model gateways - [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: MastraEditor class](references/reference-editor-mastra-editor.md) - Documentation for the MastraEditor class, the entry point for configuring the Mastra agent editor. - [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: Harness class](references/reference-harness-harness-class.md) - Documentation for the Harness class, the core orchestrator for multi-mode agents, shared state, memory, and storage in Mastra. - [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: 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 PromptInjectionDetector in Mastra, which detects prompt injection attempts in user input. - [Reference: ProviderHistoryCompat](references/reference-processors-provider-history-compat.md) - API reference for the ProviderHistoryCompat processor in Mastra, which applies provider-specific history compatibility fixes. - [Reference: RegexFilterProcessor](references/reference-processors-regex-filter-processor.md) - API reference for RegexFilterProcessor, a zero-cost regex-based content filter for blocking, redacting, or warning on pattern matches in agent messages. - [Reference: ResponseCache](references/reference-processors-response-cache.md) - API reference for the ResponseCache input processor that caches LLM responses inside the agentic loop. - [Reference: SemanticRecall](references/reference-processors-semantic-recall-processor.md) - Documentation for the SemanticRecall processor in Mastra, which enables semantic search over conversation history using vector embeddings. - [Reference: SkillSearchProcessor](references/reference-processors-skill-search-processor.md) - Documentation for the SkillSearchProcessor in Mastra, which enables on-demand skill discovery and loading for agents with many skills. - [Reference: StreamErrorRetryProcessor](references/reference-processors-stream-error-retry-processor.md) - API reference for the StreamErrorRetryProcessor processor in Mastra, which retries transient stream errors. - [Reference: SystemPromptScrubber](references/reference-processors-system-prompt-scrubber.md) - Documentation for the SystemPromptScrubber in Mastra, which detects and redacts system prompts from AI responses. - [Reference: TokenLimiterProcessor](references/reference-processors-token-limiter-processor.md) - Documentation for the TokenLimiterProcessor in Mastra, which limits the number of tokens in messages. - [Reference: ToolCallFilter](references/reference-processors-tool-call-filter.md) - Documentation for the ToolCallFilter processor in Mastra, which filters out tool calls and results from messages. - [Reference: ToolSearchProcessor](references/reference-processors-tool-search-processor.md) - Documentation for the ToolSearchProcessor in Mastra, which enables dynamic tool discovery and loading for agents with large tool libraries. - [Reference: UnicodeNormalizer](references/reference-processors-unicode-normalizer.md) - Documentation for the UnicodeNormalizer in Mastra, which normalizes Unicode text to ensure consistent formatting and remove potentially problematic characters. - [Reference: WorkingMemory](references/reference-processors-working-memory-processor.md) - Documentation for the WorkingMemory processor in Mastra, which injects persistent user/context data as system instructions. - [Reference: DatabaseConfig](references/reference-rag-database-config.md) - API reference for database-specific configuration types used with vector query tools in Mastra RAG systems. - [Reference: Embed](references/reference-rag-embeddings.md) - Documentation for embedding functionality in Mastra using the AI SDK. - [Reference: MastraServer](references/reference-server-mastra-server.md) - API reference for the MastraServer abstract class used to create server adapters. - [Reference: registerApiRoute()](references/reference-server-register-api-route.md) - API reference for registerApiRoute() function used to define custom HTTP routes for the Mastra server. - [Reference: ClickHouse storage](references/reference-storage-clickhouse.md) - Documentation for the ClickHouse storage implementation in Mastra, including the vNext observability domain. - [Reference: Cloudflare D1 storage](references/reference-storage-cloudflare-d1.md) - Documentation for the Cloudflare D1 SQL storage implementation in Mastra. - [Reference: Composite storage](references/reference-storage-composite.md) - Documentation for combining multiple storage backends in Mastra. - [Reference: Aurora DSQL Storage](references/reference-storage-dsql.md) - Documentation for the Amazon Aurora DSQL storage implementation in Mastra. - [Reference: DuckDB storage](references/reference-storage-duckdb.md) - Documentation for the DuckDB storage implementation in Mastra, an embedded analytical backend for local observability development. - [Reference: LanceDB storage](references/reference-storage-lance.md) - Documentation for the LanceDB storage implementation in Mastra. - [Reference: libSQL storage](references/reference-storage-libsql.md) - Documentation for the libSQL storage implementation in Mastra. - [Reference: MongoDB storage](references/reference-storage-mongodb.md) - Documentation for the MongoDB storage implementation in Mastra. - [Reference: MSSQL storage](references/reference-storage-mssql.md) - Documentation for the MSSQL storage implementation in Mastra. - [Reference: Storage overview](references/reference-storage-overview.md) - Core data schema and table structure for Mastra's storage system. - [Reference: PostgreSQL storage](references/reference-storage-postgresql.md) - Documentation for the PostgreSQL storage implementation in Mastra. - [Reference: Redis Storage](references/reference-storage-redis.md) - Documentation for the Redis storage implementation in Mastra. - [Reference: Upstash storage](references/reference-storage-upstash.md) - Documentation for the Upstash storage implementation in Mastra. - [Reference: MastraModelOutput](references/reference-streaming-agents-MastraModelOutput.md) - Complete reference for MastraModelOutput - the stream object returned by agent.stream() with streaming and promise-based access to model outputs. - [Reference: Agent.streamLegacy() (Legacy)](references/reference-streaming-agents-streamLegacy.md) - Documentation for the legacy `Agent.streamLegacy()` method in Mastra agents. This method is deprecated and will be removed in a future version. - [Reference: Agent.streamUntilIdle()](references/reference-streaming-agents-streamUntilIdle.md) - API reference for Agent.streamUntilIdle(), which keeps an agent stream open until all dispatched background tasks have completed. - [Reference: ChunkType](references/reference-streaming-ChunkType.md) - Documentation for the ChunkType type used in Mastra streaming responses, defining all possible chunk types and their payloads. - [Reference: Run.observeStream()](references/reference-streaming-workflows-observeStream.md) - Documentation for the `Run.observeStream()` method in workflows, which enables reopening the stream of an already active workflow run. - [Reference: Run.resumeStream()](references/reference-streaming-workflows-resumeStream.md) - Documentation for the `Run.resumeStream()` method in workflows, which enables real-time resumption and streaming of suspended workflow runs. - [Reference: Run.stream()](references/reference-streaming-workflows-stream.md) - Documentation for the `Run.stream()` method in workflows, which enables real-time streaming of responses. - [Reference: Run.timeTravelStream()](references/reference-streaming-workflows-timeTravelStream.md) - Documentation for the `Run.timeTravelStream()` method for streaming workflow time travel execution. - [Reference: Templates overview](references/reference-templates-overview.md) - Complete guide to creating, using, and contributing Mastra templates - [Reference: createTool()](references/reference-tools-create-tool.md) - Documentation for the `createTool()` function in Mastra, used to define custom tools for agents. - [Reference: createGraphRAGTool()](references/reference-tools-graph-rag-tool.md) - Documentation for the GraphRAG Tool in Mastra, which enhances RAG by building a graph of semantic relationships between documents. - [Reference: MCPClient](references/reference-tools-mcp-client.md) - API Reference for MCPClient - A class for managing multiple Model Context Protocol servers and their tools. - [Reference: MCPServer](references/reference-tools-mcp-server.md) - API Reference for MCPServer - A class for exposing Mastra tools and capabilities as a Model Context Protocol server. - [Reference: createVectorQueryTool()](references/reference-tools-vector-query-tool.md) - Documentation for the Vector Query Tool in Mastra, which facilitates semantic search over vector stores with filtering and reranking capabilities. - [Reference: libSQL vector store](references/reference-vectors-libsql.md) - Documentation for the LibSQLVector class in Mastra, which provides vector search using libSQL with vector extensions. - [Reference: MongoDB vector store](references/reference-vectors-mongodb.md) - Documentation for the MongoDBVector class in Mastra, which provides vector search using MongoDB Atlas and Atlas Vector Search. - [Reference: PG vector store](references/reference-vectors-pg.md) - Documentation for the PgVector class in Mastra, which provides vector search using PostgreSQL with pgvector extension. - [Reference: Upstash vector store](references/reference-vectors-upstash.md) - Documentation for the UpstashVector class in Mastra, which provides vector search using Upstash Vector. - [Reference: CompositeVoice](references/reference-voice-composite-voice.md) - Documentation for the CompositeVoice class, which enables combining multiple voice providers for flexible text-to-speech and speech-to-text operations. - [Reference: MastraVoice](references/reference-voice-mastra-voice.md) - Documentation for the MastraVoice abstract base class, which defines the core interface for all voice services in Mastra, including speech-to-speech capabilities. - [Reference: voice.addInstructions()](references/reference-voice-voice.addInstructions.md) - Documentation for the addI