@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,673 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Inngest | Deployment"
|
|
3
|
+
description: "Deploy Mastra workflows with Inngest"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Inngest workflow
|
|
7
|
+
|
|
8
|
+
[Inngest](https://www.inngest.com/docs) is a developer platform for building and running background workflows, without managing infrastructure.
|
|
9
|
+
|
|
10
|
+
For a complete example with advanced flow control features, see the [Inngest workflow example](https://github.com/mastra-ai/mastra/tree/main/examples/inngest).
|
|
11
|
+
|
|
12
|
+
## How Inngest works with Mastra
|
|
13
|
+
|
|
14
|
+
Inngest and Mastra integrate by aligning their workflow models: Inngest organizes logic into functions composed of steps, and Mastra workflows defined using `createWorkflow()` and `createStep()` map directly onto this paradigm. Each Mastra workflow becomes an Inngest function with a unique identifier, and each step within the workflow maps to an Inngest step.
|
|
15
|
+
|
|
16
|
+
The `serve()` function bridges the two systems by registering Mastra workflows as Inngest functions and setting up the necessary event handlers for execution and monitoring.
|
|
17
|
+
|
|
18
|
+
When an event triggers a workflow, Inngest executes it step by step, memoizing each step's result. This means if a workflow is retried or resumed, completed steps are skipped, ensuring efficient and reliable execution. Control flow primitives in Mastra, such as loops, conditionals, and nested workflows are seamlessly translated into the same Inngest's function/step model, preserving advanced workflow features like composition, branching, and suspension.
|
|
19
|
+
|
|
20
|
+
Real-time monitoring, suspend/resume, and step-level observability are enabled via Inngest's publish-subscribe system and dashboard. As each step executes, its state and output are tracked using Mastra storage and can be resumed as needed.
|
|
21
|
+
|
|
22
|
+
## Setup
|
|
23
|
+
|
|
24
|
+
Install the required packages:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm install @mastra/inngest@beta inngest @inngest/realtime
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Building an Inngest workflow
|
|
31
|
+
|
|
32
|
+
This guide walks through creating a workflow with Inngest and Mastra, demonstrating a counter application that increments a value until it reaches 10.
|
|
33
|
+
|
|
34
|
+
### Inngest initialization
|
|
35
|
+
|
|
36
|
+
Initialize the Inngest integration to obtain Mastra-compatible workflow helpers. The `createWorkflow()` and `createStep()` functions are used to create workflow and step objects that are compatible with Mastra and inngest.
|
|
37
|
+
|
|
38
|
+
In development:
|
|
39
|
+
|
|
40
|
+
```ts title="src/mastra/inngest/index.ts"
|
|
41
|
+
import { Inngest } from "inngest";
|
|
42
|
+
import { realtimeMiddleware } from "@inngest/realtime/middleware";
|
|
43
|
+
|
|
44
|
+
export const inngest = new Inngest({
|
|
45
|
+
id: "mastra",
|
|
46
|
+
baseUrl: "http://localhost:8288",
|
|
47
|
+
isDev: true,
|
|
48
|
+
middleware: [realtimeMiddleware()],
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
In production:
|
|
53
|
+
|
|
54
|
+
```ts title="src/mastra/inngest/index.ts"
|
|
55
|
+
import { Inngest } from "inngest";
|
|
56
|
+
import { realtimeMiddleware } from "@inngest/realtime/middleware";
|
|
57
|
+
|
|
58
|
+
export const inngest = new Inngest({
|
|
59
|
+
id: "mastra",
|
|
60
|
+
middleware: [realtimeMiddleware()],
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Creating steps
|
|
65
|
+
|
|
66
|
+
Define the individual steps that will compose your workflow:
|
|
67
|
+
|
|
68
|
+
```ts title="src/mastra/workflows/index.ts"
|
|
69
|
+
import { z } from "zod";
|
|
70
|
+
import { inngest } from "../inngest";
|
|
71
|
+
import { init } from "@mastra/inngest";
|
|
72
|
+
|
|
73
|
+
// Initialize Inngest with Mastra, pointing to your local Inngest server
|
|
74
|
+
const { createWorkflow, createStep } = init(inngest);
|
|
75
|
+
|
|
76
|
+
// Step: Increment the counter value
|
|
77
|
+
const incrementStep = createStep({
|
|
78
|
+
id: "increment",
|
|
79
|
+
inputSchema: z.object({
|
|
80
|
+
value: z.number(),
|
|
81
|
+
}),
|
|
82
|
+
outputSchema: z.object({
|
|
83
|
+
value: z.number(),
|
|
84
|
+
}),
|
|
85
|
+
execute: async ({ inputData }) => {
|
|
86
|
+
return { value: inputData.value + 1 };
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Creating the workflow
|
|
92
|
+
|
|
93
|
+
Compose the steps into a workflow using the `dountil` loop pattern. The `createWorkflow()` function creates a function on Inngest server that is invocable.
|
|
94
|
+
|
|
95
|
+
```ts title="src/mastra/workflows/index.ts"
|
|
96
|
+
// workflow that is registered as a function on inngest server
|
|
97
|
+
const workflow = createWorkflow({
|
|
98
|
+
id: "increment-workflow",
|
|
99
|
+
inputSchema: z.object({
|
|
100
|
+
value: z.number(),
|
|
101
|
+
}),
|
|
102
|
+
outputSchema: z.object({
|
|
103
|
+
value: z.number(),
|
|
104
|
+
}),
|
|
105
|
+
}).then(incrementStep);
|
|
106
|
+
|
|
107
|
+
workflow.commit();
|
|
108
|
+
|
|
109
|
+
export { workflow as incrementWorkflow };
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Configuring the Mastra instance
|
|
113
|
+
|
|
114
|
+
Register the workflow with Mastra and configure the Inngest API endpoint:
|
|
115
|
+
|
|
116
|
+
```ts title="src/mastra/index.ts"
|
|
117
|
+
import { Mastra } from "@mastra/core";
|
|
118
|
+
import { serve } from "@mastra/inngest";
|
|
119
|
+
import { incrementWorkflow } from "./workflows";
|
|
120
|
+
import { inngest } from "./inngest";
|
|
121
|
+
import { PinoLogger } from "@mastra/loggers";
|
|
122
|
+
|
|
123
|
+
export const mastra = new Mastra({
|
|
124
|
+
workflows: { incrementWorkflow },
|
|
125
|
+
server: {
|
|
126
|
+
host: "0.0.0.0",
|
|
127
|
+
apiRoutes: [
|
|
128
|
+
{
|
|
129
|
+
path: "/api/inngest",
|
|
130
|
+
method: "ALL",
|
|
131
|
+
createHandler: async ({ mastra }) => {
|
|
132
|
+
return serve({ mastra, inngest });
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
logger: new PinoLogger({ name: "Mastra", level: "info" }),
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Running workflows
|
|
142
|
+
|
|
143
|
+
### Running locally
|
|
144
|
+
|
|
145
|
+
1. Run `npx mastra dev` to start the Mastra server locally on port 4111
|
|
146
|
+
2. Start the Inngest Dev Server. In a new terminal, run:
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
npx inngest-cli@latest dev -u http://localhost:4111/api/inngest
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
:::note
|
|
153
|
+
The URL after `-u` tells the Inngest dev server where to find your Mastra `/api/inngest` endpoint
|
|
154
|
+
:::
|
|
155
|
+
|
|
156
|
+
3. Open the Inngest Dashboard at [http://localhost:8288](http://localhost:8288) and go to the **Apps** section in the sidebar to verify your Mastra workflow is registered
|
|
157
|
+
|
|
158
|
+
4. Invoke the workflow by going to **Functions**, selecting your workflow, and clicking **Invoke** with the following input:
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"data": {
|
|
163
|
+
"inputData": {
|
|
164
|
+
"value": 5
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
5. Monitor the workflow execution in the **Runs** tab to see step-by-step execution progress
|
|
171
|
+
|
|
172
|
+
### Running in production
|
|
173
|
+
|
|
174
|
+
Before you begin, make sure you have:
|
|
175
|
+
|
|
176
|
+
- Vercel account and Vercel CLI installed (`npm i -g vercel`)
|
|
177
|
+
- Inngest account
|
|
178
|
+
- Vercel token
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
1. Set your Vercel token in your environment:
|
|
182
|
+
|
|
183
|
+
```sh title=".env"
|
|
184
|
+
export VERCEL_TOKEN=your_vercel_token
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
2. Add `VercelDeployer` to Mastra instance
|
|
188
|
+
|
|
189
|
+
```ts title="src/mastra/index.ts"
|
|
190
|
+
import { VercelDeployer } from "@mastra/deployer-vercel";
|
|
191
|
+
|
|
192
|
+
export const mastra = new Mastra({
|
|
193
|
+
deployer: new VercelDeployer({
|
|
194
|
+
teamSlug: "your_team_slug",
|
|
195
|
+
projectName: "your_project_name",
|
|
196
|
+
// you can get your vercel token from the vercel dashboard by clicking on the user icon in the top right corner
|
|
197
|
+
// and then clicking on "Account Settings" and then clicking on "Tokens" on the left sidebar.
|
|
198
|
+
token: process.env.VERCEL_TOKEN,
|
|
199
|
+
}),
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
3. Build the mastra instance
|
|
205
|
+
|
|
206
|
+
```sh
|
|
207
|
+
npx mastra build
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
4. Deploy to Vercel
|
|
211
|
+
|
|
212
|
+
```sh
|
|
213
|
+
cd .mastra/output
|
|
214
|
+
vercel login
|
|
215
|
+
vercel --prod
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
5. Sync with the [Inngest dashboard](https://app.inngest.com/env/production/apps) by clicking **Sync new app with Vercel** and following the instructions
|
|
219
|
+
|
|
220
|
+
6. Invoke the workflow by going to **Functions**, selecting `workflow.increment-workflow`, clicking **All actions** > **Invoke**, and providing the following input:
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"data": {
|
|
225
|
+
"inputData": {
|
|
226
|
+
"value": 5
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
7. Monitor execution in the **Runs** tab to see step-by-step progress
|
|
233
|
+
|
|
234
|
+
## Adding custom Inngest functions
|
|
235
|
+
|
|
236
|
+
You can serve additional Inngest functions alongside your Mastra workflows by using the optional `functions` parameter in `serve()`.
|
|
237
|
+
|
|
238
|
+
### Creating custom functions
|
|
239
|
+
|
|
240
|
+
First, create your custom Inngest functions:
|
|
241
|
+
|
|
242
|
+
```ts title="src/inngest/custom-functions.ts"
|
|
243
|
+
import { inngest } from "../inngest";
|
|
244
|
+
|
|
245
|
+
// Define custom Inngest functions
|
|
246
|
+
export const customEmailFunction = inngest.createFunction(
|
|
247
|
+
{ id: "send-welcome-email" },
|
|
248
|
+
{ event: "user/registered" },
|
|
249
|
+
async ({ event }) => {
|
|
250
|
+
// Custom email logic here
|
|
251
|
+
console.log(`Sending welcome email to ${event.data.email}`);
|
|
252
|
+
return { status: "email_sent" };
|
|
253
|
+
},
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
export const customWebhookFunction = inngest.createFunction(
|
|
257
|
+
{ id: "process-webhook" },
|
|
258
|
+
{ event: "webhook/received" },
|
|
259
|
+
async ({ event }) => {
|
|
260
|
+
// Custom webhook processing
|
|
261
|
+
console.log(`Processing webhook: ${event.data.type}`);
|
|
262
|
+
return { processed: true };
|
|
263
|
+
},
|
|
264
|
+
);
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Serving custom functions with workflows
|
|
268
|
+
|
|
269
|
+
Update your Mastra configuration to import and include the custom functions. The highlighted lines show the additions:
|
|
270
|
+
|
|
271
|
+
```ts title="src/mastra/index.ts" {5-8,23}
|
|
272
|
+
import { Mastra } from "@mastra/core";
|
|
273
|
+
import { serve } from "@mastra/inngest";
|
|
274
|
+
import { incrementWorkflow } from "./workflows";
|
|
275
|
+
import { inngest } from "./inngest";
|
|
276
|
+
import {
|
|
277
|
+
customEmailFunction,
|
|
278
|
+
customWebhookFunction,
|
|
279
|
+
} from "./inngest/custom-functions";
|
|
280
|
+
import { PinoLogger } from "@mastra/loggers";
|
|
281
|
+
|
|
282
|
+
export const mastra = new Mastra({
|
|
283
|
+
workflows: { incrementWorkflow },
|
|
284
|
+
server: {
|
|
285
|
+
host: "0.0.0.0",
|
|
286
|
+
apiRoutes: [
|
|
287
|
+
{
|
|
288
|
+
path: "/api/inngest",
|
|
289
|
+
method: "ALL",
|
|
290
|
+
createHandler: async ({ mastra }) => {
|
|
291
|
+
return serve({
|
|
292
|
+
mastra,
|
|
293
|
+
inngest,
|
|
294
|
+
functions: [customEmailFunction, customWebhookFunction],
|
|
295
|
+
});
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
},
|
|
300
|
+
logger: new PinoLogger({ name: "Mastra", level: "info" }),
|
|
301
|
+
});
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Function registration
|
|
305
|
+
|
|
306
|
+
When you include custom functions:
|
|
307
|
+
|
|
308
|
+
1. Mastra workflows are automatically converted to Inngest functions with IDs like `workflow.${workflowId}`
|
|
309
|
+
2. Custom functions retain their specified IDs (e.g., `send-welcome-email`, `process-webhook`)
|
|
310
|
+
3. All functions are served together on the same `/api/inngest` endpoint
|
|
311
|
+
|
|
312
|
+
This allows you to combine Mastra's workflow orchestration with your existing Inngest functions.
|
|
313
|
+
|
|
314
|
+
## Using with other frameworks
|
|
315
|
+
|
|
316
|
+
The default `serve` function uses Hono internally. If you're using a different web framework like Express, Fastify, or Koa, use the `createServe` factory function with the appropriate Inngest adapter.
|
|
317
|
+
|
|
318
|
+
### Express
|
|
319
|
+
|
|
320
|
+
```ts title="src/server.ts"
|
|
321
|
+
import express from "express";
|
|
322
|
+
import { createServe } from "@mastra/inngest";
|
|
323
|
+
import { serve as expressAdapter } from "inngest/express";
|
|
324
|
+
import { mastra, inngest } from "./mastra";
|
|
325
|
+
|
|
326
|
+
const app = express();
|
|
327
|
+
|
|
328
|
+
// Body parsing middleware required for Inngest
|
|
329
|
+
app.use(express.json());
|
|
330
|
+
|
|
331
|
+
const handler = createServe(expressAdapter)({ mastra, inngest });
|
|
332
|
+
app.use("/api/inngest", handler);
|
|
333
|
+
|
|
334
|
+
app.listen(3000);
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Fastify
|
|
338
|
+
|
|
339
|
+
```ts title="src/server.ts"
|
|
340
|
+
import Fastify from "fastify";
|
|
341
|
+
import { createServe } from "@mastra/inngest";
|
|
342
|
+
import { serve as fastifyAdapter } from "inngest/fastify";
|
|
343
|
+
import { mastra, inngest } from "./mastra";
|
|
344
|
+
|
|
345
|
+
const fastify = Fastify();
|
|
346
|
+
|
|
347
|
+
// JSON parsing is handled by Fastify's default content-type parser
|
|
348
|
+
const handler = createServe(fastifyAdapter)({ mastra, inngest });
|
|
349
|
+
|
|
350
|
+
fastify.route({
|
|
351
|
+
method: ["GET", "POST", "PUT"],
|
|
352
|
+
url: "/api/inngest",
|
|
353
|
+
handler,
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
fastify.listen({ port: 3000 });
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Koa
|
|
360
|
+
|
|
361
|
+
```ts title="src/server.ts"
|
|
362
|
+
import Koa from "koa";
|
|
363
|
+
import Router from "@koa/router";
|
|
364
|
+
import bodyParser from "koa-bodyparser";
|
|
365
|
+
import { createServe } from "@mastra/inngest";
|
|
366
|
+
import { serve as koaAdapter } from "inngest/koa";
|
|
367
|
+
import { mastra, inngest } from "./mastra";
|
|
368
|
+
|
|
369
|
+
const app = new Koa();
|
|
370
|
+
const router = new Router();
|
|
371
|
+
|
|
372
|
+
// Body parsing middleware required for Inngest
|
|
373
|
+
app.use(bodyParser());
|
|
374
|
+
|
|
375
|
+
const handler = createServe(koaAdapter)({ mastra, inngest });
|
|
376
|
+
router.all("/api/inngest", handler);
|
|
377
|
+
|
|
378
|
+
app.use(router.routes());
|
|
379
|
+
app.use(router.allowedMethods());
|
|
380
|
+
|
|
381
|
+
app.listen(3000);
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Next.js
|
|
385
|
+
|
|
386
|
+
```ts title="app/api/inngest/route.ts"
|
|
387
|
+
import { createServe } from "@mastra/inngest";
|
|
388
|
+
import { serve as nextAdapter } from "inngest/next";
|
|
389
|
+
import { mastra, inngest } from "@/mastra";
|
|
390
|
+
|
|
391
|
+
const handler = createServe(nextAdapter)({ mastra, inngest });
|
|
392
|
+
|
|
393
|
+
export { handler as GET, handler as POST, handler as PUT };
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Available adapters
|
|
397
|
+
|
|
398
|
+
The `createServe` function works with any Inngest adapter. See the [Inngest serve documentation](https://www.inngest.com/docs/reference/serve) for a complete list of available adapters including AWS Lambda, Cloudflare Workers, and more.
|
|
399
|
+
|
|
400
|
+
## Flow control
|
|
401
|
+
|
|
402
|
+
Inngest workflows support flow control features including concurrency limits, rate limiting, throttling, debouncing, and priority queuing. These options are configured in the `createWorkflow()` call and help manage workflow execution at scale.
|
|
403
|
+
|
|
404
|
+
### Concurrency
|
|
405
|
+
|
|
406
|
+
Control how many workflow instances can run simultaneously:
|
|
407
|
+
|
|
408
|
+
```ts
|
|
409
|
+
const workflow = createWorkflow({
|
|
410
|
+
id: "user-processing-workflow",
|
|
411
|
+
inputSchema: z.object({ userId: z.string() }),
|
|
412
|
+
outputSchema: z.object({ result: z.string() }),
|
|
413
|
+
steps: [processUserStep],
|
|
414
|
+
// Limit to 10 concurrent executions, scoped by user ID
|
|
415
|
+
concurrency: {
|
|
416
|
+
limit: 10,
|
|
417
|
+
key: "event.data.userId",
|
|
418
|
+
},
|
|
419
|
+
});
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Rate limiting
|
|
423
|
+
|
|
424
|
+
Limit the number of workflow executions within a time period:
|
|
425
|
+
|
|
426
|
+
```ts
|
|
427
|
+
const workflow = createWorkflow({
|
|
428
|
+
id: "api-sync-workflow",
|
|
429
|
+
inputSchema: z.object({ endpoint: z.string() }),
|
|
430
|
+
outputSchema: z.object({ status: z.string() }),
|
|
431
|
+
steps: [apiSyncStep],
|
|
432
|
+
// Maximum 1000 executions per hour
|
|
433
|
+
rateLimit: {
|
|
434
|
+
period: "1h",
|
|
435
|
+
limit: 1000,
|
|
436
|
+
},
|
|
437
|
+
});
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Throttling
|
|
441
|
+
|
|
442
|
+
Ensure minimum time between workflow executions:
|
|
443
|
+
|
|
444
|
+
```ts
|
|
445
|
+
const workflow = createWorkflow({
|
|
446
|
+
id: "email-notification-workflow",
|
|
447
|
+
inputSchema: z.object({ organizationId: z.string(), message: z.string() }),
|
|
448
|
+
outputSchema: z.object({ sent: z.boolean() }),
|
|
449
|
+
steps: [sendEmailStep],
|
|
450
|
+
// Only one execution per 10 seconds per organization
|
|
451
|
+
throttle: {
|
|
452
|
+
period: "10s",
|
|
453
|
+
limit: 1,
|
|
454
|
+
key: "event.data.organizationId",
|
|
455
|
+
},
|
|
456
|
+
});
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### Debouncing
|
|
460
|
+
|
|
461
|
+
Delay execution until no new events arrive within a time window:
|
|
462
|
+
|
|
463
|
+
```ts
|
|
464
|
+
const workflow = createWorkflow({
|
|
465
|
+
id: "search-index-workflow",
|
|
466
|
+
inputSchema: z.object({ documentId: z.string() }),
|
|
467
|
+
outputSchema: z.object({ indexed: z.boolean() }),
|
|
468
|
+
steps: [indexDocumentStep],
|
|
469
|
+
// Wait 5 seconds of no updates before indexing
|
|
470
|
+
debounce: {
|
|
471
|
+
period: "5s",
|
|
472
|
+
key: "event.data.documentId",
|
|
473
|
+
},
|
|
474
|
+
});
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
### Priority
|
|
478
|
+
|
|
479
|
+
Set execution priority for workflows:
|
|
480
|
+
|
|
481
|
+
```ts
|
|
482
|
+
const workflow = createWorkflow({
|
|
483
|
+
id: "order-processing-workflow",
|
|
484
|
+
inputSchema: z.object({
|
|
485
|
+
orderId: z.string(),
|
|
486
|
+
priority: z.number().optional(),
|
|
487
|
+
}),
|
|
488
|
+
outputSchema: z.object({ processed: z.boolean() }),
|
|
489
|
+
steps: [processOrderStep],
|
|
490
|
+
// Higher priority orders execute first
|
|
491
|
+
priority: {
|
|
492
|
+
run: "event.data.priority ?? 50",
|
|
493
|
+
},
|
|
494
|
+
});
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
### Combining flow control options
|
|
498
|
+
|
|
499
|
+
Multiple flow control options can be combined in a single workflow:
|
|
500
|
+
|
|
501
|
+
```ts
|
|
502
|
+
const workflow = createWorkflow({
|
|
503
|
+
id: "comprehensive-workflow",
|
|
504
|
+
inputSchema: z.object({
|
|
505
|
+
userId: z.string(),
|
|
506
|
+
organizationId: z.string(),
|
|
507
|
+
priority: z.number().optional(),
|
|
508
|
+
}),
|
|
509
|
+
outputSchema: z.object({ result: z.string() }),
|
|
510
|
+
steps: [comprehensiveStep],
|
|
511
|
+
concurrency: {
|
|
512
|
+
limit: 5,
|
|
513
|
+
key: "event.data.userId",
|
|
514
|
+
},
|
|
515
|
+
rateLimit: {
|
|
516
|
+
period: "1m",
|
|
517
|
+
limit: 100,
|
|
518
|
+
},
|
|
519
|
+
throttle: {
|
|
520
|
+
period: "10s",
|
|
521
|
+
limit: 1,
|
|
522
|
+
key: "event.data.organizationId",
|
|
523
|
+
},
|
|
524
|
+
priority: {
|
|
525
|
+
run: "event.data.priority ?? 0",
|
|
526
|
+
},
|
|
527
|
+
});
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
All flow control options are optional. If not specified, workflows run with Inngest's default behavior. For more information, see the [Inngest flow control documentation](https://www.inngest.com/docs/guides/flow-control).
|
|
531
|
+
|
|
532
|
+
## Cron scheduling
|
|
533
|
+
|
|
534
|
+
Inngest workflows can be automatically triggered on a schedule using cron expressions. This allows you to run workflows at regular intervals, such as daily reports, hourly data syncs, or maintenance tasks.
|
|
535
|
+
|
|
536
|
+
### Basic cron scheduling
|
|
537
|
+
|
|
538
|
+
Configure a workflow to run on a schedule by adding a `cron` property:
|
|
539
|
+
|
|
540
|
+
```ts
|
|
541
|
+
const workflow = createWorkflow({
|
|
542
|
+
id: "daily-report-workflow",
|
|
543
|
+
inputSchema: z.object({ reportType: z.string() }),
|
|
544
|
+
outputSchema: z.object({ generated: z.boolean() }),
|
|
545
|
+
steps: [generateReportStep],
|
|
546
|
+
// Run daily at midnight
|
|
547
|
+
cron: "0 0 * * *",
|
|
548
|
+
});
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### Cron schedule format
|
|
552
|
+
|
|
553
|
+
The `cron` property accepts standard cron expressions in the format: `minute hour day month dayOfWeek`
|
|
554
|
+
|
|
555
|
+
- **minute**: 0-59
|
|
556
|
+
- **hour**: 0-23
|
|
557
|
+
- **day**: 1-31
|
|
558
|
+
- **month**: 1-12 or JAN-DEC
|
|
559
|
+
- **dayOfWeek**: 0-6 (Sunday = 0) or SUN-SAT
|
|
560
|
+
|
|
561
|
+
Common cron patterns:
|
|
562
|
+
|
|
563
|
+
```ts
|
|
564
|
+
// Every 15 minutes
|
|
565
|
+
cron: "*/15 * * * *"
|
|
566
|
+
|
|
567
|
+
// Every hour at minute 0
|
|
568
|
+
cron: "0 * * * *"
|
|
569
|
+
|
|
570
|
+
// Every 6 hours
|
|
571
|
+
cron: "0 */6 * * *"
|
|
572
|
+
|
|
573
|
+
// Daily at midnight
|
|
574
|
+
cron: "0 0 * * *"
|
|
575
|
+
|
|
576
|
+
// Daily at 9 AM
|
|
577
|
+
cron: "0 9 * * *"
|
|
578
|
+
|
|
579
|
+
// Every weekday at 9 AM
|
|
580
|
+
cron: "0 9 * * 1-5"
|
|
581
|
+
|
|
582
|
+
// First day of every month at midnight
|
|
583
|
+
cron: "0 0 1 * *"
|
|
584
|
+
|
|
585
|
+
// Every Monday at 8 AM
|
|
586
|
+
cron: "0 8 * * 1"
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
### Providing input data for scheduled runs
|
|
590
|
+
|
|
591
|
+
You can provide static input data that will be used for each scheduled execution:
|
|
592
|
+
|
|
593
|
+
```ts
|
|
594
|
+
const workflow = createWorkflow({
|
|
595
|
+
id: "scheduled-data-sync",
|
|
596
|
+
inputSchema: z.object({
|
|
597
|
+
source: z.string(),
|
|
598
|
+
destination: z.string(),
|
|
599
|
+
}),
|
|
600
|
+
outputSchema: z.object({ synced: z.boolean() }),
|
|
601
|
+
steps: [syncDataStep],
|
|
602
|
+
cron: "0 */6 * * *", // Every 6 hours
|
|
603
|
+
// Input data provided to each scheduled run
|
|
604
|
+
inputData: {
|
|
605
|
+
source: "production-db",
|
|
606
|
+
destination: "analytics-warehouse",
|
|
607
|
+
},
|
|
608
|
+
});
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
### Providing initial state for scheduled runs
|
|
612
|
+
|
|
613
|
+
You can also set an initial state for scheduled workflow runs:
|
|
614
|
+
|
|
615
|
+
```ts
|
|
616
|
+
const workflow = createWorkflow({
|
|
617
|
+
id: "scheduled-aggregation",
|
|
618
|
+
inputSchema: z.object({ date: z.string() }),
|
|
619
|
+
outputSchema: z.object({ aggregated: z.boolean() }),
|
|
620
|
+
stateSchema: z.object({
|
|
621
|
+
processedCount: z.number(),
|
|
622
|
+
lastProcessedDate: z.string(),
|
|
623
|
+
}),
|
|
624
|
+
steps: [aggregateDataStep],
|
|
625
|
+
cron: "0 0 * * *", // Daily at midnight
|
|
626
|
+
inputData: {
|
|
627
|
+
date: new Date().toISOString().split("T")[0], // Today's date
|
|
628
|
+
},
|
|
629
|
+
initialState: {
|
|
630
|
+
processedCount: 0,
|
|
631
|
+
lastProcessedDate: "",
|
|
632
|
+
},
|
|
633
|
+
});
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
### Combining cron with flow control
|
|
637
|
+
|
|
638
|
+
Cron scheduling can be combined with flow control options:
|
|
639
|
+
|
|
640
|
+
```ts
|
|
641
|
+
const workflow = createWorkflow({
|
|
642
|
+
id: "scheduled-api-sync",
|
|
643
|
+
inputSchema: z.object({ endpoint: z.string() }),
|
|
644
|
+
outputSchema: z.object({ synced: z.boolean() }),
|
|
645
|
+
steps: [syncApiStep],
|
|
646
|
+
cron: "*/30 * * * *", // Every 30 minutes
|
|
647
|
+
inputData: {
|
|
648
|
+
endpoint: "https://api.example.com/data",
|
|
649
|
+
},
|
|
650
|
+
// Limit concurrent executions even for scheduled runs
|
|
651
|
+
concurrency: {
|
|
652
|
+
limit: 5,
|
|
653
|
+
},
|
|
654
|
+
// Rate limit scheduled executions
|
|
655
|
+
rateLimit: {
|
|
656
|
+
period: "1h",
|
|
657
|
+
limit: 100,
|
|
658
|
+
},
|
|
659
|
+
});
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
### How cron functions work
|
|
663
|
+
|
|
664
|
+
When you configure a workflow with a `cron` property:
|
|
665
|
+
|
|
666
|
+
1. A separate Inngest function is automatically created with the ID `workflow.${workflowId}.cron`
|
|
667
|
+
2. This function is registered with Inngest and will trigger at the specified schedule
|
|
668
|
+
3. Each scheduled execution creates a new workflow run with the provided `inputData` and `initialState`
|
|
669
|
+
4. The cron function and the main workflow function are both served together when you call `serve()`
|
|
670
|
+
|
|
671
|
+
You can monitor scheduled executions in the Inngest dashboard under **Functions** and **Runs** sections. The cron function will appear as a separate function alongside your main workflow function.
|
|
672
|
+
|
|
673
|
+
For more information on cron scheduling, see the [Inngest cron documentation](https://www.inngest.com/docs/guides/scheduled-functions).
|
|
@@ -7,15 +7,19 @@ description: "Learn how to deploy a Mastra application to Netlify using the Mast
|
|
|
7
7
|
|
|
8
8
|
The `NetlifyDeployer` class handles deployment of standalone Mastra applications to Netlify. It manages configuration, deployment, and extends the base [Deployer](/reference/v1/deployer/) class with Netlify specific functionality.
|
|
9
9
|
|
|
10
|
+
:::warning
|
|
11
|
+
Netlify Functions use an ephemeral filesystem. Remove any usage of [LibSQLStore](/reference/v1/storage/libsql) with file URLs from your Mastra configuration. Use in-memory storage (`:memory:`) or external storage providers like Turso, PostgreSQL, or Upstash.
|
|
12
|
+
:::
|
|
13
|
+
|
|
10
14
|
## Installation
|
|
11
15
|
|
|
12
|
-
```bash
|
|
16
|
+
```bash
|
|
13
17
|
npm install @mastra/deployer-netlify@beta
|
|
14
18
|
```
|
|
15
19
|
|
|
16
20
|
## Usage example
|
|
17
21
|
|
|
18
|
-
```typescript title="src/mastra/index.ts"
|
|
22
|
+
```typescript title="src/mastra/index.ts"
|
|
19
23
|
import { Mastra } from "@mastra/core";
|
|
20
24
|
import { NetlifyDeployer } from "@mastra/deployer-netlify";
|
|
21
25
|
|
|
@@ -44,7 +48,7 @@ Your project is now configured with automatic deployments which occur whenever y
|
|
|
44
48
|
|
|
45
49
|
Manual deployments are also possible using the [Netlify CLI](https://docs.netlify.com/cli/get-started/). With the Netlify CLI installed run the following from your project root to deploy your application. You can also run `netlify dev` from your project root to test your Mastra application locally.
|
|
46
50
|
|
|
47
|
-
```bash
|
|
51
|
+
```bash
|
|
48
52
|
netlify deploy --prod
|
|
49
53
|
```
|
|
50
54
|
|