@mastra/mcp-docs-server 0.13.39-alpha.0 → 1.0.0-beta.0
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/%40internal%2Fai-sdk-v4.md +1 -0
- package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +0 -8
- package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +0 -8
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +29 -29
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +0 -8
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +70 -70
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fauth.md +4 -8
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +199 -199
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +223 -223
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +189 -189
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +198 -198
- package/.docs/organized/changelogs/%40mastra%2Fcodemod.md +7 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +214 -214
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +63 -63
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +57 -57
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +60 -60
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +57 -57
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +209 -209
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +191 -191
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +38 -38
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +5 -7
- package/.docs/organized/changelogs/%40mastra%2Flance.md +186 -186
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +199 -199
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +53 -53
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +69 -69
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +221 -221
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +199 -199
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +206 -206
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +197 -197
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +218 -218
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Frag.md +65 -65
- package/.docs/organized/changelogs/%40mastra%2Freact.md +61 -61
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +10 -9
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -24
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +206 -206
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +191 -191
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +58 -58
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +56 -56
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +11 -11
- package/.docs/organized/changelogs/create-mastra.md +27 -27
- package/.docs/organized/changelogs/mastra.md +87 -87
- package/.docs/organized/code-examples/a2a.md +4 -2
- package/.docs/organized/code-examples/agui.md +12 -9
- package/.docs/organized/code-examples/ai-sdk-useChat.md +12 -18
- package/.docs/organized/code-examples/ai-sdk-v5.md +4 -2
- package/.docs/organized/code-examples/bird-checker-with-express.md +5 -4
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +4 -3
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +4 -3
- package/.docs/organized/code-examples/client-side-tools.md +1 -0
- package/.docs/organized/code-examples/crypto-chatbot.md +1 -1
- package/.docs/organized/code-examples/experimental-auth-weather-agent.md +8 -177
- package/.docs/organized/code-examples/fireworks-r1.md +2 -2
- package/.docs/organized/code-examples/heads-up-game.md +10 -7
- package/.docs/organized/code-examples/mcp-configuration.md +5 -3
- package/.docs/organized/code-examples/mcp-registry-registry.md +3 -2
- package/.docs/organized/code-examples/memory-per-resource-example.md +4 -2
- package/.docs/organized/code-examples/memory-todo-agent.md +1 -0
- package/.docs/organized/code-examples/memory-with-context.md +2 -1
- package/.docs/organized/code-examples/memory-with-libsql.md +4 -2
- package/.docs/organized/code-examples/memory-with-mongodb.md +4 -2
- package/.docs/organized/code-examples/memory-with-pg.md +4 -2
- package/.docs/organized/code-examples/memory-with-processors.md +13 -8
- package/.docs/organized/code-examples/memory-with-upstash.md +5 -3
- package/.docs/organized/code-examples/openapi-spec-writer.md +32 -41
- package/.docs/organized/code-examples/quick-start.md +5 -32
- package/.docs/organized/code-examples/stock-price-tool.md +6 -5
- package/.docs/organized/code-examples/weather-agent.md +21 -16
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +3 -2
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +9 -12
- package/.docs/organized/code-examples/workflow-with-memory.md +16 -15
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +2 -2
- package/.docs/organized/code-examples/workflow-with-suspend-resume.md +3 -2
- package/.docs/raw/agents/adding-voice.mdx +27 -22
- package/.docs/raw/agents/agent-memory.mdx +23 -15
- package/.docs/raw/agents/guardrails.mdx +33 -12
- package/.docs/raw/agents/networks.mdx +8 -4
- package/.docs/raw/agents/overview.mdx +21 -15
- package/.docs/raw/agents/using-tools.mdx +11 -8
- package/.docs/raw/auth/auth0.mdx +8 -8
- package/.docs/raw/auth/clerk.mdx +6 -6
- package/.docs/raw/auth/firebase.mdx +8 -8
- package/.docs/raw/auth/index.mdx +6 -6
- package/.docs/raw/auth/jwt.mdx +6 -6
- package/.docs/raw/auth/supabase.mdx +7 -7
- package/.docs/raw/auth/workos.mdx +8 -8
- package/.docs/raw/community/contributing-templates.mdx +3 -3
- package/.docs/raw/community/discord.mdx +1 -1
- package/.docs/raw/course/01-first-agent/08-exporting-your-agent.md +2 -1
- package/.docs/raw/course/01-first-agent/16-adding-memory-to-agent.md +2 -1
- package/.docs/raw/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +2 -0
- package/.docs/raw/course/03-agent-memory/04-creating-basic-memory-agent.md +1 -0
- package/.docs/raw/course/03-agent-memory/10-storage-configuration.md +2 -3
- package/.docs/raw/course/03-agent-memory/13-vector-store-configuration.md +2 -0
- package/.docs/raw/course/03-agent-memory/16-configuring-semantic-recall.md +2 -0
- package/.docs/raw/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +1 -0
- package/.docs/raw/course/03-agent-memory/21-configuring-working-memory.md +2 -0
- package/.docs/raw/course/03-agent-memory/22-custom-working-memory-templates.md +1 -0
- package/.docs/raw/course/03-agent-memory/25-combining-memory-features.md +1 -0
- package/.docs/raw/course/03-agent-memory/27-creating-learning-assistant.md +1 -0
- package/.docs/raw/course/04-workflows/08-running-workflows-programmatically.md +2 -2
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +5 -5
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +7 -5
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +3 -3
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +4 -4
- package/.docs/raw/deployment/cloud-providers/index.mdx +11 -8
- package/.docs/raw/deployment/monorepo.mdx +2 -2
- package/.docs/raw/deployment/overview.mdx +2 -2
- package/.docs/raw/deployment/server-deployment.mdx +2 -10
- package/.docs/raw/deployment/serverless-platforms/cloudflare-deployer.mdx +4 -4
- package/.docs/raw/deployment/serverless-platforms/index.mdx +10 -7
- package/.docs/raw/deployment/serverless-platforms/netlify-deployer.mdx +4 -4
- package/.docs/raw/deployment/serverless-platforms/vercel-deployer.mdx +4 -4
- package/.docs/raw/deployment/web-framework.mdx +8 -8
- package/.docs/raw/{scorers → evals}/custom-scorers.mdx +6 -6
- package/.docs/raw/evals/off-the-shelf-scorers.mdx +50 -0
- package/.docs/raw/{scorers → evals}/overview.mdx +8 -8
- package/.docs/raw/evals/running-in-ci.mdx +113 -0
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +22 -21
- package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +8 -8
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +3 -0
- package/.docs/raw/frameworks/servers/express.mdx +10 -9
- package/.docs/raw/frameworks/web-frameworks/astro.mdx +6 -6
- package/.docs/raw/frameworks/web-frameworks/next-js.mdx +3 -3
- package/.docs/raw/frameworks/web-frameworks/sveltekit.mdx +4 -4
- package/.docs/raw/frameworks/web-frameworks/vite-react.mdx +2 -2
- package/.docs/raw/getting-started/installation.mdx +13 -12
- package/.docs/raw/getting-started/mcp-docs-server.mdx +1 -1
- package/.docs/raw/getting-started/project-structure.mdx +4 -4
- package/.docs/raw/getting-started/studio.mdx +8 -8
- package/.docs/raw/getting-started/templates.mdx +1 -1
- package/.docs/raw/guides/guide/ai-recruiter.mdx +264 -0
- package/.docs/raw/guides/guide/chef-michel.mdx +271 -0
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +450 -0
- package/.docs/raw/guides/guide/research-assistant.mdx +389 -0
- package/.docs/raw/guides/guide/stock-agent.mdx +185 -0
- package/.docs/raw/guides/guide/web-search.mdx +291 -0
- package/.docs/raw/guides/index.mdx +43 -0
- package/.docs/raw/guides/migrations/agentnetwork.mdx +114 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/_template.mdx +50 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +265 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/cli.mdx +48 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/client.mdx +153 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/evals.mdx +230 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/mastra.mdx +171 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/mcp.mdx +114 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/memory.mdx +241 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/overview.mdx +83 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/processors.mdx +62 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +270 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +115 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tracing.mdx +280 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/vectors.mdx +23 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/voice.mdx +39 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +178 -0
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +367 -0
- package/.docs/raw/index.mdx +9 -9
- package/.docs/raw/{observability/logging.mdx → logging.mdx} +4 -4
- package/.docs/raw/mastra-cloud/dashboard.mdx +2 -2
- package/.docs/raw/mastra-cloud/observability.mdx +6 -6
- package/.docs/raw/mastra-cloud/overview.mdx +2 -2
- package/.docs/raw/mastra-cloud/setting-up.mdx +4 -4
- package/.docs/raw/memory/conversation-history.mdx +1 -0
- package/.docs/raw/memory/memory-processors.mdx +4 -3
- package/.docs/raw/memory/overview.mdx +9 -5
- package/.docs/raw/memory/semantic-recall.mdx +12 -7
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +10 -5
- package/.docs/raw/memory/storage/memory-with-pg.mdx +9 -4
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +9 -4
- package/.docs/raw/memory/threads-and-resources.mdx +11 -13
- package/.docs/raw/memory/working-memory.mdx +30 -14
- package/.docs/raw/observability/overview.mdx +13 -30
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/arize.mdx +10 -18
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/braintrust.mdx +7 -16
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/cloud.mdx +11 -17
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/default.mdx +16 -20
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/langfuse.mdx +7 -16
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/langsmith.mdx +7 -16
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/otel.mdx +9 -18
- package/.docs/raw/observability/{ai-tracing → tracing}/overview.mdx +107 -142
- package/.docs/raw/observability/{ai-tracing → tracing}/processors/sensitive-data-filter.mdx +14 -13
- package/.docs/raw/rag/chunking-and-embedding.mdx +5 -5
- package/.docs/raw/rag/overview.mdx +3 -13
- package/.docs/raw/rag/retrieval.mdx +24 -12
- package/.docs/raw/rag/vector-databases.mdx +7 -1
- package/.docs/raw/reference/agents/agent.mdx +33 -28
- package/.docs/raw/reference/agents/generate.mdx +10 -10
- package/.docs/raw/reference/agents/generateLegacy.mdx +8 -8
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +21 -15
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +69 -0
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +22 -16
- package/.docs/raw/reference/agents/getDescription.mdx +1 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +8 -8
- package/.docs/raw/reference/agents/getLLM.mdx +9 -9
- package/.docs/raw/reference/agents/getMemory.mdx +9 -9
- package/.docs/raw/reference/agents/getModel.mdx +10 -10
- package/.docs/raw/reference/agents/getVoice.mdx +8 -8
- package/.docs/raw/reference/agents/listAgents.mdx +9 -9
- package/.docs/raw/reference/agents/listScorers.mdx +7 -7
- package/.docs/raw/reference/agents/listTools.mdx +7 -7
- package/.docs/raw/reference/agents/listWorkflows.mdx +7 -7
- package/.docs/raw/reference/agents/network.mdx +11 -10
- package/.docs/raw/reference/auth/auth0.mdx +4 -4
- package/.docs/raw/reference/auth/clerk.mdx +4 -4
- package/.docs/raw/reference/auth/firebase.mdx +6 -6
- package/.docs/raw/reference/auth/jwt.mdx +4 -4
- package/.docs/raw/reference/auth/supabase.mdx +4 -4
- package/.docs/raw/reference/auth/workos.mdx +4 -4
- package/.docs/raw/reference/cli/mastra.mdx +7 -7
- package/.docs/raw/reference/client-js/agents.mdx +6 -2
- package/.docs/raw/reference/client-js/mastra-client.mdx +7 -7
- package/.docs/raw/reference/client-js/memory.mdx +24 -16
- package/.docs/raw/reference/client-js/observability.mdx +11 -11
- package/.docs/raw/reference/client-js/workflows.mdx +6 -34
- 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 +2 -2
- package/.docs/raw/reference/core/getLogger.mdx +2 -2
- package/.docs/raw/reference/core/getMCPServer.mdx +31 -15
- package/.docs/raw/reference/core/getMCPServerById.mdx +81 -0
- package/.docs/raw/reference/core/getScorer.mdx +3 -3
- package/.docs/raw/reference/core/getScorerById.mdx +79 -0
- package/.docs/raw/reference/core/getServer.mdx +2 -2
- package/.docs/raw/reference/core/getStorage.mdx +2 -2
- package/.docs/raw/reference/core/getTelemetry.mdx +2 -2
- package/.docs/raw/reference/core/getVector.mdx +2 -2
- 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 +2 -2
- package/.docs/raw/reference/core/listLogsByRunId.mdx +2 -2
- package/.docs/raw/reference/core/listMCPServers.mdx +65 -0
- package/.docs/raw/reference/core/listScorers.mdx +3 -3
- package/.docs/raw/reference/core/listVectors.mdx +36 -0
- package/.docs/raw/reference/core/listWorkflows.mdx +6 -6
- package/.docs/raw/reference/core/mastra-class.mdx +3 -2
- package/.docs/raw/reference/core/setLogger.mdx +2 -2
- package/.docs/raw/reference/core/setStorage.mdx +3 -2
- package/.docs/raw/reference/core/setTelemetry.mdx +2 -2
- package/.docs/raw/reference/deployer/cloudflare.mdx +2 -2
- package/.docs/raw/reference/deployer/deployer.mdx +0 -6
- package/.docs/raw/reference/deployer/netlify.mdx +2 -2
- package/.docs/raw/reference/deployer/vercel.mdx +3 -3
- package/.docs/raw/reference/evals/answer-relevancy.mdx +164 -126
- package/.docs/raw/reference/{scorers → evals}/answer-similarity.mdx +27 -27
- package/.docs/raw/reference/evals/bias.mdx +149 -115
- package/.docs/raw/reference/evals/completeness.mdx +148 -117
- package/.docs/raw/reference/evals/content-similarity.mdx +126 -113
- package/.docs/raw/reference/evals/context-precision.mdx +290 -133
- package/.docs/raw/reference/{scorers → evals}/context-relevance.mdx +6 -6
- package/.docs/raw/reference/{scorers → evals}/create-scorer.mdx +11 -11
- package/.docs/raw/reference/evals/faithfulness.mdx +163 -121
- package/.docs/raw/reference/evals/hallucination.mdx +159 -132
- package/.docs/raw/reference/evals/keyword-coverage.mdx +169 -125
- package/.docs/raw/reference/{scorers → evals}/mastra-scorer.mdx +5 -5
- package/.docs/raw/reference/{scorers → evals}/noise-sensitivity.mdx +9 -9
- package/.docs/raw/reference/evals/prompt-alignment.mdx +604 -182
- package/.docs/raw/reference/{scorers/run-experiment.mdx → evals/run-evals.mdx} +17 -18
- package/.docs/raw/reference/evals/textual-difference.mdx +149 -117
- package/.docs/raw/reference/evals/tone-consistency.mdx +149 -125
- package/.docs/raw/reference/{scorers → evals}/tool-call-accuracy.mdx +8 -6
- package/.docs/raw/reference/evals/toxicity.mdx +152 -96
- package/.docs/raw/reference/{observability/logging → logging}/pino-logger.mdx +2 -2
- package/.docs/raw/reference/memory/createThread.mdx +5 -5
- package/.docs/raw/reference/memory/deleteMessages.mdx +7 -7
- package/.docs/raw/reference/memory/getThreadById.mdx +4 -4
- package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +110 -0
- package/.docs/raw/reference/memory/memory-class.mdx +13 -9
- package/.docs/raw/reference/memory/query.mdx +58 -57
- package/.docs/raw/reference/memory/recall.mdx +185 -0
- package/.docs/raw/reference/observability/tracing/configuration.mdx +245 -0
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/arize.mdx +13 -13
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/braintrust.mdx +11 -8
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/cloud-exporter.mdx +21 -19
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/console-exporter.mdx +49 -17
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/default-exporter.mdx +42 -41
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/langfuse.mdx +10 -7
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/langsmith.mdx +10 -7
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/otel.mdx +5 -5
- package/.docs/raw/reference/observability/tracing/instances.mdx +168 -0
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/interfaces.mdx +115 -89
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/processors/sensitive-data-filter.mdx +3 -3
- package/.docs/raw/reference/observability/{ai-tracing/span.mdx → tracing/spans.mdx} +59 -41
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +1 -1
- package/.docs/raw/reference/processors/language-detector.mdx +1 -1
- package/.docs/raw/reference/processors/moderation-processor.mdx +1 -1
- package/.docs/raw/reference/processors/pii-detector.mdx +1 -1
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +1 -1
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +1 -1
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +1 -1
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +1 -1
- package/.docs/raw/reference/rag/chunk.mdx +1 -8
- package/.docs/raw/reference/rag/database-config.mdx +7 -7
- package/.docs/raw/reference/rag/metadata-filters.mdx +14 -11
- package/.docs/raw/reference/storage/libsql.mdx +2 -0
- package/.docs/raw/reference/storage/mssql.mdx +5 -0
- package/.docs/raw/reference/storage/postgresql.mdx +6 -0
- package/.docs/raw/reference/storage/upstash.mdx +1 -0
- package/.docs/raw/reference/streaming/agents/stream.mdx +12 -12
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +8 -8
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +3 -3
- package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +3 -3
- package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +6 -6
- package/.docs/raw/reference/streaming/workflows/stream.mdx +10 -10
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +11 -11
- package/.docs/raw/reference/templates/overview.mdx +2 -2
- package/.docs/raw/reference/tools/create-tool.mdx +52 -35
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +15 -15
- package/.docs/raw/reference/tools/mcp-client.mdx +1 -1
- package/.docs/raw/reference/tools/mcp-server.mdx +119 -35
- package/.docs/raw/reference/tools/vector-query-tool.mdx +27 -26
- package/.docs/raw/reference/vectors/libsql.mdx +1 -0
- package/.docs/raw/reference/vectors/pg.mdx +3 -0
- package/.docs/raw/reference/vectors/upstash.mdx +1 -0
- package/.docs/raw/reference/voice/google-gemini-live.mdx +1 -1
- package/.docs/raw/reference/voice/voice.addTools.mdx +3 -3
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +4 -4
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +14 -14
- package/.docs/raw/reference/workflows/run-methods/start.mdx +17 -17
- package/.docs/raw/reference/workflows/run.mdx +1 -8
- package/.docs/raw/reference/workflows/step.mdx +5 -5
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +7 -13
- 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 +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +5 -0
- 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 +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow.mdx +1 -1
- package/.docs/raw/server-db/custom-api-routes.mdx +2 -2
- package/.docs/raw/server-db/mastra-client.mdx +19 -18
- package/.docs/raw/server-db/middleware.mdx +7 -7
- package/.docs/raw/server-db/production-server.mdx +4 -4
- package/.docs/raw/server-db/{runtime-context.mdx → request-context.mdx} +46 -45
- package/.docs/raw/server-db/storage.mdx +29 -21
- package/.docs/raw/streaming/events.mdx +3 -3
- package/.docs/raw/streaming/overview.mdx +5 -5
- package/.docs/raw/streaming/tool-streaming.mdx +18 -17
- package/.docs/raw/streaming/workflow-streaming.mdx +1 -1
- package/.docs/raw/tools-mcp/advanced-usage.mdx +5 -4
- package/.docs/raw/tools-mcp/mcp-overview.mdx +32 -19
- package/.docs/raw/tools-mcp/overview.mdx +11 -11
- package/.docs/raw/voice/overview.mdx +63 -43
- package/.docs/raw/voice/speech-to-speech.mdx +5 -3
- package/.docs/raw/voice/speech-to-text.mdx +9 -8
- package/.docs/raw/voice/text-to-speech.mdx +12 -11
- package/.docs/raw/workflows/agents-and-tools.mdx +9 -5
- package/.docs/raw/workflows/control-flow.mdx +3 -3
- package/.docs/raw/workflows/error-handling.mdx +2 -21
- package/.docs/raw/workflows/human-in-the-loop.mdx +7 -4
- package/.docs/raw/workflows/inngest-workflow.mdx +2 -2
- package/.docs/raw/workflows/input-data-mapping.mdx +107 -0
- package/.docs/raw/workflows/overview.mdx +17 -16
- package/.docs/raw/workflows/snapshots.mdx +13 -11
- package/.docs/raw/workflows/suspend-and-resume.mdx +23 -15
- package/CHANGELOG.md +52 -47
- package/README.md +11 -2
- package/dist/{chunk-TUAHUTTB.js → chunk-5NJC7NRO.js} +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
- package/dist/prepare-docs/prepare.js +1 -1
- package/dist/prompts/migration.d.ts +6 -0
- package/dist/prompts/migration.d.ts.map +1 -0
- package/dist/stdio.js +402 -30
- package/dist/tools/migration.d.ts +40 -0
- package/dist/tools/migration.d.ts.map +1 -0
- package/package.json +8 -12
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +0 -302
- package/.docs/raw/observability/nextjs-tracing.mdx +0 -109
- package/.docs/raw/observability/otel-tracing.mdx +0 -189
- package/.docs/raw/reference/agents/getScorers.mdx +0 -69
- package/.docs/raw/reference/agents/getTools.mdx +0 -69
- package/.docs/raw/reference/agents/getWorkflows.mdx +0 -69
- package/.docs/raw/reference/client-js/workflows-legacy.mdx +0 -143
- package/.docs/raw/reference/core/getAgents.mdx +0 -35
- package/.docs/raw/reference/core/getLogs.mdx +0 -96
- package/.docs/raw/reference/core/getLogsByRunId.mdx +0 -87
- package/.docs/raw/reference/core/getMCPServers.mdx +0 -36
- package/.docs/raw/reference/core/getMemory.mdx +0 -36
- package/.docs/raw/reference/core/getScorerByName.mdx +0 -78
- package/.docs/raw/reference/core/getScorers.mdx +0 -43
- package/.docs/raw/reference/core/getVectors.mdx +0 -36
- package/.docs/raw/reference/core/getWorkflows.mdx +0 -45
- package/.docs/raw/reference/evals/context-position.mdx +0 -197
- package/.docs/raw/reference/evals/context-relevancy.mdx +0 -196
- package/.docs/raw/reference/evals/contextual-recall.mdx +0 -196
- package/.docs/raw/reference/evals/summarization.mdx +0 -212
- package/.docs/raw/reference/legacyWorkflows/after.mdx +0 -89
- package/.docs/raw/reference/legacyWorkflows/afterEvent.mdx +0 -79
- package/.docs/raw/reference/legacyWorkflows/commit.mdx +0 -33
- package/.docs/raw/reference/legacyWorkflows/createRun.mdx +0 -76
- package/.docs/raw/reference/legacyWorkflows/else.mdx +0 -68
- package/.docs/raw/reference/legacyWorkflows/events.mdx +0 -305
- package/.docs/raw/reference/legacyWorkflows/execute.mdx +0 -110
- package/.docs/raw/reference/legacyWorkflows/if.mdx +0 -108
- package/.docs/raw/reference/legacyWorkflows/resume.mdx +0 -158
- package/.docs/raw/reference/legacyWorkflows/resumeWithEvent.mdx +0 -133
- package/.docs/raw/reference/legacyWorkflows/snapshots.mdx +0 -207
- package/.docs/raw/reference/legacyWorkflows/start.mdx +0 -87
- package/.docs/raw/reference/legacyWorkflows/step-class.mdx +0 -100
- package/.docs/raw/reference/legacyWorkflows/step-condition.mdx +0 -137
- package/.docs/raw/reference/legacyWorkflows/step-function.mdx +0 -93
- package/.docs/raw/reference/legacyWorkflows/step-options.mdx +0 -69
- package/.docs/raw/reference/legacyWorkflows/step-retries.mdx +0 -196
- package/.docs/raw/reference/legacyWorkflows/suspend.mdx +0 -70
- package/.docs/raw/reference/legacyWorkflows/then.mdx +0 -72
- package/.docs/raw/reference/legacyWorkflows/until.mdx +0 -168
- package/.docs/raw/reference/legacyWorkflows/watch.mdx +0 -124
- package/.docs/raw/reference/legacyWorkflows/while.mdx +0 -168
- package/.docs/raw/reference/legacyWorkflows/workflow.mdx +0 -234
- package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +0 -79
- package/.docs/raw/reference/memory/getThreadsByResourceIdPaginated.mdx +0 -110
- package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +0 -185
- package/.docs/raw/reference/observability/ai-tracing/configuration.mdx +0 -238
- package/.docs/raw/reference/observability/otel-tracing/otel-config.mdx +0 -117
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-ax.mdx +0 -81
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-phoenix.mdx +0 -121
- package/.docs/raw/reference/observability/otel-tracing/providers/braintrust.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/dash0.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/index.mdx +0 -20
- package/.docs/raw/reference/observability/otel-tracing/providers/keywordsai.mdx +0 -73
- package/.docs/raw/reference/observability/otel-tracing/providers/laminar.mdx +0 -41
- package/.docs/raw/reference/observability/otel-tracing/providers/langfuse.mdx +0 -84
- package/.docs/raw/reference/observability/otel-tracing/providers/langsmith.mdx +0 -48
- package/.docs/raw/reference/observability/otel-tracing/providers/langwatch.mdx +0 -43
- package/.docs/raw/reference/observability/otel-tracing/providers/new-relic.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/signoz.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/traceloop.mdx +0 -40
- package/.docs/raw/reference/scorers/answer-relevancy.mdx +0 -227
- package/.docs/raw/reference/scorers/bias.mdx +0 -228
- package/.docs/raw/reference/scorers/completeness.mdx +0 -214
- package/.docs/raw/reference/scorers/content-similarity.mdx +0 -197
- package/.docs/raw/reference/scorers/context-precision.mdx +0 -352
- package/.docs/raw/reference/scorers/faithfulness.mdx +0 -241
- package/.docs/raw/reference/scorers/hallucination.mdx +0 -252
- package/.docs/raw/reference/scorers/keyword-coverage.mdx +0 -229
- package/.docs/raw/reference/scorers/prompt-alignment.mdx +0 -668
- package/.docs/raw/reference/scorers/textual-difference.mdx +0 -203
- package/.docs/raw/reference/scorers/tone-consistency.mdx +0 -211
- package/.docs/raw/reference/scorers/toxicity.mdx +0 -228
- package/.docs/raw/reference/workflows/run-methods/watch.mdx +0 -73
- package/.docs/raw/scorers/evals-old-api/custom-eval.mdx +0 -24
- package/.docs/raw/scorers/evals-old-api/overview.mdx +0 -106
- package/.docs/raw/scorers/evals-old-api/running-in-ci.mdx +0 -85
- package/.docs/raw/scorers/evals-old-api/textual-evals.mdx +0 -58
- package/.docs/raw/scorers/off-the-shelf-scorers.mdx +0 -50
- package/.docs/raw/workflows-legacy/control-flow.mdx +0 -774
- package/.docs/raw/workflows-legacy/dynamic-workflows.mdx +0 -239
- package/.docs/raw/workflows-legacy/error-handling.mdx +0 -187
- package/.docs/raw/workflows-legacy/nested-workflows.mdx +0 -360
- package/.docs/raw/workflows-legacy/overview.mdx +0 -182
- package/.docs/raw/workflows-legacy/runtime-variables.mdx +0 -156
- package/.docs/raw/workflows-legacy/steps.mdx +0 -115
- package/.docs/raw/workflows-legacy/suspend-and-resume.mdx +0 -406
- package/.docs/raw/workflows-legacy/variables.mdx +0 -318
|
@@ -101,7 +101,8 @@ import { Agent } from "@mastra/core/agent";
|
|
|
101
101
|
import { openai } from "@ai-sdk/openai";
|
|
102
102
|
|
|
103
103
|
export const agentOne = new Agent({
|
|
104
|
-
|
|
104
|
+
id: "openapi-spec-gen-agent",
|
|
105
|
+
name: "OpenAPI Spec Generator Agent",
|
|
105
106
|
instructions:
|
|
106
107
|
"You are an expert Open API spec writer. You can take markdown documentation and extract all the information you can to generate an amazing Open API spec. You are also able to merge multiple fragmented Open API specs from the same source into a single compliant spec.",
|
|
107
108
|
model: openai("gpt-3.5-turbo"),
|
|
@@ -112,7 +113,7 @@ export const agentOne = new Agent({
|
|
|
112
113
|
### mastra/index.ts
|
|
113
114
|
```typescript
|
|
114
115
|
import { PinoLogger } from "@mastra/loggers";
|
|
115
|
-
import { Mastra } from "@mastra/core
|
|
116
|
+
import { Mastra } from "@mastra/core";
|
|
116
117
|
import { UpstashTransport } from "@mastra/loggers/upstash";
|
|
117
118
|
import { agentOne } from "./agents";
|
|
118
119
|
import { makePRToMastraWorkflow, openApiSpecGenWorkflow } from "./workflows";
|
|
@@ -129,16 +130,6 @@ export const mastra = new Mastra({
|
|
|
129
130
|
},
|
|
130
131
|
}),
|
|
131
132
|
agents: { "openapi-spec-gen-agent": agentOne },
|
|
132
|
-
telemetry: {
|
|
133
|
-
serviceName: "mastra-vnext",
|
|
134
|
-
sampling: {
|
|
135
|
-
type: "always_on",
|
|
136
|
-
},
|
|
137
|
-
enabled: true,
|
|
138
|
-
export: {
|
|
139
|
-
type: "otlp",
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
133
|
workflows: {
|
|
143
134
|
openApiSpecGenWorkflow,
|
|
144
135
|
makePRToMastraWorkflow,
|
|
@@ -194,16 +185,16 @@ export const siteCrawlTool = createTool({
|
|
|
194
185
|
),
|
|
195
186
|
entityType: z.string(),
|
|
196
187
|
}),
|
|
197
|
-
execute: async (
|
|
188
|
+
execute: async (inputData) => {
|
|
198
189
|
const client = await firecrawl.getApiClient();
|
|
199
190
|
|
|
200
|
-
console.log("Starting crawl",
|
|
191
|
+
console.log("Starting crawl", inputData.url);
|
|
201
192
|
|
|
202
193
|
const res = await client.crawlUrls({
|
|
203
194
|
body: {
|
|
204
|
-
url:
|
|
205
|
-
limit:
|
|
206
|
-
includePaths: [
|
|
195
|
+
url: inputData.url,
|
|
196
|
+
limit: inputData.limit || 3,
|
|
197
|
+
includePaths: [inputData.pathRegex],
|
|
207
198
|
scrapeOptions: {
|
|
208
199
|
formats: ["markdown"],
|
|
209
200
|
includeTags: ["main"],
|
|
@@ -243,7 +234,7 @@ export const siteCrawlTool = createTool({
|
|
|
243
234
|
});
|
|
244
235
|
}
|
|
245
236
|
|
|
246
|
-
const entityType = `CRAWL_${
|
|
237
|
+
const entityType = `CRAWL_${inputData.url}`;
|
|
247
238
|
|
|
248
239
|
return {
|
|
249
240
|
success: true,
|
|
@@ -270,17 +261,17 @@ export const generateSpecTool = createTool({
|
|
|
270
261
|
mergedSpec: z.string(),
|
|
271
262
|
}),
|
|
272
263
|
description: "Generate a spec from a website",
|
|
273
|
-
execute: async (
|
|
264
|
+
execute: async (inputData, context) => {
|
|
274
265
|
const crawledData =
|
|
275
|
-
context?.steps?.["site-crawl"]?.status === "success"
|
|
276
|
-
? context?.steps?.["site-crawl"]?.output?.crawlData
|
|
266
|
+
context?.workflow?.state?.steps?.["site-crawl"]?.status === "success"
|
|
267
|
+
? context?.workflow?.state?.steps?.["site-crawl"]?.output?.crawlData
|
|
277
268
|
: [];
|
|
278
269
|
|
|
279
270
|
if (!crawledData) {
|
|
280
271
|
throw new Error("No crawled data found");
|
|
281
272
|
}
|
|
282
273
|
|
|
283
|
-
const agent = mastra?.agents?.["openapi-spec-gen-agent"];
|
|
274
|
+
const agent = context?.mastra?.agents?.["openapi-spec-gen-agent"];
|
|
284
275
|
|
|
285
276
|
if (!agent) {
|
|
286
277
|
throw new Error("Agent not found");
|
|
@@ -292,7 +283,7 @@ export const generateSpecTool = createTool({
|
|
|
292
283
|
for (const d of crawledData) {
|
|
293
284
|
const data = await agent.generate(
|
|
294
285
|
`I wrote another page of docs, turn this into an Open API spec: ${d.data.markdown}`,
|
|
295
|
-
{ runId }
|
|
286
|
+
{ runId: context?.workflow?.runId }
|
|
296
287
|
);
|
|
297
288
|
|
|
298
289
|
openapiResponses.push(data.text);
|
|
@@ -307,7 +298,7 @@ export const generateSpecTool = createTool({
|
|
|
307
298
|
.map((r) => r)
|
|
308
299
|
.join("\n\n")} - merge them into a single spec,
|
|
309
300
|
`,
|
|
310
|
-
{ runId }
|
|
301
|
+
{ runId: context?.workflow?.runId }
|
|
311
302
|
);
|
|
312
303
|
|
|
313
304
|
mergedSpecAnswer = mergedSpec.text
|
|
@@ -338,18 +329,18 @@ export const addToGitHubTool = createTool({
|
|
|
338
329
|
pr_url: z.string().optional(),
|
|
339
330
|
}),
|
|
340
331
|
description: "Commit the spec to GitHub",
|
|
341
|
-
execute: async (
|
|
332
|
+
execute: async (inputData, context) => {
|
|
342
333
|
const client = await github.getApiClient();
|
|
343
334
|
|
|
344
|
-
const content =
|
|
345
|
-
const integrationName =
|
|
335
|
+
const content = inputData.yaml;
|
|
336
|
+
const integrationName = inputData.integration_name.toLowerCase();
|
|
346
337
|
|
|
347
|
-
console.log("Writing to Github for",
|
|
348
|
-
const agent = mastra?.agents?.["openapi-spec-gen-agent"];
|
|
338
|
+
console.log("Writing to Github for", inputData.integration_name);
|
|
339
|
+
const agent = context?.mastra?.agents?.["openapi-spec-gen-agent"];
|
|
349
340
|
|
|
350
341
|
const d = await agent?.generate(
|
|
351
342
|
`Can you take this text blob and format it into proper YAML? ${content}`,
|
|
352
|
-
{ runId }
|
|
343
|
+
{ runId: context?.workflow?.runId }
|
|
353
344
|
);
|
|
354
345
|
|
|
355
346
|
if (!d) {
|
|
@@ -373,12 +364,12 @@ export const addToGitHubTool = createTool({
|
|
|
373
364
|
const mainRef = await client.gitGetRef({
|
|
374
365
|
path: {
|
|
375
366
|
ref: "heads/main",
|
|
376
|
-
owner:
|
|
377
|
-
repo:
|
|
367
|
+
owner: inputData.owner,
|
|
368
|
+
repo: inputData.repo,
|
|
378
369
|
},
|
|
379
370
|
});
|
|
380
371
|
|
|
381
|
-
console.log({
|
|
372
|
+
console.log({ input, mainRef });
|
|
382
373
|
|
|
383
374
|
const mainSha = mainRef.data?.object?.sha;
|
|
384
375
|
|
|
@@ -395,8 +386,8 @@ export const addToGitHubTool = createTool({
|
|
|
395
386
|
sha: mainSha,
|
|
396
387
|
},
|
|
397
388
|
path: {
|
|
398
|
-
owner:
|
|
399
|
-
repo:
|
|
389
|
+
owner: inputData.owner,
|
|
390
|
+
repo: inputData.repo,
|
|
400
391
|
},
|
|
401
392
|
});
|
|
402
393
|
|
|
@@ -404,13 +395,13 @@ export const addToGitHubTool = createTool({
|
|
|
404
395
|
console.log({ path, content });
|
|
405
396
|
await client.reposCreateOrUpdateFileContents({
|
|
406
397
|
body: {
|
|
407
|
-
message: `Add open api spec from ${
|
|
398
|
+
message: `Add open api spec from ${inputData.site_url}`,
|
|
408
399
|
content,
|
|
409
400
|
branch: branchName,
|
|
410
401
|
},
|
|
411
402
|
path: {
|
|
412
|
-
owner:
|
|
413
|
-
repo:
|
|
403
|
+
owner: inputData.owner,
|
|
404
|
+
repo: inputData.repo,
|
|
414
405
|
path,
|
|
415
406
|
},
|
|
416
407
|
});
|
|
@@ -418,13 +409,13 @@ export const addToGitHubTool = createTool({
|
|
|
418
409
|
|
|
419
410
|
const pullData = await client.pullsCreate({
|
|
420
411
|
body: {
|
|
421
|
-
title: `Add open api spec from ${
|
|
412
|
+
title: `Add open api spec from ${inputData.site_url} for ${integrationName}`,
|
|
422
413
|
head: branchName,
|
|
423
414
|
base: "main",
|
|
424
415
|
},
|
|
425
416
|
path: {
|
|
426
|
-
owner:
|
|
427
|
-
repo:
|
|
417
|
+
owner: inputData.owner,
|
|
418
|
+
repo: inputData.repo,
|
|
428
419
|
},
|
|
429
420
|
});
|
|
430
421
|
|
|
@@ -42,7 +42,7 @@ const main = async () => {
|
|
|
42
42
|
|
|
43
43
|
console.log(res.species);
|
|
44
44
|
|
|
45
|
-
const run = await mastra.getWorkflow('logCatWorkflow').
|
|
45
|
+
const run = await mastra.getWorkflow('logCatWorkflow').createRun();
|
|
46
46
|
const { start } = run;
|
|
47
47
|
|
|
48
48
|
await start({ triggerData: { name: res.species } });
|
|
@@ -58,10 +58,11 @@ main();
|
|
|
58
58
|
### mastra/agents/agent.ts
|
|
59
59
|
```typescript
|
|
60
60
|
import { openai } from '@ai-sdk/openai';
|
|
61
|
-
import { Agent } from '@mastra/core';
|
|
61
|
+
import { Agent } from '@mastra/core/agent';
|
|
62
62
|
|
|
63
63
|
export const catOne = new Agent({
|
|
64
|
-
|
|
64
|
+
id: 'cat-one',
|
|
65
|
+
name: 'Cat One',
|
|
65
66
|
instructions:
|
|
66
67
|
'You are a feline expert with comprehensive knowledge of all cat species, from domestic breeds to wild big cats. As a lifelong cat specialist, you understand their behavior, biology, social structures, and evolutionary history in great depth. If you are asked for a specie name, do not return a paragraph, a succint two or three letter name of the species will suffice.',
|
|
67
68
|
model: openai('gpt-4o'),
|
|
@@ -71,7 +72,7 @@ export const catOne = new Agent({
|
|
|
71
72
|
|
|
72
73
|
### mastra/index.ts
|
|
73
74
|
```typescript
|
|
74
|
-
import { Mastra } from '@mastra/core';
|
|
75
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
75
76
|
import { PinoLogger } from '@mastra/loggers';
|
|
76
77
|
import { catOne } from './agents/agent';
|
|
77
78
|
import { logCatWorkflow as legacy_catWorkflow } from './legacy-workflows';
|
|
@@ -93,34 +94,6 @@ export const mastra = new Mastra({
|
|
|
93
94
|
|
|
94
95
|
```
|
|
95
96
|
|
|
96
|
-
### mastra/legacy-workflows/index.ts
|
|
97
|
-
```typescript
|
|
98
|
-
import { LegacyWorkflow as Workflow, LegacyStep as Step } from '@mastra/core/workflows/legacy';
|
|
99
|
-
import { z } from 'zod';
|
|
100
|
-
|
|
101
|
-
const logCatName = new Step({
|
|
102
|
-
id: 'logCatName',
|
|
103
|
-
outputSchema: z.object({
|
|
104
|
-
rawText: z.string(),
|
|
105
|
-
}),
|
|
106
|
-
execute: async ({ context }) => {
|
|
107
|
-
const name = context?.getStepResult<{ name: string }>('trigger')?.name;
|
|
108
|
-
console.log(`Hello, ${name} 🐈`);
|
|
109
|
-
return { rawText: `Hello ${name}` };
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
export const logCatWorkflow = new Workflow({
|
|
114
|
-
name: 'log-cat-workflow',
|
|
115
|
-
triggerSchema: z.object({
|
|
116
|
-
name: z.string(),
|
|
117
|
-
}),
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
logCatWorkflow.step(logCatName).commit();
|
|
121
|
-
|
|
122
|
-
```
|
|
123
|
-
|
|
124
97
|
### mastra/workflows/index.ts
|
|
125
98
|
```typescript
|
|
126
99
|
import { createWorkflow, createStep } from '@mastra/core/workflows';
|
|
@@ -43,6 +43,7 @@ import { Agent } from '@mastra/core/agent';
|
|
|
43
43
|
import { stockPrices } from '../tools/stock-price';
|
|
44
44
|
|
|
45
45
|
export const stockAgent = new Agent({
|
|
46
|
+
id: 'stock-agent',
|
|
46
47
|
name: 'Stock Agent',
|
|
47
48
|
instructions:
|
|
48
49
|
'You are a helpful assistant that provides current stock prices. When asked about a stock, use the stock price tool to fetch the stock price.',
|
|
@@ -56,7 +57,7 @@ export const stockAgent = new Agent({
|
|
|
56
57
|
|
|
57
58
|
### mastra/index.ts
|
|
58
59
|
```typescript
|
|
59
|
-
import { Mastra } from '@mastra/core';
|
|
60
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
60
61
|
|
|
61
62
|
import { stockAgent } from './agents';
|
|
62
63
|
|
|
@@ -82,11 +83,11 @@ export const stockPrices = createTool({
|
|
|
82
83
|
symbol: z.string(),
|
|
83
84
|
}),
|
|
84
85
|
description: `Fetches the last day's closing stock price for a given symbol`,
|
|
85
|
-
execute: async
|
|
86
|
-
console.log('Using tool to fetch stock price for',
|
|
86
|
+
execute: async input => {
|
|
87
|
+
console.log('Using tool to fetch stock price for', inputData.symbol);
|
|
87
88
|
return {
|
|
88
|
-
symbol:
|
|
89
|
-
currentPrice: await getStockPrice(
|
|
89
|
+
symbol: inputData.symbol,
|
|
90
|
+
currentPrice: await getStockPrice(inputData.symbol),
|
|
90
91
|
};
|
|
91
92
|
},
|
|
92
93
|
});
|
|
@@ -28,17 +28,19 @@ import { weatherTool } from '../tools';
|
|
|
28
28
|
|
|
29
29
|
// const memory = new Memory({
|
|
30
30
|
// storage: new LibSQLStore({
|
|
31
|
+
// id: 'weather-agent-storage',
|
|
31
32
|
// url: 'file:../mastra.db', // Or your database URL
|
|
32
33
|
// }),
|
|
33
34
|
// });
|
|
34
35
|
|
|
35
36
|
export const weatherAgent = new Agent({
|
|
37
|
+
id: 'weather-agent',
|
|
36
38
|
name: 'Weather Agent',
|
|
37
39
|
instructions: `You are a helpful weather assistant that provides accurate weather information.
|
|
38
40
|
|
|
39
41
|
Your primary function is to help users get weather details for specific locations. When responding:
|
|
40
42
|
- Always ask for a location if none is provided
|
|
41
|
-
- If the location name isn
|
|
43
|
+
- If the location name isn't in English, please translate it
|
|
42
44
|
- If giving a location with multiple parts (e.g. "New York, NY"), use the most relevant part (e.g. "New York")
|
|
43
45
|
- Include relevant details like humidity, wind conditions, and precipitation
|
|
44
46
|
- Keep responses concise but informative
|
|
@@ -56,7 +58,8 @@ Use the weatherTool to fetch current weather data.`,
|
|
|
56
58
|
});
|
|
57
59
|
|
|
58
60
|
export const weatherReporterAgent = new Agent({
|
|
59
|
-
|
|
61
|
+
id: 'weatherExplainerAgent',
|
|
62
|
+
name: 'Weather Explainer Agent',
|
|
60
63
|
model: openai('gpt-4o'),
|
|
61
64
|
instructions: `
|
|
62
65
|
You are a weather explainer. You have access to input that will help you get weather-specific activities for any city.
|
|
@@ -68,7 +71,7 @@ export const weatherReporterAgent = new Agent({
|
|
|
68
71
|
|
|
69
72
|
### mastra/index.ts
|
|
70
73
|
```typescript
|
|
71
|
-
import { Mastra } from '@mastra/core';
|
|
74
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
72
75
|
import { LibSQLStore } from '@mastra/libsql';
|
|
73
76
|
|
|
74
77
|
import { weatherAgent, weatherReporterAgent } from './agents';
|
|
@@ -77,6 +80,7 @@ import { weatherWorkflow, weatherWorkflow2 } from './workflows/new-workflow';
|
|
|
77
80
|
|
|
78
81
|
export const mastra = new Mastra({
|
|
79
82
|
storage: new LibSQLStore({
|
|
83
|
+
id: 'weather-agent-storage',
|
|
80
84
|
url: 'file:./mastra.db',
|
|
81
85
|
}),
|
|
82
86
|
agents: { weatherAgent, weatherReporterAgent },
|
|
@@ -118,8 +122,8 @@ export const weatherTool = createTool({
|
|
|
118
122
|
conditions: z.string(),
|
|
119
123
|
location: z.string(),
|
|
120
124
|
}),
|
|
121
|
-
execute: async
|
|
122
|
-
return await getWeather(
|
|
125
|
+
execute: async input => {
|
|
126
|
+
return await getWeather(inputData.location);
|
|
123
127
|
},
|
|
124
128
|
});
|
|
125
129
|
|
|
@@ -190,10 +194,11 @@ function getWeatherCondition(code: number): string {
|
|
|
190
194
|
```typescript
|
|
191
195
|
import { openai } from '@ai-sdk/openai';
|
|
192
196
|
import { Agent } from '@mastra/core/agent';
|
|
193
|
-
import {
|
|
197
|
+
import { createStep, createWorkflow } from '@mastra/core/workflows';
|
|
194
198
|
import { z } from 'zod';
|
|
195
199
|
|
|
196
200
|
const agent = new Agent({
|
|
201
|
+
id: 'weather-agent',
|
|
197
202
|
name: 'Weather Agent',
|
|
198
203
|
instructions: `
|
|
199
204
|
You are a local activities and travel expert who excels at weather-based planning. Analyze the weather data and provide practical activity recommendations.
|
|
@@ -232,14 +237,14 @@ const agent = new Agent({
|
|
|
232
237
|
model: openai('gpt-4o'),
|
|
233
238
|
});
|
|
234
239
|
|
|
235
|
-
const fetchWeather =
|
|
240
|
+
const fetchWeather = createStep({
|
|
236
241
|
id: 'fetch-weather',
|
|
237
242
|
description: 'Fetches weather forecast for a given city',
|
|
238
243
|
inputSchema: z.object({
|
|
239
244
|
city: z.string().describe('The city to get the weather for'),
|
|
240
245
|
}),
|
|
241
|
-
execute: async (
|
|
242
|
-
const triggerData = context?.getStepResult<{ city: string }>('trigger');
|
|
246
|
+
execute: async (inputData, context) => {
|
|
247
|
+
const triggerData = context?.workflow?.state?.getStepResult<{ city: string }>('trigger');
|
|
243
248
|
|
|
244
249
|
if (!triggerData) {
|
|
245
250
|
throw new Error('Trigger data not found');
|
|
@@ -283,12 +288,12 @@ const forecastSchema = z.array(
|
|
|
283
288
|
}),
|
|
284
289
|
);
|
|
285
290
|
|
|
286
|
-
const planActivities =
|
|
291
|
+
const planActivities = createStep({
|
|
287
292
|
id: 'plan-activities',
|
|
288
293
|
description: 'Suggests activities based on weather conditions',
|
|
289
294
|
inputSchema: forecastSchema,
|
|
290
|
-
execute: async (
|
|
291
|
-
const forecast = context?.getStepResult<z.infer<typeof forecastSchema>>('fetch-weather');
|
|
295
|
+
execute: async (inputData, context) => {
|
|
296
|
+
const forecast = context?.workflow?.state?.getStepResult<z.infer<typeof forecastSchema>>('fetch-weather');
|
|
292
297
|
|
|
293
298
|
if (!forecast) {
|
|
294
299
|
throw new Error('Forecast data not found');
|
|
@@ -340,16 +345,15 @@ function getWeatherCondition(code: number): string {
|
|
|
340
345
|
return conditions[code] || 'Unknown';
|
|
341
346
|
}
|
|
342
347
|
|
|
343
|
-
const weatherWorkflow =
|
|
348
|
+
const weatherWorkflow = createWorkflow({
|
|
344
349
|
name: 'weather-workflow',
|
|
345
350
|
triggerSchema: z.object({
|
|
346
351
|
city: z.string().describe('The city to get the weather for'),
|
|
347
352
|
}),
|
|
348
353
|
})
|
|
349
354
|
.step(fetchWeather)
|
|
350
|
-
.then(planActivities)
|
|
351
|
-
|
|
352
|
-
weatherWorkflow.commit();
|
|
355
|
+
.then(planActivities)
|
|
356
|
+
.commit();
|
|
353
357
|
|
|
354
358
|
export { weatherWorkflow };
|
|
355
359
|
|
|
@@ -365,6 +369,7 @@ import { weatherTool } from '../tools';
|
|
|
365
369
|
import { weatherReporterAgent } from '../agents';
|
|
366
370
|
|
|
367
371
|
const agent = new Agent({
|
|
372
|
+
id: 'weather-agent',
|
|
368
373
|
name: 'Weather Agent',
|
|
369
374
|
model: openai('gpt-4o'),
|
|
370
375
|
instructions: `
|
|
@@ -21,12 +21,13 @@
|
|
|
21
21
|
### mastra/index.ts
|
|
22
22
|
```typescript
|
|
23
23
|
import { openai } from '@ai-sdk/openai';
|
|
24
|
-
import { Mastra } from '@mastra/core';
|
|
24
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
25
25
|
import { Agent } from '@mastra/core/agent';
|
|
26
26
|
import { Step, Workflow } from '@mastra/core/workflows';
|
|
27
27
|
import { z } from 'zod';
|
|
28
28
|
|
|
29
29
|
const recruiter = new Agent({
|
|
30
|
+
id: 'recruiter-agent',
|
|
30
31
|
name: 'Recruiter Agent',
|
|
31
32
|
instructions: `You are a recruiter.`,
|
|
32
33
|
model: openai('gpt-4o-mini'),
|
|
@@ -132,7 +133,7 @@ const mastra = new Mastra({
|
|
|
132
133
|
});
|
|
133
134
|
|
|
134
135
|
(async () => {
|
|
135
|
-
const run = await mastra.getWorkflow('candidateWorkflow').
|
|
136
|
+
const run = await mastra.getWorkflow('candidateWorkflow').createRun();
|
|
136
137
|
const { runId, start } = run;
|
|
137
138
|
|
|
138
139
|
console.log('Run', runId);
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
### mastra/index.ts
|
|
19
19
|
```typescript
|
|
20
|
-
import { Mastra } from '@mastra/core';
|
|
20
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
21
21
|
|
|
22
22
|
import { myWorkflow } from './workflows';
|
|
23
23
|
|
|
@@ -51,8 +51,8 @@ myWorkflow
|
|
|
51
51
|
outputSchema: z.object({
|
|
52
52
|
doubledValue: z.number(),
|
|
53
53
|
}),
|
|
54
|
-
execute: async (
|
|
55
|
-
const doubledValue = context?.triggerData.inputValue * 2;
|
|
54
|
+
execute: async (inputData, context) => {
|
|
55
|
+
const doubledValue = context?.workflow?.state?.triggerData.inputValue * 2;
|
|
56
56
|
return { doubledValue };
|
|
57
57
|
},
|
|
58
58
|
}),
|
|
@@ -66,21 +66,18 @@ myWorkflow
|
|
|
66
66
|
outputSchema: z.object({
|
|
67
67
|
incrementedValue: z.number(),
|
|
68
68
|
}),
|
|
69
|
-
execute: async (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return { incrementedValue };
|
|
73
|
-
}
|
|
74
|
-
return { incrementedValue: 0 };
|
|
69
|
+
execute: async (inputData, context) => {
|
|
70
|
+
const incrementedValue = inputData.valueToIncrement + 1;
|
|
71
|
+
return { incrementedValue };
|
|
75
72
|
},
|
|
76
73
|
}),
|
|
77
74
|
)
|
|
78
75
|
.then(
|
|
79
76
|
new Step({
|
|
80
77
|
id: 'stepThree',
|
|
81
|
-
execute: async (
|
|
82
|
-
if (context?.resumeData?.confirm !== 'true') {
|
|
83
|
-
return suspend({
|
|
78
|
+
execute: async (inputData, context) => {
|
|
79
|
+
if (context?.workflow?.resumeData?.confirm !== 'true') {
|
|
80
|
+
return context?.workflow?.suspend({
|
|
84
81
|
message: 'Do you accept?',
|
|
85
82
|
});
|
|
86
83
|
}
|
|
@@ -30,7 +30,8 @@ const memory = new Memory({
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
export const catOne = new Agent({
|
|
33
|
-
|
|
33
|
+
id: 'cat-one',
|
|
34
|
+
name: 'Cat One',
|
|
34
35
|
memory,
|
|
35
36
|
instructions:
|
|
36
37
|
'You are a feline expert with comprehensive knowledge of all cat species, from domestic breeds to wild big cats. As a lifelong cat specialist, you understand their behavior, biology, social structures, and evolutionary history in great depth.',
|
|
@@ -41,7 +42,7 @@ export const catOne = new Agent({
|
|
|
41
42
|
|
|
42
43
|
### mastra/index.ts
|
|
43
44
|
```typescript
|
|
44
|
-
import { Mastra } from '@mastra/core';
|
|
45
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
45
46
|
import { PinoLogger } from '@mastra/loggers';
|
|
46
47
|
|
|
47
48
|
import { catOne } from './agents/index';
|
|
@@ -103,8 +104,8 @@ const stepOne = new Step({
|
|
|
103
104
|
outputSchema: z.object({
|
|
104
105
|
doubledValue: z.number(),
|
|
105
106
|
}),
|
|
106
|
-
execute: async
|
|
107
|
-
const doubledValue =
|
|
107
|
+
execute: async inputData => {
|
|
108
|
+
const doubledValue = inputData.inputValue * 2;
|
|
108
109
|
return { doubledValue };
|
|
109
110
|
},
|
|
110
111
|
});
|
|
@@ -118,8 +119,8 @@ const stepTwo = new Step({
|
|
|
118
119
|
outputSchema: z.object({
|
|
119
120
|
incrementedValue: z.number(),
|
|
120
121
|
}),
|
|
121
|
-
execute: async
|
|
122
|
-
const incrementedValue =
|
|
122
|
+
execute: async inputData => {
|
|
123
|
+
const incrementedValue = inputData.valueToIncrement + 1;
|
|
123
124
|
return { incrementedValue };
|
|
124
125
|
},
|
|
125
126
|
});
|
|
@@ -133,8 +134,8 @@ const stepThree = new Step({
|
|
|
133
134
|
outputSchema: z.object({
|
|
134
135
|
squaredValue: z.number(),
|
|
135
136
|
}),
|
|
136
|
-
execute: async
|
|
137
|
-
const squaredValue =
|
|
137
|
+
execute: async inputData => {
|
|
138
|
+
const squaredValue = inputData.valueToSquare * inputData.valueToSquare;
|
|
138
139
|
return { squaredValue };
|
|
139
140
|
},
|
|
140
141
|
});
|
|
@@ -148,8 +149,8 @@ const stepFour = new Step({
|
|
|
148
149
|
outputSchema: z.object({
|
|
149
150
|
rootValue: z.number(),
|
|
150
151
|
}),
|
|
151
|
-
execute: async
|
|
152
|
-
return { rootValue: Math.sqrt(
|
|
152
|
+
execute: async inputData => {
|
|
153
|
+
return { rootValue: Math.sqrt(inputData.valueToRoot) };
|
|
153
154
|
},
|
|
154
155
|
});
|
|
155
156
|
|
|
@@ -162,8 +163,8 @@ const stepFive = new Step({
|
|
|
162
163
|
outputSchema: z.object({
|
|
163
164
|
tripledValue: z.number(),
|
|
164
165
|
}),
|
|
165
|
-
execute: async
|
|
166
|
-
const tripledValue =
|
|
166
|
+
execute: async inputData => {
|
|
167
|
+
const tripledValue = inputData.inputValue * 3;
|
|
167
168
|
return { tripledValue };
|
|
168
169
|
},
|
|
169
170
|
});
|
|
@@ -177,9 +178,9 @@ const stepSix = new Step({
|
|
|
177
178
|
outputSchema: z.object({
|
|
178
179
|
rawText: z.string(),
|
|
179
180
|
}),
|
|
180
|
-
execute: async
|
|
181
|
-
console.log(
|
|
182
|
-
return { rawText:
|
|
181
|
+
execute: async inputData => {
|
|
182
|
+
console.log(inputData.inputValue);
|
|
183
|
+
return { rawText: inputData.inputValue.toString() };
|
|
183
184
|
},
|
|
184
185
|
});
|
|
185
186
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { mastra } from './mastra';
|
|
21
21
|
|
|
22
22
|
async function main() {
|
|
23
|
-
const run = await mastra.getWorkflow('myWorkflow').
|
|
23
|
+
const run = await mastra.getWorkflow('myWorkflow').createRun();
|
|
24
24
|
try {
|
|
25
25
|
const res = await run.start({
|
|
26
26
|
inputData: {
|
|
@@ -46,7 +46,7 @@ main();
|
|
|
46
46
|
|
|
47
47
|
### mastra/index.ts
|
|
48
48
|
```typescript
|
|
49
|
-
import { Mastra } from '@mastra/core';
|
|
49
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
50
50
|
|
|
51
51
|
import { myWorkflow } from './workflows';
|
|
52
52
|
|
|
@@ -24,7 +24,7 @@ async function main() {
|
|
|
24
24
|
console.log('🚀 Starting workflow with suspend/resume example...\n');
|
|
25
25
|
|
|
26
26
|
const myWorkflow = mastra.getWorkflow('myWorkflow');
|
|
27
|
-
const run = await myWorkflow.
|
|
27
|
+
const run = await myWorkflow.createRun();
|
|
28
28
|
|
|
29
29
|
try {
|
|
30
30
|
// Start the workflow - it will suspend at stepTwo
|
|
@@ -65,7 +65,7 @@ main();
|
|
|
65
65
|
|
|
66
66
|
### mastra/index.ts
|
|
67
67
|
```typescript
|
|
68
|
-
import { Mastra } from '@mastra/core';
|
|
68
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
69
69
|
import { LibSQLStore } from '@mastra/libsql';
|
|
70
70
|
|
|
71
71
|
import { myWorkflow } from './workflows';
|
|
@@ -75,6 +75,7 @@ export const mastra = new Mastra({
|
|
|
75
75
|
myWorkflow,
|
|
76
76
|
},
|
|
77
77
|
storage: new LibSQLStore({
|
|
78
|
+
id: 'workflow-snapshots-storage',
|
|
78
79
|
url: 'file:./workflow-snapshots.db',
|
|
79
80
|
}),
|
|
80
81
|
});
|