@mastra/mcp-docs-server 1.0.0-beta.8 → 1.0.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%2Fchangeset-cli.md +1 -13
- package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +1 -5
- package/.docs/organized/changelogs/%40internal%2Fplayground.md +40 -0
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +8 -8
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +1 -53
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +287 -287
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +315 -315
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +53 -53
- package/.docs/organized/changelogs/%40mastra%2Fauth.md +38 -0
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +66 -66
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +522 -212
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +658 -196
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +439 -234
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +450 -211
- package/.docs/organized/changelogs/%40mastra%2Fcodemod.md +208 -0
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +448 -22
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +3341 -271
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +60 -60
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +289 -289
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +90 -90
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +74 -74
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +70 -70
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +247 -220
- package/.docs/organized/changelogs/%40mastra%2Fduckdb.md +70 -0
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +403 -225
- package/.docs/organized/changelogs/%40mastra%2Felasticsearch.md +72 -0
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +145 -145
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +54 -0
- package/.docs/organized/changelogs/%40mastra%2Flance.md +456 -226
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +604 -208
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +71 -71
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +247 -247
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +28 -28
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +285 -285
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +354 -156
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +545 -212
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +481 -202
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +194 -194
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +759 -213
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +198 -198
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +636 -229
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +163 -163
- package/.docs/organized/changelogs/%40mastra%2Frag.md +310 -310
- package/.docs/organized/changelogs/%40mastra%2Freact.md +328 -230
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +64 -0
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +160 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +829 -218
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +57 -57
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +479 -232
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +53 -53
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +47 -47
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +110 -110
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +15 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +98 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +54 -54
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +46 -46
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +93 -93
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +47 -47
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +45 -45
- package/.docs/organized/changelogs/create-mastra.md +227 -227
- package/.docs/organized/changelogs/mastra.md +277 -277
- package/.docs/organized/code-examples/a2a.md +2 -2
- package/.docs/organized/code-examples/agent-v6.md +221 -0
- package/.docs/organized/code-examples/agui.md +4 -4
- package/.docs/organized/code-examples/ai-elements.md +3 -3
- package/.docs/organized/code-examples/ai-sdk-useChat.md +2 -2
- package/.docs/organized/code-examples/ai-sdk-v5.md +3 -3
- package/.docs/organized/code-examples/assistant-ui.md +5 -5
- package/.docs/organized/code-examples/bird-checker-with-express.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +2 -2
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +3 -3
- package/.docs/organized/code-examples/client-side-tools.md +4 -4
- package/.docs/organized/code-examples/crypto-chatbot.md +5 -5
- package/.docs/organized/code-examples/experimental-auth-weather-agent.md +1 -1
- package/.docs/organized/code-examples/fireworks-r1.md +2 -2
- package/.docs/organized/code-examples/heads-up-game.md +7 -7
- package/.docs/organized/code-examples/inngest.md +1075 -0
- package/.docs/organized/code-examples/mcp-configuration.md +1 -1
- package/.docs/organized/code-examples/mcp-server-adapters.md +3 -4
- package/.docs/organized/code-examples/memory-per-resource-example.md +3 -3
- package/.docs/organized/code-examples/memory-todo-agent.md +1 -1
- package/.docs/organized/code-examples/memory-with-context.md +1 -1
- package/.docs/organized/code-examples/memory-with-processors.md +1 -1
- package/.docs/organized/code-examples/openapi-spec-writer.md +3 -3
- package/.docs/organized/code-examples/processors-with-ai-sdk.md +14 -0
- package/.docs/organized/code-examples/quick-start.md +1 -5
- package/.docs/organized/code-examples/server-app-access.md +3 -3
- package/.docs/organized/code-examples/server-express-adapter.md +1 -1
- package/.docs/organized/code-examples/server-fastify-adapter.md +83 -0
- package/.docs/organized/code-examples/server-hono-adapter.md +3 -3
- package/.docs/organized/code-examples/server-koa-adapter.md +94 -0
- package/.docs/organized/code-examples/stock-price-tool.md +21 -2
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +1 -1
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +1 -1
- package/.docs/organized/code-examples/workflow-with-memory.md +1 -1
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +1 -1
- package/.docs/organized/code-examples/workflow-with-suspend-resume.md +1 -1
- package/.docs/raw/agents/adding-voice.mdx +24 -6
- package/.docs/raw/agents/agent-approval.mdx +209 -12
- package/.docs/raw/agents/agent-memory.mdx +36 -32
- package/.docs/raw/agents/guardrails.mdx +105 -56
- package/.docs/raw/agents/network-approval.mdx +281 -0
- package/.docs/raw/agents/networks.mdx +69 -13
- package/.docs/raw/agents/overview.mdx +43 -25
- package/.docs/raw/agents/processors.mdx +234 -17
- package/.docs/raw/agents/structured-output.mdx +78 -8
- package/.docs/raw/agents/using-tools.mdx +67 -6
- package/.docs/raw/course/01-first-agent/07-creating-your-agent.md +1 -2
- package/.docs/raw/course/01-first-agent/12-connecting-tool-to-agent.md +1 -1
- package/.docs/raw/course/01-first-agent/16-adding-memory-to-agent.md +1 -2
- package/.docs/raw/course/02-agent-tools-mcp/05-updating-your-agent.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/10-updating-agent-instructions-zapier.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/16-updating-agent-instructions-github.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/21-updating-agent-instructions-hackernews.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/27-updating-agent-instructions-filesystem.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +3 -3
- package/.docs/raw/course/03-agent-memory/04-creating-basic-memory-agent.md +1 -2
- package/.docs/raw/course/03-agent-memory/07-understanding-memory-threads.md +35 -0
- package/.docs/raw/course/03-agent-memory/08-configuring-conversation-history.md +1 -2
- package/.docs/raw/course/03-agent-memory/13-vector-store-configuration.md +1 -1
- package/.docs/raw/course/03-agent-memory/16-configuring-semantic-recall.md +4 -5
- package/.docs/raw/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +1 -1
- package/.docs/raw/course/03-agent-memory/21-configuring-working-memory.md +3 -4
- package/.docs/raw/course/03-agent-memory/22-custom-working-memory-templates.md +3 -4
- package/.docs/raw/course/03-agent-memory/25-combining-memory-features.md +3 -4
- package/.docs/raw/course/03-agent-memory/27-creating-learning-assistant.md +3 -4
- package/.docs/raw/course/04-workflows/11-creating-an-ai-agent.md +2 -3
- package/.docs/raw/deployment/cloud-providers.mdx +22 -0
- package/.docs/raw/deployment/mastra-server.mdx +140 -0
- package/.docs/raw/deployment/monorepo.mdx +106 -42
- package/.docs/raw/deployment/overview.mdx +35 -48
- package/.docs/raw/deployment/web-framework.mdx +17 -19
- package/.docs/raw/deployment/workflow-runners.mdx +16 -0
- package/.docs/raw/evals/built-in-scorers.mdx +2 -0
- package/.docs/raw/evals/custom-scorers.mdx +60 -12
- package/.docs/raw/evals/overview.mdx +6 -6
- package/.docs/raw/evals/running-in-ci.mdx +4 -2
- package/.docs/raw/getting-started/manual-install.mdx +20 -20
- package/.docs/raw/getting-started/mcp-docs-server.mdx +59 -2
- package/.docs/raw/getting-started/project-structure.mdx +2 -2
- package/.docs/raw/getting-started/start.mdx +17 -1
- package/.docs/raw/getting-started/studio.mdx +10 -37
- package/.docs/raw/guides/agent-frameworks/ai-sdk.mdx +151 -0
- package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +1034 -80
- package/.docs/raw/guides/build-your-ui/assistant-ui.mdx +8 -8
- package/.docs/raw/guides/build-your-ui/copilotkit.mdx +32 -11
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/amazon-ec2.mdx +9 -9
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/aws-lambda.mdx +13 -16
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/azure-app-services.mdx +5 -7
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/cloudflare-deployer.mdx +8 -5
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/digital-ocean.mdx +18 -23
- package/.docs/raw/guides/deployment/index.mdx +32 -0
- package/.docs/raw/guides/deployment/inngest.mdx +673 -0
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/netlify-deployer.mdx +7 -3
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/vercel-deployer.mdx +8 -5
- package/.docs/raw/guides/getting-started/astro.mdx +292 -451
- package/.docs/raw/guides/getting-started/express.mdx +72 -153
- package/.docs/raw/guides/getting-started/hono.mdx +227 -0
- package/.docs/raw/guides/getting-started/next-js.mdx +173 -61
- package/.docs/raw/guides/getting-started/nuxt.mdx +505 -0
- package/.docs/raw/guides/getting-started/quickstart.mdx +5 -5
- package/.docs/raw/guides/getting-started/sveltekit.mdx +238 -409
- package/.docs/raw/guides/getting-started/vite-react.mdx +317 -147
- 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 +20 -20
- package/.docs/raw/guides/guide/stock-agent.mdx +5 -5
- package/.docs/raw/guides/guide/web-search.mdx +38 -38
- package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +7 -7
- package/.docs/raw/guides/index.mdx +0 -1
- package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +2 -2
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +105 -4
- package/.docs/raw/guides/migrations/upgrade-to-v1/cli.mdx +15 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/client.mdx +170 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/deployment.mdx +42 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/mastra.mdx +0 -35
- package/.docs/raw/guides/migrations/upgrade-to-v1/memory.mdx +40 -3
- package/.docs/raw/guides/migrations/upgrade-to-v1/overview.mdx +17 -2
- package/.docs/raw/guides/migrations/upgrade-to-v1/processors.mdx +11 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/rag.mdx +47 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +271 -25
- package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +3 -3
- package/.docs/raw/guides/migrations/upgrade-to-v1/tracing.mdx +72 -17
- package/.docs/raw/guides/migrations/upgrade-to-v1/vectors.mdx +46 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +50 -7
- 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 +86 -0
- package/.docs/raw/mastra-cloud/observability.mdx +43 -0
- package/.docs/raw/mastra-cloud/overview.mdx +31 -0
- package/.docs/raw/mastra-cloud/setup.mdx +64 -0
- package/.docs/raw/mastra-cloud/studio.mdx +35 -0
- package/.docs/raw/mcp/overview.mdx +60 -25
- package/.docs/raw/mcp/publishing-mcp-server.mdx +7 -4
- package/.docs/raw/memory/memory-processors.mdx +17 -12
- package/.docs/raw/memory/message-history.mdx +72 -0
- package/.docs/raw/memory/overview.mdx +38 -76
- package/.docs/raw/memory/semantic-recall.mdx +65 -52
- package/.docs/raw/memory/storage.mdx +248 -0
- package/.docs/raw/memory/working-memory.mdx +24 -13
- package/.docs/raw/observability/logging.mdx +16 -15
- package/.docs/raw/observability/overview.mdx +27 -7
- package/.docs/raw/observability/tracing/bridges/otel.mdx +7 -4
- package/.docs/raw/observability/tracing/exporters/arize.mdx +61 -24
- package/.docs/raw/observability/tracing/exporters/braintrust.mdx +32 -22
- package/.docs/raw/observability/tracing/exporters/cloud.mdx +24 -5
- package/.docs/raw/observability/tracing/exporters/datadog.mdx +175 -0
- package/.docs/raw/observability/tracing/exporters/default.mdx +28 -7
- package/.docs/raw/observability/tracing/exporters/laminar.mdx +89 -0
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +31 -22
- package/.docs/raw/observability/tracing/exporters/langsmith.mdx +33 -3
- package/.docs/raw/observability/tracing/exporters/otel.mdx +194 -22
- package/.docs/raw/observability/tracing/exporters/posthog.mdx +32 -22
- package/.docs/raw/observability/tracing/exporters/sentry.mdx +198 -0
- package/.docs/raw/observability/tracing/overview.mdx +388 -108
- package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +27 -7
- package/.docs/raw/rag/chunking-and-embedding.mdx +22 -33
- package/.docs/raw/rag/graph-rag.mdx +223 -0
- package/.docs/raw/rag/overview.mdx +6 -3
- package/.docs/raw/rag/retrieval.mdx +53 -57
- package/.docs/raw/rag/vector-databases.mdx +55 -31
- package/.docs/raw/reference/agents/agent.mdx +17 -14
- package/.docs/raw/reference/agents/generate.mdx +172 -44
- package/.docs/raw/reference/agents/generateLegacy.mdx +5 -3
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +5 -3
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +5 -3
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +5 -3
- package/.docs/raw/reference/agents/getDescription.mdx +3 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +5 -3
- package/.docs/raw/reference/agents/getLLM.mdx +5 -3
- package/.docs/raw/reference/agents/getMemory.mdx +5 -3
- package/.docs/raw/reference/agents/getModel.mdx +5 -3
- package/.docs/raw/reference/agents/getTools.mdx +4 -2
- package/.docs/raw/reference/agents/getVoice.mdx +4 -2
- package/.docs/raw/reference/agents/listAgents.mdx +4 -2
- package/.docs/raw/reference/agents/listScorers.mdx +5 -3
- package/.docs/raw/reference/agents/listTools.mdx +4 -2
- package/.docs/raw/reference/agents/listWorkflows.mdx +4 -2
- package/.docs/raw/reference/agents/network.mdx +113 -1
- package/.docs/raw/reference/ai-sdk/chat-route.mdx +6 -3
- package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +4 -2
- package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +4 -2
- package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +5 -3
- package/.docs/raw/reference/ai-sdk/network-route.mdx +6 -3
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-stream.mdx +10 -6
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v4-messages.mdx +130 -0
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v5-messages.mdx +110 -0
- package/.docs/raw/reference/ai-sdk/with-mastra.mdx +122 -0
- package/.docs/raw/reference/ai-sdk/workflow-route.mdx +7 -4
- package/.docs/raw/reference/auth/auth0.mdx +5 -3
- package/.docs/raw/reference/auth/clerk.mdx +5 -3
- package/.docs/raw/reference/auth/firebase.mdx +6 -5
- package/.docs/raw/reference/auth/jwt.mdx +5 -3
- package/.docs/raw/reference/auth/supabase.mdx +5 -3
- package/.docs/raw/reference/auth/workos.mdx +5 -3
- package/.docs/raw/reference/cli/create-mastra.mdx +12 -10
- package/.docs/raw/reference/cli/mastra.mdx +63 -15
- package/.docs/raw/reference/client-js/agents.mdx +311 -85
- package/.docs/raw/reference/client-js/error-handling.mdx +3 -3
- package/.docs/raw/reference/client-js/logs.mdx +2 -0
- package/.docs/raw/reference/client-js/mastra-client.mdx +6 -4
- package/.docs/raw/reference/client-js/memory.mdx +47 -2
- package/.docs/raw/reference/client-js/observability.mdx +2 -0
- package/.docs/raw/reference/client-js/telemetry.mdx +2 -0
- package/.docs/raw/reference/client-js/tools.mdx +2 -0
- package/.docs/raw/reference/client-js/vectors.mdx +2 -0
- package/.docs/raw/reference/client-js/workflows.mdx +47 -3
- package/.docs/raw/reference/configuration.mdx +761 -0
- package/.docs/raw/reference/core/addGateway.mdx +2 -0
- package/.docs/raw/reference/core/getAgent.mdx +3 -1
- package/.docs/raw/reference/core/getAgentById.mdx +3 -1
- package/.docs/raw/reference/core/getDeployer.mdx +3 -1
- package/.docs/raw/reference/core/getGateway.mdx +2 -0
- package/.docs/raw/reference/core/getGatewayById.mdx +2 -0
- package/.docs/raw/reference/core/getLogger.mdx +3 -1
- package/.docs/raw/reference/core/getMCPServer.mdx +3 -1
- package/.docs/raw/reference/core/getMCPServerById.mdx +3 -1
- package/.docs/raw/reference/core/getMemory.mdx +77 -0
- package/.docs/raw/reference/core/getScorer.mdx +2 -0
- package/.docs/raw/reference/core/getScorerById.mdx +2 -0
- package/.docs/raw/reference/core/getServer.mdx +6 -4
- package/.docs/raw/reference/core/getStorage.mdx +5 -3
- package/.docs/raw/reference/core/getStoredAgentById.mdx +185 -0
- package/.docs/raw/reference/core/getTelemetry.mdx +3 -1
- package/.docs/raw/reference/core/getVector.mdx +3 -1
- package/.docs/raw/reference/core/getWorkflow.mdx +3 -1
- package/.docs/raw/reference/core/listAgents.mdx +3 -1
- package/.docs/raw/reference/core/listGateways.mdx +2 -0
- package/.docs/raw/reference/core/listLogs.mdx +3 -1
- package/.docs/raw/reference/core/listLogsByRunId.mdx +3 -1
- package/.docs/raw/reference/core/listMCPServers.mdx +3 -1
- package/.docs/raw/reference/core/listMemory.mdx +74 -0
- package/.docs/raw/reference/core/listScorers.mdx +2 -0
- package/.docs/raw/reference/core/listStoredAgents.mdx +153 -0
- package/.docs/raw/reference/core/listVectors.mdx +3 -1
- package/.docs/raw/reference/core/listWorkflows.mdx +3 -1
- package/.docs/raw/reference/core/mastra-class.mdx +35 -20
- package/.docs/raw/reference/core/mastra-model-gateway.mdx +2 -0
- package/.docs/raw/reference/core/setLogger.mdx +3 -1
- package/.docs/raw/reference/core/setStorage.mdx +6 -4
- package/.docs/raw/reference/deployer/cloudflare.mdx +22 -53
- package/.docs/raw/reference/deployer/deployer.mdx +2 -1
- package/.docs/raw/reference/deployer/netlify.mdx +4 -1
- package/.docs/raw/reference/deployer/vercel.mdx +5 -4
- package/.docs/raw/reference/evals/answer-relevancy.mdx +4 -1
- package/.docs/raw/reference/evals/answer-similarity.mdx +4 -1
- package/.docs/raw/reference/evals/bias.mdx +4 -1
- package/.docs/raw/reference/evals/completeness.mdx +4 -1
- package/.docs/raw/reference/evals/content-similarity.mdx +4 -1
- package/.docs/raw/reference/evals/context-precision.mdx +4 -1
- package/.docs/raw/reference/evals/context-relevance.mdx +2 -0
- package/.docs/raw/reference/evals/create-scorer.mdx +11 -3
- package/.docs/raw/reference/evals/faithfulness.mdx +4 -1
- package/.docs/raw/reference/evals/hallucination.mdx +4 -1
- package/.docs/raw/reference/evals/keyword-coverage.mdx +4 -1
- package/.docs/raw/reference/evals/mastra-scorer.mdx +2 -0
- package/.docs/raw/reference/evals/noise-sensitivity.mdx +2 -0
- package/.docs/raw/reference/evals/prompt-alignment.mdx +9 -7
- package/.docs/raw/reference/evals/run-evals.mdx +3 -1
- package/.docs/raw/reference/evals/scorer-utils.mdx +3 -0
- package/.docs/raw/reference/evals/textual-difference.mdx +4 -1
- package/.docs/raw/reference/evals/tone-consistency.mdx +4 -1
- package/.docs/raw/reference/evals/tool-call-accuracy.mdx +25 -23
- package/.docs/raw/reference/evals/toxicity.mdx +4 -1
- package/.docs/raw/reference/index.mdx +2 -1
- package/.docs/raw/reference/logging/pino-logger.mdx +10 -8
- package/.docs/raw/reference/memory/clone-utilities.mdx +345 -0
- package/.docs/raw/reference/memory/cloneThread.mdx +237 -0
- package/.docs/raw/reference/memory/createThread.mdx +6 -4
- package/.docs/raw/reference/memory/deleteMessages.mdx +4 -2
- package/.docs/raw/reference/memory/getThreadById.mdx +3 -1
- package/.docs/raw/reference/memory/listThreads.mdx +187 -0
- package/.docs/raw/reference/memory/memory-class.mdx +27 -20
- package/.docs/raw/reference/memory/recall.mdx +6 -4
- package/.docs/raw/reference/observability/tracing/bridges/otel.mdx +6 -2
- package/.docs/raw/reference/observability/tracing/configuration.mdx +51 -0
- package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +25 -6
- package/.docs/raw/reference/observability/tracing/exporters/braintrust.mdx +23 -2
- package/.docs/raw/reference/observability/tracing/exporters/cloud-exporter.mdx +10 -0
- package/.docs/raw/reference/observability/tracing/exporters/console-exporter.mdx +3 -0
- package/.docs/raw/reference/observability/tracing/exporters/datadog.mdx +172 -0
- package/.docs/raw/reference/observability/tracing/exporters/default-exporter.mdx +10 -0
- package/.docs/raw/reference/observability/tracing/exporters/laminar.mdx +139 -0
- package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +26 -4
- package/.docs/raw/reference/observability/tracing/exporters/langsmith.mdx +10 -0
- package/.docs/raw/reference/observability/tracing/exporters/otel.mdx +51 -34
- package/.docs/raw/reference/observability/tracing/exporters/posthog.mdx +25 -4
- package/.docs/raw/reference/observability/tracing/exporters/sentry.mdx +224 -0
- package/.docs/raw/reference/observability/tracing/instances.mdx +2 -0
- package/.docs/raw/reference/observability/tracing/interfaces.mdx +20 -0
- package/.docs/raw/reference/observability/tracing/processors/sensitive-data-filter.mdx +2 -0
- package/.docs/raw/reference/observability/tracing/spans.mdx +2 -0
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +4 -2
- package/.docs/raw/reference/processors/language-detector.mdx +6 -3
- package/.docs/raw/reference/processors/message-history-processor.mdx +5 -2
- package/.docs/raw/reference/processors/moderation-processor.mdx +6 -4
- package/.docs/raw/reference/processors/pii-detector.mdx +6 -4
- package/.docs/raw/reference/processors/processor-interface.mdx +326 -23
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +5 -3
- package/.docs/raw/reference/processors/semantic-recall-processor.mdx +7 -2
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +5 -3
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +62 -19
- package/.docs/raw/reference/processors/tool-call-filter.mdx +5 -3
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +6 -3
- package/.docs/raw/reference/processors/working-memory-processor.mdx +6 -3
- package/.docs/raw/reference/rag/chunk.mdx +7 -6
- package/.docs/raw/reference/rag/database-config.mdx +8 -6
- package/.docs/raw/reference/rag/document.mdx +2 -0
- package/.docs/raw/reference/rag/embeddings.mdx +2 -0
- package/.docs/raw/reference/rag/extract-params.mdx +57 -3
- package/.docs/raw/reference/rag/graph-rag.mdx +2 -0
- package/.docs/raw/reference/rag/metadata-filters.mdx +27 -7
- package/.docs/raw/reference/rag/rerank.mdx +2 -0
- package/.docs/raw/reference/rag/rerankWithScorer.mdx +2 -0
- package/.docs/raw/reference/server/create-route.mdx +34 -18
- package/.docs/raw/reference/server/express-adapter.mdx +78 -50
- package/.docs/raw/reference/server/fastify-adapter.mdx +130 -0
- package/.docs/raw/reference/server/hono-adapter.mdx +78 -48
- package/.docs/raw/reference/server/koa-adapter.mdx +129 -0
- package/.docs/raw/reference/server/mastra-server.mdx +52 -34
- package/.docs/raw/reference/server/routes.mdx +73 -10
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +10 -5
- package/.docs/raw/reference/storage/cloudflare.mdx +12 -2
- package/.docs/raw/reference/storage/composite.mdx +245 -0
- package/.docs/raw/reference/storage/convex.mdx +8 -6
- package/.docs/raw/reference/storage/dynamodb.mdx +134 -8
- package/.docs/raw/reference/storage/lance.mdx +9 -5
- package/.docs/raw/reference/storage/libsql.mdx +76 -54
- package/.docs/raw/reference/storage/mongodb.mdx +115 -16
- package/.docs/raw/reference/storage/mssql.mdx +11 -6
- package/.docs/raw/{server-db/storage.mdx → reference/storage/overview.mdx} +15 -111
- package/.docs/raw/reference/storage/postgresql.mdx +228 -83
- package/.docs/raw/reference/storage/upstash.mdx +78 -2
- package/.docs/raw/reference/streaming/ChunkType.mdx +31 -3
- package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +67 -6
- package/.docs/raw/reference/streaming/agents/stream.mdx +48 -51
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +5 -3
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +3 -1
- package/.docs/raw/reference/streaming/workflows/resumeStream.mdx +3 -1
- package/.docs/raw/reference/streaming/workflows/stream.mdx +37 -22
- package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +6 -4
- package/.docs/raw/reference/templates/overview.mdx +3 -2
- package/.docs/raw/reference/tools/client.mdx +3 -0
- package/.docs/raw/reference/tools/create-tool.mdx +127 -5
- package/.docs/raw/reference/tools/document-chunker-tool.mdx +2 -0
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +40 -3
- package/.docs/raw/reference/tools/mcp-client.mdx +110 -1
- package/.docs/raw/reference/tools/mcp-server.mdx +278 -24
- package/.docs/raw/reference/tools/vector-query-tool.mdx +68 -4
- package/.docs/raw/reference/vectors/astra.mdx +5 -3
- package/.docs/raw/reference/vectors/chroma.mdx +5 -3
- package/.docs/raw/reference/vectors/convex.mdx +14 -12
- package/.docs/raw/reference/vectors/couchbase.mdx +7 -5
- package/.docs/raw/reference/vectors/duckdb.mdx +12 -10
- package/.docs/raw/reference/vectors/elasticsearch.mdx +12 -4
- package/.docs/raw/reference/vectors/lance.mdx +6 -4
- package/.docs/raw/reference/vectors/libsql.mdx +66 -13
- package/.docs/raw/reference/vectors/mongodb.mdx +90 -10
- package/.docs/raw/reference/vectors/opensearch.mdx +30 -3
- package/.docs/raw/reference/vectors/pg.mdx +58 -6
- package/.docs/raw/reference/vectors/pinecone.mdx +23 -8
- package/.docs/raw/reference/vectors/qdrant.mdx +148 -4
- package/.docs/raw/reference/vectors/s3vectors.mdx +8 -6
- package/.docs/raw/reference/vectors/turbopuffer.mdx +6 -4
- package/.docs/raw/reference/vectors/upstash.mdx +60 -6
- package/.docs/raw/reference/vectors/vectorize.mdx +5 -3
- package/.docs/raw/reference/voice/azure.mdx +2 -0
- package/.docs/raw/reference/voice/cloudflare.mdx +2 -0
- package/.docs/raw/reference/voice/composite-voice.mdx +4 -0
- package/.docs/raw/reference/voice/deepgram.mdx +2 -0
- package/.docs/raw/reference/voice/elevenlabs.mdx +2 -0
- package/.docs/raw/reference/voice/google-gemini-live.mdx +3 -0
- package/.docs/raw/reference/voice/google.mdx +2 -0
- package/.docs/raw/reference/voice/mastra-voice.mdx +2 -0
- package/.docs/raw/reference/voice/murf.mdx +2 -0
- package/.docs/raw/reference/voice/openai-realtime.mdx +3 -0
- package/.docs/raw/reference/voice/openai.mdx +2 -0
- package/.docs/raw/reference/voice/playai.mdx +2 -0
- package/.docs/raw/reference/voice/sarvam.mdx +2 -0
- package/.docs/raw/reference/voice/speechify.mdx +2 -0
- package/.docs/raw/reference/voice/voice.addInstructions.mdx +3 -0
- package/.docs/raw/reference/voice/voice.addTools.mdx +3 -0
- package/.docs/raw/reference/voice/voice.answer.mdx +4 -0
- package/.docs/raw/reference/voice/voice.close.mdx +3 -0
- package/.docs/raw/reference/voice/voice.connect.mdx +5 -1
- package/.docs/raw/reference/voice/voice.events.mdx +2 -0
- package/.docs/raw/reference/voice/voice.getSpeakers.mdx +3 -0
- package/.docs/raw/reference/voice/voice.listen.mdx +6 -0
- package/.docs/raw/reference/voice/voice.off.mdx +2 -0
- package/.docs/raw/reference/voice/voice.on.mdx +5 -1
- package/.docs/raw/reference/voice/voice.send.mdx +4 -0
- package/.docs/raw/reference/voice/voice.speak.mdx +6 -0
- package/.docs/raw/reference/voice/voice.updateConfig.mdx +2 -0
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +55 -5
- package/.docs/raw/reference/workflows/run-methods/restart.mdx +3 -3
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +6 -4
- package/.docs/raw/reference/workflows/run-methods/start.mdx +7 -5
- package/.docs/raw/reference/workflows/run-methods/startAsync.mdx +145 -0
- package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +10 -8
- package/.docs/raw/reference/workflows/run.mdx +11 -3
- package/.docs/raw/reference/workflows/step.mdx +56 -3
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +3 -1
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +3 -1
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +39 -2
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +3 -1
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +3 -1
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +71 -4
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +9 -7
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +3 -1
- package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +4 -6
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +4 -6
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +3 -1
- package/.docs/raw/reference/workflows/workflow.mdx +193 -2
- package/.docs/raw/{auth → server/auth}/auth0.mdx +40 -21
- package/.docs/raw/{auth → server/auth}/clerk.mdx +37 -16
- package/.docs/raw/{auth → server/auth}/firebase.mdx +47 -25
- package/.docs/raw/{auth → server/auth}/index.mdx +8 -6
- package/.docs/raw/{auth → server/auth}/jwt.mdx +22 -10
- package/.docs/raw/{auth → server/auth}/supabase.mdx +45 -25
- package/.docs/raw/{auth → server/auth}/workos.mdx +39 -20
- package/.docs/raw/{server-db → server}/custom-adapters.mdx +40 -24
- package/.docs/raw/{server-db → server}/custom-api-routes.mdx +6 -6
- package/.docs/raw/{server-db → server}/mastra-client.mdx +35 -38
- package/.docs/raw/server/mastra-server.mdx +86 -0
- package/.docs/raw/{server-db → server}/middleware.mdx +11 -9
- package/.docs/raw/{server-db → server}/request-context.mdx +85 -43
- package/.docs/raw/server/server-adapters.mdx +410 -0
- package/.docs/raw/streaming/events.mdx +16 -7
- package/.docs/raw/streaming/overview.mdx +30 -17
- package/.docs/raw/streaming/tool-streaming.mdx +15 -17
- package/.docs/raw/streaming/workflow-streaming.mdx +8 -8
- package/.docs/raw/tools-mcp/advanced-usage.mdx +4 -2
- package/.docs/raw/tools-mcp/mcp-overview.mdx +46 -12
- package/.docs/raw/tools-mcp/overview.mdx +14 -13
- package/.docs/raw/voice/overview.mdx +17 -2
- package/.docs/raw/voice/speech-to-speech.mdx +5 -0
- package/.docs/raw/voice/speech-to-text.mdx +4 -0
- package/.docs/raw/voice/text-to-speech.mdx +3 -0
- package/.docs/raw/workflows/agents-and-tools.mdx +70 -21
- package/.docs/raw/workflows/control-flow.mdx +369 -34
- package/.docs/raw/workflows/error-handling.mdx +192 -18
- package/.docs/raw/workflows/human-in-the-loop.mdx +8 -7
- package/.docs/raw/workflows/input-data-mapping.mdx +9 -7
- package/.docs/raw/workflows/overview.mdx +80 -34
- package/.docs/raw/workflows/snapshots.mdx +19 -45
- package/.docs/raw/workflows/suspend-and-resume.mdx +14 -14
- package/.docs/raw/workflows/time-travel.mdx +25 -21
- package/.docs/raw/workflows/workflow-state.mdx +7 -8
- package/CHANGELOG.md +254 -0
- package/README.md +36 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/stdio.js +746 -49
- package/dist/tools/course.d.ts.map +1 -1
- package/dist/tools/embedded-docs.d.ts +276 -0
- package/dist/tools/embedded-docs.d.ts.map +1 -0
- package/package.json +9 -8
- package/.docs/organized/changelogs/%40internal%2Fai-sdk-v4.md +0 -1
- package/.docs/raw/deployment/building-mastra.mdx +0 -73
- package/.docs/raw/deployment/cloud-providers/index.mdx +0 -55
- package/.docs/raw/deployment/mastra-cloud/dashboard.mdx +0 -100
- package/.docs/raw/deployment/mastra-cloud/observability.mdx +0 -53
- package/.docs/raw/deployment/mastra-cloud/overview.mdx +0 -65
- package/.docs/raw/deployment/mastra-cloud/setting-up.mdx +0 -105
- 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/reference/core/setTelemetry.mdx +0 -36
- package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +0 -110
- package/.docs/raw/reference/memory/query.mdx +0 -189
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +0 -70
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +0 -66
- package/.docs/raw/server-db/mastra-server.mdx +0 -97
- package/.docs/raw/server-db/server-adapters.mdx +0 -286
- package/.docs/raw/workflows/inngest-workflow.mdx +0 -363
|
@@ -0,0 +1,1075 @@
|
|
|
1
|
+
### package.json
|
|
2
|
+
```json
|
|
3
|
+
{
|
|
4
|
+
"name": "inngest",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@hono/node-server": "^1.19.8",
|
|
7
|
+
"@inngest/realtime": "^0.4.5",
|
|
8
|
+
"@mastra/core": "1.0.0-beta.20",
|
|
9
|
+
"@mastra/deployer": "1.0.0-beta.20",
|
|
10
|
+
"@mastra/inngest": "1.0.0-beta.11",
|
|
11
|
+
"@mastra/libsql": "1.0.0-beta.11",
|
|
12
|
+
"@mastra/loggers": "1.0.0-beta.4",
|
|
13
|
+
"@mastra/observability": "1.0.0-beta.10",
|
|
14
|
+
"inngest": "^3.49.0",
|
|
15
|
+
"mastra": "1.0.0-beta.13",
|
|
16
|
+
"zod": "^3.25.76"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### mastra/agents/planning-agent.ts
|
|
22
|
+
```typescript
|
|
23
|
+
import { Agent } from '@mastra/core/agent';
|
|
24
|
+
|
|
25
|
+
// Create a new planning agent that uses the OpenAI model
|
|
26
|
+
const planningAgent = new Agent({
|
|
27
|
+
id: 'planning-agent',
|
|
28
|
+
name: 'planningAgent',
|
|
29
|
+
model: 'openai/gpt-5.1',
|
|
30
|
+
instructions: `
|
|
31
|
+
You are a local activities and travel expert who excels at weather-based planning. Analyze the weather data and provide practical activity recommendations.
|
|
32
|
+
|
|
33
|
+
📅 [Day, Month Date, Year]
|
|
34
|
+
═══════════════════════════
|
|
35
|
+
|
|
36
|
+
🌡️ WEATHER SUMMARY
|
|
37
|
+
• Conditions: [brief description]
|
|
38
|
+
• Temperature: [X°C/Y°F to A°C/B°F]
|
|
39
|
+
• Precipitation: [X% chance]
|
|
40
|
+
|
|
41
|
+
🌅 MORNING ACTIVITIES
|
|
42
|
+
Outdoor:
|
|
43
|
+
• [Activity Name] - [Brief description including specific location/route]
|
|
44
|
+
Best timing: [specific time range]
|
|
45
|
+
Note: [relevant weather consideration]
|
|
46
|
+
|
|
47
|
+
🌞 AFTERNOON ACTIVITIES
|
|
48
|
+
Outdoor:
|
|
49
|
+
• [Activity Name] - [Brief description including specific location/route]
|
|
50
|
+
Best timing: [specific time range]
|
|
51
|
+
Note: [relevant weather consideration]
|
|
52
|
+
|
|
53
|
+
🏠 INDOOR ALTERNATIVES
|
|
54
|
+
• [Activity Name] - [Brief description including specific venue]
|
|
55
|
+
Ideal for: [weather condition that would trigger this alternative]
|
|
56
|
+
|
|
57
|
+
⚠️ SPECIAL CONSIDERATIONS
|
|
58
|
+
• [Any relevant weather warnings, UV index, wind conditions, etc.]
|
|
59
|
+
|
|
60
|
+
Guidelines:
|
|
61
|
+
- Suggest 2-3 time-specific outdoor activities per day
|
|
62
|
+
- Include 1-2 indoor backup options
|
|
63
|
+
- For precipitation >50%, lead with indoor activities
|
|
64
|
+
- All activities must be specific to the location
|
|
65
|
+
- Include specific venues, trails, or locations
|
|
66
|
+
- Consider activity intensity based on temperature
|
|
67
|
+
- Keep descriptions concise but informative
|
|
68
|
+
|
|
69
|
+
Maintain this exact formatting for consistency, using the emoji and section headers as shown.
|
|
70
|
+
`,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export { planningAgent };
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### mastra/agents/trip-comparison-agent.ts
|
|
78
|
+
```typescript
|
|
79
|
+
import { Agent } from '@mastra/core/agent';
|
|
80
|
+
|
|
81
|
+
const tripComparisonAgent = new Agent({
|
|
82
|
+
id: 'trip-comparison-agent',
|
|
83
|
+
name: 'tripComparisonAgent',
|
|
84
|
+
model: 'openai/gpt-4o-mini',
|
|
85
|
+
instructions: `You are a travel advisor who compares two city trip plans and provides a recommendation.
|
|
86
|
+
|
|
87
|
+
Given activity plans for two cities, analyze:
|
|
88
|
+
- Weather conditions in each city
|
|
89
|
+
- Quality and variety of suggested activities
|
|
90
|
+
- Overall trip experience potential
|
|
91
|
+
|
|
92
|
+
Provide a concise comparison and recommend which city would be better for a trip, explaining your reasoning.
|
|
93
|
+
|
|
94
|
+
Keep your response brief and actionable.`,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export { tripComparisonAgent };
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### mastra/index.ts
|
|
102
|
+
```typescript
|
|
103
|
+
import { Mastra } from '@mastra/core';
|
|
104
|
+
import { serve as inngestServe } from '@mastra/inngest';
|
|
105
|
+
import { PinoLogger } from '@mastra/loggers';
|
|
106
|
+
import { Observability, ConsoleExporter, DefaultExporter } from '@mastra/observability';
|
|
107
|
+
import { activityPlanningWorkflow, inngest } from './workflows/inngest-workflow';
|
|
108
|
+
import { defaultActivityPlanningWorkflow } from './workflows/default-workflow';
|
|
109
|
+
import { parallelCityComparisonWorkflow } from './workflows/inngest-parallel-workflow';
|
|
110
|
+
import { defaultParallelCityComparisonWorkflow } from './workflows/default-parallel-workflow';
|
|
111
|
+
import { planningAgent } from './agents/planning-agent';
|
|
112
|
+
import { tripComparisonAgent } from './agents/trip-comparison-agent';
|
|
113
|
+
import { LibSQLStore } from '@mastra/libsql';
|
|
114
|
+
|
|
115
|
+
const storage = new LibSQLStore({
|
|
116
|
+
id: 'mastra-storage',
|
|
117
|
+
url: 'file:./mastra.db',
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Configure observability with tracing exporters
|
|
121
|
+
// ConsoleExporter logs spans to console for debugging
|
|
122
|
+
// DefaultExporter persists traces to storage for later analysis
|
|
123
|
+
const observability = new Observability({
|
|
124
|
+
configs: {
|
|
125
|
+
default: {
|
|
126
|
+
serviceName: 'inngest-workflow-example',
|
|
127
|
+
exporters: [
|
|
128
|
+
new ConsoleExporter(), // Logs trace events to console
|
|
129
|
+
new DefaultExporter(), // Persists traces to storage
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Create and configure the main Mastra instance
|
|
136
|
+
export const mastra = new Mastra({
|
|
137
|
+
workflows: {
|
|
138
|
+
activityPlanningWorkflow,
|
|
139
|
+
defaultActivityPlanningWorkflow,
|
|
140
|
+
parallelCityComparisonWorkflow,
|
|
141
|
+
defaultParallelCityComparisonWorkflow,
|
|
142
|
+
},
|
|
143
|
+
agents: {
|
|
144
|
+
planningAgent,
|
|
145
|
+
tripComparisonAgent,
|
|
146
|
+
},
|
|
147
|
+
storage,
|
|
148
|
+
observability,
|
|
149
|
+
server: {
|
|
150
|
+
host: '0.0.0.0',
|
|
151
|
+
apiRoutes: [
|
|
152
|
+
{
|
|
153
|
+
path: '/api/inngest', // API endpoint for Inngest to send events to
|
|
154
|
+
method: 'ALL',
|
|
155
|
+
createHandler: async ({ mastra }) => inngestServe({ mastra, inngest }),
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
logger: new PinoLogger({
|
|
160
|
+
name: 'Mastra',
|
|
161
|
+
level: 'info',
|
|
162
|
+
}),
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### mastra/workflows/default-parallel-workflow.ts
|
|
168
|
+
```typescript
|
|
169
|
+
import { createWorkflow, createStep } from '@mastra/core/workflows';
|
|
170
|
+
import { z } from 'zod';
|
|
171
|
+
|
|
172
|
+
function getWeatherCondition(code: number): string {
|
|
173
|
+
const conditions: Record<number, string> = {
|
|
174
|
+
0: 'Clear sky',
|
|
175
|
+
1: 'Mainly clear',
|
|
176
|
+
2: 'Partly cloudy',
|
|
177
|
+
3: 'Overcast',
|
|
178
|
+
45: 'Foggy',
|
|
179
|
+
51: 'Light drizzle',
|
|
180
|
+
61: 'Slight rain',
|
|
181
|
+
63: 'Moderate rain',
|
|
182
|
+
65: 'Heavy rain',
|
|
183
|
+
95: 'Thunderstorm',
|
|
184
|
+
};
|
|
185
|
+
return conditions[code] || 'Unknown';
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const forecastSchema = z.object({
|
|
189
|
+
date: z.string(),
|
|
190
|
+
maxTemp: z.number(),
|
|
191
|
+
minTemp: z.number(),
|
|
192
|
+
precipitationChance: z.number(),
|
|
193
|
+
condition: z.string(),
|
|
194
|
+
location: z.string(),
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
const fetchWeatherA = createStep({
|
|
198
|
+
id: 'fetch-weather-a',
|
|
199
|
+
inputSchema: z.object({ cityA: z.string(), cityB: z.string() }),
|
|
200
|
+
outputSchema: forecastSchema,
|
|
201
|
+
execute: async ({ inputData }) => {
|
|
202
|
+
const city = inputData.cityA;
|
|
203
|
+
const geocodingUrl = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(city)}&count=1`;
|
|
204
|
+
const geocodingResponse = await fetch(geocodingUrl);
|
|
205
|
+
const geocodingData = (await geocodingResponse.json()) as {
|
|
206
|
+
results: { latitude: number; longitude: number; name: string }[];
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
if (!geocodingData.results?.[0]) {
|
|
210
|
+
throw new Error(`Location '${city}' not found`);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const { latitude, longitude, name } = geocodingData.results[0];
|
|
214
|
+
|
|
215
|
+
const weatherUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=precipitation,weathercode&timezone=auto,&hourly=precipitation_probability,temperature_2m`;
|
|
216
|
+
const response = await fetch(weatherUrl);
|
|
217
|
+
const data = (await response.json()) as {
|
|
218
|
+
current: { weathercode: number };
|
|
219
|
+
hourly: { precipitation_probability: number[]; temperature_2m: number[] };
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
date: new Date().toISOString(),
|
|
224
|
+
maxTemp: Math.max(...data.hourly.temperature_2m),
|
|
225
|
+
minTemp: Math.min(...data.hourly.temperature_2m),
|
|
226
|
+
condition: getWeatherCondition(data.current.weathercode),
|
|
227
|
+
location: name,
|
|
228
|
+
precipitationChance: Math.max(...data.hourly.precipitation_probability),
|
|
229
|
+
};
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
const fetchWeatherB = createStep({
|
|
234
|
+
id: 'fetch-weather-b',
|
|
235
|
+
inputSchema: z.object({ cityA: z.string(), cityB: z.string() }),
|
|
236
|
+
outputSchema: forecastSchema,
|
|
237
|
+
execute: async ({ inputData }) => {
|
|
238
|
+
const city = inputData.cityB;
|
|
239
|
+
const geocodingUrl = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(city)}&count=1`;
|
|
240
|
+
const geocodingResponse = await fetch(geocodingUrl);
|
|
241
|
+
const geocodingData = (await geocodingResponse.json()) as {
|
|
242
|
+
results: { latitude: number; longitude: number; name: string }[];
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
if (!geocodingData.results?.[0]) {
|
|
246
|
+
throw new Error(`Location '${city}' not found`);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const { latitude, longitude, name } = geocodingData.results[0];
|
|
250
|
+
|
|
251
|
+
const weatherUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=precipitation,weathercode&timezone=auto,&hourly=precipitation_probability,temperature_2m`;
|
|
252
|
+
const response = await fetch(weatherUrl);
|
|
253
|
+
const data = (await response.json()) as {
|
|
254
|
+
current: { weathercode: number };
|
|
255
|
+
hourly: { precipitation_probability: number[]; temperature_2m: number[] };
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
return {
|
|
259
|
+
date: new Date().toISOString(),
|
|
260
|
+
maxTemp: Math.max(...data.hourly.temperature_2m),
|
|
261
|
+
minTemp: Math.min(...data.hourly.temperature_2m),
|
|
262
|
+
condition: getWeatherCondition(data.current.weathercode),
|
|
263
|
+
location: name,
|
|
264
|
+
precipitationChance: Math.max(...data.hourly.precipitation_probability),
|
|
265
|
+
};
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
const planActivitiesA = createStep({
|
|
270
|
+
id: 'plan-activities-a',
|
|
271
|
+
inputSchema: forecastSchema,
|
|
272
|
+
outputSchema: z.object({ activities: z.string(), location: z.string() }),
|
|
273
|
+
execute: async ({ inputData, mastra }) => {
|
|
274
|
+
const agent = mastra?.getAgent('planningAgent');
|
|
275
|
+
if (!agent) throw new Error('Planning agent not found');
|
|
276
|
+
|
|
277
|
+
const response = await agent.stream([
|
|
278
|
+
{
|
|
279
|
+
role: 'user',
|
|
280
|
+
content: `Based on the following weather forecast for ${inputData.location}, suggest appropriate activities:\n${JSON.stringify(inputData, null, 2)}`,
|
|
281
|
+
},
|
|
282
|
+
]);
|
|
283
|
+
|
|
284
|
+
let activitiesText = '';
|
|
285
|
+
for await (const chunk of response.textStream) {
|
|
286
|
+
process.stdout.write(chunk);
|
|
287
|
+
activitiesText += chunk;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return { activities: activitiesText, location: inputData.location };
|
|
291
|
+
},
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
const planActivitiesB = createStep({
|
|
295
|
+
id: 'plan-activities-b',
|
|
296
|
+
inputSchema: forecastSchema,
|
|
297
|
+
outputSchema: z.object({ activities: z.string(), location: z.string() }),
|
|
298
|
+
execute: async ({ inputData, mastra }) => {
|
|
299
|
+
const agent = mastra?.getAgent('planningAgent');
|
|
300
|
+
if (!agent) throw new Error('Planning agent not found');
|
|
301
|
+
|
|
302
|
+
const response = await agent.stream([
|
|
303
|
+
{
|
|
304
|
+
role: 'user',
|
|
305
|
+
content: `Based on the following weather forecast for ${inputData.location}, suggest appropriate activities:\n${JSON.stringify(inputData, null, 2)}`,
|
|
306
|
+
},
|
|
307
|
+
]);
|
|
308
|
+
|
|
309
|
+
let activitiesText = '';
|
|
310
|
+
for await (const chunk of response.textStream) {
|
|
311
|
+
process.stdout.write(chunk);
|
|
312
|
+
activitiesText += chunk;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return { activities: activitiesText, location: inputData.location };
|
|
316
|
+
},
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
const inputSchema = z.object({ cityA: z.string(), cityB: z.string() });
|
|
320
|
+
|
|
321
|
+
// Nested workflow A: fetches weather and plans activities for cityA
|
|
322
|
+
const defaultCityPlanWorkflowA = createWorkflow({
|
|
323
|
+
id: 'default-city-plan-workflow-a',
|
|
324
|
+
inputSchema,
|
|
325
|
+
outputSchema: z.object({ activities: z.string(), location: z.string() }),
|
|
326
|
+
})
|
|
327
|
+
.then(fetchWeatherA)
|
|
328
|
+
.then(planActivitiesA);
|
|
329
|
+
|
|
330
|
+
defaultCityPlanWorkflowA.commit();
|
|
331
|
+
|
|
332
|
+
// Nested workflow B: fetches weather and plans activities for cityB
|
|
333
|
+
const defaultCityPlanWorkflowB = createWorkflow({
|
|
334
|
+
id: 'default-city-plan-workflow-b',
|
|
335
|
+
inputSchema,
|
|
336
|
+
outputSchema: z.object({ activities: z.string(), location: z.string() }),
|
|
337
|
+
})
|
|
338
|
+
.then(fetchWeatherB)
|
|
339
|
+
.then(planActivitiesB);
|
|
340
|
+
|
|
341
|
+
defaultCityPlanWorkflowB.commit();
|
|
342
|
+
|
|
343
|
+
const compareTripsDefault = createStep({
|
|
344
|
+
id: 'compare-trips',
|
|
345
|
+
inputSchema: z.object({
|
|
346
|
+
'default-city-plan-workflow-a': z.object({ activities: z.string(), location: z.string() }),
|
|
347
|
+
'default-city-plan-workflow-b': z.object({ activities: z.string(), location: z.string() }),
|
|
348
|
+
}),
|
|
349
|
+
outputSchema: z.object({ comparison: z.string() }),
|
|
350
|
+
execute: async ({ inputData, mastra }) => {
|
|
351
|
+
const agent = mastra?.getAgent('tripComparisonAgent');
|
|
352
|
+
if (!agent) throw new Error('Trip comparison agent not found');
|
|
353
|
+
|
|
354
|
+
const planA = inputData['default-city-plan-workflow-a'];
|
|
355
|
+
const planB = inputData['default-city-plan-workflow-b'];
|
|
356
|
+
|
|
357
|
+
const response = await agent.stream([
|
|
358
|
+
{
|
|
359
|
+
role: 'user',
|
|
360
|
+
content: `Compare these two city trip plans and recommend which is better:
|
|
361
|
+
|
|
362
|
+
## ${planA.location}
|
|
363
|
+
${planA.activities}
|
|
364
|
+
|
|
365
|
+
## ${planB.location}
|
|
366
|
+
${planB.activities}`,
|
|
367
|
+
},
|
|
368
|
+
]);
|
|
369
|
+
|
|
370
|
+
let comparisonText = '';
|
|
371
|
+
for await (const chunk of response.textStream) {
|
|
372
|
+
process.stdout.write(chunk);
|
|
373
|
+
comparisonText += chunk;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return { comparison: comparisonText };
|
|
377
|
+
},
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// Main workflow: runs both city plans in parallel, then compares them
|
|
381
|
+
const defaultParallelCityComparisonWorkflow = createWorkflow({
|
|
382
|
+
id: 'default-parallel-city-comparison-workflow',
|
|
383
|
+
inputSchema,
|
|
384
|
+
outputSchema: z.object({ comparison: z.string() }),
|
|
385
|
+
})
|
|
386
|
+
.parallel([defaultCityPlanWorkflowA, defaultCityPlanWorkflowB])
|
|
387
|
+
.then(compareTripsDefault)
|
|
388
|
+
.commit();
|
|
389
|
+
|
|
390
|
+
export { defaultParallelCityComparisonWorkflow };
|
|
391
|
+
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### mastra/workflows/default-workflow.ts
|
|
395
|
+
```typescript
|
|
396
|
+
import { createWorkflow, createStep } from '@mastra/core/workflows';
|
|
397
|
+
import { z } from 'zod';
|
|
398
|
+
|
|
399
|
+
// Helper function to convert weather codes to human-readable descriptions
|
|
400
|
+
function getWeatherCondition(code: number): string {
|
|
401
|
+
const conditions: Record<number, string> = {
|
|
402
|
+
0: 'Clear sky',
|
|
403
|
+
1: 'Mainly clear',
|
|
404
|
+
2: 'Partly cloudy',
|
|
405
|
+
3: 'Overcast',
|
|
406
|
+
45: 'Foggy',
|
|
407
|
+
48: 'Depositing rime fog',
|
|
408
|
+
51: 'Light drizzle',
|
|
409
|
+
53: 'Moderate drizzle',
|
|
410
|
+
55: 'Dense drizzle',
|
|
411
|
+
61: 'Slight rain',
|
|
412
|
+
63: 'Moderate rain',
|
|
413
|
+
65: 'Heavy rain',
|
|
414
|
+
71: 'Slight snow fall',
|
|
415
|
+
73: 'Moderate snow fall',
|
|
416
|
+
75: 'Heavy snow fall',
|
|
417
|
+
95: 'Thunderstorm',
|
|
418
|
+
};
|
|
419
|
+
return conditions[code] || 'Unknown';
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
const forecastSchema = z.object({
|
|
423
|
+
date: z.string(),
|
|
424
|
+
maxTemp: z.number(),
|
|
425
|
+
minTemp: z.number(),
|
|
426
|
+
precipitationChance: z.number(),
|
|
427
|
+
condition: z.string(),
|
|
428
|
+
location: z.string(),
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
const fetchWeatherDefault = createStep({
|
|
432
|
+
id: 'fetch-weather',
|
|
433
|
+
description: 'Fetches weather forecast for a given city',
|
|
434
|
+
inputSchema: z.object({
|
|
435
|
+
city: z.string(),
|
|
436
|
+
}),
|
|
437
|
+
outputSchema: forecastSchema,
|
|
438
|
+
execute: async ({ inputData }) => {
|
|
439
|
+
console.dir({ inputData }, { depth: null });
|
|
440
|
+
if (!inputData) {
|
|
441
|
+
throw new Error('Trigger data not found');
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// Get latitude and longitude for the city
|
|
445
|
+
const geocodingUrl = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(inputData.city)}&count=1`;
|
|
446
|
+
const geocodingResponse = await fetch(geocodingUrl);
|
|
447
|
+
const geocodingData = (await geocodingResponse.json()) as {
|
|
448
|
+
results: { latitude: number; longitude: number; name: string }[];
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
if (!geocodingData.results?.[0]) {
|
|
452
|
+
throw new Error(`Location '${inputData.city}' not found`);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
const { latitude, longitude, name } = geocodingData.results[0];
|
|
456
|
+
|
|
457
|
+
// Fetch weather data using the coordinates
|
|
458
|
+
const weatherUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=precipitation,weathercode&timezone=auto,&hourly=precipitation_probability,temperature_2m`;
|
|
459
|
+
const response = await fetch(weatherUrl);
|
|
460
|
+
const data = (await response.json()) as {
|
|
461
|
+
current: {
|
|
462
|
+
time: string;
|
|
463
|
+
precipitation: number;
|
|
464
|
+
weathercode: number;
|
|
465
|
+
};
|
|
466
|
+
hourly: {
|
|
467
|
+
precipitation_probability: number[];
|
|
468
|
+
temperature_2m: number[];
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
const forecast = {
|
|
473
|
+
date: new Date().toISOString(),
|
|
474
|
+
maxTemp: Math.max(...data.hourly.temperature_2m),
|
|
475
|
+
minTemp: Math.min(...data.hourly.temperature_2m),
|
|
476
|
+
condition: getWeatherCondition(data.current.weathercode),
|
|
477
|
+
location: name,
|
|
478
|
+
precipitationChance: data.hourly.precipitation_probability.reduce((acc, curr) => Math.max(acc, curr), 0),
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
return forecast;
|
|
482
|
+
},
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
const planActivitiesDefault = createStep({
|
|
486
|
+
id: 'plan-activities',
|
|
487
|
+
description: 'Suggests activities based on weather conditions',
|
|
488
|
+
inputSchema: forecastSchema,
|
|
489
|
+
outputSchema: z.object({
|
|
490
|
+
activities: z.string(),
|
|
491
|
+
}),
|
|
492
|
+
execute: async ({ inputData, mastra }) => {
|
|
493
|
+
const forecast = inputData;
|
|
494
|
+
|
|
495
|
+
if (!forecast) {
|
|
496
|
+
throw new Error('Forecast data not found');
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const prompt = `Based on the following weather forecast for ${forecast.location}, suggest appropriate activities:
|
|
500
|
+
${JSON.stringify(forecast, null, 2)}
|
|
501
|
+
`;
|
|
502
|
+
|
|
503
|
+
const agent = mastra?.getAgent('planningAgent');
|
|
504
|
+
if (!agent) {
|
|
505
|
+
throw new Error('Planning agent not found');
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
const response = await agent.stream([
|
|
509
|
+
{
|
|
510
|
+
role: 'user',
|
|
511
|
+
content: prompt,
|
|
512
|
+
},
|
|
513
|
+
]);
|
|
514
|
+
|
|
515
|
+
let activitiesText = '';
|
|
516
|
+
|
|
517
|
+
for await (const chunk of response.textStream) {
|
|
518
|
+
process.stdout.write(chunk);
|
|
519
|
+
activitiesText += chunk;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
return {
|
|
523
|
+
activities: activitiesText,
|
|
524
|
+
};
|
|
525
|
+
},
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
const planIndoorActivitiesDefault = createStep({
|
|
529
|
+
id: 'plan-indoor-activities',
|
|
530
|
+
description: 'Suggests indoor activities based on weather conditions',
|
|
531
|
+
inputSchema: forecastSchema,
|
|
532
|
+
outputSchema: z.object({
|
|
533
|
+
activities: z.string(),
|
|
534
|
+
}),
|
|
535
|
+
execute: async ({ inputData, mastra }) => {
|
|
536
|
+
const forecast = inputData;
|
|
537
|
+
|
|
538
|
+
if (!forecast) {
|
|
539
|
+
throw new Error('Forecast data not found');
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
const prompt = `In case it rains, plan indoor activities for ${forecast.location} on ${forecast.date}`;
|
|
543
|
+
|
|
544
|
+
const agent = mastra?.getAgent('planningAgent');
|
|
545
|
+
if (!agent) {
|
|
546
|
+
throw new Error('Planning agent not found');
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
const response = await agent.stream([
|
|
550
|
+
{
|
|
551
|
+
role: 'user',
|
|
552
|
+
content: prompt,
|
|
553
|
+
},
|
|
554
|
+
]);
|
|
555
|
+
|
|
556
|
+
let activitiesText = '';
|
|
557
|
+
|
|
558
|
+
for await (const chunk of response.textStream) {
|
|
559
|
+
process.stdout.write(chunk);
|
|
560
|
+
activitiesText += chunk;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
return {
|
|
564
|
+
activities: activitiesText,
|
|
565
|
+
};
|
|
566
|
+
},
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
// Same workflow structure but using the default (non-Inngest) engine
|
|
570
|
+
const defaultActivityPlanningWorkflow = createWorkflow({
|
|
571
|
+
id: 'default-activity-planning-workflow',
|
|
572
|
+
inputSchema: z.object({
|
|
573
|
+
city: z.string().describe('The city to get the weather for'),
|
|
574
|
+
}),
|
|
575
|
+
outputSchema: z.object({
|
|
576
|
+
activities: z.string(),
|
|
577
|
+
}),
|
|
578
|
+
})
|
|
579
|
+
.then(fetchWeatherDefault)
|
|
580
|
+
.branch([
|
|
581
|
+
[
|
|
582
|
+
// If precipitation chance is greater than 50%, suggest indoor activities
|
|
583
|
+
async ({ inputData }) => {
|
|
584
|
+
return inputData?.precipitationChance > 50;
|
|
585
|
+
},
|
|
586
|
+
planIndoorActivitiesDefault,
|
|
587
|
+
],
|
|
588
|
+
[
|
|
589
|
+
// Otherwise, suggest a mix of activities
|
|
590
|
+
async ({ inputData }) => {
|
|
591
|
+
return inputData?.precipitationChance <= 50;
|
|
592
|
+
},
|
|
593
|
+
planActivitiesDefault,
|
|
594
|
+
],
|
|
595
|
+
]);
|
|
596
|
+
|
|
597
|
+
defaultActivityPlanningWorkflow.commit();
|
|
598
|
+
|
|
599
|
+
export { defaultActivityPlanningWorkflow };
|
|
600
|
+
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### mastra/workflows/inngest-parallel-workflow.ts
|
|
604
|
+
```typescript
|
|
605
|
+
import { init } from '@mastra/inngest';
|
|
606
|
+
import { z } from 'zod';
|
|
607
|
+
import { inngest } from './inngest-workflow';
|
|
608
|
+
|
|
609
|
+
const { createWorkflow, createStep } = init(inngest);
|
|
610
|
+
|
|
611
|
+
function getWeatherCondition(code: number): string {
|
|
612
|
+
const conditions: Record<number, string> = {
|
|
613
|
+
0: 'Clear sky',
|
|
614
|
+
1: 'Mainly clear',
|
|
615
|
+
2: 'Partly cloudy',
|
|
616
|
+
3: 'Overcast',
|
|
617
|
+
45: 'Foggy',
|
|
618
|
+
51: 'Light drizzle',
|
|
619
|
+
61: 'Slight rain',
|
|
620
|
+
63: 'Moderate rain',
|
|
621
|
+
65: 'Heavy rain',
|
|
622
|
+
95: 'Thunderstorm',
|
|
623
|
+
};
|
|
624
|
+
return conditions[code] || 'Unknown';
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
const forecastSchema = z.object({
|
|
628
|
+
date: z.string(),
|
|
629
|
+
maxTemp: z.number(),
|
|
630
|
+
minTemp: z.number(),
|
|
631
|
+
precipitationChance: z.number(),
|
|
632
|
+
condition: z.string(),
|
|
633
|
+
location: z.string(),
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
const fetchWeatherA = createStep({
|
|
637
|
+
id: 'fetch-weather-a',
|
|
638
|
+
inputSchema: z.object({ cityA: z.string(), cityB: z.string() }),
|
|
639
|
+
outputSchema: forecastSchema,
|
|
640
|
+
execute: async ({ inputData }) => {
|
|
641
|
+
const city = inputData.cityA;
|
|
642
|
+
const geocodingUrl = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(city)}&count=1`;
|
|
643
|
+
const geocodingResponse = await fetch(geocodingUrl);
|
|
644
|
+
|
|
645
|
+
if (!geocodingResponse.ok) {
|
|
646
|
+
const errorBody = await geocodingResponse.text();
|
|
647
|
+
throw new Error(`Geocoding API error (${geocodingResponse.status}): ${errorBody} - URL: ${geocodingUrl}`);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
const geocodingData = (await geocodingResponse.json()) as {
|
|
651
|
+
results: { latitude: number; longitude: number; name: string }[];
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
if (!geocodingData.results?.[0]) {
|
|
655
|
+
throw new Error(`Location '${city}' not found`);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const { latitude, longitude, name } = geocodingData.results[0];
|
|
659
|
+
|
|
660
|
+
const weatherUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=precipitation,weathercode&timezone=auto,&hourly=precipitation_probability,temperature_2m`;
|
|
661
|
+
const response = await fetch(weatherUrl);
|
|
662
|
+
|
|
663
|
+
if (!response.ok) {
|
|
664
|
+
const errorBody = await response.text();
|
|
665
|
+
throw new Error(`Weather API error (${response.status}): ${errorBody} - URL: ${weatherUrl}`);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
const data = (await response.json()) as {
|
|
669
|
+
current: { weathercode: number };
|
|
670
|
+
hourly: { precipitation_probability: number[]; temperature_2m: number[] };
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
return {
|
|
674
|
+
date: new Date().toISOString(),
|
|
675
|
+
maxTemp: Math.max(...data.hourly.temperature_2m),
|
|
676
|
+
minTemp: Math.min(...data.hourly.temperature_2m),
|
|
677
|
+
condition: getWeatherCondition(data.current.weathercode),
|
|
678
|
+
location: name,
|
|
679
|
+
precipitationChance: Math.max(...data.hourly.precipitation_probability),
|
|
680
|
+
};
|
|
681
|
+
},
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
const fetchWeatherB = createStep({
|
|
685
|
+
id: 'fetch-weather-b',
|
|
686
|
+
inputSchema: z.object({ cityA: z.string(), cityB: z.string() }),
|
|
687
|
+
outputSchema: forecastSchema,
|
|
688
|
+
execute: async ({ inputData }) => {
|
|
689
|
+
const city = inputData.cityB;
|
|
690
|
+
const geocodingUrl = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(city)}&count=1`;
|
|
691
|
+
const geocodingResponse = await fetch(geocodingUrl);
|
|
692
|
+
|
|
693
|
+
if (!geocodingResponse.ok) {
|
|
694
|
+
const errorBody = await geocodingResponse.text();
|
|
695
|
+
throw new Error(`Geocoding API error (${geocodingResponse.status}): ${errorBody} - URL: ${geocodingUrl}`);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
const geocodingData = (await geocodingResponse.json()) as {
|
|
699
|
+
results: { latitude: number; longitude: number; name: string }[];
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
if (!geocodingData.results?.[0]) {
|
|
703
|
+
throw new Error(`Location '${city}' not found`);
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
const { latitude, longitude, name } = geocodingData.results[0];
|
|
707
|
+
|
|
708
|
+
const weatherUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=precipitation,weathercode&timezone=auto,&hourly=precipitation_probability,temperature_2m`;
|
|
709
|
+
const response = await fetch(weatherUrl);
|
|
710
|
+
|
|
711
|
+
if (!response.ok) {
|
|
712
|
+
const errorBody = await response.text();
|
|
713
|
+
throw new Error(`Weather API error (${response.status}): ${errorBody} - URL: ${weatherUrl}`);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
const data = (await response.json()) as {
|
|
717
|
+
current: { weathercode: number };
|
|
718
|
+
hourly: { precipitation_probability: number[]; temperature_2m: number[] };
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
return {
|
|
722
|
+
date: new Date().toISOString(),
|
|
723
|
+
maxTemp: Math.max(...data.hourly.temperature_2m),
|
|
724
|
+
minTemp: Math.min(...data.hourly.temperature_2m),
|
|
725
|
+
condition: getWeatherCondition(data.current.weathercode),
|
|
726
|
+
location: name,
|
|
727
|
+
precipitationChance: Math.max(...data.hourly.precipitation_probability),
|
|
728
|
+
};
|
|
729
|
+
},
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
const planActivitiesA = createStep({
|
|
733
|
+
id: 'plan-activities-a',
|
|
734
|
+
inputSchema: forecastSchema,
|
|
735
|
+
outputSchema: z.object({ activities: z.string(), location: z.string() }),
|
|
736
|
+
execute: async ({ inputData, mastra }) => {
|
|
737
|
+
const agent = mastra?.getAgent('planningAgent');
|
|
738
|
+
if (!agent) throw new Error('Planning agent not found');
|
|
739
|
+
|
|
740
|
+
const response = await agent.stream([
|
|
741
|
+
{
|
|
742
|
+
role: 'user',
|
|
743
|
+
content: `Based on the following weather forecast for ${inputData.location}, suggest appropriate activities:\n${JSON.stringify(inputData, null, 2)}`,
|
|
744
|
+
},
|
|
745
|
+
]);
|
|
746
|
+
|
|
747
|
+
let activitiesText = '';
|
|
748
|
+
for await (const chunk of response.textStream) {
|
|
749
|
+
process.stdout.write(chunk);
|
|
750
|
+
activitiesText += chunk;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
return { activities: activitiesText, location: inputData.location };
|
|
754
|
+
},
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
const planActivitiesB = createStep({
|
|
758
|
+
id: 'plan-activities-b',
|
|
759
|
+
inputSchema: forecastSchema,
|
|
760
|
+
outputSchema: z.object({ activities: z.string(), location: z.string() }),
|
|
761
|
+
execute: async ({ inputData, mastra }) => {
|
|
762
|
+
const agent = mastra?.getAgent('planningAgent');
|
|
763
|
+
if (!agent) throw new Error('Planning agent not found');
|
|
764
|
+
|
|
765
|
+
const response = await agent.stream([
|
|
766
|
+
{
|
|
767
|
+
role: 'user',
|
|
768
|
+
content: `Based on the following weather forecast for ${inputData.location}, suggest appropriate activities:\n${JSON.stringify(inputData, null, 2)}`,
|
|
769
|
+
},
|
|
770
|
+
]);
|
|
771
|
+
|
|
772
|
+
let activitiesText = '';
|
|
773
|
+
for await (const chunk of response.textStream) {
|
|
774
|
+
process.stdout.write(chunk);
|
|
775
|
+
activitiesText += chunk;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
return { activities: activitiesText, location: inputData.location };
|
|
779
|
+
},
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
const inputSchema = z.object({ cityA: z.string(), cityB: z.string() });
|
|
783
|
+
|
|
784
|
+
// Nested workflow A: fetches weather and plans activities for cityA
|
|
785
|
+
const cityPlanWorkflowA = createWorkflow({
|
|
786
|
+
id: 'city-plan-workflow-a',
|
|
787
|
+
inputSchema,
|
|
788
|
+
outputSchema: z.object({ activities: z.string(), location: z.string() }),
|
|
789
|
+
})
|
|
790
|
+
.then(fetchWeatherA)
|
|
791
|
+
.then(planActivitiesA);
|
|
792
|
+
|
|
793
|
+
cityPlanWorkflowA.commit();
|
|
794
|
+
|
|
795
|
+
// Nested workflow B: fetches weather and plans activities for cityB
|
|
796
|
+
const cityPlanWorkflowB = createWorkflow({
|
|
797
|
+
id: 'city-plan-workflow-b',
|
|
798
|
+
inputSchema,
|
|
799
|
+
outputSchema: z.object({ activities: z.string(), location: z.string() }),
|
|
800
|
+
})
|
|
801
|
+
.then(fetchWeatherB)
|
|
802
|
+
.then(planActivitiesB);
|
|
803
|
+
|
|
804
|
+
cityPlanWorkflowB.commit();
|
|
805
|
+
|
|
806
|
+
const compareTrips = createStep({
|
|
807
|
+
id: 'compare-trips',
|
|
808
|
+
inputSchema: z.object({
|
|
809
|
+
'city-plan-workflow-a': z.object({ activities: z.string(), location: z.string() }),
|
|
810
|
+
'city-plan-workflow-b': z.object({ activities: z.string(), location: z.string() }),
|
|
811
|
+
}),
|
|
812
|
+
outputSchema: z.object({ comparison: z.string() }),
|
|
813
|
+
execute: async ({ inputData, mastra }) => {
|
|
814
|
+
const agent = mastra?.getAgent('tripComparisonAgent');
|
|
815
|
+
if (!agent) throw new Error('Trip comparison agent not found');
|
|
816
|
+
|
|
817
|
+
const planA = inputData['city-plan-workflow-a'];
|
|
818
|
+
const planB = inputData['city-plan-workflow-b'];
|
|
819
|
+
|
|
820
|
+
const response = await agent.stream([
|
|
821
|
+
{
|
|
822
|
+
role: 'user',
|
|
823
|
+
content: `Compare these two city trip plans and recommend which is better:
|
|
824
|
+
|
|
825
|
+
## ${planA.location}
|
|
826
|
+
${planA.activities}
|
|
827
|
+
|
|
828
|
+
## ${planB.location}
|
|
829
|
+
${planB.activities}`,
|
|
830
|
+
},
|
|
831
|
+
]);
|
|
832
|
+
|
|
833
|
+
let comparisonText = '';
|
|
834
|
+
for await (const chunk of response.textStream) {
|
|
835
|
+
process.stdout.write(chunk);
|
|
836
|
+
comparisonText += chunk;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
return { comparison: comparisonText };
|
|
840
|
+
},
|
|
841
|
+
});
|
|
842
|
+
|
|
843
|
+
// Main workflow: runs both city plans in parallel, then compares them
|
|
844
|
+
const parallelCityComparisonWorkflow = createWorkflow({
|
|
845
|
+
id: 'parallel-city-comparison-workflow',
|
|
846
|
+
inputSchema,
|
|
847
|
+
outputSchema: z.object({ comparison: z.string() }),
|
|
848
|
+
})
|
|
849
|
+
.parallel([cityPlanWorkflowA, cityPlanWorkflowB])
|
|
850
|
+
.then(compareTrips)
|
|
851
|
+
.commit();
|
|
852
|
+
|
|
853
|
+
export { parallelCityComparisonWorkflow };
|
|
854
|
+
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
### mastra/workflows/inngest-workflow.ts
|
|
858
|
+
```typescript
|
|
859
|
+
import { realtimeMiddleware } from '@inngest/realtime/middleware';
|
|
860
|
+
import { init } from '@mastra/inngest';
|
|
861
|
+
import { Inngest } from 'inngest';
|
|
862
|
+
import { z } from 'zod';
|
|
863
|
+
|
|
864
|
+
// Create a single Inngest instance to be shared across the application
|
|
865
|
+
export const inngest = new Inngest({
|
|
866
|
+
id: 'mastra',
|
|
867
|
+
baseUrl: `http://localhost:8288`, // URL of your local Inngest dev server
|
|
868
|
+
isDev: true,
|
|
869
|
+
middleware: [realtimeMiddleware()], // Enable real-time updates in the Inngest dashboard
|
|
870
|
+
});
|
|
871
|
+
|
|
872
|
+
const { createWorkflow, createStep } = init(inngest);
|
|
873
|
+
|
|
874
|
+
// Helper function to convert weather codes to human-readable descriptions
|
|
875
|
+
function getWeatherCondition(code: number): string {
|
|
876
|
+
const conditions: Record<number, string> = {
|
|
877
|
+
0: 'Clear sky',
|
|
878
|
+
1: 'Mainly clear',
|
|
879
|
+
2: 'Partly cloudy',
|
|
880
|
+
3: 'Overcast',
|
|
881
|
+
45: 'Foggy',
|
|
882
|
+
48: 'Depositing rime fog',
|
|
883
|
+
51: 'Light drizzle',
|
|
884
|
+
53: 'Moderate drizzle',
|
|
885
|
+
55: 'Dense drizzle',
|
|
886
|
+
61: 'Slight rain',
|
|
887
|
+
63: 'Moderate rain',
|
|
888
|
+
65: 'Heavy rain',
|
|
889
|
+
71: 'Slight snow fall',
|
|
890
|
+
73: 'Moderate snow fall',
|
|
891
|
+
75: 'Heavy snow fall',
|
|
892
|
+
95: 'Thunderstorm',
|
|
893
|
+
};
|
|
894
|
+
return conditions[code] || 'Unknown';
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
const forecastSchema = z.object({
|
|
898
|
+
date: z.string(),
|
|
899
|
+
maxTemp: z.number(),
|
|
900
|
+
minTemp: z.number(),
|
|
901
|
+
precipitationChance: z.number(),
|
|
902
|
+
condition: z.string(),
|
|
903
|
+
location: z.string(),
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
const fetchWeather = createStep({
|
|
907
|
+
id: 'fetch-weather',
|
|
908
|
+
description: 'Fetches weather forecast for a given city',
|
|
909
|
+
inputSchema: z.object({
|
|
910
|
+
city: z.string(),
|
|
911
|
+
}),
|
|
912
|
+
outputSchema: forecastSchema,
|
|
913
|
+
execute: async ({ inputData }) => {
|
|
914
|
+
console.dir({ inputData }, { depth: null });
|
|
915
|
+
if (!inputData) {
|
|
916
|
+
throw new Error('Trigger data not found');
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
// Get latitude and longitude for the city
|
|
920
|
+
const geocodingUrl = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(inputData.city)}&count=1`;
|
|
921
|
+
const geocodingResponse = await fetch(geocodingUrl);
|
|
922
|
+
const geocodingData = (await geocodingResponse.json()) as {
|
|
923
|
+
results: { latitude: number; longitude: number; name: string }[];
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
if (!geocodingData.results?.[0]) {
|
|
927
|
+
throw new Error(`Location '${inputData.city}' not found`);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
const { latitude, longitude, name } = geocodingData.results[0];
|
|
931
|
+
|
|
932
|
+
// Fetch weather data using the coordinates
|
|
933
|
+
const weatherUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=precipitation,weathercode&timezone=auto,&hourly=precipitation_probability,temperature_2m`;
|
|
934
|
+
const response = await fetch(weatherUrl);
|
|
935
|
+
const data = (await response.json()) as {
|
|
936
|
+
current: {
|
|
937
|
+
time: string;
|
|
938
|
+
precipitation: number;
|
|
939
|
+
weathercode: number;
|
|
940
|
+
};
|
|
941
|
+
hourly: {
|
|
942
|
+
precipitation_probability: number[];
|
|
943
|
+
temperature_2m: number[];
|
|
944
|
+
};
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
const forecast = {
|
|
948
|
+
date: new Date().toISOString(),
|
|
949
|
+
maxTemp: Math.max(...data.hourly.temperature_2m),
|
|
950
|
+
minTemp: Math.min(...data.hourly.temperature_2m),
|
|
951
|
+
condition: getWeatherCondition(data.current.weathercode),
|
|
952
|
+
location: name,
|
|
953
|
+
precipitationChance: data.hourly.precipitation_probability.reduce((acc, curr) => Math.max(acc, curr), 0),
|
|
954
|
+
};
|
|
955
|
+
|
|
956
|
+
return forecast;
|
|
957
|
+
},
|
|
958
|
+
});
|
|
959
|
+
|
|
960
|
+
const planActivities = createStep({
|
|
961
|
+
id: 'plan-activities',
|
|
962
|
+
description: 'Suggests activities based on weather conditions',
|
|
963
|
+
inputSchema: forecastSchema,
|
|
964
|
+
outputSchema: z.object({
|
|
965
|
+
activities: z.string(),
|
|
966
|
+
}),
|
|
967
|
+
execute: async ({ inputData, mastra }) => {
|
|
968
|
+
const forecast = inputData;
|
|
969
|
+
|
|
970
|
+
if (!forecast) {
|
|
971
|
+
throw new Error('Forecast data not found');
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
const prompt = `Based on the following weather forecast for ${forecast.location}, suggest appropriate activities:
|
|
975
|
+
${JSON.stringify(forecast, null, 2)}
|
|
976
|
+
`;
|
|
977
|
+
|
|
978
|
+
const agent = mastra?.getAgent('planningAgent');
|
|
979
|
+
if (!agent) {
|
|
980
|
+
throw new Error('Planning agent not found');
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
const response = await agent.stream([
|
|
984
|
+
{
|
|
985
|
+
role: 'user',
|
|
986
|
+
content: prompt,
|
|
987
|
+
},
|
|
988
|
+
]);
|
|
989
|
+
|
|
990
|
+
let activitiesText = '';
|
|
991
|
+
|
|
992
|
+
for await (const chunk of response.textStream) {
|
|
993
|
+
process.stdout.write(chunk);
|
|
994
|
+
activitiesText += chunk;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
return {
|
|
998
|
+
activities: activitiesText,
|
|
999
|
+
};
|
|
1000
|
+
},
|
|
1001
|
+
});
|
|
1002
|
+
|
|
1003
|
+
const planIndoorActivities = createStep({
|
|
1004
|
+
id: 'plan-indoor-activities',
|
|
1005
|
+
description: 'Suggests indoor activities based on weather conditions',
|
|
1006
|
+
inputSchema: forecastSchema,
|
|
1007
|
+
outputSchema: z.object({
|
|
1008
|
+
activities: z.string(),
|
|
1009
|
+
}),
|
|
1010
|
+
execute: async ({ inputData, mastra }) => {
|
|
1011
|
+
const forecast = inputData;
|
|
1012
|
+
|
|
1013
|
+
if (!forecast) {
|
|
1014
|
+
throw new Error('Forecast data not found');
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
const prompt = `In case it rains, plan indoor activities for ${forecast.location} on ${forecast.date}`;
|
|
1018
|
+
|
|
1019
|
+
const agent = mastra?.getAgent('planningAgent');
|
|
1020
|
+
if (!agent) {
|
|
1021
|
+
throw new Error('Planning agent not found');
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
const response = await agent.stream([
|
|
1025
|
+
{
|
|
1026
|
+
role: 'user',
|
|
1027
|
+
content: prompt,
|
|
1028
|
+
},
|
|
1029
|
+
]);
|
|
1030
|
+
|
|
1031
|
+
let activitiesText = '';
|
|
1032
|
+
|
|
1033
|
+
for await (const chunk of response.textStream) {
|
|
1034
|
+
process.stdout.write(chunk);
|
|
1035
|
+
activitiesText += chunk;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
return {
|
|
1039
|
+
activities: activitiesText,
|
|
1040
|
+
};
|
|
1041
|
+
},
|
|
1042
|
+
});
|
|
1043
|
+
|
|
1044
|
+
const activityPlanningWorkflow = createWorkflow({
|
|
1045
|
+
id: 'activity-planning-workflow-step2-if-else',
|
|
1046
|
+
inputSchema: z.object({
|
|
1047
|
+
city: z.string().describe('The city to get the weather for'),
|
|
1048
|
+
}),
|
|
1049
|
+
outputSchema: z.object({
|
|
1050
|
+
activities: z.string(),
|
|
1051
|
+
}),
|
|
1052
|
+
})
|
|
1053
|
+
.then(fetchWeather)
|
|
1054
|
+
.branch([
|
|
1055
|
+
[
|
|
1056
|
+
// If precipitation chance is greater than 50%, suggest indoor activities
|
|
1057
|
+
async ({ inputData }) => {
|
|
1058
|
+
return inputData?.precipitationChance > 50;
|
|
1059
|
+
},
|
|
1060
|
+
planIndoorActivities,
|
|
1061
|
+
],
|
|
1062
|
+
[
|
|
1063
|
+
// Otherwise, suggest a mix of activities
|
|
1064
|
+
async ({ inputData }) => {
|
|
1065
|
+
return inputData?.precipitationChance <= 50;
|
|
1066
|
+
},
|
|
1067
|
+
planActivities,
|
|
1068
|
+
],
|
|
1069
|
+
]);
|
|
1070
|
+
|
|
1071
|
+
activityPlanningWorkflow.commit();
|
|
1072
|
+
|
|
1073
|
+
export { activityPlanningWorkflow };
|
|
1074
|
+
|
|
1075
|
+
```
|