@mastra/mcp-docs-server 1.0.0-beta.13 → 1.0.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +78 -78
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +173 -173
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +248 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +338 -338
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Flance.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +139 -139
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +219 -219
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +219 -219
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +235 -235
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +102 -102
- package/.docs/organized/changelogs/%40mastra%2Frag.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Freact.md +77 -70
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +218 -218
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +195 -195
- package/.docs/organized/changelogs/create-mastra.md +13 -13
- package/.docs/organized/changelogs/mastra.md +56 -56
- package/.docs/organized/code-examples/agent-v6.md +210 -0
- package/.docs/organized/code-examples/ai-elements.md +1 -1
- package/.docs/organized/code-examples/client-side-tools.md +1 -1
- package/.docs/raw/agents/adding-voice.mdx +10 -6
- package/.docs/raw/agents/agent-approval.mdx +5 -6
- package/.docs/raw/agents/agent-memory.mdx +22 -30
- package/.docs/raw/agents/guardrails.mdx +60 -50
- package/.docs/raw/agents/networks.mdx +8 -12
- package/.docs/raw/agents/overview.mdx +39 -23
- package/.docs/raw/agents/processors.mdx +20 -19
- package/.docs/raw/agents/structured-output.mdx +11 -7
- package/.docs/raw/agents/using-tools.mdx +4 -5
- package/.docs/raw/deployment/mastra-server.mdx +3 -3
- package/.docs/raw/deployment/overview.mdx +7 -1
- package/.docs/raw/deployment/web-framework.mdx +4 -6
- package/.docs/raw/deployment/workflow-runners.mdx +14 -0
- package/.docs/raw/evals/custom-scorers.mdx +9 -6
- package/.docs/raw/evals/overview.mdx +3 -6
- package/.docs/raw/evals/running-in-ci.mdx +2 -2
- package/.docs/raw/getting-started/manual-install.mdx +20 -20
- package/.docs/raw/getting-started/mcp-docs-server.mdx +2 -2
- package/.docs/raw/getting-started/studio.mdx +1 -1
- package/.docs/raw/guides/agent-frameworks/ai-sdk.mdx +4 -4
- package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +30 -30
- package/.docs/raw/guides/build-your-ui/assistant-ui.mdx +8 -8
- package/.docs/raw/guides/build-your-ui/copilotkit.mdx +11 -11
- package/.docs/raw/guides/deployment/amazon-ec2.mdx +9 -9
- package/.docs/raw/guides/deployment/aws-lambda.mdx +11 -11
- package/.docs/raw/guides/deployment/azure-app-services.mdx +2 -2
- package/.docs/raw/guides/deployment/cloudflare-deployer.mdx +5 -6
- package/.docs/raw/guides/deployment/digital-ocean.mdx +10 -10
- package/.docs/raw/guides/deployment/index.mdx +1 -1
- package/.docs/raw/guides/deployment/inngest.mdx +444 -0
- package/.docs/raw/guides/deployment/netlify-deployer.mdx +4 -4
- package/.docs/raw/guides/deployment/vercel-deployer.mdx +5 -6
- package/.docs/raw/guides/getting-started/astro.mdx +292 -451
- package/.docs/raw/guides/getting-started/express.mdx +7 -7
- package/.docs/raw/guides/getting-started/hono.mdx +18 -18
- package/.docs/raw/guides/getting-started/next-js.mdx +19 -20
- package/.docs/raw/guides/getting-started/quickstart.mdx +4 -4
- package/.docs/raw/guides/getting-started/sveltekit.mdx +238 -409
- package/.docs/raw/guides/getting-started/vite-react.mdx +21 -21
- package/.docs/raw/guides/guide/ai-recruiter.mdx +10 -10
- package/.docs/raw/guides/guide/chef-michel.mdx +9 -11
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +15 -15
- package/.docs/raw/guides/guide/research-assistant.mdx +13 -13
- package/.docs/raw/guides/guide/stock-agent.mdx +5 -5
- package/.docs/raw/guides/guide/web-search.mdx +8 -8
- package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +7 -7
- package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +2 -2
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +1 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/memory.mdx +11 -3
- package/.docs/raw/guides/migrations/upgrade-to-v1/processors.mdx +11 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +41 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +0 -2
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +21 -23
- package/.docs/raw/index.mdx +2 -2
- package/.docs/raw/mastra-cloud/deployment.mdx +39 -0
- package/.docs/raw/mastra-cloud/observability.mdx +9 -15
- package/.docs/raw/mastra-cloud/overview.mdx +14 -44
- package/.docs/raw/mastra-cloud/setup.mdx +64 -0
- package/.docs/raw/mastra-cloud/studio.mdx +35 -0
- package/.docs/raw/mcp/overview.mdx +31 -13
- package/.docs/raw/mcp/publishing-mcp-server.mdx +2 -2
- package/.docs/raw/memory/memory-processors.mdx +9 -9
- package/.docs/raw/memory/message-history.mdx +69 -0
- package/.docs/raw/memory/overview.mdx +34 -76
- package/.docs/raw/memory/semantic-recall.mdx +58 -49
- package/.docs/raw/memory/storage.mdx +188 -0
- package/.docs/raw/memory/working-memory.mdx +7 -7
- package/.docs/raw/observability/logging.mdx +9 -10
- package/.docs/raw/observability/overview.mdx +0 -1
- package/.docs/raw/observability/tracing/bridges/otel.mdx +2 -2
- package/.docs/raw/observability/tracing/exporters/default.mdx +3 -3
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +1 -2
- package/.docs/raw/observability/tracing/overview.mdx +23 -25
- package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +3 -3
- package/.docs/raw/rag/chunking-and-embedding.mdx +6 -6
- package/.docs/raw/rag/graph-rag.mdx +7 -7
- package/.docs/raw/rag/overview.mdx +1 -1
- package/.docs/raw/rag/retrieval.mdx +21 -22
- package/.docs/raw/rag/vector-databases.mdx +22 -22
- package/.docs/raw/reference/agents/agent.mdx +3 -3
- package/.docs/raw/reference/agents/generate.mdx +1 -1
- package/.docs/raw/reference/agents/generateLegacy.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +2 -2
- package/.docs/raw/reference/agents/getDescription.mdx +1 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +2 -2
- package/.docs/raw/reference/agents/getLLM.mdx +2 -2
- package/.docs/raw/reference/agents/getMemory.mdx +2 -2
- package/.docs/raw/reference/agents/getModel.mdx +2 -2
- package/.docs/raw/reference/agents/getTools.mdx +2 -2
- package/.docs/raw/reference/agents/getVoice.mdx +2 -2
- package/.docs/raw/reference/agents/listAgents.mdx +2 -2
- package/.docs/raw/reference/agents/listScorers.mdx +2 -2
- package/.docs/raw/reference/agents/listTools.mdx +2 -2
- package/.docs/raw/reference/agents/listWorkflows.mdx +2 -2
- package/.docs/raw/reference/agents/network.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/chat-route.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/network-route.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-stream.mdx +6 -6
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v4-messages.mdx +3 -3
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v5-messages.mdx +3 -3
- package/.docs/raw/reference/ai-sdk/with-mastra.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/workflow-route.mdx +2 -2
- package/.docs/raw/reference/auth/auth0.mdx +1 -2
- package/.docs/raw/reference/auth/clerk.mdx +1 -2
- package/.docs/raw/reference/auth/firebase.mdx +2 -4
- package/.docs/raw/reference/auth/jwt.mdx +1 -2
- package/.docs/raw/reference/auth/supabase.mdx +1 -2
- package/.docs/raw/reference/auth/workos.mdx +1 -2
- package/.docs/raw/reference/cli/create-mastra.mdx +10 -10
- package/.docs/raw/reference/cli/mastra.mdx +9 -9
- package/.docs/raw/reference/client-js/agents.mdx +1 -2
- package/.docs/raw/reference/client-js/mastra-client.mdx +1 -1
- package/.docs/raw/reference/core/getAgent.mdx +1 -1
- package/.docs/raw/reference/core/getAgentById.mdx +1 -1
- package/.docs/raw/reference/core/getDeployer.mdx +1 -1
- package/.docs/raw/reference/core/getLogger.mdx +1 -1
- package/.docs/raw/reference/core/getMCPServer.mdx +1 -1
- package/.docs/raw/reference/core/getMCPServerById.mdx +1 -1
- package/.docs/raw/reference/core/getMemory.mdx +2 -2
- package/.docs/raw/reference/core/getServer.mdx +1 -1
- package/.docs/raw/reference/core/getStorage.mdx +2 -2
- package/.docs/raw/reference/core/getStoredAgentById.mdx +3 -3
- package/.docs/raw/reference/core/getTelemetry.mdx +1 -1
- package/.docs/raw/reference/core/getVector.mdx +1 -1
- package/.docs/raw/reference/core/getWorkflow.mdx +1 -1
- package/.docs/raw/reference/core/listAgents.mdx +1 -1
- package/.docs/raw/reference/core/listLogs.mdx +1 -1
- package/.docs/raw/reference/core/listLogsByRunId.mdx +1 -1
- package/.docs/raw/reference/core/listMCPServers.mdx +1 -1
- package/.docs/raw/reference/core/listMemory.mdx +2 -2
- package/.docs/raw/reference/core/listStoredAgents.mdx +4 -4
- package/.docs/raw/reference/core/listVectors.mdx +1 -1
- package/.docs/raw/reference/core/listWorkflows.mdx +1 -1
- package/.docs/raw/reference/core/setLogger.mdx +1 -1
- package/.docs/raw/reference/core/setStorage.mdx +2 -2
- package/.docs/raw/reference/core/setTelemetry.mdx +1 -1
- package/.docs/raw/reference/deployer/cloudflare.mdx +1 -2
- package/.docs/raw/reference/deployer/deployer.mdx +0 -1
- package/.docs/raw/reference/deployer/netlify.mdx +1 -1
- package/.docs/raw/reference/deployer/vercel.mdx +2 -4
- package/.docs/raw/reference/evals/answer-relevancy.mdx +1 -1
- package/.docs/raw/reference/evals/answer-similarity.mdx +1 -1
- package/.docs/raw/reference/evals/bias.mdx +1 -1
- package/.docs/raw/reference/evals/completeness.mdx +1 -1
- package/.docs/raw/reference/evals/content-similarity.mdx +1 -1
- package/.docs/raw/reference/evals/context-precision.mdx +1 -1
- package/.docs/raw/reference/evals/faithfulness.mdx +1 -1
- package/.docs/raw/reference/evals/hallucination.mdx +1 -1
- package/.docs/raw/reference/evals/keyword-coverage.mdx +1 -1
- package/.docs/raw/reference/evals/prompt-alignment.mdx +7 -7
- package/.docs/raw/reference/evals/textual-difference.mdx +1 -1
- package/.docs/raw/reference/evals/tone-consistency.mdx +1 -1
- package/.docs/raw/reference/evals/tool-call-accuracy.mdx +10 -10
- package/.docs/raw/reference/evals/toxicity.mdx +1 -1
- package/.docs/raw/reference/logging/pino-logger.mdx +7 -8
- package/.docs/raw/reference/memory/createThread.mdx +2 -2
- package/.docs/raw/reference/memory/deleteMessages.mdx +2 -2
- package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +2 -2
- package/.docs/raw/reference/memory/memory-class.mdx +3 -3
- package/.docs/raw/reference/memory/query.mdx +2 -2
- package/.docs/raw/reference/memory/recall.mdx +2 -2
- package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +1 -1
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +2 -2
- package/.docs/raw/reference/processors/language-detector.mdx +2 -2
- package/.docs/raw/reference/processors/message-history-processor.mdx +2 -2
- package/.docs/raw/reference/processors/moderation-processor.mdx +3 -3
- package/.docs/raw/reference/processors/pii-detector.mdx +3 -3
- package/.docs/raw/reference/processors/processor-interface.mdx +13 -13
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +2 -2
- package/.docs/raw/reference/processors/semantic-recall-processor.mdx +2 -2
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +2 -2
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +40 -19
- package/.docs/raw/reference/processors/tool-call-filter.mdx +3 -3
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +2 -2
- package/.docs/raw/reference/processors/working-memory-processor.mdx +3 -3
- package/.docs/raw/reference/rag/chunk.mdx +1 -1
- package/.docs/raw/reference/rag/extract-params.mdx +2 -2
- package/.docs/raw/reference/rag/metadata-filters.mdx +7 -7
- package/.docs/raw/reference/server/create-route.mdx +13 -13
- package/.docs/raw/reference/server/express-adapter.mdx +6 -7
- package/.docs/raw/reference/server/hono-adapter.mdx +6 -7
- package/.docs/raw/reference/server/mastra-server.mdx +20 -20
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +7 -5
- package/.docs/raw/reference/storage/cloudflare.mdx +2 -2
- package/.docs/raw/reference/storage/convex.mdx +6 -6
- package/.docs/raw/reference/storage/dynamodb.mdx +4 -4
- package/.docs/raw/reference/storage/lance.mdx +6 -5
- package/.docs/raw/reference/storage/libsql.mdx +72 -54
- package/.docs/raw/reference/storage/mongodb.mdx +84 -9
- package/.docs/raw/reference/storage/mssql.mdx +8 -6
- package/.docs/raw/{memory → reference}/storage/overview.mdx +12 -110
- package/.docs/raw/reference/storage/postgresql.mdx +82 -9
- package/.docs/raw/reference/storage/upstash.mdx +74 -2
- package/.docs/raw/reference/streaming/agents/stream.mdx +5 -5
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +2 -2
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/resumeStream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/stream.mdx +2 -2
- package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +4 -4
- package/.docs/raw/reference/templates/overview.mdx +1 -2
- package/.docs/raw/reference/tools/create-tool.mdx +1 -4
- package/.docs/raw/reference/tools/vector-query-tool.mdx +1 -1
- package/.docs/raw/reference/vectors/astra.mdx +3 -3
- package/.docs/raw/reference/vectors/chroma.mdx +3 -3
- package/.docs/raw/reference/vectors/convex.mdx +12 -12
- package/.docs/raw/reference/vectors/couchbase.mdx +5 -5
- package/.docs/raw/reference/vectors/duckdb.mdx +10 -10
- package/.docs/raw/reference/vectors/elasticsearch.mdx +4 -4
- package/.docs/raw/reference/vectors/lance.mdx +4 -4
- package/.docs/raw/reference/vectors/libsql.mdx +61 -11
- package/.docs/raw/reference/vectors/mongodb.mdx +58 -5
- package/.docs/raw/reference/vectors/pg.mdx +53 -6
- package/.docs/raw/reference/vectors/pinecone.mdx +3 -3
- package/.docs/raw/reference/vectors/qdrant.mdx +3 -3
- package/.docs/raw/reference/vectors/s3vectors.mdx +6 -6
- package/.docs/raw/reference/vectors/turbopuffer.mdx +4 -4
- package/.docs/raw/reference/vectors/upstash.mdx +55 -6
- package/.docs/raw/reference/vectors/vectorize.mdx +3 -3
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/restart.mdx +1 -3
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/start.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/startAsync.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +5 -5
- package/.docs/raw/reference/workflows/run.mdx +1 -1
- package/.docs/raw/reference/workflows/step.mdx +3 -3
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +3 -3
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +6 -6
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +7 -7
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow.mdx +3 -3
- package/.docs/raw/server/auth/auth0.mdx +20 -14
- package/.docs/raw/server/auth/clerk.mdx +16 -9
- package/.docs/raw/server/auth/firebase.mdx +21 -15
- package/.docs/raw/server/auth/jwt.mdx +14 -7
- package/.docs/raw/server/auth/supabase.mdx +16 -9
- package/.docs/raw/server/auth/workos.mdx +19 -13
- package/.docs/raw/server/custom-adapters.mdx +10 -10
- package/.docs/raw/server/custom-api-routes.mdx +2 -4
- package/.docs/raw/server/mastra-client.mdx +24 -13
- package/.docs/raw/server/mastra-server.mdx +3 -3
- package/.docs/raw/server/middleware.mdx +7 -7
- package/.docs/raw/server/request-context.mdx +31 -30
- package/.docs/raw/server/server-adapters.mdx +6 -6
- package/.docs/raw/streaming/events.mdx +14 -7
- package/.docs/raw/streaming/overview.mdx +21 -10
- package/.docs/raw/streaming/tool-streaming.mdx +6 -6
- package/.docs/raw/streaming/workflow-streaming.mdx +6 -8
- package/.docs/raw/tools-mcp/advanced-usage.mdx +2 -2
- package/.docs/raw/tools-mcp/mcp-overview.mdx +31 -12
- package/.docs/raw/tools-mcp/overview.mdx +9 -10
- package/.docs/raw/voice/overview.mdx +2 -2
- package/.docs/raw/workflows/agents-and-tools.mdx +28 -19
- package/.docs/raw/workflows/control-flow.mdx +27 -40
- package/.docs/raw/workflows/error-handling.mdx +15 -22
- package/.docs/raw/workflows/human-in-the-loop.mdx +6 -7
- package/.docs/raw/workflows/input-data-mapping.mdx +7 -7
- package/.docs/raw/workflows/overview.mdx +34 -23
- package/.docs/raw/workflows/snapshots.mdx +16 -45
- package/.docs/raw/workflows/suspend-and-resume.mdx +7 -7
- package/.docs/raw/workflows/time-travel.mdx +16 -16
- package/.docs/raw/workflows/workflow-state.mdx +5 -8
- package/CHANGELOG.md +16 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/stdio.js +53 -0
- package/package.json +3 -3
- package/.docs/raw/mastra-cloud/dashboard.mdx +0 -96
- package/.docs/raw/mastra-cloud/setting-up.mdx +0 -102
- package/.docs/raw/memory/conversation-history.mdx +0 -24
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +0 -140
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +0 -150
- package/.docs/raw/memory/storage/memory-with-pg.mdx +0 -138
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +0 -146
- package/.docs/raw/memory/threads-and-resources.mdx +0 -95
- package/.docs/raw/workflows/inngest-workflow.mdx +0 -363
|
@@ -35,18 +35,17 @@ Mastra includes several processors for common use cases. You can also create cus
|
|
|
35
35
|
|
|
36
36
|
Import and instantiate the processor, then pass it to the agent's `inputProcessors` or `outputProcessors` array:
|
|
37
37
|
|
|
38
|
-
```typescript {
|
|
39
|
-
import { openai } from "@ai-sdk/openai";
|
|
38
|
+
```typescript {2,8-14} title="src/mastra/agents/moderated-agent.ts"
|
|
40
39
|
import { Agent } from "@mastra/core/agent";
|
|
41
40
|
import { ModerationProcessor } from "@mastra/core/processors";
|
|
42
41
|
|
|
43
42
|
export const moderatedAgent = new Agent({
|
|
44
43
|
name: "moderated-agent",
|
|
45
44
|
instructions: "You are a helpful assistant",
|
|
46
|
-
model: openai
|
|
45
|
+
model: "openai/gpt-4o-mini",
|
|
47
46
|
inputProcessors: [
|
|
48
47
|
new ModerationProcessor({
|
|
49
|
-
model: openai
|
|
48
|
+
model: "openai/gpt-4.1-nano",
|
|
50
49
|
categories: ["hate", "harassment", "violence"],
|
|
51
50
|
threshold: 0.7,
|
|
52
51
|
strategy: "block",
|
|
@@ -77,7 +76,7 @@ When memory is enabled on an agent, memory processors are automatically added to
|
|
|
77
76
|
```
|
|
78
77
|
[Memory Processors] → [Your inputProcessors]
|
|
79
78
|
```
|
|
80
|
-
Memory loads
|
|
79
|
+
Memory loads message history first, then your processors run.
|
|
81
80
|
|
|
82
81
|
**Output processors:**
|
|
83
82
|
```
|
|
@@ -93,7 +92,7 @@ Custom processors implement the `Processor` interface:
|
|
|
93
92
|
|
|
94
93
|
### Custom input processor
|
|
95
94
|
|
|
96
|
-
```typescript title="src/mastra/processors/custom-input.ts"
|
|
95
|
+
```typescript title="src/mastra/processors/custom-input.ts"
|
|
97
96
|
import type {
|
|
98
97
|
Processor,
|
|
99
98
|
MastraDBMessage,
|
|
@@ -141,7 +140,7 @@ The framework handles both return formats, so modifying system messages is optio
|
|
|
141
140
|
|
|
142
141
|
To modify system messages (e.g., trim verbose prompts for smaller models), return an object with both `messages` and `systemMessages`:
|
|
143
142
|
|
|
144
|
-
```typescript title="src/mastra/processors/system-trimmer.ts"
|
|
143
|
+
```typescript title="src/mastra/processors/system-trimmer.ts"
|
|
145
144
|
import type { Processor, CoreMessage, MastraDBMessage } from "@mastra/core";
|
|
146
145
|
|
|
147
146
|
export class SystemTrimmer implements Processor {
|
|
@@ -174,7 +173,7 @@ This is useful for:
|
|
|
174
173
|
|
|
175
174
|
While `processInput` runs once at the start of agent execution, `processInputStep` runs at **each step** of the agentic loop (including tool call continuations). This enables per-step configuration changes like dynamic model switching or tool choice modifications.
|
|
176
175
|
|
|
177
|
-
```typescript title="src/mastra/processors/step-processor.ts"
|
|
176
|
+
```typescript title="src/mastra/processors/step-processor.ts"
|
|
178
177
|
import type { Processor, ProcessInputStepArgs, ProcessInputStepResult } from "@mastra/core";
|
|
179
178
|
|
|
180
179
|
export class DynamicModelProcessor implements Processor {
|
|
@@ -247,7 +246,7 @@ await agent.generate({
|
|
|
247
246
|
|
|
248
247
|
### Custom output processor
|
|
249
248
|
|
|
250
|
-
```typescript title="src/mastra/processors/custom-output.ts"
|
|
249
|
+
```typescript title="src/mastra/processors/custom-output.ts"
|
|
251
250
|
import type {
|
|
252
251
|
Processor,
|
|
253
252
|
MastraDBMessage,
|
|
@@ -292,14 +291,13 @@ Mastra provides utility processors for common tasks:
|
|
|
292
291
|
|
|
293
292
|
Prevents context window overflow by removing older messages when the total token count exceeds a specified limit.
|
|
294
293
|
|
|
295
|
-
```typescript
|
|
294
|
+
```typescript {7-10}
|
|
296
295
|
import { Agent } from "@mastra/core/agent";
|
|
297
296
|
import { TokenLimiter } from "@mastra/core/processors";
|
|
298
|
-
import { openai } from "@ai-sdk/openai";
|
|
299
297
|
|
|
300
298
|
const agent = new Agent({
|
|
301
299
|
name: "my-agent",
|
|
302
|
-
model: openai
|
|
300
|
+
model: "openai/gpt-4o",
|
|
303
301
|
inputProcessors: [
|
|
304
302
|
// Ensure the total tokens don't exceed ~127k
|
|
305
303
|
new TokenLimiter(127000),
|
|
@@ -309,7 +307,7 @@ const agent = new Agent({
|
|
|
309
307
|
|
|
310
308
|
The `TokenLimiter` uses the `o200k_base` encoding by default (suitable for GPT-4o). You can specify other encodings for different models:
|
|
311
309
|
|
|
312
|
-
```typescript
|
|
310
|
+
```typescript {6-9}
|
|
313
311
|
import cl100k_base from "js-tiktoken/ranks/cl100k_base";
|
|
314
312
|
|
|
315
313
|
const agent = new Agent({
|
|
@@ -327,14 +325,13 @@ const agent = new Agent({
|
|
|
327
325
|
|
|
328
326
|
Removes tool calls from messages sent to the LLM, saving tokens by excluding potentially verbose tool interactions.
|
|
329
327
|
|
|
330
|
-
```typescript
|
|
328
|
+
```typescript {7-16}
|
|
331
329
|
import { Agent } from "@mastra/core/agent";
|
|
332
330
|
import { ToolCallFilter, TokenLimiter } from "@mastra/core/processors";
|
|
333
|
-
import { openai } from "@ai-sdk/openai";
|
|
334
331
|
|
|
335
332
|
const agent = new Agent({
|
|
336
333
|
name: "my-agent",
|
|
337
|
-
model: openai
|
|
334
|
+
model: "openai/gpt-4o",
|
|
338
335
|
inputProcessors: [
|
|
339
336
|
// Example 1: Remove all tool calls/results
|
|
340
337
|
new ToolCallFilter(),
|
|
@@ -348,13 +345,17 @@ const agent = new Agent({
|
|
|
348
345
|
});
|
|
349
346
|
```
|
|
350
347
|
|
|
351
|
-
|
|
348
|
+
:::note
|
|
349
|
+
|
|
350
|
+
The example above filters tool calls and limits tokens for the LLM, but these filtered messages will still be saved to memory. To also filter messages before they're saved to memory, manually add memory processors before utility processors. See [Memory Processors](/docs/v1/memory/memory-processors#manual-control-and-deduplication) for details.
|
|
351
|
+
|
|
352
|
+
:::
|
|
352
353
|
|
|
353
354
|
## Using workflows as processors
|
|
354
355
|
|
|
355
356
|
You can use Mastra workflows as processors to create complex processing pipelines with parallel execution, conditional branching, and error handling:
|
|
356
357
|
|
|
357
|
-
```typescript title="src/mastra/processors/moderation-workflow.ts"
|
|
358
|
+
```typescript title="src/mastra/processors/moderation-workflow.ts"
|
|
358
359
|
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
359
360
|
import { ProcessorStepSchema } from "@mastra/core/processors";
|
|
360
361
|
import { Agent } from "@mastra/core/agent";
|
|
@@ -387,7 +388,7 @@ When an agent is registered with Mastra, processor workflows are automatically r
|
|
|
387
388
|
|
|
388
389
|
Processors can request that the LLM retry its response with feedback. This is useful for implementing quality checks, output validation, or iterative refinement:
|
|
389
390
|
|
|
390
|
-
```typescript title="src/mastra/processors/quality-checker.ts"
|
|
391
|
+
```typescript title="src/mastra/processors/quality-checker.ts"
|
|
391
392
|
import type { Processor } from "@mastra/core";
|
|
392
393
|
|
|
393
394
|
export class QualityChecker implements Processor {
|
|
@@ -23,7 +23,7 @@ Agents can return structured data by defining the expected output with either [Z
|
|
|
23
23
|
|
|
24
24
|
Define the `output` shape using [Zod](https://zod.dev/):
|
|
25
25
|
|
|
26
|
-
```typescript
|
|
26
|
+
```typescript
|
|
27
27
|
import { z } from "zod";
|
|
28
28
|
|
|
29
29
|
const response = await testAgent.generate("Help me plan my day.", {
|
|
@@ -45,7 +45,7 @@ console.log(response.object);
|
|
|
45
45
|
|
|
46
46
|
You can also use JSON Schema to define your output structure:
|
|
47
47
|
|
|
48
|
-
```typescript
|
|
48
|
+
```typescript
|
|
49
49
|
const response = await testAgent.generate("Help me plan my day.", {
|
|
50
50
|
structuredOutput: {
|
|
51
51
|
schema: {
|
|
@@ -72,7 +72,11 @@ console.log(response.object);
|
|
|
72
72
|
</Tabs>
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
:::info
|
|
76
|
+
|
|
77
|
+
Visit [.generate()](/reference/v1/agents/generate#structuredoutput) for a full list of configuration options.
|
|
78
|
+
|
|
79
|
+
:::
|
|
76
80
|
|
|
77
81
|
### Example output
|
|
78
82
|
|
|
@@ -99,7 +103,7 @@ The `response.object` will contain the structured data as defined by the schema.
|
|
|
99
103
|
|
|
100
104
|
Streaming also supports structured output. The final structured object is available on `stream.fullStream` and after the stream completes on `stream.object`. Text stream chunks are still emitted, but they contain natural language text rather than structured data.
|
|
101
105
|
|
|
102
|
-
```typescript
|
|
106
|
+
```typescript
|
|
103
107
|
import { z } from "zod";
|
|
104
108
|
|
|
105
109
|
const stream = await testAgent.stream("Help me plan my day.", {
|
|
@@ -131,7 +135,7 @@ for await (const chunk of stream.textStream) {
|
|
|
131
135
|
|
|
132
136
|
When your main agent isn't proficient at creating structured output you can provide a `model` to `structuredOutput`. In this case, Mastra uses a second agent under the hood to extract structured data from the main agent's natural language response. This makes two LLM calls, one to generate the response and another to turn that response into the structured object, which adds some latency and cost but can improve accuracy for complex structuring tasks.
|
|
133
137
|
|
|
134
|
-
```typescript
|
|
138
|
+
```typescript
|
|
135
139
|
import { z } from "zod";
|
|
136
140
|
|
|
137
141
|
const response = await testAgent.generate("Analyze the TypeScript programming language.", {
|
|
@@ -162,7 +166,7 @@ By default, Mastra passes the schema to the model provider using the `response_f
|
|
|
162
166
|
|
|
163
167
|
If your model provider doesn't support `response_format`, you'll get an error from the API. When this happens, set `jsonPromptInjection: true`. This adds the schema to the system prompt instead, instructing the model to output JSON. This is less reliable than the API parameter approach.
|
|
164
168
|
|
|
165
|
-
```typescript
|
|
169
|
+
```typescript
|
|
166
170
|
import { z } from "zod";
|
|
167
171
|
|
|
168
172
|
const response = await testAgent.generate("Help me plan my day.", {
|
|
@@ -198,7 +202,7 @@ const response = await agentWithTools.generate("Your prompt", {
|
|
|
198
202
|
|
|
199
203
|
When schema validation fails, you can control how errors are handled using `errorStrategy`. The default `strict` strategy throws an error, while `warn` logs a warning and continues. The `fallback` strategy returns the values provided using `fallbackValue`.
|
|
200
204
|
|
|
201
|
-
```typescript
|
|
205
|
+
```typescript
|
|
202
206
|
import { z } from "zod";
|
|
203
207
|
|
|
204
208
|
const response = await testAgent.generate("Tell me about TypeScript.", {
|
|
@@ -17,7 +17,7 @@ When creating tools, keep descriptions simple and focused on what the tool does,
|
|
|
17
17
|
|
|
18
18
|
This example shows how to create a tool that fetches weather data from an API. When the agent calls the tool, it provides the required input as defined by the tool's `inputSchema`. The tool accesses this data through its `inputData` parameter, which in this example includes the `location` used in the weather API query.
|
|
19
19
|
|
|
20
|
-
```typescript
|
|
20
|
+
```typescript title="src/mastra/tools/weather-tool.ts"
|
|
21
21
|
import { createTool } from "@mastra/core/tools";
|
|
22
22
|
import { z } from "zod";
|
|
23
23
|
|
|
@@ -47,7 +47,7 @@ To make a tool available to an agent, add it to `tools`. Mentioning available to
|
|
|
47
47
|
|
|
48
48
|
An agent can use multiple tools to handle more complex tasks by delegating specific parts to individual tools. The agent decides which tools to use based on the user's message, the agent's instructions, and the tool descriptions and schemas.
|
|
49
49
|
|
|
50
|
-
```typescript {
|
|
50
|
+
```typescript {11} title="src/mastra/agents/weather-agent.ts"
|
|
51
51
|
import { Agent } from "@mastra/core/agent";
|
|
52
52
|
import { weatherTool } from "../tools/weather-tool";
|
|
53
53
|
|
|
@@ -66,7 +66,7 @@ export const weatherAgent = new Agent({
|
|
|
66
66
|
|
|
67
67
|
The agent uses the tool's `inputSchema` to infer what data the tool expects. In this case, it extracts `London` as the `location` from the message and passes it to the tool's inputData parameter.
|
|
68
68
|
|
|
69
|
-
```typescript title="src/test-tool.ts"
|
|
69
|
+
```typescript title="src/test-tool.ts"
|
|
70
70
|
import { mastra } from "./mastra";
|
|
71
71
|
|
|
72
72
|
const agent = mastra.getAgent("weatherAgent");
|
|
@@ -78,14 +78,13 @@ const result = await agent.generate("What's the weather in London?");
|
|
|
78
78
|
|
|
79
79
|
When multiple tools are available, the agent may choose to use one, several, or none, depending on what's needed to answer the query.
|
|
80
80
|
|
|
81
|
-
```typescript {
|
|
81
|
+
```typescript {7} title="src/mastra/agents/weather-agent.ts"
|
|
82
82
|
import { weatherTool } from "../tools/weather-tool";
|
|
83
83
|
import { activitiesTool } from "../tools/activities-tool";
|
|
84
84
|
|
|
85
85
|
export const weatherAgent = new Agent({
|
|
86
86
|
id: "weather-agent",
|
|
87
87
|
name: "Weather Agent",
|
|
88
|
-
// ..
|
|
89
88
|
tools: { weatherTool, activitiesTool },
|
|
90
89
|
});
|
|
91
90
|
```
|
|
@@ -26,7 +26,7 @@ tsconfig.json
|
|
|
26
26
|
|
|
27
27
|
The `mastra build` command starts the build process:
|
|
28
28
|
|
|
29
|
-
```bash
|
|
29
|
+
```bash
|
|
30
30
|
mastra build
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ mastra build
|
|
|
34
34
|
|
|
35
35
|
If your Mastra files are located elsewhere, use the `--dir` flag to specify the custom location. The `--dir` flag tells Mastra where to find your entry point file (`index.ts` or `index.js`) and related directories.
|
|
36
36
|
|
|
37
|
-
```bash
|
|
37
|
+
```bash
|
|
38
38
|
mastra build --dir ./my-project/mastra
|
|
39
39
|
```
|
|
40
40
|
|
|
@@ -68,6 +68,6 @@ If a `public` folder exists in `src/mastra`, its contents are copied into the `.
|
|
|
68
68
|
|
|
69
69
|
Start the HTTP server:
|
|
70
70
|
|
|
71
|
-
```bash
|
|
71
|
+
```bash
|
|
72
72
|
node .mastra/output/index.mjs
|
|
73
73
|
```
|
|
@@ -22,7 +22,7 @@ Mastra can run against any of these runtime environments:
|
|
|
22
22
|
|
|
23
23
|
Mastra provides a [server](/docs/v1/server/mastra-server) powered by Hono that can be deployed independently. Use the `mastra build` command to build your application and deploy the output to your preferred VM, container, or PaaS platform.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Visit the [Mastra server deployment guide](/docs/v1/deployment/mastra-server).
|
|
26
26
|
|
|
27
27
|
### Monorepo
|
|
28
28
|
|
|
@@ -55,3 +55,9 @@ When Mastra is integrated with a web framework, it deploys alongside your applic
|
|
|
55
55
|
We're building Mastra Cloud to be the easiest place to deploy and observe your Mastra agents. It's currently in beta.
|
|
56
56
|
|
|
57
57
|
Learn more in the [Mastra Cloud docs](/docs/v1/mastra-cloud/overview).
|
|
58
|
+
|
|
59
|
+
## Workflow Runners
|
|
60
|
+
|
|
61
|
+
Mastra workflows run using the built-in execution engine by default. For production workloads requiring managed infrastructure, workflows can also be deployed to specialized platforms like [Inngest](https://www.inngest.com) that provide step memoization, automatic retries, and real-time monitoring.
|
|
62
|
+
|
|
63
|
+
Visit the [Workflow Runners guide](/docs/v1/deployment/workflow-runners) for execution options and the [Inngest deployment guide](/guides/v1/deployment/inngest) for setup instructions.
|
|
@@ -8,7 +8,7 @@ description: "Learn how Mastra can be deployed when integrated with a Web Framew
|
|
|
8
8
|
When Mastra is integrated with a web framework, it deploys alongside your application using the framework's standard deployment process. Follow the instructions below to ensure your Mastra integration deploys correctly.
|
|
9
9
|
|
|
10
10
|
:::warning
|
|
11
|
-
If you're deploying to a cloud provider, remove any usage of [LibSQLStore](/
|
|
11
|
+
If you're deploying to a cloud provider, remove any usage of [LibSQLStore](/reference/v1/storage/libsql) from your Mastra configuration. LibSQLStore requires filesystem access and is not compatible with serverless platforms.
|
|
12
12
|
:::
|
|
13
13
|
|
|
14
14
|
Integration guides:
|
|
@@ -20,7 +20,7 @@ Integration guides:
|
|
|
20
20
|
|
|
21
21
|
If you've integrated Mastra with Next.js [by following our guide](/guides/v1/getting-started/next-js) and plan to deploy to Vercel, add `serverExternalPackages: ["@mastra/*"]` to your `next.config.ts`:
|
|
22
22
|
|
|
23
|
-
```typescript {4} title="next.config.ts"
|
|
23
|
+
```typescript {4} title="next.config.ts"
|
|
24
24
|
import type { NextConfig } from "next";
|
|
25
25
|
|
|
26
26
|
const nextConfig: NextConfig = {
|
|
@@ -34,12 +34,11 @@ export default nextConfig;
|
|
|
34
34
|
|
|
35
35
|
If you've integrated Mastra with Astro [by following our guide](/guides/v1/getting-started/astro) and plan to deploy to Vercel, add the Vercel adapter and server output to your `astro.config.mjs`:
|
|
36
36
|
|
|
37
|
-
```javascript {2,6
|
|
37
|
+
```javascript {2,5-6} title="astro.config.mjs"
|
|
38
38
|
import { defineConfig } from "astro/config";
|
|
39
39
|
import vercel from "@astrojs/vercel";
|
|
40
40
|
|
|
41
41
|
export default defineConfig({
|
|
42
|
-
// ...
|
|
43
42
|
adapter: vercel(),
|
|
44
43
|
output: "server",
|
|
45
44
|
});
|
|
@@ -49,12 +48,11 @@ export default defineConfig({
|
|
|
49
48
|
|
|
50
49
|
If you've integrated Mastra with Astro [by following our guide](/guides/v1/getting-started/astro) and plan to deploy to Netlify, add the Netlify adapter and server output to your `astro.config.mjs`:
|
|
51
50
|
|
|
52
|
-
```javascript {2,6
|
|
51
|
+
```javascript {2,5-6} title="astro.config.mjs"
|
|
53
52
|
import { defineConfig } from "astro/config";
|
|
54
53
|
import netlify from "@astrojs/netlify";
|
|
55
54
|
|
|
56
55
|
export default defineConfig({
|
|
57
|
-
// ...
|
|
58
56
|
adapter: netlify(),
|
|
59
57
|
output: "server",
|
|
60
58
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Workflow Runners | Deployment"
|
|
3
|
+
description: "Deploy Mastra workflows to specialized workflow execution platforms"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Workflow Runners
|
|
7
|
+
|
|
8
|
+
Mastra [workflows](../workflows/overview.mdx) can be executed using the built-in workflow runner or deployed to specialized workflow execution platforms that handle orchestration, monitoring, and reliability.
|
|
9
|
+
|
|
10
|
+
## Inngest
|
|
11
|
+
|
|
12
|
+
Inngest is a developer platform for running background workflows without managing infrastructure. Mastra workflows can be deployed to Inngest, which provides step memoization, automatic retries, real-time monitoring, and suspend/resume capabilities.
|
|
13
|
+
|
|
14
|
+
Visit the [Inngest deployment guide](/guides/v1/deployment/inngest) for setup instructions and the [Inngest workflow example](https://github.com/mastra-ai/mastra/tree/main/examples/inngest) for a complete implementation.
|
|
@@ -65,7 +65,6 @@ For type safety and compatibility with both live agent scoring and trace scoring
|
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
67
|
const myScorer = createScorer({
|
|
68
|
-
// ...
|
|
69
68
|
type: "agent", // Automatically handles agent input/output types
|
|
70
69
|
}).generateScore(({ run, results }) => {
|
|
71
70
|
// run.output is automatically typed as ScorerRunOutputForAgent
|
|
@@ -241,9 +240,13 @@ A custom scorer in Mastra uses `createScorer` with four core components:
|
|
|
241
240
|
|
|
242
241
|
Together, these components allow you to define custom evaluation logic using LLMs as judges.
|
|
243
242
|
|
|
244
|
-
|
|
243
|
+
:::info
|
|
245
244
|
|
|
246
|
-
|
|
245
|
+
Visit [createScorer](/reference/v1/evals/create-scorer) for the full API and configuration options.
|
|
246
|
+
|
|
247
|
+
:::
|
|
248
|
+
|
|
249
|
+
```typescript title="src/mastra/scorers/gluten-checker.ts"
|
|
247
250
|
import { createScorer } from "@mastra/core/evals";
|
|
248
251
|
import { z } from "zod";
|
|
249
252
|
|
|
@@ -399,7 +402,7 @@ The reason generation step creates explanations that help users understand why a
|
|
|
399
402
|
|
|
400
403
|
## High gluten-free example
|
|
401
404
|
|
|
402
|
-
```typescript title="src/example-high-gluten-free.ts"
|
|
405
|
+
```typescript title="src/example-high-gluten-free.ts"
|
|
403
406
|
const result = await glutenCheckerScorer.run({
|
|
404
407
|
input: [{ role: 'user', content: 'Mix rice, beans, and vegetables' }],
|
|
405
408
|
output: { text: 'Mix rice, beans, and vegetables' },
|
|
@@ -425,7 +428,7 @@ console.log('Reason:', result.reason);
|
|
|
425
428
|
|
|
426
429
|
## Partial gluten example
|
|
427
430
|
|
|
428
|
-
```typescript title="src/example-partial-gluten.ts"
|
|
431
|
+
```typescript title="src/example-partial-gluten.ts"
|
|
429
432
|
const result = await glutenCheckerScorer.run({
|
|
430
433
|
input: [{ role: "user", content: "Mix flour and water to make dough" }],
|
|
431
434
|
output: { text: "Mix flour and water to make dough" },
|
|
@@ -451,7 +454,7 @@ console.log("Reason:", result.reason);
|
|
|
451
454
|
|
|
452
455
|
## Low gluten-free example
|
|
453
456
|
|
|
454
|
-
```typescript title="src/example-low-gluten-free.ts"
|
|
457
|
+
```typescript title="src/example-low-gluten-free.ts"
|
|
455
458
|
const result = await glutenCheckerScorer.run({
|
|
456
459
|
input: [{ role: "user", content: "Add soy sauce and noodles" }],
|
|
457
460
|
output: { text: "Add soy sauce and noodles" },
|
|
@@ -23,7 +23,7 @@ There are different kinds of scorers, each serving a specific purpose. Here are
|
|
|
23
23
|
|
|
24
24
|
To access Mastra's scorers feature install the `@mastra/evals` package.
|
|
25
25
|
|
|
26
|
-
```bash
|
|
26
|
+
```bash
|
|
27
27
|
npm install @mastra/evals@beta
|
|
28
28
|
```
|
|
29
29
|
|
|
@@ -35,7 +35,7 @@ npm install @mastra/evals@beta
|
|
|
35
35
|
|
|
36
36
|
You can add built-in scorers to your agents to automatically evaluate their outputs. See the [full list of built-in scorers](/docs/v1/evals/built-in-scorers) for all available options.
|
|
37
37
|
|
|
38
|
-
```typescript title="src/mastra/agents/evaluated-agent.ts"
|
|
38
|
+
```typescript title="src/mastra/agents/evaluated-agent.ts"
|
|
39
39
|
import { Agent } from "@mastra/core/agent";
|
|
40
40
|
import {
|
|
41
41
|
createAnswerRelevancyScorer,
|
|
@@ -43,7 +43,6 @@ import {
|
|
|
43
43
|
} from "@mastra/evals/scorers/prebuilt";
|
|
44
44
|
|
|
45
45
|
export const evaluatedAgent = new Agent({
|
|
46
|
-
// ...
|
|
47
46
|
scorers: {
|
|
48
47
|
relevancy: {
|
|
49
48
|
scorer: createAnswerRelevancyScorer({ model: "openai/gpt-4.1-nano" }),
|
|
@@ -61,13 +60,12 @@ export const evaluatedAgent = new Agent({
|
|
|
61
60
|
|
|
62
61
|
You can also add scorers to individual workflow steps to evaluate outputs at specific points in your process:
|
|
63
62
|
|
|
64
|
-
```typescript title="src/mastra/workflows/content-generation.ts"
|
|
63
|
+
```typescript title="src/mastra/workflows/content-generation.ts"
|
|
65
64
|
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
66
65
|
import { z } from "zod";
|
|
67
66
|
import { customStepScorer } from "../scorers/custom-step-scorer";
|
|
68
67
|
|
|
69
68
|
const contentStep = createStep({
|
|
70
|
-
// ...
|
|
71
69
|
scorers: {
|
|
72
70
|
customStepScorer: {
|
|
73
71
|
scorer: customStepScorer(),
|
|
@@ -115,7 +113,6 @@ To score traces, you first need to register your scorers with your Mastra instan
|
|
|
115
113
|
|
|
116
114
|
```typescript
|
|
117
115
|
const mastra = new Mastra({
|
|
118
|
-
// ...
|
|
119
116
|
scorers: {
|
|
120
117
|
answerRelevancy: myAnswerRelevancyScorer,
|
|
121
118
|
responseQuality: myResponseQualityScorer,
|
|
@@ -15,7 +15,7 @@ You can use any testing framework that supports ESM modules, such as [Vitest](ht
|
|
|
15
15
|
|
|
16
16
|
Use `runEvals` to evaluate your agent against multiple test cases. The function accepts an array of data items, each containing an `input` and optional `groundTruth` for scorer validation.
|
|
17
17
|
|
|
18
|
-
```typescript
|
|
18
|
+
```typescript title="src/mastra/agents/weather-agent.test.ts"
|
|
19
19
|
import { describe, it, expect } from 'vitest';
|
|
20
20
|
import { createScorer, runEvals } from "@mastra/core/evals";
|
|
21
21
|
import { weatherAgent } from "./weather-agent";
|
|
@@ -72,7 +72,7 @@ The `runEvals` function returns an object with:
|
|
|
72
72
|
|
|
73
73
|
Create separate test cases for different evaluation scenarios:
|
|
74
74
|
|
|
75
|
-
```typescript
|
|
75
|
+
```typescript title="src/mastra/agents/weather-agent.test.ts"
|
|
76
76
|
describe('Weather Agent Tests', () => {
|
|
77
77
|
const locationScorer = createScorer({ /* ... */ });
|
|
78
78
|
|
|
@@ -22,7 +22,7 @@ If you prefer not to use our automatic CLI tool, you can set up your project you
|
|
|
22
22
|
|
|
23
23
|
Create a new project and change directory:
|
|
24
24
|
|
|
25
|
-
```bash
|
|
25
|
+
```bash
|
|
26
26
|
mkdir my-first-agent && cd my-first-agent
|
|
27
27
|
```
|
|
28
28
|
|
|
@@ -31,7 +31,7 @@ Initialize a TypeScript project and install the following dependencies:
|
|
|
31
31
|
<Tabs>
|
|
32
32
|
<TabItem value="npm" label="npm">
|
|
33
33
|
|
|
34
|
-
```bash
|
|
34
|
+
```bash
|
|
35
35
|
npm init -y
|
|
36
36
|
npm install -D typescript @types/node mastra@beta
|
|
37
37
|
npm install @mastra/core@beta zod@^4
|
|
@@ -40,7 +40,7 @@ npm install @mastra/core@beta zod@^4
|
|
|
40
40
|
</TabItem>
|
|
41
41
|
<TabItem value="pnpm" label="pnpm">
|
|
42
42
|
|
|
43
|
-
```bash
|
|
43
|
+
```bash
|
|
44
44
|
pnpm init
|
|
45
45
|
pnpm add -D typescript @types/node mastra@beta
|
|
46
46
|
pnpm add @mastra/core@beta zod@^4
|
|
@@ -49,7 +49,7 @@ pnpm add @mastra/core@beta zod@^4
|
|
|
49
49
|
</TabItem>
|
|
50
50
|
<TabItem value="yarn" label="yarn">
|
|
51
51
|
|
|
52
|
-
```bash
|
|
52
|
+
```bash
|
|
53
53
|
yarn init -y
|
|
54
54
|
yarn add -D typescript @types/node mastra@beta
|
|
55
55
|
yarn add @mastra/core@beta zod@^4
|
|
@@ -58,7 +58,7 @@ yarn add @mastra/core@beta zod@^4
|
|
|
58
58
|
</TabItem>
|
|
59
59
|
<TabItem value="bun" label="bun">
|
|
60
60
|
|
|
61
|
-
```bash
|
|
61
|
+
```bash
|
|
62
62
|
bun init -y
|
|
63
63
|
bun add -d typescript @types/node mastra@beta
|
|
64
64
|
bun add @mastra/core@beta zod@^4
|
|
@@ -69,7 +69,7 @@ bun add @mastra/core@beta zod@^4
|
|
|
69
69
|
|
|
70
70
|
Add `dev` and `build` scripts to your `package.json` file:
|
|
71
71
|
|
|
72
|
-
```json title="package.json"
|
|
72
|
+
```json title="package.json" /,/ /"dev": "mastra dev",/ /"build": "mastra build"/
|
|
73
73
|
{
|
|
74
74
|
"scripts": {
|
|
75
75
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -85,13 +85,13 @@ Add `dev` and `build` scripts to your `package.json` file:
|
|
|
85
85
|
|
|
86
86
|
Create a `tsconfig.json` file:
|
|
87
87
|
|
|
88
|
-
```bash
|
|
88
|
+
```bash
|
|
89
89
|
touch tsconfig.json
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
Add the following configuration:
|
|
93
93
|
|
|
94
|
-
```json title="tsconfig.json"
|
|
94
|
+
```json title="tsconfig.json"
|
|
95
95
|
{
|
|
96
96
|
"compilerOptions": {
|
|
97
97
|
"target": "ES2022",
|
|
@@ -120,13 +120,13 @@ Mastra requires modern `module` and `moduleResolution` settings. Using `CommonJS
|
|
|
120
120
|
|
|
121
121
|
Create an `.env` file:
|
|
122
122
|
|
|
123
|
-
```bash
|
|
123
|
+
```bash
|
|
124
124
|
touch .env
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
Add your API key:
|
|
128
128
|
|
|
129
|
-
```bash title=".env"
|
|
129
|
+
```bash title=".env"
|
|
130
130
|
GOOGLE_GENERATIVE_AI_API_KEY=<your-api-key>
|
|
131
131
|
```
|
|
132
132
|
|
|
@@ -142,13 +142,13 @@ This guide uses Google Gemini, but you can use any supported [model provider](/m
|
|
|
142
142
|
|
|
143
143
|
Create a `weather-tool.ts` file:
|
|
144
144
|
|
|
145
|
-
```bash
|
|
145
|
+
```bash
|
|
146
146
|
mkdir -p src/mastra/tools && touch src/mastra/tools/weather-tool.ts
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
Add the following code:
|
|
150
150
|
|
|
151
|
-
```ts title="src/mastra/tools/weather-tool.ts"
|
|
151
|
+
```ts title="src/mastra/tools/weather-tool.ts"
|
|
152
152
|
import { createTool } from "@mastra/core/tools";
|
|
153
153
|
import { z } from "zod";
|
|
154
154
|
|
|
@@ -181,13 +181,13 @@ We've shortened and simplified the `weatherTool` example here. You can see the c
|
|
|
181
181
|
|
|
182
182
|
Create a `weather-agent.ts` file:
|
|
183
183
|
|
|
184
|
-
```bash
|
|
184
|
+
```bash
|
|
185
185
|
mkdir -p src/mastra/agents && touch src/mastra/agents/weather-agent.ts
|
|
186
186
|
```
|
|
187
187
|
|
|
188
188
|
Add the following code:
|
|
189
189
|
|
|
190
|
-
```ts title="src/mastra/agents/weather-agent.ts"
|
|
190
|
+
```ts title="src/mastra/agents/weather-agent.ts"
|
|
191
191
|
import { Agent } from "@mastra/core/agent";
|
|
192
192
|
import { weatherTool } from "../tools/weather-tool";
|
|
193
193
|
|
|
@@ -217,13 +217,13 @@ export const weatherAgent = new Agent({
|
|
|
217
217
|
|
|
218
218
|
Create the Mastra entry point and register your agent:
|
|
219
219
|
|
|
220
|
-
```bash
|
|
220
|
+
```bash
|
|
221
221
|
touch src/mastra/index.ts
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
Add the following code:
|
|
225
225
|
|
|
226
|
-
```ts title="src/mastra/index.ts"
|
|
226
|
+
```ts title="src/mastra/index.ts"
|
|
227
227
|
import { Mastra } from "@mastra/core";
|
|
228
228
|
import { weatherAgent } from "./agents/weather-agent";
|
|
229
229
|
|
|
@@ -241,28 +241,28 @@ You can now launch [Studio](/docs/v1/getting-started/studio) and test your agent
|
|
|
241
241
|
<Tabs>
|
|
242
242
|
<TabItem value="npm" label="npm">
|
|
243
243
|
|
|
244
|
-
```bash
|
|
244
|
+
```bash
|
|
245
245
|
npm run dev
|
|
246
246
|
```
|
|
247
247
|
|
|
248
248
|
</TabItem>
|
|
249
249
|
<TabItem value="pnpm" label="pnpm">
|
|
250
250
|
|
|
251
|
-
```bash
|
|
251
|
+
```bash
|
|
252
252
|
pnpm run dev
|
|
253
253
|
```
|
|
254
254
|
|
|
255
255
|
</TabItem>
|
|
256
256
|
<TabItem value="yarn" label="yarn">
|
|
257
257
|
|
|
258
|
-
```bash
|
|
258
|
+
```bash
|
|
259
259
|
yarn run dev
|
|
260
260
|
```
|
|
261
261
|
|
|
262
262
|
</TabItem>
|
|
263
263
|
<TabItem value="bun" label="bun">
|
|
264
264
|
|
|
265
|
-
```bash
|
|
265
|
+
```bash
|
|
266
266
|
bun run dev
|
|
267
267
|
```
|
|
268
268
|
|
|
@@ -25,7 +25,7 @@ During the interactive [create-mastra](/reference/v1/cli/create-mastra) wizard,
|
|
|
25
25
|
|
|
26
26
|
If there are no specific instructions for your tool below, you may be able to add the MCP server with this common JSON configuration anyways.
|
|
27
27
|
|
|
28
|
-
```json
|
|
28
|
+
```json
|
|
29
29
|
{
|
|
30
30
|
"mcpServers": {
|
|
31
31
|
"mastra": {
|
|
@@ -41,7 +41,7 @@ If there are no specific instructions for your tool below, you may be able to ad
|
|
|
41
41
|
|
|
42
42
|
Install using the terminal command:
|
|
43
43
|
|
|
44
|
-
```bash
|
|
44
|
+
```bash
|
|
45
45
|
claude mcp add mastra -- npx -y @mastra/mcp-docs-server@beta
|
|
46
46
|
```
|
|
47
47
|
|
|
@@ -14,7 +14,7 @@ Studio provides an interactive UI for building and testing your agents, along wi
|
|
|
14
14
|
|
|
15
15
|
As your project evolves, Studio's development environment helps you iterate on your agent quickly. Meanwhile, Observability and Scorer features give you visibility into performance at every stage.
|
|
16
16
|
|
|
17
|
-
To get started, run Studio locally using the instructions below, or [create a project in Mastra Cloud](
|
|
17
|
+
To get started, run Studio locally using the instructions below, or [create a project in Mastra Cloud](/docs/v1/mastra-cloud/setup) to collaborate with your team.
|
|
18
18
|
|
|
19
19
|
<YouTube id="ojGu6Bi4wYk" />
|
|
20
20
|
|