@mastra/mcp-docs-server 1.1.7 → 1.1.8-alpha.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/docs/agents/agent-approval.md +61 -31
- package/.docs/docs/agents/supervisor-agents.md +1 -1
- package/.docs/docs/getting-started/manual-install.md +1 -1
- package/.docs/docs/index.md +68 -24
- package/.docs/docs/mastra-cloud/setup.md +1 -1
- package/.docs/docs/memory/observational-memory.md +9 -0
- package/.docs/docs/memory/semantic-recall.md +17 -1
- package/.docs/docs/workspace/skills.md +7 -5
- package/.docs/guides/deployment/aws-lambda.md +76 -165
- package/.docs/guides/deployment/azure-app-services.md +38 -61
- package/.docs/guides/deployment/cloudflare.md +1 -1
- package/.docs/guides/deployment/netlify.md +1 -1
- package/.docs/guides/deployment/vercel.md +1 -1
- package/.docs/models/gateways/netlify.md +5 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/anthropic.md +9 -9
- package/.docs/models/providers/deepseek.md +1 -1
- package/.docs/models/providers/google.md +11 -11
- package/.docs/models/providers/openai.md +19 -19
- package/.docs/models/providers/opencode.md +33 -33
- package/.docs/models/providers/xai.md +3 -3
- package/.docs/reference/agents/agent.md +20 -20
- package/.docs/reference/agents/generate.md +200 -66
- package/.docs/reference/agents/generateLegacy.md +77 -35
- package/.docs/reference/agents/getDefaultGenerateOptions.md +4 -6
- package/.docs/reference/agents/getDefaultOptions.md +4 -6
- package/.docs/reference/agents/getDefaultStreamOptions.md +4 -6
- package/.docs/reference/agents/getDescription.md +1 -1
- package/.docs/reference/agents/getInstructions.md +4 -6
- package/.docs/reference/agents/getLLM.md +6 -8
- package/.docs/reference/agents/getMemory.md +4 -6
- package/.docs/reference/agents/getModel.md +4 -6
- package/.docs/reference/agents/getTools.md +5 -7
- package/.docs/reference/agents/getVoice.md +4 -6
- package/.docs/reference/agents/listAgents.md +4 -6
- package/.docs/reference/agents/listScorers.md +4 -6
- package/.docs/reference/agents/listTools.md +4 -6
- package/.docs/reference/agents/listWorkflows.md +4 -6
- package/.docs/reference/agents/network.md +69 -23
- package/.docs/reference/ai-sdk/chat-route.md +7 -7
- package/.docs/reference/ai-sdk/handle-chat-stream.md +12 -12
- package/.docs/reference/ai-sdk/handle-network-stream.md +4 -4
- package/.docs/reference/ai-sdk/handle-workflow-stream.md +11 -11
- package/.docs/reference/ai-sdk/network-route.md +3 -3
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +9 -9
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +9 -9
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +5 -5
- package/.docs/reference/ai-sdk/with-mastra.md +12 -12
- package/.docs/reference/ai-sdk/workflow-route.md +3 -3
- package/.docs/reference/auth/auth0.md +6 -6
- package/.docs/reference/auth/better-auth.md +5 -5
- package/.docs/reference/auth/clerk.md +5 -5
- package/.docs/reference/auth/firebase.md +7 -7
- package/.docs/reference/auth/jwt.md +1 -1
- package/.docs/reference/auth/supabase.md +4 -4
- package/.docs/reference/auth/workos.md +6 -6
- package/.docs/reference/cli/create-mastra.md +14 -14
- package/.docs/reference/client-js/mastra-client.md +23 -23
- package/.docs/reference/client-js/workflows.md +3 -3
- package/.docs/reference/core/addGateway.md +2 -2
- package/.docs/reference/core/getAgent.md +2 -2
- package/.docs/reference/core/getAgentById.md +2 -2
- package/.docs/reference/core/getDeployer.md +1 -1
- package/.docs/reference/core/getGateway.md +2 -2
- package/.docs/reference/core/getGatewayById.md +2 -2
- package/.docs/reference/core/getLogger.md +1 -1
- package/.docs/reference/core/getMCPServer.md +2 -2
- package/.docs/reference/core/getMCPServerById.md +3 -3
- package/.docs/reference/core/getMemory.md +2 -2
- package/.docs/reference/core/getScorer.md +2 -2
- package/.docs/reference/core/getScorerById.md +2 -2
- package/.docs/reference/core/getServer.md +1 -1
- package/.docs/reference/core/getStorage.md +1 -1
- package/.docs/reference/core/getStoredAgentById.md +18 -20
- package/.docs/reference/core/getTelemetry.md +1 -1
- package/.docs/reference/core/getVector.md +2 -2
- package/.docs/reference/core/getWorkflow.md +3 -3
- package/.docs/reference/core/listAgents.md +1 -1
- package/.docs/reference/core/listGateways.md +1 -1
- package/.docs/reference/core/listLogs.md +9 -11
- package/.docs/reference/core/listLogsByRunId.md +9 -9
- package/.docs/reference/core/listMCPServers.md +1 -1
- package/.docs/reference/core/listMemory.md +1 -1
- package/.docs/reference/core/listScorers.md +1 -1
- package/.docs/reference/core/listStoredAgents.md +9 -11
- package/.docs/reference/core/listVectors.md +1 -1
- package/.docs/reference/core/listWorkflows.md +2 -2
- package/.docs/reference/core/mastra-class.md +17 -17
- package/.docs/reference/core/mastra-model-gateway.md +15 -15
- package/.docs/reference/core/setLogger.md +2 -4
- package/.docs/reference/core/setStorage.md +1 -1
- package/.docs/reference/datasets/addItem.md +20 -4
- package/.docs/reference/datasets/addItems.md +8 -2
- package/.docs/reference/datasets/compareExperiments.md +15 -3
- package/.docs/reference/datasets/create.md +6 -6
- package/.docs/reference/datasets/dataset.md +1 -1
- package/.docs/reference/datasets/delete.md +2 -2
- package/.docs/reference/datasets/deleteExperiment.md +2 -2
- package/.docs/reference/datasets/deleteItem.md +2 -2
- package/.docs/reference/datasets/deleteItems.md +2 -2
- package/.docs/reference/datasets/get.md +2 -2
- package/.docs/reference/datasets/getDetails.md +9 -9
- package/.docs/reference/datasets/getExperiment.md +2 -2
- package/.docs/reference/datasets/getItem.md +3 -3
- package/.docs/reference/datasets/getItemHistory.md +22 -2
- package/.docs/reference/datasets/list.md +7 -3
- package/.docs/reference/datasets/listExperimentResults.md +34 -4
- package/.docs/reference/datasets/listExperiments.md +41 -3
- package/.docs/reference/datasets/listItems.md +18 -6
- package/.docs/reference/datasets/listVersions.md +23 -3
- package/.docs/reference/datasets/startExperiment.md +62 -12
- package/.docs/reference/datasets/startExperimentAsync.md +5 -1
- package/.docs/reference/datasets/update.md +6 -6
- package/.docs/reference/datasets/updateItem.md +5 -5
- package/.docs/reference/deployer.md +8 -8
- package/.docs/reference/evals/answer-relevancy.md +11 -11
- package/.docs/reference/evals/answer-similarity.md +17 -19
- package/.docs/reference/evals/bias.md +10 -10
- package/.docs/reference/evals/completeness.md +3 -3
- package/.docs/reference/evals/content-similarity.md +6 -6
- package/.docs/reference/evals/context-precision.md +4 -4
- package/.docs/reference/evals/context-relevance.md +4 -4
- package/.docs/reference/evals/create-scorer.md +47 -49
- package/.docs/reference/evals/faithfulness.md +11 -11
- package/.docs/reference/evals/hallucination.md +17 -21
- package/.docs/reference/evals/keyword-coverage.md +4 -4
- package/.docs/reference/evals/mastra-scorer.md +14 -14
- package/.docs/reference/evals/noise-sensitivity.md +4 -4
- package/.docs/reference/evals/prompt-alignment.md +4 -4
- package/.docs/reference/evals/run-evals.md +16 -16
- package/.docs/reference/evals/scorer-utils.md +3 -3
- package/.docs/reference/evals/textual-difference.md +3 -3
- package/.docs/reference/evals/tone-consistency.md +3 -3
- package/.docs/reference/evals/tool-call-accuracy.md +5 -5
- package/.docs/reference/evals/toxicity.md +8 -8
- package/.docs/reference/harness/harness-class.md +34 -42
- package/.docs/reference/logging/pino-logger.md +5 -5
- package/.docs/reference/memory/clone-utilities.md +5 -5
- package/.docs/reference/memory/cloneThread.md +17 -21
- package/.docs/reference/memory/createThread.md +10 -10
- package/.docs/reference/memory/deleteMessages.md +2 -2
- package/.docs/reference/memory/getThreadById.md +2 -2
- package/.docs/reference/memory/listThreads.md +5 -5
- package/.docs/reference/memory/memory-class.md +12 -14
- package/.docs/reference/memory/observational-memory.md +102 -94
- package/.docs/reference/memory/recall.md +14 -16
- package/.docs/reference/observability/tracing/configuration.md +27 -10
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +4 -7
- package/.docs/reference/processors/batch-parts-processor.md +8 -10
- package/.docs/reference/processors/language-detector.md +14 -16
- package/.docs/reference/processors/message-history-processor.md +7 -9
- package/.docs/reference/processors/moderation-processor.md +13 -15
- package/.docs/reference/processors/pii-detector.md +14 -16
- package/.docs/reference/processors/processor-interface.md +62 -62
- package/.docs/reference/processors/prompt-injection-detector.md +11 -13
- package/.docs/reference/processors/semantic-recall-processor.md +14 -16
- package/.docs/reference/processors/system-prompt-scrubber.md +12 -14
- package/.docs/reference/processors/token-limiter-processor.md +11 -13
- package/.docs/reference/processors/tool-call-filter.md +5 -7
- package/.docs/reference/processors/tool-search-processor.md +9 -11
- package/.docs/reference/processors/unicode-normalizer.md +8 -10
- package/.docs/reference/processors/working-memory-processor.md +14 -18
- package/.docs/reference/rag/chunk.md +38 -38
- package/.docs/reference/rag/database-config.md +11 -7
- package/.docs/reference/rag/document.md +2 -2
- package/.docs/reference/rag/embeddings.md +12 -12
- package/.docs/reference/rag/extract-params.md +23 -23
- package/.docs/reference/rag/graph-rag.md +12 -12
- package/.docs/reference/rag/rerank.md +25 -17
- package/.docs/reference/rag/rerankWithScorer.md +25 -17
- package/.docs/reference/server/create-route.md +14 -14
- package/.docs/reference/server/express-adapter.md +10 -10
- package/.docs/reference/server/fastify-adapter.md +10 -10
- package/.docs/reference/server/hono-adapter.md +10 -10
- package/.docs/reference/server/koa-adapter.md +10 -10
- package/.docs/reference/server/mastra-server.md +10 -10
- package/.docs/reference/server/register-api-route.md +13 -13
- package/.docs/reference/storage/cloudflare-d1.md +5 -5
- package/.docs/reference/storage/cloudflare.md +6 -6
- package/.docs/reference/storage/composite.md +9 -9
- package/.docs/reference/storage/convex.md +3 -3
- package/.docs/reference/storage/dynamodb.md +9 -9
- package/.docs/reference/storage/lance.md +3 -3
- package/.docs/reference/storage/libsql.md +2 -2
- package/.docs/reference/storage/mongodb.md +5 -5
- package/.docs/reference/storage/mssql.md +2 -2
- package/.docs/reference/storage/postgresql.md +25 -25
- package/.docs/reference/storage/upstash.md +3 -3
- package/.docs/reference/streaming/ChunkType.md +251 -59
- package/.docs/reference/streaming/agents/MastraModelOutput.md +86 -16
- package/.docs/reference/streaming/agents/stream.md +155 -43
- package/.docs/reference/streaming/agents/streamLegacy.md +79 -39
- package/.docs/reference/streaming/workflows/resumeStream.md +18 -8
- package/.docs/reference/streaming/workflows/stream.md +21 -9
- package/.docs/reference/streaming/workflows/timeTravelStream.md +4 -4
- package/.docs/reference/tools/create-tool.md +25 -21
- package/.docs/reference/tools/document-chunker-tool.md +7 -7
- package/.docs/reference/tools/graph-rag-tool.md +16 -18
- package/.docs/reference/tools/mcp-client.md +38 -27
- package/.docs/reference/tools/mcp-server.md +45 -45
- package/.docs/reference/tools/vector-query-tool.md +34 -22
- package/.docs/reference/vectors/astra.md +22 -22
- package/.docs/reference/vectors/chroma.md +44 -44
- package/.docs/reference/vectors/convex.md +26 -26
- package/.docs/reference/vectors/couchbase.md +30 -30
- package/.docs/reference/vectors/duckdb.md +29 -29
- package/.docs/reference/vectors/elasticsearch.md +27 -27
- package/.docs/reference/vectors/lance.md +46 -38
- package/.docs/reference/vectors/libsql.md +31 -31
- package/.docs/reference/vectors/mongodb.md +32 -32
- package/.docs/reference/vectors/opensearch.md +27 -27
- package/.docs/reference/vectors/pg.md +60 -44
- package/.docs/reference/vectors/pinecone.md +38 -38
- package/.docs/reference/vectors/qdrant.md +36 -36
- package/.docs/reference/vectors/s3vectors.md +24 -24
- package/.docs/reference/vectors/turbopuffer.md +29 -29
- package/.docs/reference/vectors/upstash.md +25 -25
- package/.docs/reference/vectors/vectorize.md +27 -27
- package/.docs/reference/voice/azure.md +19 -15
- package/.docs/reference/voice/cloudflare.md +10 -12
- package/.docs/reference/voice/composite-voice.md +10 -10
- package/.docs/reference/voice/deepgram.md +20 -14
- package/.docs/reference/voice/elevenlabs.md +20 -22
- package/.docs/reference/voice/google-gemini-live.md +42 -44
- package/.docs/reference/voice/google.md +25 -21
- package/.docs/reference/voice/mastra-voice.md +20 -20
- package/.docs/reference/voice/murf.md +24 -28
- package/.docs/reference/voice/openai-realtime.md +26 -26
- package/.docs/reference/voice/openai.md +14 -12
- package/.docs/reference/voice/playai.md +13 -15
- package/.docs/reference/voice/sarvam.md +21 -25
- package/.docs/reference/voice/speechify.md +11 -13
- package/.docs/reference/voice/voice.addInstructions.md +1 -1
- package/.docs/reference/voice/voice.addTools.md +1 -1
- package/.docs/reference/voice/voice.answer.md +1 -1
- package/.docs/reference/voice/voice.connect.md +3 -3
- package/.docs/reference/voice/voice.events.md +11 -11
- package/.docs/reference/voice/voice.getSpeakers.md +30 -30
- package/.docs/reference/voice/voice.listen.md +9 -9
- package/.docs/reference/voice/voice.off.md +2 -2
- package/.docs/reference/voice/voice.on.md +2 -2
- package/.docs/reference/voice/voice.send.md +1 -1
- package/.docs/reference/voice/voice.speak.md +11 -11
- package/.docs/reference/voice/voice.updateConfig.md +3 -3
- package/.docs/reference/workflows/run-methods/cancel.md +2 -2
- package/.docs/reference/workflows/run-methods/restart.md +17 -5
- package/.docs/reference/workflows/run-methods/resume.md +23 -9
- package/.docs/reference/workflows/run-methods/start.md +22 -8
- package/.docs/reference/workflows/run-methods/startAsync.md +12 -6
- package/.docs/reference/workflows/run-methods/timeTravel.md +29 -13
- package/.docs/reference/workflows/run.md +12 -12
- package/.docs/reference/workflows/step.md +24 -26
- package/.docs/reference/workflows/workflow-methods/branch.md +2 -2
- package/.docs/reference/workflows/workflow-methods/commit.md +1 -1
- package/.docs/reference/workflows/workflow-methods/create-run.md +4 -4
- package/.docs/reference/workflows/workflow-methods/dountil.md +3 -3
- package/.docs/reference/workflows/workflow-methods/dowhile.md +3 -3
- package/.docs/reference/workflows/workflow-methods/foreach.md +9 -9
- package/.docs/reference/workflows/workflow-methods/map.md +2 -2
- package/.docs/reference/workflows/workflow-methods/parallel.md +2 -2
- package/.docs/reference/workflows/workflow-methods/sleep.md +2 -2
- package/.docs/reference/workflows/workflow-methods/sleepUntil.md +2 -2
- package/.docs/reference/workflows/workflow-methods/then.md +2 -2
- package/.docs/reference/workflows/workflow.md +40 -50
- package/.docs/reference/workspace/daytona-sandbox.md +33 -33
- package/.docs/reference/workspace/e2b-sandbox.md +20 -20
- package/.docs/reference/workspace/filesystem.md +22 -22
- package/.docs/reference/workspace/gcs-filesystem.md +15 -15
- package/.docs/reference/workspace/local-filesystem.md +35 -35
- package/.docs/reference/workspace/local-sandbox.md +26 -26
- package/.docs/reference/workspace/s3-filesystem.md +18 -18
- package/.docs/reference/workspace/sandbox.md +8 -8
- package/.docs/reference/workspace/workspace-class.md +30 -34
- package/CHANGELOG.md +8 -0
- package/package.json +6 -6
- package/.docs/docs/getting-started/start.md +0 -28
|
@@ -10,13 +10,13 @@ workflow.dowhile(step1, async ({ inputData }) => true)
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**step
|
|
13
|
+
**step** (`Step`): The step instance to execute in the loop
|
|
14
14
|
|
|
15
|
-
**condition
|
|
15
|
+
**condition** (`(params : ExecuteParams & { iterationCount: number }) => Promise<boolean>`): A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters and the iteration count.
|
|
16
16
|
|
|
17
17
|
## Returns
|
|
18
18
|
|
|
19
|
-
**workflow
|
|
19
|
+
**workflow** (`Workflow`): The workflow instance for method chaining
|
|
20
20
|
|
|
21
21
|
## Related
|
|
22
22
|
|
|
@@ -10,13 +10,13 @@ workflow.foreach(step1, { concurrency: 2 })
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**step
|
|
13
|
+
**step** (`Step`): The step instance to execute in the loop. The previous step must return an array type.
|
|
14
14
|
|
|
15
|
-
**opts
|
|
15
|
+
**opts** (`object`): Optional configuration for the loop. The concurrency option controls how many iterations can run in parallel (default: 1)
|
|
16
16
|
|
|
17
17
|
## Returns
|
|
18
18
|
|
|
19
|
-
**workflow
|
|
19
|
+
**workflow** (`Workflow`): The workflow instance for method chaining. The output type is an array of the step's output type.
|
|
20
20
|
|
|
21
21
|
## Behavior
|
|
22
22
|
|
|
@@ -101,17 +101,17 @@ for await (const chunk of stream) {
|
|
|
101
101
|
|
|
102
102
|
Each progress event payload contains:
|
|
103
103
|
|
|
104
|
-
**id
|
|
104
|
+
**id** (`string`): The step ID of the foreach step
|
|
105
105
|
|
|
106
|
-
**completedCount
|
|
106
|
+
**completedCount** (`number`): Number of iterations completed so far
|
|
107
107
|
|
|
108
|
-
**totalCount
|
|
108
|
+
**totalCount** (`number`): Total number of iterations
|
|
109
109
|
|
|
110
|
-
**currentIndex
|
|
110
|
+
**currentIndex** (`number`): Index of the iteration that just completed
|
|
111
111
|
|
|
112
|
-
**iterationStatus
|
|
112
|
+
**iterationStatus** (`'success' | 'failed' | 'suspended'`): Status of the iteration that just completed
|
|
113
113
|
|
|
114
|
-
**iterationOutput
|
|
114
|
+
**iterationOutput** (`Record<string, any>`): Output of the iteration (present when iterationStatus is 'success')
|
|
115
115
|
|
|
116
116
|
## Related
|
|
117
117
|
|
|
@@ -10,11 +10,11 @@ workflow.map(async ({ inputData }) => `${inputData.value} - map`)
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**mappingFunction
|
|
13
|
+
**mappingFunction** (`(params: { inputData: any }) => any`): Function that transforms input data and returns the mapped result
|
|
14
14
|
|
|
15
15
|
## Returns
|
|
16
16
|
|
|
17
|
-
**workflow
|
|
17
|
+
**workflow** (`Workflow`): The workflow instance for method chaining
|
|
18
18
|
|
|
19
19
|
## Using `inputData`
|
|
20
20
|
|
|
@@ -10,11 +10,11 @@ workflow.parallel([step1, step2])
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**steps
|
|
13
|
+
**steps** (`Step[]`): The step instances to execute in parallel
|
|
14
14
|
|
|
15
15
|
## Returns
|
|
16
16
|
|
|
17
|
-
**workflow
|
|
17
|
+
**workflow** (`Workflow`): The workflow instance for method chaining
|
|
18
18
|
|
|
19
19
|
## Related
|
|
20
20
|
|
|
@@ -10,11 +10,11 @@ workflow.sleep(5000)
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**milliseconds
|
|
13
|
+
**milliseconds** (`number | ((context: { inputData: any }) => number | Promise<number>)`): The number of milliseconds to pause execution, or a callback that returns the delay
|
|
14
14
|
|
|
15
15
|
## Returns
|
|
16
16
|
|
|
17
|
-
**workflow
|
|
17
|
+
**workflow** (`Workflow`): The workflow instance for method chaining
|
|
18
18
|
|
|
19
19
|
## Extended usage example
|
|
20
20
|
|
|
@@ -10,11 +10,11 @@ workflow.sleepUntil(new Date(Date.now() + 5000))
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**dateOrCallback
|
|
13
|
+
**dateOrCallback** (`Date | ((params: ExecuteFunctionParams) => Promise<Date>)`): Either a Date object or a callback function that returns a Date. The callback receives execution context and can compute the target time dynamically based on input data.
|
|
14
14
|
|
|
15
15
|
## Returns
|
|
16
16
|
|
|
17
|
-
**workflow
|
|
17
|
+
**workflow** (`Workflow`): The workflow instance for method chaining
|
|
18
18
|
|
|
19
19
|
## Extended usage example
|
|
20
20
|
|
|
@@ -10,11 +10,11 @@ workflow.then(step1).then(step2)
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**step
|
|
13
|
+
**step** (`Step`): The step instance that should execute after the previous step completes
|
|
14
14
|
|
|
15
15
|
## Returns
|
|
16
16
|
|
|
17
|
-
**workflow
|
|
17
|
+
**workflow** (`NewWorkflow`): The workflow instance for method chaining
|
|
18
18
|
|
|
19
19
|
## Related
|
|
20
20
|
|
|
@@ -21,87 +21,77 @@ export const workflow = createWorkflow({
|
|
|
21
21
|
|
|
22
22
|
## Constructor parameters
|
|
23
23
|
|
|
24
|
-
**id
|
|
24
|
+
**id** (`string`): Unique identifier for the workflow
|
|
25
25
|
|
|
26
|
-
**inputSchema
|
|
26
|
+
**inputSchema** (`z.ZodType<any>`): Zod schema defining the input structure for the workflow
|
|
27
27
|
|
|
28
|
-
**outputSchema
|
|
28
|
+
**outputSchema** (`z.ZodType<any>`): Zod schema defining the output structure for the workflow
|
|
29
29
|
|
|
30
|
-
**stateSchema
|
|
30
|
+
**stateSchema** (`z.ZodObject<any>`): Optional Zod schema for the workflow state. Automatically injected when using Mastra's state system. If not specified, type is 'any'.
|
|
31
31
|
|
|
32
|
-
**requestContextSchema
|
|
32
|
+
**requestContextSchema** (`z.ZodType<any>`): Zod schema for validating request context values. When provided, the context is validated at the start of run.start(), throwing an error if validation fails.
|
|
33
33
|
|
|
34
|
-
**options
|
|
34
|
+
**options** (`WorkflowOptions`): Optional options for the workflow
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
**options.tracingPolicy** (`TracingPolicy`): Optional tracing policy for the workflow
|
|
37
37
|
|
|
38
|
-
**
|
|
38
|
+
**options.validateInputs** (`boolean`): Optional flag to determine whether to validate the workflow inputs. This also applies default values from zodSchemas on the workflow/step input/resume data. If input/resume data validation fails on start/resume, the workflow will not start/resume, it throws an error instead. If input data validation fails on a step execution, the step fails, causing the workflow to fail and the error is returned.
|
|
39
39
|
|
|
40
|
-
**
|
|
40
|
+
**options.shouldPersistSnapshot** (`(params: { stepResults: Record<string, StepResult<any, any, any, any>>; workflowStatus: WorkflowRunStatus }) => boolean`): Optional flag to determine whether to persist the workflow snapshot
|
|
41
41
|
|
|
42
|
-
**
|
|
42
|
+
**options.onFinish** (`(result: WorkflowFinishCallbackResult) => void | Promise<void>`): Callback invoked when workflow completes with any status (success, failed, suspended, tripwire). Receives the workflow result including status, output, error, and step results. Errors thrown in this callback are caught and logged, not propagated.
|
|
43
43
|
|
|
44
|
-
**onFinish
|
|
44
|
+
**options.onFinish.status** (`WorkflowRunStatus`): The workflow status: 'success', 'failed', 'suspended', or 'tripwire'
|
|
45
45
|
|
|
46
|
-
**
|
|
46
|
+
**options.onFinish.result** (`any`): The workflow output (when status is 'success')
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
**options.onFinish.error** (`SerializedError`): Error details (when status is 'failed')
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
**options.onFinish.steps** (`Record<string, StepResult>`): Individual step results with their status and output
|
|
51
51
|
|
|
52
|
-
**
|
|
52
|
+
**options.onFinish.tripwire** (`StepTripwireInfo`): Tripwire information (when status is 'tripwire')
|
|
53
53
|
|
|
54
|
-
**
|
|
54
|
+
**options.onFinish.runId** (`string`): The unique identifier for this workflow run
|
|
55
55
|
|
|
56
|
-
**
|
|
56
|
+
**options.onFinish.workflowId** (`string`): The workflow's identifier
|
|
57
57
|
|
|
58
|
-
**
|
|
58
|
+
**options.onFinish.resourceId** (`string`): Optional resource identifier (if provided when creating the run)
|
|
59
59
|
|
|
60
|
-
**
|
|
60
|
+
**options.onFinish.getInitData** (`() => any`): Function that returns the initial input data passed to the workflow
|
|
61
61
|
|
|
62
|
-
**
|
|
62
|
+
**options.onFinish.mastra** (`Mastra`): The Mastra instance (if workflow is registered with Mastra)
|
|
63
63
|
|
|
64
|
-
**
|
|
64
|
+
**options.onFinish.requestContext** (`RequestContext`): Request-scoped context data
|
|
65
65
|
|
|
66
|
-
**
|
|
66
|
+
**options.onFinish.logger** (`IMastraLogger`): The workflow's logger instance
|
|
67
67
|
|
|
68
|
-
**
|
|
68
|
+
**options.onFinish.state** (`Record<string, any>`): The workflow's current state object
|
|
69
69
|
|
|
70
|
-
**
|
|
70
|
+
**options.onError** (`(errorInfo: WorkflowErrorCallbackInfo) => void | Promise<void>`): Callback invoked only when workflow fails (failed or tripwire status). Receives error details and step results. Errors thrown in this callback are caught and logged, not propagated.
|
|
71
71
|
|
|
72
|
-
**
|
|
72
|
+
**options.onError.status** (`'failed' | 'tripwire'`): The workflow status (either 'failed' or 'tripwire')
|
|
73
73
|
|
|
74
|
-
**
|
|
74
|
+
**options.onError.error** (`SerializedError`): Error details
|
|
75
75
|
|
|
76
|
-
**
|
|
76
|
+
**options.onError.steps** (`Record<string, StepResult>`): Individual step results with their status and output
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
**options.onError.tripwire** (`StepTripwireInfo`): Tripwire information (when status is 'tripwire')
|
|
79
79
|
|
|
80
|
-
The
|
|
80
|
+
**options.onError.runId** (`string`): The unique identifier for this workflow run
|
|
81
81
|
|
|
82
|
-
**
|
|
82
|
+
**options.onError.workflowId** (`string`): The workflow's identifier
|
|
83
83
|
|
|
84
|
-
**
|
|
84
|
+
**options.onError.resourceId** (`string`): Optional resource identifier (if provided when creating the run)
|
|
85
85
|
|
|
86
|
-
**
|
|
86
|
+
**options.onError.getInitData** (`() => any`): Function that returns the initial input data passed to the workflow
|
|
87
87
|
|
|
88
|
-
**
|
|
88
|
+
**options.onError.mastra** (`Mastra`): The Mastra instance (if workflow is registered with Mastra)
|
|
89
89
|
|
|
90
|
-
**
|
|
90
|
+
**options.onError.requestContext** (`RequestContext`): Request-scoped context data
|
|
91
91
|
|
|
92
|
-
**
|
|
92
|
+
**options.onError.logger** (`IMastraLogger`): The workflow's logger instance
|
|
93
93
|
|
|
94
|
-
**
|
|
95
|
-
|
|
96
|
-
**getInitData:** (`() => any`): Function that returns the initial input data passed to the workflow
|
|
97
|
-
|
|
98
|
-
**mastra?:** (`Mastra`): The Mastra instance (if workflow is registered with Mastra)
|
|
99
|
-
|
|
100
|
-
**requestContext:** (`RequestContext`): Request-scoped context data
|
|
101
|
-
|
|
102
|
-
**logger:** (`IMastraLogger`): The workflow's logger instance
|
|
103
|
-
|
|
104
|
-
**state:** (`Record<string, any>`): The workflow's current state object
|
|
94
|
+
**options.onError.state** (`Record<string, any>`): The workflow's current state object
|
|
105
95
|
|
|
106
96
|
## Running with initial state
|
|
107
97
|
|
|
@@ -125,13 +115,13 @@ The `initialState` object should match the structure defined in the workflow's `
|
|
|
125
115
|
|
|
126
116
|
A workflow's `status` indicates its current execution state. The possible values are:
|
|
127
117
|
|
|
128
|
-
**success
|
|
118
|
+
**success** (`string`): All steps finished executing successfully, with a valid result output
|
|
129
119
|
|
|
130
|
-
**failed
|
|
120
|
+
**failed** (`string`): Workflow encountered an error during execution, with error details available
|
|
131
121
|
|
|
132
|
-
**suspended
|
|
122
|
+
**suspended** (`string`): Workflow execution is paused waiting for resume, with suspended step information
|
|
133
123
|
|
|
134
|
-
**tripwire
|
|
124
|
+
**tripwire** (`string`): Workflow was terminated by a processor tripwire. This occurs when an agent step within the workflow triggers a tripwire (e.g., content was blocked by a guardrail). The tripwire information is available on the result.
|
|
135
125
|
|
|
136
126
|
### Handling tripwire status
|
|
137
127
|
|
|
@@ -242,59 +242,59 @@ const workspace = new Workspace({
|
|
|
242
242
|
|
|
243
243
|
## Constructor parameters
|
|
244
244
|
|
|
245
|
-
**id
|
|
245
|
+
**id** (`string`): Unique identifier for this sandbox instance. (Default: `Auto-generated`)
|
|
246
246
|
|
|
247
|
-
**apiKey
|
|
247
|
+
**apiKey** (`string`): Daytona API key for authentication. Falls back to DAYTONA\_API\_KEY environment variable.
|
|
248
248
|
|
|
249
|
-
**apiUrl
|
|
249
|
+
**apiUrl** (`string`): Daytona API endpoint. Falls back to DAYTONA\_API\_URL environment variable.
|
|
250
250
|
|
|
251
|
-
**target
|
|
251
|
+
**target** (`string`): Runner region. Falls back to DAYTONA\_TARGET environment variable.
|
|
252
252
|
|
|
253
|
-
**timeout
|
|
253
|
+
**timeout** (`number`): Default execution timeout in milliseconds. (Default: `300000 (5 minutes)`)
|
|
254
254
|
|
|
255
|
-
**language
|
|
255
|
+
**language** (`'typescript' | 'javascript' | 'python'`): Runtime language for the sandbox. (Default: `'typescript'`)
|
|
256
256
|
|
|
257
|
-
**snapshot
|
|
257
|
+
**snapshot** (`string`): Pre-built snapshot ID to create the sandbox from. Takes precedence over image.
|
|
258
258
|
|
|
259
|
-
**image
|
|
259
|
+
**image** (`string`): Docker image for sandbox creation. Triggers image-based creation when set. Can be combined with resources. Ignored when snapshot is set.
|
|
260
260
|
|
|
261
|
-
**resources
|
|
261
|
+
**resources** (`{ cpu?: number; memory?: number; disk?: number }`): Resource allocation for the sandbox (CPU cores, memory in GiB, disk in GiB). Only used when image is set.
|
|
262
262
|
|
|
263
|
-
**env
|
|
263
|
+
**env** (`Record<string, string>`): Environment variables to set in the sandbox. (Default: `{}`)
|
|
264
264
|
|
|
265
|
-
**labels
|
|
265
|
+
**labels** (`Record<string, string>`): Custom metadata labels. (Default: `{}`)
|
|
266
266
|
|
|
267
|
-
**name
|
|
267
|
+
**name** (`string`): Sandbox display name. (Default: `Sandbox id`)
|
|
268
268
|
|
|
269
|
-
**user
|
|
269
|
+
**user** (`string`): OS user to run commands as. (Default: `'daytona'`)
|
|
270
270
|
|
|
271
|
-
**public
|
|
271
|
+
**public** (`boolean`): Make port previews public. (Default: `false`)
|
|
272
272
|
|
|
273
|
-
**ephemeral
|
|
273
|
+
**ephemeral** (`boolean`): Delete sandbox immediately on stop. (Default: `false`)
|
|
274
274
|
|
|
275
|
-
**autoStopInterval
|
|
275
|
+
**autoStopInterval** (`number`): Auto-stop interval in minutes. Set to 0 to disable. (Default: `15`)
|
|
276
276
|
|
|
277
|
-
**autoArchiveInterval
|
|
277
|
+
**autoArchiveInterval** (`number`): Auto-archive interval in minutes. Set to 0 for the maximum interval (7 days). (Default: `7 days`)
|
|
278
278
|
|
|
279
|
-
**autoDeleteInterval
|
|
279
|
+
**autoDeleteInterval** (`number`): Auto-delete interval in minutes. Negative values disable auto-delete. Set to 0 to delete on stop. (Default: `disabled`)
|
|
280
280
|
|
|
281
|
-
**volumes
|
|
281
|
+
**volumes** (`Array<{ volumeId: string; mountPath: string }>`): Daytona volumes to attach at sandbox creation time.
|
|
282
282
|
|
|
283
|
-
**networkBlockAll
|
|
283
|
+
**networkBlockAll** (`boolean`): Block all outbound network access from the sandbox. (Default: `false`)
|
|
284
284
|
|
|
285
|
-
**networkAllowList
|
|
285
|
+
**networkAllowList** (`string`): Comma-separated list of allowed CIDR addresses when network access is restricted.
|
|
286
286
|
|
|
287
287
|
## Properties
|
|
288
288
|
|
|
289
|
-
**id
|
|
289
|
+
**id** (`string`): Sandbox instance identifier.
|
|
290
290
|
|
|
291
|
-
**name
|
|
291
|
+
**name** (`string`): Provider name ('DaytonaSandbox').
|
|
292
292
|
|
|
293
|
-
**provider
|
|
293
|
+
**provider** (`string`): Provider identifier ('daytona').
|
|
294
294
|
|
|
295
|
-
**status
|
|
295
|
+
**status** (`ProviderStatus`): 'pending' | 'initializing' | 'ready' | 'stopped' | 'destroyed' | 'error'
|
|
296
296
|
|
|
297
|
-
**instance
|
|
297
|
+
**instance** (`Sandbox`): The underlying Daytona Sandbox instance. Throws SandboxNotReadyError if the sandbox has not been started.
|
|
298
298
|
|
|
299
299
|
## Methods
|
|
300
300
|
|
|
@@ -344,19 +344,19 @@ await sandbox.executeCommand('bash', ['-c', 'for i in 1 2 3; do echo "line $i";
|
|
|
344
344
|
|
|
345
345
|
**Parameters:**
|
|
346
346
|
|
|
347
|
-
**command
|
|
347
|
+
**command** (`string`): Command to execute.
|
|
348
348
|
|
|
349
|
-
**args
|
|
349
|
+
**args** (`string[]`): Command arguments.
|
|
350
350
|
|
|
351
|
-
**options.timeout
|
|
351
|
+
**options.timeout** (`number`): Execution timeout in milliseconds. Overrides the instance default.
|
|
352
352
|
|
|
353
|
-
**options.cwd
|
|
353
|
+
**options.cwd** (`string`): Working directory for the command.
|
|
354
354
|
|
|
355
|
-
**options.env
|
|
355
|
+
**options.env** (`Record<string, string>`): Additional environment variables for this command. Merged with instance-level env.
|
|
356
356
|
|
|
357
|
-
**options.onStdout
|
|
357
|
+
**options.onStdout** (`(data: string) => void`): Callback for stdout streaming.
|
|
358
358
|
|
|
359
|
-
**options.onStderr
|
|
359
|
+
**options.onStderr** (`(data: string) => void`): Callback for stderr streaming.
|
|
360
360
|
|
|
361
361
|
### `mount(filesystem, mountPath)`
|
|
362
362
|
|
|
@@ -35,33 +35,33 @@ const agent = new Agent({
|
|
|
35
35
|
|
|
36
36
|
## Constructor parameters
|
|
37
37
|
|
|
38
|
-
**apiKey
|
|
38
|
+
**apiKey** (`string`): E2B API key. Falls back to E2B\_API\_KEY environment variable.
|
|
39
39
|
|
|
40
|
-
**timeout
|
|
40
|
+
**timeout** (`number`): Execution timeout in milliseconds (Default: `300000 (5 minutes)`)
|
|
41
41
|
|
|
42
|
-
**template
|
|
42
|
+
**template** (`string | TemplateBuilder | function`): Sandbox template specification. Can be a template ID string, a TemplateBuilder, or a function that customizes the default template.
|
|
43
43
|
|
|
44
|
-
**env
|
|
44
|
+
**env** (`Record<string, string>`): Environment variables to set in the sandbox
|
|
45
45
|
|
|
46
|
-
**id
|
|
46
|
+
**id** (`string`): Unique identifier for this sandbox instance (Default: `Auto-generated`)
|
|
47
47
|
|
|
48
|
-
**domain
|
|
48
|
+
**domain** (`string`): Domain for self-hosted E2B. Falls back to E2B\_DOMAIN env var.
|
|
49
49
|
|
|
50
|
-
**apiUrl
|
|
50
|
+
**apiUrl** (`string`): API URL for self-hosted E2B. Falls back to E2B\_API\_URL env var.
|
|
51
51
|
|
|
52
|
-
**accessToken
|
|
52
|
+
**accessToken** (`string`): Access token for authentication. Falls back to E2B\_ACCESS\_TOKEN env var.
|
|
53
53
|
|
|
54
54
|
## Properties
|
|
55
55
|
|
|
56
|
-
**id
|
|
56
|
+
**id** (`string`): Sandbox instance identifier
|
|
57
57
|
|
|
58
|
-
**name
|
|
58
|
+
**name** (`string`): Provider name ('E2BSandbox')
|
|
59
59
|
|
|
60
|
-
**provider
|
|
60
|
+
**provider** (`string`): Provider identifier ('e2b')
|
|
61
61
|
|
|
62
|
-
**status
|
|
62
|
+
**status** (`ProviderStatus`): 'pending' | 'initializing' | 'ready' | 'error'
|
|
63
63
|
|
|
64
|
-
**supportsMounting
|
|
64
|
+
**supportsMounting** (`boolean`): Always true - E2B sandboxes support mounting cloud filesystems
|
|
65
65
|
|
|
66
66
|
## Methods
|
|
67
67
|
|
|
@@ -105,19 +105,19 @@ const npmResult = await sandbox.executeCommand('npm', ['install', 'lodash'], {
|
|
|
105
105
|
|
|
106
106
|
**Parameters:**
|
|
107
107
|
|
|
108
|
-
**command
|
|
108
|
+
**command** (`string`): Command to execute
|
|
109
109
|
|
|
110
|
-
**args
|
|
110
|
+
**args** (`string[]`): Command arguments
|
|
111
111
|
|
|
112
|
-
**options.timeout
|
|
112
|
+
**options.timeout** (`number`): Execution timeout in milliseconds
|
|
113
113
|
|
|
114
|
-
**options.cwd
|
|
114
|
+
**options.cwd** (`string`): Working directory for the command
|
|
115
115
|
|
|
116
|
-
**options.env
|
|
116
|
+
**options.env** (`Record<string, string>`): Additional environment variables
|
|
117
117
|
|
|
118
|
-
**options.onStdout
|
|
118
|
+
**options.onStdout** (`(data: string) => void`): Callback for stdout streaming
|
|
119
119
|
|
|
120
|
-
**options.onStderr
|
|
120
|
+
**options.onStderr** (`(data: string) => void`): Callback for stderr streaming
|
|
121
121
|
|
|
122
122
|
### `canMount(filesystem)`
|
|
123
123
|
|
|
@@ -17,9 +17,9 @@ const buffer = await filesystem.readFile('/image.png', { encoding: 'binary' })
|
|
|
17
17
|
|
|
18
18
|
**Parameters:**
|
|
19
19
|
|
|
20
|
-
**path
|
|
20
|
+
**path** (`string`): File path relative to basePath
|
|
21
21
|
|
|
22
|
-
**options.encoding
|
|
22
|
+
**options.encoding** (`'utf-8' | 'binary'`): Text or binary encoding (Default: `'utf-8'`)
|
|
23
23
|
|
|
24
24
|
**Returns:** `Promise<string | Buffer>`
|
|
25
25
|
|
|
@@ -34,13 +34,13 @@ await filesystem.writeFile('/nested/path/file.md', content, { recursive: true })
|
|
|
34
34
|
|
|
35
35
|
**Parameters:**
|
|
36
36
|
|
|
37
|
-
**path
|
|
37
|
+
**path** (`string`): File path relative to basePath
|
|
38
38
|
|
|
39
|
-
**content
|
|
39
|
+
**content** (`string | Buffer`): File content
|
|
40
40
|
|
|
41
|
-
**options.recursive
|
|
41
|
+
**options.recursive** (`boolean`): Create parent directories if they don't exist (Default: `false`)
|
|
42
42
|
|
|
43
|
-
**options.overwrite
|
|
43
|
+
**options.overwrite** (`boolean`): Overwrite existing file (Default: `true`)
|
|
44
44
|
|
|
45
45
|
### `deleteFile(path, options?)`
|
|
46
46
|
|
|
@@ -53,9 +53,9 @@ await filesystem.deleteFile('/docs/maybe.md', { force: true }) // Don't throw if
|
|
|
53
53
|
|
|
54
54
|
**Parameters:**
|
|
55
55
|
|
|
56
|
-
**path
|
|
56
|
+
**path** (`string`): File path
|
|
57
57
|
|
|
58
|
-
**options.force
|
|
58
|
+
**options.force** (`boolean`): Don't throw error if file doesn't exist (Default: `false`)
|
|
59
59
|
|
|
60
60
|
### `appendFile(path, content)`
|
|
61
61
|
|
|
@@ -67,9 +67,9 @@ await filesystem.appendFile('/logs/app.log', 'New log entry\n')
|
|
|
67
67
|
|
|
68
68
|
**Parameters:**
|
|
69
69
|
|
|
70
|
-
**path
|
|
70
|
+
**path** (`string`): File path
|
|
71
71
|
|
|
72
|
-
**content
|
|
72
|
+
**content** (`string | Buffer`): Content to append
|
|
73
73
|
|
|
74
74
|
### `copyFile(src, dest, options?)`
|
|
75
75
|
|
|
@@ -81,11 +81,11 @@ await filesystem.copyFile('/docs/template.md', '/docs/new-doc.md')
|
|
|
81
81
|
|
|
82
82
|
**Parameters:**
|
|
83
83
|
|
|
84
|
-
**src
|
|
84
|
+
**src** (`string`): Source file path
|
|
85
85
|
|
|
86
|
-
**dest
|
|
86
|
+
**dest** (`string`): Destination file path
|
|
87
87
|
|
|
88
|
-
**options.overwrite
|
|
88
|
+
**options.overwrite** (`boolean`): Overwrite destination if it exists (Default: `true`)
|
|
89
89
|
|
|
90
90
|
### `moveFile(src, dest, options?)`
|
|
91
91
|
|
|
@@ -97,11 +97,11 @@ await filesystem.moveFile('/docs/draft.md', '/docs/final.md')
|
|
|
97
97
|
|
|
98
98
|
**Parameters:**
|
|
99
99
|
|
|
100
|
-
**src
|
|
100
|
+
**src** (`string`): Source file path
|
|
101
101
|
|
|
102
|
-
**dest
|
|
102
|
+
**dest** (`string`): Destination file path
|
|
103
103
|
|
|
104
|
-
**options.overwrite
|
|
104
|
+
**options.overwrite** (`boolean`): Overwrite destination if it exists (Default: `true`)
|
|
105
105
|
|
|
106
106
|
### `readdir(path, options?)`
|
|
107
107
|
|
|
@@ -135,9 +135,9 @@ await filesystem.mkdir('/deeply/nested/path', { recursive: true })
|
|
|
135
135
|
|
|
136
136
|
**Parameters:**
|
|
137
137
|
|
|
138
|
-
**path
|
|
138
|
+
**path** (`string`): Directory path
|
|
139
139
|
|
|
140
|
-
**options.recursive
|
|
140
|
+
**options.recursive** (`boolean`): Create parent directories (Default: `false`)
|
|
141
141
|
|
|
142
142
|
### `rmdir(path, options?)`
|
|
143
143
|
|
|
@@ -150,11 +150,11 @@ await filesystem.rmdir('/docs/nested', { recursive: true })
|
|
|
150
150
|
|
|
151
151
|
**Parameters:**
|
|
152
152
|
|
|
153
|
-
**path
|
|
153
|
+
**path** (`string`): Directory path
|
|
154
154
|
|
|
155
|
-
**options.recursive
|
|
155
|
+
**options.recursive** (`boolean`): Remove contents recursively (Default: `false`)
|
|
156
156
|
|
|
157
|
-
**options.force
|
|
157
|
+
**options.force** (`boolean`): Don't throw if directory doesn't exist (Default: `false`)
|
|
158
158
|
|
|
159
159
|
### `exists(path)`
|
|
160
160
|
|
|
@@ -245,7 +245,7 @@ const instructions = filesystem.getInstructions?.()
|
|
|
245
245
|
|
|
246
246
|
**Parameters:**
|
|
247
247
|
|
|
248
|
-
**opts.requestContext
|
|
248
|
+
**opts.requestContext** (`RequestContext`): Forwarded to the \`instructions\` function if one was provided in the constructor.
|
|
249
249
|
|
|
250
250
|
**Returns:** `string`
|
|
251
251
|
|