@mastra/mcp-docs-server 1.0.0-beta.4 → 1.0.0-beta.6
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%2Fstorage-test-utils.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +29 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +411 -211
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fduckdb.md +42 -0
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Felasticsearch.md +52 -0
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Flance.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Frag.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Freact.md +89 -1
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +42 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +92 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +67 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +201 -1
- package/.docs/organized/changelogs/create-mastra.md +201 -1
- package/.docs/organized/changelogs/mastra.md +201 -1
- package/.docs/organized/code-examples/agui.md +1 -0
- package/.docs/organized/code-examples/ai-sdk-v5.md +1 -0
- package/.docs/organized/code-examples/mcp-server-adapters.md +721 -0
- package/.docs/organized/code-examples/memory-with-processors.md +1 -1
- package/.docs/organized/code-examples/quick-start.md +1 -1
- package/.docs/organized/code-examples/server-app-access.md +342 -0
- package/.docs/raw/agents/adding-voice.mdx +7 -10
- package/.docs/raw/agents/agent-approval.mdx +189 -0
- package/.docs/raw/agents/guardrails.mdx +26 -23
- package/.docs/raw/agents/networks.mdx +2 -2
- package/.docs/raw/agents/overview.mdx +27 -62
- package/.docs/raw/agents/processors.mdx +279 -0
- package/.docs/raw/agents/using-tools.mdx +4 -5
- package/.docs/raw/course/01-first-agent/05-running-playground.md +5 -5
- package/.docs/raw/course/01-first-agent/09-testing-your-agent.md +3 -3
- package/.docs/raw/course/01-first-agent/13-testing-your-tool.md +3 -3
- package/.docs/raw/course/01-first-agent/17-testing-memory.md +2 -2
- package/.docs/raw/course/04-workflows/07-using-playground.md +1 -1
- package/.docs/raw/deployment/building-mastra.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/index.mdx +20 -27
- package/.docs/raw/deployment/cloud-providers/netlify-deployer.mdx +44 -13
- package/.docs/raw/deployment/mastra-cloud/observability.mdx +19 -17
- package/.docs/raw/deployment/mastra-cloud/setting-up.mdx +1 -1
- package/.docs/raw/deployment/overview.mdx +2 -2
- package/.docs/raw/deployment/web-framework.mdx +5 -5
- package/.docs/raw/evals/custom-scorers.mdx +3 -5
- package/.docs/raw/evals/overview.mdx +2 -3
- package/.docs/raw/evals/running-in-ci.mdx +0 -2
- package/.docs/raw/{guides/guide → getting-started}/manual-install.mdx +2 -2
- package/.docs/raw/getting-started/project-structure.mdx +1 -1
- package/.docs/raw/getting-started/start.mdx +72 -0
- package/.docs/raw/getting-started/studio.mdx +1 -1
- package/.docs/raw/{frameworks/agentic-uis/ai-sdk.mdx → guides/build-your-ui/ai-sdk-ui.mdx} +113 -11
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/astro.mdx +23 -25
- package/.docs/raw/{frameworks/servers → guides/getting-started}/express.mdx +3 -4
- package/.docs/raw/guides/{quickstarts/nextjs.mdx → getting-started/next-js.mdx} +11 -11
- package/.docs/raw/guides/{quickstarts/standalone-server.mdx → getting-started/quickstart.mdx} +7 -7
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/sveltekit.mdx +23 -25
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/vite-react.mdx +7 -7
- package/.docs/raw/guides/guide/ai-recruiter.mdx +2 -3
- package/.docs/raw/guides/guide/chef-michel.mdx +2 -3
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +2 -2
- package/.docs/raw/guides/guide/research-assistant.mdx +7 -8
- package/.docs/raw/guides/guide/stock-agent.mdx +4 -6
- package/.docs/raw/guides/guide/web-search.mdx +12 -10
- package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +421 -0
- package/.docs/raw/guides/index.mdx +3 -35
- package/.docs/raw/guides/migrations/agentnetwork.mdx +4 -4
- package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +1 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +40 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +5 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +51 -0
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +2 -2
- package/.docs/raw/index.mdx +2 -2
- package/.docs/raw/mcp/overview.mdx +3 -5
- package/.docs/raw/memory/memory-processors.mdx +264 -79
- package/.docs/raw/memory/semantic-recall.mdx +7 -7
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +2 -4
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +2 -4
- package/.docs/raw/memory/storage/memory-with-pg.mdx +2 -4
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +2 -4
- package/.docs/raw/memory/threads-and-resources.mdx +3 -3
- package/.docs/raw/memory/working-memory.mdx +14 -7
- package/.docs/raw/{logging.mdx → observability/logging.mdx} +1 -1
- package/.docs/raw/observability/overview.mdx +2 -3
- package/.docs/raw/observability/tracing/bridges/otel.mdx +176 -0
- package/.docs/raw/observability/tracing/exporters/arize.mdx +17 -0
- package/.docs/raw/observability/tracing/exporters/braintrust.mdx +19 -0
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +20 -0
- package/.docs/raw/observability/tracing/exporters/langsmith.mdx +12 -0
- package/.docs/raw/observability/tracing/exporters/otel.mdx +25 -5
- package/.docs/raw/observability/tracing/exporters/posthog.mdx +107 -0
- package/.docs/raw/observability/tracing/overview.mdx +74 -8
- package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +0 -1
- package/.docs/raw/rag/chunking-and-embedding.mdx +16 -17
- package/.docs/raw/rag/overview.mdx +3 -2
- package/.docs/raw/rag/retrieval.mdx +43 -38
- package/.docs/raw/rag/vector-databases.mdx +93 -2
- package/.docs/raw/reference/agents/agent.mdx +7 -10
- package/.docs/raw/reference/agents/generate.mdx +55 -6
- package/.docs/raw/reference/agents/generateLegacy.mdx +2 -2
- package/.docs/raw/reference/agents/getLLM.mdx +1 -1
- package/.docs/raw/reference/agents/network.mdx +46 -3
- package/.docs/raw/reference/cli/mastra.mdx +2 -1
- package/.docs/raw/reference/client-js/agents.mdx +3 -3
- package/.docs/raw/reference/client-js/memory.mdx +43 -0
- package/.docs/raw/reference/client-js/workflows.mdx +92 -63
- package/.docs/raw/reference/core/getLogger.mdx +1 -1
- package/.docs/raw/reference/core/listLogs.mdx +1 -1
- package/.docs/raw/reference/core/listLogsByRunId.mdx +1 -1
- package/.docs/raw/reference/core/mastra-model-gateway.mdx +5 -19
- package/.docs/raw/reference/core/setLogger.mdx +1 -1
- package/.docs/raw/reference/core/setTelemetry.mdx +1 -1
- package/.docs/raw/reference/deployer/netlify.mdx +1 -2
- package/.docs/raw/reference/evals/answer-relevancy.mdx +28 -98
- package/.docs/raw/reference/evals/answer-similarity.mdx +12 -258
- package/.docs/raw/reference/evals/bias.mdx +29 -87
- package/.docs/raw/reference/evals/completeness.mdx +31 -90
- package/.docs/raw/reference/evals/content-similarity.mdx +28 -88
- package/.docs/raw/reference/evals/context-precision.mdx +28 -130
- package/.docs/raw/reference/evals/context-relevance.mdx +11 -11
- package/.docs/raw/reference/evals/faithfulness.mdx +28 -101
- package/.docs/raw/reference/evals/hallucination.mdx +28 -103
- package/.docs/raw/reference/evals/keyword-coverage.mdx +28 -107
- package/.docs/raw/reference/evals/noise-sensitivity.mdx +11 -11
- package/.docs/raw/reference/evals/prompt-alignment.mdx +15 -15
- package/.docs/raw/reference/evals/scorer-utils.mdx +362 -0
- package/.docs/raw/reference/evals/textual-difference.mdx +27 -100
- package/.docs/raw/reference/evals/tone-consistency.mdx +25 -98
- package/.docs/raw/reference/evals/tool-call-accuracy.mdx +7 -7
- package/.docs/raw/reference/evals/toxicity.mdx +29 -92
- package/.docs/raw/reference/index.mdx +1 -0
- package/.docs/raw/reference/memory/memory-class.mdx +5 -7
- package/.docs/raw/reference/observability/tracing/bridges/otel.mdx +150 -0
- package/.docs/raw/reference/observability/tracing/configuration.mdx +0 -4
- package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +4 -0
- package/.docs/raw/reference/observability/tracing/exporters/langsmith.mdx +17 -1
- package/.docs/raw/reference/observability/tracing/exporters/otel.mdx +6 -0
- package/.docs/raw/reference/observability/tracing/exporters/posthog.mdx +132 -0
- package/.docs/raw/reference/observability/tracing/instances.mdx +0 -4
- package/.docs/raw/reference/observability/tracing/interfaces.mdx +29 -4
- package/.docs/raw/reference/observability/tracing/spans.mdx +0 -4
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +1 -1
- package/.docs/raw/reference/processors/language-detector.mdx +10 -3
- package/.docs/raw/reference/processors/message-history-processor.mdx +131 -0
- package/.docs/raw/reference/processors/moderation-processor.mdx +12 -5
- package/.docs/raw/reference/processors/pii-detector.mdx +12 -5
- package/.docs/raw/reference/processors/processor-interface.mdx +502 -0
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +10 -3
- package/.docs/raw/reference/processors/semantic-recall-processor.mdx +197 -0
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +3 -4
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +2 -2
- package/.docs/raw/reference/processors/tool-call-filter.mdx +125 -0
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +1 -1
- package/.docs/raw/reference/processors/working-memory-processor.mdx +221 -0
- package/.docs/raw/reference/rag/embeddings.mdx +5 -5
- package/.docs/raw/reference/rag/rerank.mdx +1 -2
- package/.docs/raw/reference/rag/rerankWithScorer.mdx +0 -1
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +37 -0
- package/.docs/raw/reference/storage/convex.mdx +164 -0
- package/.docs/raw/reference/storage/lance.mdx +33 -0
- package/.docs/raw/reference/storage/libsql.mdx +37 -0
- package/.docs/raw/reference/storage/mongodb.mdx +39 -0
- package/.docs/raw/reference/storage/mssql.mdx +37 -0
- package/.docs/raw/reference/storage/postgresql.mdx +37 -0
- package/.docs/raw/reference/streaming/ChunkType.mdx +1 -1
- package/.docs/raw/reference/streaming/agents/stream.mdx +64 -2
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +7 -9
- package/.docs/raw/reference/streaming/workflows/{resumeStreamVNext.mdx → resumeStream.mdx} +51 -11
- package/.docs/raw/reference/streaming/workflows/stream.mdx +83 -24
- package/.docs/raw/reference/templates/overview.mdx +1 -4
- package/.docs/raw/reference/tools/client.mdx +1 -2
- package/.docs/raw/reference/tools/create-tool.mdx +132 -0
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +5 -5
- package/.docs/raw/reference/tools/mcp-client.mdx +76 -21
- package/.docs/raw/reference/tools/mcp-server.mdx +1 -2
- package/.docs/raw/reference/tools/vector-query-tool.mdx +14 -15
- package/.docs/raw/reference/vectors/chroma.mdx +81 -1
- package/.docs/raw/reference/vectors/convex.mdx +429 -0
- package/.docs/raw/reference/vectors/couchbase.mdx +24 -17
- package/.docs/raw/reference/vectors/duckdb.mdx +462 -0
- package/.docs/raw/reference/vectors/elasticsearch.mdx +310 -0
- package/.docs/raw/reference/vectors/lance.mdx +38 -22
- package/.docs/raw/reference/vectors/libsql.mdx +35 -2
- package/.docs/raw/reference/vectors/mongodb.mdx +35 -2
- package/.docs/raw/reference/vectors/opensearch.mdx +37 -16
- package/.docs/raw/reference/vectors/pg.mdx +43 -36
- package/.docs/raw/reference/vectors/pinecone.mdx +48 -1
- package/.docs/raw/reference/vectors/qdrant.mdx +36 -1
- package/.docs/raw/reference/vectors/turbopuffer.mdx +74 -0
- package/.docs/raw/reference/voice/google.mdx +159 -20
- package/.docs/raw/reference/voice/openai-realtime.mdx +2 -2
- package/.docs/raw/reference/voice/voice.addInstructions.mdx +2 -3
- package/.docs/raw/reference/voice/voice.addTools.mdx +1 -1
- package/.docs/raw/reference/voice/voice.answer.mdx +1 -1
- package/.docs/raw/reference/voice/voice.close.mdx +1 -1
- package/.docs/raw/reference/voice/voice.connect.mdx +1 -1
- package/.docs/raw/reference/voice/voice.off.mdx +1 -1
- package/.docs/raw/reference/voice/voice.on.mdx +1 -1
- package/.docs/raw/reference/voice/voice.send.mdx +1 -1
- package/.docs/raw/reference/voice/voice.updateConfig.mdx +1 -1
- package/.docs/raw/reference/workflows/run-methods/restart.mdx +142 -0
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +44 -0
- package/.docs/raw/reference/workflows/run-methods/start.mdx +44 -0
- package/.docs/raw/reference/workflows/run.mdx +13 -5
- package/.docs/raw/reference/workflows/step.mdx +13 -0
- package/.docs/raw/reference/workflows/workflow.mdx +19 -0
- package/.docs/raw/server-db/mastra-client.mdx +1 -2
- package/.docs/raw/server-db/mastra-server.mdx +30 -1
- package/.docs/raw/server-db/request-context.mdx +0 -1
- package/.docs/raw/server-db/storage.mdx +11 -0
- package/.docs/raw/streaming/overview.mdx +26 -15
- package/.docs/raw/streaming/tool-streaming.mdx +48 -5
- package/.docs/raw/streaming/workflow-streaming.mdx +5 -11
- package/.docs/raw/tools-mcp/advanced-usage.mdx +1 -2
- package/.docs/raw/tools-mcp/mcp-overview.mdx +3 -5
- package/.docs/raw/voice/overview.mdx +21 -41
- package/.docs/raw/voice/speech-to-speech.mdx +4 -4
- package/.docs/raw/voice/speech-to-text.mdx +1 -2
- package/.docs/raw/voice/text-to-speech.mdx +1 -2
- package/.docs/raw/workflows/control-flow.mdx +180 -0
- package/.docs/raw/workflows/error-handling.mdx +1 -0
- package/.docs/raw/workflows/human-in-the-loop.mdx +4 -4
- package/.docs/raw/workflows/overview.mdx +56 -44
- package/.docs/raw/workflows/snapshots.mdx +1 -0
- package/.docs/raw/workflows/suspend-and-resume.mdx +85 -16
- package/.docs/raw/workflows/time-travel.mdx +313 -0
- package/.docs/raw/workflows/workflow-state.mdx +191 -0
- package/CHANGELOG.md +18 -0
- package/dist/{chunk-5NJC7NRO.js → chunk-4CM2BQNP.js} +24 -4
- package/dist/prepare-docs/package-changes.d.ts.map +1 -1
- package/dist/prepare-docs/prepare.js +1 -1
- package/dist/stdio.js +1 -1
- package/package.json +7 -7
- package/.docs/raw/agents/human-in-the-loop-with-tools.mdx +0 -90
- package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +0 -102
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +0 -179
- package/.docs/raw/frameworks/web-frameworks/next-js.mdx +0 -379
- package/.docs/raw/getting-started/quickstart.mdx +0 -27
- package/.docs/raw/getting-started/templates.mdx +0 -73
- package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +0 -47
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +0 -153
- /package/.docs/raw/{frameworks/agentic-uis → guides/build-your-ui}/assistant-ui.mdx +0 -0
- /package/.docs/raw/{frameworks/agentic-uis → guides/build-your-ui}/copilotkit.mdx +0 -0
|
@@ -95,6 +95,43 @@ The storage implementation handles schema creation and updates automatically. It
|
|
|
95
95
|
- `messages`: Stores individual messages
|
|
96
96
|
- `metadata`: Stores additional metadata for threads and messages
|
|
97
97
|
|
|
98
|
+
### Initialization
|
|
99
|
+
|
|
100
|
+
When you pass storage to the Mastra class, `init()` is called automatically before any storage operation:
|
|
101
|
+
|
|
102
|
+
```typescript copy
|
|
103
|
+
import { Mastra } from "@mastra/core";
|
|
104
|
+
import { D1Store } from "@mastra/cloudflare-d1";
|
|
105
|
+
|
|
106
|
+
const storage = new D1Store({
|
|
107
|
+
binding: D1Database,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const mastra = new Mastra({
|
|
111
|
+
storage, // init() is called automatically
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
If you're using storage directly without Mastra, you must call `init()` explicitly to create the tables:
|
|
116
|
+
|
|
117
|
+
```typescript copy
|
|
118
|
+
import { D1Store } from "@mastra/cloudflare-d1";
|
|
119
|
+
|
|
120
|
+
const storage = new D1Store({
|
|
121
|
+
binding: D1Database,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Required when using storage directly
|
|
125
|
+
await storage.init();
|
|
126
|
+
|
|
127
|
+
// Now you can use the storage
|
|
128
|
+
await storage.getThread({ threadId: "..." });
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
:::warning
|
|
132
|
+
If `init()` is not called, tables won't be created and storage operations will fail silently or throw errors.
|
|
133
|
+
:::
|
|
134
|
+
|
|
98
135
|
### Transactions & Consistency
|
|
99
136
|
|
|
100
137
|
Cloudflare D1 provides transactional guarantees for single-row operations. This means that multiple operations can be executed as a single, all-or-nothing unit of work.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: Convex Storage | Storage"
|
|
3
|
+
description: Documentation for the Convex storage implementation in Mastra.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Convex Storage
|
|
7
|
+
|
|
8
|
+
The Convex storage implementation provides a serverless storage solution using [Convex](https://convex.dev), a full-stack TypeScript development platform with real-time sync and automatic caching.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash copy
|
|
13
|
+
npm install @mastra/convex@beta
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Convex Setup
|
|
17
|
+
|
|
18
|
+
Before using `ConvexStore`, you need to set up the Convex schema and storage handler in your Convex project.
|
|
19
|
+
|
|
20
|
+
### 1. Set up Convex Schema
|
|
21
|
+
|
|
22
|
+
In `convex/schema.ts`:
|
|
23
|
+
|
|
24
|
+
```typescript copy
|
|
25
|
+
import { defineSchema } from 'convex/server';
|
|
26
|
+
import {
|
|
27
|
+
mastraThreadsTable,
|
|
28
|
+
mastraMessagesTable,
|
|
29
|
+
mastraResourcesTable,
|
|
30
|
+
mastraWorkflowSnapshotsTable,
|
|
31
|
+
mastraScoresTable,
|
|
32
|
+
mastraVectorIndexesTable,
|
|
33
|
+
mastraVectorsTable,
|
|
34
|
+
mastraDocumentsTable,
|
|
35
|
+
} from '@mastra/convex/server';
|
|
36
|
+
|
|
37
|
+
export default defineSchema({
|
|
38
|
+
mastra_threads: mastraThreadsTable,
|
|
39
|
+
mastra_messages: mastraMessagesTable,
|
|
40
|
+
mastra_resources: mastraResourcesTable,
|
|
41
|
+
mastra_workflow_snapshots: mastraWorkflowSnapshotsTable,
|
|
42
|
+
mastra_scorers: mastraScoresTable,
|
|
43
|
+
mastra_vector_indexes: mastraVectorIndexesTable,
|
|
44
|
+
mastra_vectors: mastraVectorsTable,
|
|
45
|
+
mastra_documents: mastraDocumentsTable,
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. Create the Storage Handler
|
|
50
|
+
|
|
51
|
+
In `convex/mastra/storage.ts`:
|
|
52
|
+
|
|
53
|
+
```typescript copy
|
|
54
|
+
import { mastraStorage } from '@mastra/convex/server';
|
|
55
|
+
|
|
56
|
+
export const handle = mastraStorage;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. Deploy to Convex
|
|
60
|
+
|
|
61
|
+
```bash copy
|
|
62
|
+
npx convex dev
|
|
63
|
+
# or for production
|
|
64
|
+
npx convex deploy
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
```typescript copy showLineNumbers
|
|
70
|
+
import { ConvexStore } from "@mastra/convex";
|
|
71
|
+
|
|
72
|
+
const storage = new ConvexStore({
|
|
73
|
+
id: 'convex-storage',
|
|
74
|
+
deploymentUrl: process.env.CONVEX_URL!,
|
|
75
|
+
adminAuthToken: process.env.CONVEX_ADMIN_KEY!,
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Parameters
|
|
80
|
+
|
|
81
|
+
<PropertiesTable
|
|
82
|
+
content={[
|
|
83
|
+
{
|
|
84
|
+
name: "deploymentUrl",
|
|
85
|
+
type: "string",
|
|
86
|
+
description:
|
|
87
|
+
"Convex deployment URL (e.g., https://your-project.convex.cloud)",
|
|
88
|
+
isOptional: false,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "adminAuthToken",
|
|
92
|
+
type: "string",
|
|
93
|
+
description:
|
|
94
|
+
"Convex admin authentication token for backend access",
|
|
95
|
+
isOptional: false,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "storageFunction",
|
|
99
|
+
type: "string",
|
|
100
|
+
description:
|
|
101
|
+
"Path to the storage mutation function (default: 'mastra/storage:handle')",
|
|
102
|
+
isOptional: true,
|
|
103
|
+
defaultValue: "mastra/storage:handle",
|
|
104
|
+
},
|
|
105
|
+
]}
|
|
106
|
+
/>
|
|
107
|
+
|
|
108
|
+
## Constructor Examples
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { ConvexStore } from "@mastra/convex";
|
|
112
|
+
|
|
113
|
+
// Basic configuration
|
|
114
|
+
const store = new ConvexStore({
|
|
115
|
+
id: 'convex-storage',
|
|
116
|
+
deploymentUrl: "https://your-project.convex.cloud",
|
|
117
|
+
adminAuthToken: "your-admin-token",
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// With custom storage function path
|
|
121
|
+
const storeCustom = new ConvexStore({
|
|
122
|
+
id: 'convex-storage',
|
|
123
|
+
deploymentUrl: "https://your-project.convex.cloud",
|
|
124
|
+
adminAuthToken: "your-admin-token",
|
|
125
|
+
storageFunction: "custom/path:handler",
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Additional Notes
|
|
130
|
+
|
|
131
|
+
### Schema Management
|
|
132
|
+
|
|
133
|
+
The storage implementation uses typed Convex tables for each Mastra domain:
|
|
134
|
+
|
|
135
|
+
| Domain | Convex Table | Purpose |
|
|
136
|
+
| -------------- | --------------------------- | -------------------- |
|
|
137
|
+
| Threads | `mastra_threads` | Conversation threads |
|
|
138
|
+
| Messages | `mastra_messages` | Chat messages |
|
|
139
|
+
| Resources | `mastra_resources` | User working memory |
|
|
140
|
+
| Workflows | `mastra_workflow_snapshots` | Workflow state |
|
|
141
|
+
| Scorers | `mastra_scorers` | Evaluation data |
|
|
142
|
+
| Fallback | `mastra_documents` | Unknown tables |
|
|
143
|
+
|
|
144
|
+
### Architecture
|
|
145
|
+
|
|
146
|
+
All typed tables include:
|
|
147
|
+
|
|
148
|
+
- An `id` field for Mastra's record ID (distinct from Convex's auto-generated `_id`)
|
|
149
|
+
- A `by_record_id` index for efficient lookups by Mastra ID
|
|
150
|
+
|
|
151
|
+
This design ensures compatibility with Mastra's storage contract while leveraging Convex's automatic indexing and real-time capabilities.
|
|
152
|
+
|
|
153
|
+
### Environment Variables
|
|
154
|
+
|
|
155
|
+
Set these environment variables for your deployment:
|
|
156
|
+
|
|
157
|
+
- `CONVEX_URL` – Your Convex deployment URL
|
|
158
|
+
- `CONVEX_ADMIN_KEY` – Admin authentication token (get from Convex dashboard)
|
|
159
|
+
|
|
160
|
+
## Related
|
|
161
|
+
|
|
162
|
+
- [Convex Vector Store](../vectors/convex)
|
|
163
|
+
- [Convex Documentation](https://docs.convex.dev/)
|
|
164
|
+
|
|
@@ -73,6 +73,39 @@ The LanceStorage implementation automatically handles schema creation and update
|
|
|
73
73
|
- `jsonb`, `json` → Utf8 (serialized)
|
|
74
74
|
- `binary` → Binary
|
|
75
75
|
|
|
76
|
+
### Initialization
|
|
77
|
+
|
|
78
|
+
When you pass storage to the Mastra class, `init()` is called automatically before any storage operation:
|
|
79
|
+
|
|
80
|
+
```typescript copy
|
|
81
|
+
import { Mastra } from "@mastra/core";
|
|
82
|
+
import { LanceStorage } from "@mastra/lance";
|
|
83
|
+
|
|
84
|
+
const storage = await LanceStorage.create("my-storage", "/path/to/db");
|
|
85
|
+
|
|
86
|
+
const mastra = new Mastra({
|
|
87
|
+
storage, // init() is called automatically
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
If you're using storage directly without Mastra, you must call `init()` explicitly to create the tables:
|
|
92
|
+
|
|
93
|
+
```typescript copy
|
|
94
|
+
import { LanceStorage } from "@mastra/lance";
|
|
95
|
+
|
|
96
|
+
const storage = await LanceStorage.create("my-storage", "/path/to/db");
|
|
97
|
+
|
|
98
|
+
// Required when using storage directly
|
|
99
|
+
await storage.init();
|
|
100
|
+
|
|
101
|
+
// Now you can use the storage
|
|
102
|
+
await storage.getThread({ threadId: "..." });
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
:::warning
|
|
106
|
+
If `init()` is not called, tables won't be created and storage operations will fail silently or throw errors.
|
|
107
|
+
:::
|
|
108
|
+
|
|
76
109
|
### Deployment Options
|
|
77
110
|
|
|
78
111
|
LanceDB storage can be configured for different deployment scenarios:
|
|
@@ -74,3 +74,40 @@ The storage implementation handles schema creation and updates automatically. It
|
|
|
74
74
|
- `mastra_traces`: Stores telemetry and tracing data
|
|
75
75
|
- `mastra_scorers`: Stores scoring and evaluation data
|
|
76
76
|
- `mastra_resources`: Stores resource working memory data
|
|
77
|
+
|
|
78
|
+
### Initialization
|
|
79
|
+
|
|
80
|
+
When you pass storage to the Mastra class, `init()` is called automatically before any storage operation:
|
|
81
|
+
|
|
82
|
+
```typescript copy
|
|
83
|
+
import { Mastra } from "@mastra/core";
|
|
84
|
+
import { LibSQLStore } from "@mastra/libsql";
|
|
85
|
+
|
|
86
|
+
const storage = new LibSQLStore({
|
|
87
|
+
url: "file:./storage.db",
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const mastra = new Mastra({
|
|
91
|
+
storage, // init() is called automatically
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
If you're using storage directly without Mastra, you must call `init()` explicitly to create the tables:
|
|
96
|
+
|
|
97
|
+
```typescript copy
|
|
98
|
+
import { LibSQLStore } from "@mastra/libsql";
|
|
99
|
+
|
|
100
|
+
const storage = new LibSQLStore({
|
|
101
|
+
url: "file:./storage.db",
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Required when using storage directly
|
|
105
|
+
await storage.init();
|
|
106
|
+
|
|
107
|
+
// Now you can use the storage
|
|
108
|
+
await storage.getThread({ threadId: "..." });
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
:::warning
|
|
112
|
+
If `init()` is not called, tables won't be created and storage operations will fail silently or throw errors.
|
|
113
|
+
:::
|
|
@@ -93,6 +93,45 @@ The storage implementation handles collection creation and management automatica
|
|
|
93
93
|
- `mastra_scorers`: Stores scoring and evaluation data
|
|
94
94
|
- `mastra_resources`: Stores resource working memory data
|
|
95
95
|
|
|
96
|
+
### Initialization
|
|
97
|
+
|
|
98
|
+
When you pass storage to the Mastra class, `init()` is called automatically before any storage operation:
|
|
99
|
+
|
|
100
|
+
```typescript copy
|
|
101
|
+
import { Mastra } from "@mastra/core";
|
|
102
|
+
import { MongoDBStore } from "@mastra/mongodb";
|
|
103
|
+
|
|
104
|
+
const storage = new MongoDBStore({
|
|
105
|
+
url: process.env.MONGODB_URL,
|
|
106
|
+
dbName: process.env.MONGODB_DATABASE,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const mastra = new Mastra({
|
|
110
|
+
storage, // init() is called automatically
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If you're using storage directly without Mastra, you must call `init()` explicitly to create the collections:
|
|
115
|
+
|
|
116
|
+
```typescript copy
|
|
117
|
+
import { MongoDBStore } from "@mastra/mongodb";
|
|
118
|
+
|
|
119
|
+
const storage = new MongoDBStore({
|
|
120
|
+
url: process.env.MONGODB_URL,
|
|
121
|
+
dbName: process.env.MONGODB_DATABASE,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Required when using storage directly
|
|
125
|
+
await storage.init();
|
|
126
|
+
|
|
127
|
+
// Now you can use the storage
|
|
128
|
+
await storage.getThread({ threadId: "..." });
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
:::warning
|
|
132
|
+
If `init()` is not called, collections won't be created and storage operations will fail silently or throw errors.
|
|
133
|
+
:::
|
|
134
|
+
|
|
96
135
|
## Vector Search Capabilities
|
|
97
136
|
|
|
98
137
|
MongoDB storage includes built-in vector search capabilities for AI applications:
|
|
@@ -101,6 +101,43 @@ The storage implementation handles schema creation and updates automatically. It
|
|
|
101
101
|
- `mastra_scorers`: Stores scoring and evaluation data
|
|
102
102
|
- `mastra_resources`: Stores resource working memory data
|
|
103
103
|
|
|
104
|
+
### Initialization
|
|
105
|
+
|
|
106
|
+
When you pass storage to the Mastra class, `init()` is called automatically before any storage operation:
|
|
107
|
+
|
|
108
|
+
```typescript copy
|
|
109
|
+
import { Mastra } from "@mastra/core";
|
|
110
|
+
import { MSSQLStore } from "@mastra/mssql";
|
|
111
|
+
|
|
112
|
+
const storage = new MSSQLStore({
|
|
113
|
+
connectionString: process.env.DATABASE_URL,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const mastra = new Mastra({
|
|
117
|
+
storage, // init() is called automatically
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
If you're using storage directly without Mastra, you must call `init()` explicitly to create the tables:
|
|
122
|
+
|
|
123
|
+
```typescript copy
|
|
124
|
+
import { MSSQLStore } from "@mastra/mssql";
|
|
125
|
+
|
|
126
|
+
const storage = new MSSQLStore({
|
|
127
|
+
connectionString: process.env.DATABASE_URL,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Required when using storage directly
|
|
131
|
+
await storage.init();
|
|
132
|
+
|
|
133
|
+
// Now you can use the storage
|
|
134
|
+
await storage.getThread({ threadId: "..." });
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
:::warning
|
|
138
|
+
If `init()` is not called, tables won't be created and storage operations will fail silently or throw errors.
|
|
139
|
+
:::
|
|
140
|
+
|
|
104
141
|
### Direct Database and Pool Access
|
|
105
142
|
|
|
106
143
|
`MSSQLStore` exposes the mssql connection pool as public fields:
|
|
@@ -101,6 +101,43 @@ The storage implementation handles schema creation and updates automatically. It
|
|
|
101
101
|
- `mastra_scorers`: Stores scoring and evaluation data
|
|
102
102
|
- `mastra_resources`: Stores resource working memory data
|
|
103
103
|
|
|
104
|
+
### Initialization
|
|
105
|
+
|
|
106
|
+
When you pass storage to the Mastra class, `init()` is called automatically before any storage operation:
|
|
107
|
+
|
|
108
|
+
```typescript copy
|
|
109
|
+
import { Mastra } from "@mastra/core";
|
|
110
|
+
import { PostgresStore } from "@mastra/pg";
|
|
111
|
+
|
|
112
|
+
const storage = new PostgresStore({
|
|
113
|
+
connectionString: process.env.DATABASE_URL,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const mastra = new Mastra({
|
|
117
|
+
storage, // init() is called automatically
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
If you're using storage directly without Mastra, you must call `init()` explicitly to create the tables:
|
|
122
|
+
|
|
123
|
+
```typescript copy
|
|
124
|
+
import { PostgresStore } from "@mastra/pg";
|
|
125
|
+
|
|
126
|
+
const storage = new PostgresStore({
|
|
127
|
+
connectionString: process.env.DATABASE_URL,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Required when using storage directly
|
|
131
|
+
await storage.init();
|
|
132
|
+
|
|
133
|
+
// Now you can use the storage
|
|
134
|
+
await storage.getThread({ threadId: "..." });
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
:::warning
|
|
138
|
+
If `init()` is not called, tables won't be created and storage operations will fail silently or throw errors.
|
|
139
|
+
:::
|
|
140
|
+
|
|
104
141
|
### Direct Database and Pool Access
|
|
105
142
|
|
|
106
143
|
`PostgresStore` exposes both the underlying database object and the pg-promise instance as public fields:
|
|
@@ -1325,4 +1325,4 @@ for await (const chunk of stream.fullStream) {
|
|
|
1325
1325
|
|
|
1326
1326
|
- [.stream()](./agents/stream) - Method that returns streams emitting these chunks
|
|
1327
1327
|
- [MastraModelOutput](./agents/MastraModelOutput) - The stream object that emits these chunks
|
|
1328
|
-
- [workflow.
|
|
1328
|
+
- [workflow.stream()](./workflows/stream) - Method that returns streams emitting these chunks for workflows
|
|
@@ -245,6 +245,17 @@ const aiSdkStream = await agent.stream("message for agent", {
|
|
|
245
245
|
},
|
|
246
246
|
],
|
|
247
247
|
},
|
|
248
|
+
{
|
|
249
|
+
parameters: [
|
|
250
|
+
{
|
|
251
|
+
name: "providerOptions",
|
|
252
|
+
type: "ProviderOptions",
|
|
253
|
+
isOptional: true,
|
|
254
|
+
description:
|
|
255
|
+
"Provider-specific options passed to the internal structuring agent. Use this to control model behavior like reasoning effort for thinking models (e.g., `{ openai: { reasoningEffort: 'low' } }`).",
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
},
|
|
248
259
|
],
|
|
249
260
|
},
|
|
250
261
|
{
|
|
@@ -254,6 +265,13 @@ const aiSdkStream = await agent.stream("message for agent", {
|
|
|
254
265
|
description:
|
|
255
266
|
"Overrides the output processors set on the agent. Output processors that can modify or validate messages from the agent before they are returned to the user. Must implement either (or both) of the `processOutputResult` and `processOutputStream` functions.",
|
|
256
267
|
},
|
|
268
|
+
{
|
|
269
|
+
name: "includeRawChunks",
|
|
270
|
+
type: "boolean",
|
|
271
|
+
isOptional: true,
|
|
272
|
+
description:
|
|
273
|
+
"Whether to include raw chunks in the stream output (not available on all model providers).",
|
|
274
|
+
},
|
|
257
275
|
{
|
|
258
276
|
name: "inputProcessors",
|
|
259
277
|
type: "Processor[]",
|
|
@@ -577,6 +595,50 @@ const aiSdkStream = await agent.stream("message for agent", {
|
|
|
577
595
|
},
|
|
578
596
|
],
|
|
579
597
|
},
|
|
598
|
+
{
|
|
599
|
+
parameters: [
|
|
600
|
+
{
|
|
601
|
+
name: "requestContextKeys",
|
|
602
|
+
type: "string[]",
|
|
603
|
+
isOptional: true,
|
|
604
|
+
description:
|
|
605
|
+
"Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').",
|
|
606
|
+
},
|
|
607
|
+
],
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
parameters: [
|
|
611
|
+
{
|
|
612
|
+
name: "traceId",
|
|
613
|
+
type: "string",
|
|
614
|
+
isOptional: true,
|
|
615
|
+
description:
|
|
616
|
+
"Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.",
|
|
617
|
+
},
|
|
618
|
+
],
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
parameters: [
|
|
622
|
+
{
|
|
623
|
+
name: "parentSpanId",
|
|
624
|
+
type: "string",
|
|
625
|
+
isOptional: true,
|
|
626
|
+
description:
|
|
627
|
+
"Parent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.",
|
|
628
|
+
},
|
|
629
|
+
],
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
parameters: [
|
|
633
|
+
{
|
|
634
|
+
name: "tags",
|
|
635
|
+
type: "string[]",
|
|
636
|
+
isOptional: true,
|
|
637
|
+
description:
|
|
638
|
+
"Tags to apply to this trace. String labels for categorizing and filtering traces.",
|
|
639
|
+
},
|
|
640
|
+
],
|
|
641
|
+
},
|
|
580
642
|
],
|
|
581
643
|
},
|
|
582
644
|
]}
|
|
@@ -701,12 +763,12 @@ await agent.stream("message for agent", {
|
|
|
701
763
|
sentiment: z.enum(["positive", "negative", "neutral"]),
|
|
702
764
|
confidence: z.number(),
|
|
703
765
|
}),
|
|
704
|
-
model: "openai/gpt-
|
|
766
|
+
model: "openai/gpt-5.1",
|
|
705
767
|
errorStrategy: "warn",
|
|
706
768
|
},
|
|
707
769
|
// Output processors for streaming response validation
|
|
708
770
|
outputProcessors: [
|
|
709
|
-
new ModerationProcessor({ model: "openai/gpt-
|
|
771
|
+
new ModerationProcessor({ model: "openrouter/openai/gpt-oss-safeguard-20b" }),
|
|
710
772
|
new BatchPartsProcessor({ maxBatchSize: 3, maxWaitTime: 100 }),
|
|
711
773
|
],
|
|
712
774
|
});
|
|
@@ -18,7 +18,7 @@ run.stream({
|
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const stream = await run.observeStream();
|
|
22
22
|
|
|
23
23
|
for await (const chunk of stream) {
|
|
24
24
|
console.log(chunk);
|
|
@@ -33,17 +33,15 @@ for await (const chunk of stream) {
|
|
|
33
33
|
|
|
34
34
|
The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
|
|
35
35
|
|
|
36
|
-
- **`start`**: Workflow execution begins
|
|
37
|
-
- **`step-start`**: A step begins execution
|
|
38
|
-
- **`
|
|
39
|
-
- **`
|
|
40
|
-
- **`
|
|
41
|
-
- **`step-result`**: A step completes with results
|
|
42
|
-
- **`step-finish`**: A step finishes execution
|
|
43
|
-
- **`finish`**: Workflow execution completes
|
|
36
|
+
- **`workflow-start`**: Workflow execution begins
|
|
37
|
+
- **`workflow-step-start`**: A step begins execution
|
|
38
|
+
- **`workflow-step-output`**: Custom output from a step
|
|
39
|
+
- **`workflow-step-result`**: A step completes with results
|
|
40
|
+
- **`workflow-finish`**: Workflow execution completes with usage statistics
|
|
44
41
|
|
|
45
42
|
## Related
|
|
46
43
|
|
|
47
44
|
- [Workflows overview](/docs/v1/workflows/overview#running-workflows)
|
|
48
45
|
- [Workflow.createRun()](/reference/v1/workflows/workflow-methods/create-run)
|
|
49
46
|
- [Run.stream()](./stream)
|
|
47
|
+
- [Run.resumeStream()](./resumeStream)
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: Run.
|
|
3
|
-
description: Documentation for the `Run.
|
|
2
|
+
title: "Reference: Run.resumeStream() | Streaming"
|
|
3
|
+
description: Documentation for the `Run.resumeStream()` method in workflows, which enables real-time resumption and streaming of suspended workflow runs.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Run.
|
|
6
|
+
# Run.resumeStream()
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
This is an experimental API that may change in future versions. The `resumeStreamVNext()` method is part of the enhanced streaming system that will eventually replace the current streaming methods. Use with caution in production environments.
|
|
10
|
-
:::
|
|
11
|
-
|
|
12
|
-
The `.resumeStreamVNext()` method resumes a suspended workflow run with new data, allowing you to continue execution from a specific step and to observe the stream of events.
|
|
8
|
+
The `.resumeStream()` method resumes a suspended workflow run with new data, allowing you to continue execution from a specific step and to observe the stream of events.
|
|
13
9
|
|
|
14
10
|
## Usage example
|
|
15
11
|
|
|
16
12
|
```typescript showLineNumbers copy
|
|
17
13
|
const run = await workflow.createRun();
|
|
18
14
|
|
|
19
|
-
const stream = run.
|
|
15
|
+
const stream = run.stream({
|
|
20
16
|
inputData: {
|
|
21
17
|
value: "initial data",
|
|
22
18
|
},
|
|
@@ -25,7 +21,7 @@ const stream = run.streamVNext({
|
|
|
25
21
|
const result = await stream.result;
|
|
26
22
|
|
|
27
23
|
if (result!.status === "suspended") {
|
|
28
|
-
const resumedStream = await run.
|
|
24
|
+
const resumedStream = await run.resumeStream({
|
|
29
25
|
resumeData: {
|
|
30
26
|
value: "resume data",
|
|
31
27
|
},
|
|
@@ -72,6 +68,50 @@ if (result!.status === "suspended") {
|
|
|
72
68
|
},
|
|
73
69
|
],
|
|
74
70
|
},
|
|
71
|
+
{
|
|
72
|
+
parameters: [
|
|
73
|
+
{
|
|
74
|
+
name: "requestContextKeys",
|
|
75
|
+
type: "string[]",
|
|
76
|
+
isOptional: true,
|
|
77
|
+
description:
|
|
78
|
+
"Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').",
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
parameters: [
|
|
84
|
+
{
|
|
85
|
+
name: "traceId",
|
|
86
|
+
type: "string",
|
|
87
|
+
isOptional: true,
|
|
88
|
+
description:
|
|
89
|
+
"Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.",
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
parameters: [
|
|
95
|
+
{
|
|
96
|
+
name: "parentSpanId",
|
|
97
|
+
type: "string",
|
|
98
|
+
isOptional: true,
|
|
99
|
+
description:
|
|
100
|
+
"Parent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.",
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
parameters: [
|
|
106
|
+
{
|
|
107
|
+
name: "tags",
|
|
108
|
+
type: "string[]",
|
|
109
|
+
isOptional: true,
|
|
110
|
+
description:
|
|
111
|
+
"Tags to apply to this trace. String labels for categorizing and filtering traces.",
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
},
|
|
75
115
|
],
|
|
76
116
|
},
|
|
77
117
|
]}
|
|
@@ -119,4 +159,4 @@ The stream emits various event types during workflow execution. Each event has a
|
|
|
119
159
|
|
|
120
160
|
- [Workflows overview](/docs/v1/workflows/overview#running-workflows)
|
|
121
161
|
- [Workflow.createRun()](/reference/v1/workflows/workflow-methods/create-run)
|
|
122
|
-
- [Run.
|
|
162
|
+
- [Run.stream()](./stream)
|