@mastra/mcp-docs-server 1.2.5-alpha.1 → 1.2.5-alpha.5
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/agent-builder/deploying.md +1 -1
- package/.docs/docs/agent-controller/overview.md +1 -1
- package/.docs/docs/agent-controller/session.md +1 -1
- package/.docs/docs/agents/overview.md +1 -1
- package/.docs/docs/agents/processors.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +3 -3
- package/.docs/docs/agents/using-tools.md +1 -1
- package/.docs/docs/{agents → long-running-agents}/background-tasks.md +2 -2
- package/.docs/docs/{agents → long-running-agents}/durable-agents.md +2 -2
- package/.docs/docs/{agents → long-running-agents}/goals.md +1 -1
- package/.docs/docs/{agents → long-running-agents}/heartbeats.md +5 -5
- package/.docs/docs/{agents → long-running-agents}/signal-providers.md +4 -4
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/config.md +1 -2
- package/.docs/docs/server/pubsub.md +2 -2
- package/.docs/docs/voice/overview.md +3 -3
- package/.docs/docs/voice/speech-to-speech.md +81 -1
- package/.docs/docs/voice/speech-to-text.md +19 -1
- package/.docs/docs/voice/text-to-speech.md +21 -1
- package/.docs/docs/workflows/control-flow.md +1 -1
- package/.docs/docs/workflows/error-handling.md +1 -1
- package/.docs/docs/workflows/human-in-the-loop.md +1 -1
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/docs/workflows/snapshots.md +1 -1
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workflows/time-travel.md +1 -1
- package/.docs/docs/workflows/workflow-state.md +1 -1
- package/.docs/guides/build-your-ui/copilotkit/channels.md +76 -0
- package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +174 -0
- package/.docs/guides/build-your-ui/copilotkit/overview.md +411 -0
- package/.docs/guides/concepts/streaming.md +1 -1
- package/.docs/guides/deployment/vercel.md +1 -2
- package/.docs/guides/guide/signal-provider.md +5 -5
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +2 -1
- package/.docs/models/providers/friendli.md +1 -2
- package/.docs/models/providers/nvidia.md +3 -2
- package/.docs/models/providers/tencent-token-plan.md +7 -7
- package/.docs/models/providers/tencent-tokenhub.md +5 -4
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/acp/acp-agent.md +5 -5
- package/.docs/reference/acp/create-acp-tool.md +5 -5
- package/.docs/reference/agent-controller/agent-controller-class.md +27 -27
- package/.docs/reference/agents/agent.md +34 -34
- package/.docs/reference/agents/channels.md +19 -19
- package/.docs/reference/agents/createSkill.md +2 -2
- package/.docs/reference/agents/durable-agent.md +22 -22
- package/.docs/reference/agents/generate.md +10 -10
- package/.docs/reference/agents/generateLegacy.md +12 -12
- package/.docs/reference/agents/getMetadata.md +1 -1
- package/.docs/reference/agents/getVoice.md +1 -1
- package/.docs/reference/agents/inngest-agent.md +9 -9
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/ai-sdk/chat-route.md +4 -4
- package/.docs/reference/ai-sdk/handle-chat-stream.md +6 -6
- package/.docs/reference/ai-sdk/handle-network-stream.md +3 -3
- package/.docs/reference/ai-sdk/handle-workflow-stream.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +4 -4
- package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
- package/.docs/reference/ai-sdk/with-mastra.md +2 -2
- package/.docs/reference/ai-sdk/workflow-route.md +2 -2
- package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +1 -1
- package/.docs/reference/auth/google.md +10 -10
- package/.docs/reference/auth/okta.md +11 -11
- package/.docs/reference/auth/workos.md +3 -3
- package/.docs/reference/channels/slack-provider.md +15 -15
- package/.docs/reference/cli/mastra.md +145 -0
- package/.docs/reference/client-js/agents.md +9 -9
- package/.docs/reference/client-js/mastra-client.md +5 -5
- package/.docs/reference/client-js/responses.md +3 -3
- package/.docs/reference/configuration.md +1 -1
- package/.docs/reference/core/getAgentById.md +3 -3
- package/.docs/reference/core/getWorkflow.md +1 -1
- package/.docs/reference/core/listWorkflows.md +1 -1
- package/.docs/reference/core/mastra-class.md +3 -3
- package/.docs/reference/core/removeWorkspace.md +2 -2
- package/.docs/reference/datasets/compareExperiments.md +1 -1
- package/.docs/reference/datasets/getItemHistory.md +1 -1
- package/.docs/reference/datasets/list.md +5 -5
- package/.docs/reference/datasets/listExperimentResults.md +4 -4
- package/.docs/reference/datasets/listExperiments.md +4 -4
- package/.docs/reference/datasets/listItems.md +5 -5
- package/.docs/reference/datasets/listVersions.md +3 -3
- package/.docs/reference/datasets/startExperiment.md +8 -8
- package/.docs/reference/datasets/startExperimentAsync.md +1 -1
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +4 -4
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +7 -7
- package/.docs/reference/editor/agent-builder/builder-models.md +4 -4
- package/.docs/reference/editor/blob-store-provider.md +2 -2
- package/.docs/reference/editor/browser-provider.md +2 -2
- package/.docs/reference/editor/filesystem-provider.md +2 -2
- package/.docs/reference/editor/mastra-editor.md +2 -2
- package/.docs/reference/editor/processor-provider.md +4 -4
- package/.docs/reference/editor/sandbox-provider.md +2 -2
- package/.docs/reference/editor/storage-browser-ref.md +2 -2
- package/.docs/reference/editor/storage-workspace-ref.md +7 -7
- package/.docs/reference/evals/create-scorer.md +8 -8
- package/.docs/reference/evals/rubric.md +1 -1
- package/.docs/reference/evals/run-evals.md +7 -7
- package/.docs/reference/evals/trajectory-accuracy.md +1 -1
- package/.docs/reference/index.md +2 -2
- package/.docs/reference/logging/pino-logger.md +4 -4
- package/.docs/reference/memory/cloneThread.md +35 -4
- package/.docs/reference/memory/memory-class.md +5 -5
- package/.docs/reference/memory/observational-memory.md +43 -43
- package/.docs/reference/memory/recall.md +4 -4
- package/.docs/reference/memory/serialized-memory-config.md +6 -6
- package/.docs/reference/observability/tracing/configuration.md +4 -4
- package/.docs/reference/processors/language-detector.md +1 -1
- package/.docs/reference/processors/moderation-processor.md +1 -1
- package/.docs/reference/processors/pii-detector.md +1 -1
- package/.docs/reference/processors/processor-interface.md +20 -20
- package/.docs/reference/processors/prompt-injection-detector.md +1 -1
- package/.docs/reference/processors/response-cache.md +6 -6
- package/.docs/reference/processors/unicode-normalizer.md +1 -1
- package/.docs/reference/pubsub/base.md +7 -7
- package/.docs/reference/pubsub/caching-pubsub.md +1 -1
- package/.docs/reference/pubsub/event-emitter.md +2 -2
- package/.docs/reference/pubsub/google-cloud-pubsub.md +1 -1
- package/.docs/reference/pubsub/lease-provider.md +3 -3
- package/.docs/reference/pubsub/redis-streams.md +6 -6
- package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
- package/.docs/reference/rag/chunk.md +2 -2
- package/.docs/reference/server/create-route.md +3 -3
- package/.docs/reference/server/express-adapter.md +4 -4
- package/.docs/reference/server/fastify-adapter.md +4 -4
- package/.docs/reference/server/hono-adapter.md +4 -4
- package/.docs/reference/server/koa-adapter.md +4 -4
- package/.docs/reference/server/mastra-server.md +1 -1
- package/.docs/reference/server/nestjs-adapter.md +3 -3
- package/.docs/reference/server/register-api-route.md +3 -3
- package/.docs/reference/signals/create-notification-inbox-tool.md +3 -3
- package/.docs/reference/signals/signal-provider.md +7 -7
- package/.docs/reference/signals/webhook-signal-provider.md +2 -2
- package/.docs/reference/storage/clickhouse.md +7 -7
- package/.docs/reference/storage/composite.md +2 -2
- package/.docs/reference/storage/duckdb.md +1 -1
- package/.docs/reference/storage/dynamodb.md +1 -1
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/postgresql.md +2 -2
- package/.docs/reference/storage/redis.md +2 -2
- package/.docs/reference/storage/retention.md +5 -5
- package/.docs/reference/storage/spanner.md +6 -6
- package/.docs/reference/streaming/ChunkType.md +3 -3
- package/.docs/reference/streaming/agents/stream.md +14 -14
- package/.docs/reference/streaming/agents/streamLegacy.md +10 -10
- package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/templates/overview.md +1 -140
- package/.docs/reference/tools/brightdata.md +4 -4
- package/.docs/reference/tools/create-code-mode.md +5 -5
- package/.docs/reference/tools/create-tool.md +15 -15
- package/.docs/reference/tools/graph-rag-tool.md +1 -1
- package/.docs/reference/tools/mcp-client.md +2 -2
- package/.docs/reference/tools/mcp-server.md +12 -12
- package/.docs/reference/tools/perplexity.md +3 -3
- package/.docs/reference/tools/tavily.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +1 -1
- package/.docs/reference/vectors/chroma.md +1 -1
- package/.docs/reference/vectors/mongodb.md +1 -1
- package/.docs/reference/vectors/pg.md +1 -1
- package/.docs/reference/vectors/s3vectors.md +4 -4
- package/.docs/reference/voice/google-gemini-live.md +3 -3
- package/.docs/reference/voice/inworld-realtime.md +12 -12
- package/.docs/reference/voice/inworld.md +2 -2
- package/.docs/reference/voice/voice.on.md +1 -1
- package/.docs/reference/workflows/run-methods/resume.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workspace/agentcore-runtime-sandbox.md +4 -4
- package/.docs/reference/workspace/agentfs-filesystem.md +1 -1
- package/.docs/reference/workspace/apple-container-sandbox.md +5 -5
- package/.docs/reference/workspace/archil-filesystem.md +5 -5
- package/.docs/reference/workspace/blaxel-sandbox.md +1 -1
- package/.docs/reference/workspace/daytona-sandbox.md +1 -1
- package/.docs/reference/workspace/docker-sandbox.md +2 -2
- package/.docs/reference/workspace/e2b-sandbox.md +2 -2
- package/.docs/reference/workspace/files-sdk-filesystem.md +1 -1
- package/.docs/reference/workspace/filesystem.md +1 -1
- package/.docs/reference/workspace/local-filesystem.md +3 -3
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/mesa-filesystem.md +3 -3
- package/.docs/reference/workspace/modal-sandbox.md +1 -1
- package/.docs/reference/workspace/railway-sandbox.md +1 -1
- package/.docs/reference/workspace/s3-filesystem.md +4 -4
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/{vercel-microvm-sandbox.md → vercel-sandbox.md} +21 -15
- package/.docs/reference/workspace/{vercel.md → vercel-serverless.md} +21 -14
- package/.docs/reference/workspace/workspace-class.md +15 -15
- package/CHANGELOG.md +15 -0
- package/package.json +4 -4
- package/.docs/docs/agents/adding-voice.md +0 -383
- package/.docs/docs/community/contributing-templates.md +0 -5
- package/.docs/docs/community/discord.md +0 -11
- package/.docs/guides/build-your-ui/copilotkit.md +0 -291
- package/LICENSE.md +0 -30
- /package/.docs/docs/{community/licensing.md → license.md} +0 -0
- /package/.docs/docs/{agents → long-running-agents}/signals.md +0 -0
|
@@ -50,7 +50,7 @@ voice.on('error', ({ message, code, details }) => {
|
|
|
50
50
|
|
|
51
51
|
## Parameters
|
|
52
52
|
|
|
53
|
-
**event** (`string`): Name of the event to listen for. See the
|
|
53
|
+
**event** (`string`): Name of the event to listen for. See the Voice Events documentation for a list of available events.
|
|
54
54
|
|
|
55
55
|
**callback** (`function`): Callback function that will be called when the event occurs. The callback signature depends on the specific event.
|
|
56
56
|
|
|
@@ -28,7 +28,7 @@ if (result.status === 'suspended') {
|
|
|
28
28
|
|
|
29
29
|
**retryCount** (`number`): Optional retry count for nested workflow execution
|
|
30
30
|
|
|
31
|
-
**forEachIndex** (`number`): Target a specific iteration of a suspended
|
|
31
|
+
**forEachIndex** (`number`): Target a specific iteration of a suspended .foreach() step. Pass the zero-based index of the iteration you want to resume; other iterations remain suspended. Omit this field to resume all suspended iterations of the step with the same resumeData.
|
|
32
32
|
|
|
33
33
|
**tracingContext** (`TracingContext`): Tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.
|
|
34
34
|
|
|
@@ -159,4 +159,4 @@ const result = await run.timeTravel({
|
|
|
159
159
|
- [Workflows overview](https://mastra.ai/docs/workflows/overview)
|
|
160
160
|
- [Workflow.createRun()](https://mastra.ai/reference/workflows/workflow-methods/create-run)
|
|
161
161
|
- [Snapshots](https://mastra.ai/docs/workflows/snapshots)
|
|
162
|
-
- [Suspend
|
|
162
|
+
- [Suspend and Resume](https://mastra.ai/docs/workflows/suspend-and-resume)
|
|
@@ -94,13 +94,13 @@ if (!result?.success) {
|
|
|
94
94
|
|
|
95
95
|
**commandTimeout** (`number`): Default command timeout in milliseconds. (Default: `300000`)
|
|
96
96
|
|
|
97
|
-
**stopSessionOnLifecycle** (`boolean`): Whether
|
|
97
|
+
**stopSessionOnLifecycle** (`boolean`): Whether stop() and destroy() should call StopRuntimeSession. Defaults to false because AgentCore Runtime sessions are often shared with agent invocations outside the sandbox instance. (Default: `false`)
|
|
98
98
|
|
|
99
|
-
**stopClientToken** (`string`): Client token used when
|
|
99
|
+
**stopClientToken** (`string`): Client token used when StopRuntimeSession is called. (Default: `Generated UUID`)
|
|
100
100
|
|
|
101
101
|
**client** (`BedrockAgentCoreClient`): Preconfigured AWS SDK client. Use this for custom credentials, retry behavior, or tests.
|
|
102
102
|
|
|
103
|
-
**instructions** (`string | ((opts) => string)`): Custom instructions that override the default instructions returned by
|
|
103
|
+
**instructions** (`string | ((opts) => string)`): Custom instructions that override the default instructions returned by getInstructions(). Pass a string to replace the defaults, or a function to extend them.
|
|
104
104
|
|
|
105
105
|
## Properties
|
|
106
106
|
|
|
@@ -110,7 +110,7 @@ if (!result?.success) {
|
|
|
110
110
|
|
|
111
111
|
**provider** (`'agentcore'`): Provider type identifier.
|
|
112
112
|
|
|
113
|
-
**status** (`ProviderStatus`): Current lifecycle status:
|
|
113
|
+
**status** (`ProviderStatus`): Current lifecycle status: 'pending', 'starting', 'running', 'stopping', 'stopped', 'destroying', 'destroyed', or 'error'.
|
|
114
114
|
|
|
115
115
|
**runtimeSessionId** (`string`): AgentCore Runtime session ID used for command execution.
|
|
116
116
|
|
|
@@ -86,7 +86,7 @@ const filesystem = new AgentFSFilesystem({
|
|
|
86
86
|
|
|
87
87
|
You must provide at least one of `agentId`, `path`, or `agent`.
|
|
88
88
|
|
|
89
|
-
**agentId** (`string`): Agent ID — creates database at
|
|
89
|
+
**agentId** (`string`): Agent ID — creates database at .agentfs/\<agentId>.db
|
|
90
90
|
|
|
91
91
|
**path** (`string`): Explicit database file path (alternative to agentId)
|
|
92
92
|
|
|
@@ -73,7 +73,7 @@ console.log(response.text)
|
|
|
73
73
|
|
|
74
74
|
**id** (`string`): Unique identifier for this sandbox instance. (Default: `Auto-generated`)
|
|
75
75
|
|
|
76
|
-
**name** (`string`): Apple container name passed to
|
|
76
|
+
**name** (`string`): Apple container name passed to container run --name. Characters outside \[a-zA-Z0-9\_.-] are replaced with - and the result is prefixed if it would not start with an alphanumeric character. (Default: `` The sandbox `id` ``)
|
|
77
77
|
|
|
78
78
|
**image** (`string`): OCI image to use for the container. (Default: `'node:22-slim'`)
|
|
79
79
|
|
|
@@ -83,13 +83,13 @@ console.log(response.text)
|
|
|
83
83
|
|
|
84
84
|
**volumes** (`Record<string, string>`): Host-to-container bind mounts. Keys are host paths, values are container paths.
|
|
85
85
|
|
|
86
|
-
**mounts** (`string[]`): Raw
|
|
86
|
+
**mounts** (`string[]`): Raw container run --mount specs.
|
|
87
87
|
|
|
88
88
|
**network** (`string`): Apple container network attachment spec.
|
|
89
89
|
|
|
90
|
-
**publishedPorts** (`string[]`): Port publish specs passed as
|
|
90
|
+
**publishedPorts** (`string[]`): Port publish specs passed as --publish.
|
|
91
91
|
|
|
92
|
-
**publishedSockets** (`string[]`): Socket publish specs passed as
|
|
92
|
+
**publishedSockets** (`string[]`): Socket publish specs passed as --publish-socket.
|
|
93
93
|
|
|
94
94
|
**cpus** (`number | string`): Number of CPUs to allocate.
|
|
95
95
|
|
|
@@ -115,7 +115,7 @@ console.log(response.text)
|
|
|
115
115
|
|
|
116
116
|
**capDrop** (`string[]`): Linux capabilities to drop.
|
|
117
117
|
|
|
118
|
-
**tmpfs** (`string[]`): tmpfs destination paths passed as
|
|
118
|
+
**tmpfs** (`string[]`): tmpfs destination paths passed as --tmpfs, for example /tmp.
|
|
119
119
|
|
|
120
120
|
**dns** (`string[]`): DNS nameserver IPs.
|
|
121
121
|
|
|
@@ -95,17 +95,17 @@ const filesystem = new ArchilFilesystem({
|
|
|
95
95
|
|
|
96
96
|
## Constructor parameters
|
|
97
97
|
|
|
98
|
-
**diskId** (`string`): Existing Archil disk ID (e.g. "dsk-0123456789abcdef"). Mutually exclusive with
|
|
98
|
+
**diskId** (`string`): Existing Archil disk ID (e.g. "dsk-0123456789abcdef"). Mutually exclusive with createDiskOptions.
|
|
99
99
|
|
|
100
|
-
**createDiskOptions** (`CreateDiskRequest`): Options for creating a new disk on init. Mutually exclusive with
|
|
100
|
+
**createDiskOptions** (`CreateDiskRequest`): Options for creating a new disk on init. Mutually exclusive with diskId.
|
|
101
101
|
|
|
102
|
-
**apiKey** (`string`): Archil API key. Falls back to
|
|
102
|
+
**apiKey** (`string`): Archil API key. Falls back to ARCHIL\_API\_KEY environment variable.
|
|
103
103
|
|
|
104
|
-
**region** (`string`): Archil region (e.g. "aws-us-east-1"). Falls back to
|
|
104
|
+
**region** (`string`): Archil region (e.g. "aws-us-east-1"). Falls back to ARCHIL\_REGION environment variable.
|
|
105
105
|
|
|
106
106
|
**baseUrl** (`string`): Custom Archil control-plane URL (for testing or self-hosted deployments).
|
|
107
107
|
|
|
108
|
-
**s3BaseUrl** (`string`): Custom S3-compatible API URL. Falls back to
|
|
108
|
+
**s3BaseUrl** (`string`): Custom S3-compatible API URL. Falls back to ARCHIL\_S3\_BASE\_URL environment variable.
|
|
109
109
|
|
|
110
110
|
**id** (`string`): Unique identifier for this filesystem instance. (Default: `Auto-generated`)
|
|
111
111
|
|
|
@@ -101,7 +101,7 @@ const workspace = new Workspace({
|
|
|
101
101
|
|
|
102
102
|
**instance** (`SandboxInstance`): The underlying Blaxel SandboxInstance for direct access to Blaxel APIs. Throws SandboxNotReadyError if the sandbox has not been started.
|
|
103
103
|
|
|
104
|
-
**processes** (`BlaxelProcessManager`): Background process manager. See
|
|
104
|
+
**processes** (`BlaxelProcessManager`): Background process manager. See SandboxProcessManager reference.
|
|
105
105
|
|
|
106
106
|
## Background processes
|
|
107
107
|
|
|
@@ -321,7 +321,7 @@ const workspace = new Workspace({
|
|
|
321
321
|
|
|
322
322
|
**instance** (`Sandbox`): The underlying Daytona Sandbox instance. Throws SandboxNotReadyError if the sandbox has not been started.
|
|
323
323
|
|
|
324
|
-
**processes** (`DaytonaProcessManager`): Background process manager. See
|
|
324
|
+
**processes** (`DaytonaProcessManager`): Background process manager. See SandboxProcessManager reference.
|
|
325
325
|
|
|
326
326
|
## Background processes
|
|
327
327
|
|
|
@@ -61,7 +61,7 @@ const agent = new Agent({
|
|
|
61
61
|
|
|
62
62
|
**id** (`string`): Unique identifier for this sandbox instance. Used for label-based reconnection. (Default: `Auto-generated`)
|
|
63
63
|
|
|
64
|
-
**name** (`string`): Container display name passed to Docker as
|
|
64
|
+
**name** (`string`): Container display name passed to Docker as --name. Characters outside \[a-zA-Z0-9\_.-] are replaced with - and the result is prefixed if it would not start with an alphanumeric character. (Default: `` The sandbox `id` ``)
|
|
65
65
|
|
|
66
66
|
**image** (`string`): Docker image to use for the container. (Default: `'node:22-slim'`)
|
|
67
67
|
|
|
@@ -121,7 +121,7 @@ const agent = new Agent({
|
|
|
121
121
|
|
|
122
122
|
**container** (`Container`): The underlying dockerode Container instance. Throws SandboxNotReadyError if the sandbox has not been started.
|
|
123
123
|
|
|
124
|
-
**processes** (`DockerProcessManager`): Background process manager. See
|
|
124
|
+
**processes** (`DockerProcessManager`): Background process manager. See SandboxProcessManager reference.
|
|
125
125
|
|
|
126
126
|
## Background processes
|
|
127
127
|
|
|
@@ -76,7 +76,7 @@ const agent = new Agent({
|
|
|
76
76
|
|
|
77
77
|
**metadata** (`Record<string, unknown>`): Custom metadata attached to the sandbox instance.
|
|
78
78
|
|
|
79
|
-
**instructions** (`string | ((opts: { defaultInstructions: string; requestContext?: RequestContext }) => string)`): Custom instructions returned by
|
|
79
|
+
**instructions** (`string | ((opts: { defaultInstructions: string; requestContext?: RequestContext }) => string)`): Custom instructions returned by getInstructions(). A string fully replaces the defaults; a function receives the defaults and can extend or customize them per-request. Pass an empty string to suppress instructions entirely.
|
|
80
80
|
|
|
81
81
|
## Properties
|
|
82
82
|
|
|
@@ -88,7 +88,7 @@ const agent = new Agent({
|
|
|
88
88
|
|
|
89
89
|
**status** (`ProviderStatus`): 'pending' | 'initializing' | 'ready' | 'starting' | 'running' | 'stopping' | 'stopped' | 'destroying' | 'destroyed' | 'error'
|
|
90
90
|
|
|
91
|
-
**processes** (`E2BProcessManager`): Background process manager. See
|
|
91
|
+
**processes** (`E2BProcessManager`): Background process manager. See SandboxProcessManager reference.
|
|
92
92
|
|
|
93
93
|
## Background processes
|
|
94
94
|
|
|
@@ -105,7 +105,7 @@ All write operations (`writeFile`, `appendFile`, `deleteFile`, `copyFile`, `move
|
|
|
105
105
|
|
|
106
106
|
## Constructor parameters
|
|
107
107
|
|
|
108
|
-
**files** (`Files`): A pre-configured FilesSDK
|
|
108
|
+
**files** (`Files`): A pre-configured FilesSDK Files instance bound to the adapter and credentials you want to use.
|
|
109
109
|
|
|
110
110
|
**id** (`string`): Unique identifier for this filesystem instance. (Default: `Auto-generated`)
|
|
111
111
|
|
|
@@ -263,7 +263,7 @@ const instructions = filesystem.getInstructions?.()
|
|
|
263
263
|
|
|
264
264
|
**Parameters:**
|
|
265
265
|
|
|
266
|
-
**opts.requestContext** (`RequestContext`): Forwarded to the
|
|
266
|
+
**opts.requestContext** (`RequestContext`): Forwarded to the instructions function if one was provided in the constructor.
|
|
267
267
|
|
|
268
268
|
**Returns:** `string`
|
|
269
269
|
|
|
@@ -38,9 +38,9 @@ const response = await agent.generate('List all files in the workspace')
|
|
|
38
38
|
|
|
39
39
|
**id** (`string`): Unique identifier for this filesystem instance (Default: `Auto-generated`)
|
|
40
40
|
|
|
41
|
-
**contained** (`boolean`): When true, all file operations are restricted to stay within basePath. Prevents path traversal attacks and symlink escapes. See
|
|
41
|
+
**contained** (`boolean`): When true, all file operations are restricted to stay within basePath. Prevents path traversal attacks and symlink escapes. See containment. (Default: `true`)
|
|
42
42
|
|
|
43
|
-
**allowedPaths** (`string[]`): Additional directories the agent can access outside of
|
|
43
|
+
**allowedPaths** (`string[]`): Additional directories the agent can access outside of basePath. (Default: `[]`)
|
|
44
44
|
|
|
45
45
|
**instructions** (`string | ((opts: { defaultInstructions: string; requestContext?: RequestContext }) => string)`): Custom instructions that override the default instructions returned by getInstructions(). Pass a string to fully replace them, or a function to extend them with access to the current requestContext for per-request customization.
|
|
46
46
|
|
|
@@ -302,7 +302,7 @@ const instructions = filesystem.getInstructions({ requestContext })
|
|
|
302
302
|
|
|
303
303
|
**Parameters:**
|
|
304
304
|
|
|
305
|
-
**opts.requestContext** (`RequestContext`): Forwarded to the
|
|
305
|
+
**opts.requestContext** (`RequestContext`): Forwarded to the instructions function if one was provided in the constructor.
|
|
306
306
|
|
|
307
307
|
**Returns:** `string`
|
|
308
308
|
|
|
@@ -84,7 +84,7 @@ Configuration options for native OS sandboxing (used with `isolation: 'seatbelt'
|
|
|
84
84
|
|
|
85
85
|
**workingDirectory** (`string`): The configured working directory
|
|
86
86
|
|
|
87
|
-
**processes** (`LocalProcessManager`): Background process manager. See
|
|
87
|
+
**processes** (`LocalProcessManager`): Background process manager. See SandboxProcessManager reference.
|
|
88
88
|
|
|
89
89
|
## Path Resolution
|
|
90
90
|
|
|
@@ -65,7 +65,7 @@ const agent = new Agent({
|
|
|
65
65
|
|
|
66
66
|
## Constructor parameters
|
|
67
67
|
|
|
68
|
-
**apiKey** (`string`): Mesa API key. Falls back to
|
|
68
|
+
**apiKey** (`string`): Mesa API key. Falls back to MESA\_API\_KEY when omitted.
|
|
69
69
|
|
|
70
70
|
**org** (`string`): Mesa org slug. When omitted, the Mesa SDK resolves the default org.
|
|
71
71
|
|
|
@@ -81,9 +81,9 @@ const agent = new Agent({
|
|
|
81
81
|
|
|
82
82
|
**id** (`string`): Filesystem instance identifier.
|
|
83
83
|
|
|
84
|
-
**name** (`string`): Provider name (
|
|
84
|
+
**name** (`string`): Provider name ('MesaFilesystem').
|
|
85
85
|
|
|
86
|
-
**provider** (`string`): Provider identifier (
|
|
86
|
+
**provider** (`string`): Provider identifier ('mesa').
|
|
87
87
|
|
|
88
88
|
**readOnly** (`boolean | undefined`): Whether write operations are blocked.
|
|
89
89
|
|
|
@@ -114,7 +114,7 @@ Get your credentials from the [Modal dashboard](https://modal.com/settings/token
|
|
|
114
114
|
|
|
115
115
|
**modal** (`Sandbox`): The underlying Modal Sandbox instance. Throws SandboxNotReadyError if the sandbox has not been started.
|
|
116
116
|
|
|
117
|
-
**processes** (`ModalProcessManager`): Background process manager. See
|
|
117
|
+
**processes** (`ModalProcessManager`): Background process manager. See SandboxProcessManager reference.
|
|
118
118
|
|
|
119
119
|
## Sandbox lifecycle
|
|
120
120
|
|
|
@@ -188,7 +188,7 @@ const result = await sandbox.executeCommand('cat', ['/tmp/state.txt'])
|
|
|
188
188
|
|
|
189
189
|
**railway** (`Sandbox`): The underlying Railway Sandbox instance for direct SDK access. Throws SandboxNotReadyError if the sandbox has not been started.
|
|
190
190
|
|
|
191
|
-
**processes** (`RailwayProcessManager`): Background process manager. See
|
|
191
|
+
**processes** (`RailwayProcessManager`): Background process manager. See SandboxProcessManager reference.
|
|
192
192
|
|
|
193
193
|
## Methods
|
|
194
194
|
|
|
@@ -164,13 +164,13 @@ Tigris uses virtual-hosted-style addressing, so `forcePathStyle` must be set to
|
|
|
164
164
|
|
|
165
165
|
**region** (`string`): AWS region (use 'auto' for R2)
|
|
166
166
|
|
|
167
|
-
**credentials** (`AwsCredentialIdentity | AwsCredentialIdentityProvider`): AWS credentials or credential provider function. Accepts static credentials or a provider that auto-refreshes (e.g.
|
|
167
|
+
**credentials** (`AwsCredentialIdentity | AwsCredentialIdentityProvider`): AWS credentials or credential provider function. Accepts static credentials or a provider that auto-refreshes (e.g. fromNodeProviderChain() from @aws-sdk/credential-providers). Takes precedence over accessKeyId/secretAccessKey/sessionToken. When all credential options are omitted, the SDK default credential provider chain is used.
|
|
168
168
|
|
|
169
|
-
**accessKeyId** (`string`): AWS access key ID. When omitted along with
|
|
169
|
+
**accessKeyId** (`string`): AWS access key ID. When omitted along with secretAccessKey and credentials, the SDK default credential provider chain is used.
|
|
170
170
|
|
|
171
|
-
**secretAccessKey** (`string`): AWS secret access key. When omitted along with
|
|
171
|
+
**secretAccessKey** (`string`): AWS secret access key. When omitted along with accessKeyId and credentials, the SDK default credential provider chain is used.
|
|
172
172
|
|
|
173
|
-
**sessionToken** (`string`): AWS session token for static temporary credentials. Use with
|
|
173
|
+
**sessionToken** (`string`): AWS session token for static temporary credentials. Use with accessKeyId/secretAccessKey only when passing a complete temporary credential set manually. For auto-refreshing SSO, AssumeRole, or container credentials, use the credentials provider parameter or the SDK default credential provider chain.
|
|
174
174
|
|
|
175
175
|
**endpoint** (`string`): Custom endpoint URL for S3-compatible storage (R2, MinIO, Tigris, etc.)
|
|
176
176
|
|
|
@@ -85,7 +85,7 @@ const instructions = sandbox.getInstructions?.()
|
|
|
85
85
|
|
|
86
86
|
**Parameters:**
|
|
87
87
|
|
|
88
|
-
**opts.requestContext** (`RequestContext`): Forwarded to the
|
|
88
|
+
**opts.requestContext** (`RequestContext`): Forwarded to the instructions function if one was provided in the constructor.
|
|
89
89
|
|
|
90
90
|
**Returns:** `string`
|
|
91
91
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# VercelSandbox
|
|
4
4
|
|
|
5
|
-
Executes commands inside [Vercel Sandbox](https://vercel.com/docs/vercel-sandbox)
|
|
5
|
+
Executes commands inside [Vercel Sandbox](https://vercel.com/docs/vercel-sandbox) which is an ephemeral [Firecracker](https://firecracker-microvm.github.io/) MicroVM running Amazon Linux 2023. Provides a persistent in-session filesystem, `sudo` access, exposed ports, and background processes.
|
|
6
6
|
|
|
7
7
|
> **Info:** For interface details, see the [WorkspaceSandbox interface](https://mastra.ai/reference/workspace/sandbox).
|
|
8
8
|
|
|
9
|
-
> **Note:** This is distinct from [`
|
|
9
|
+
> **Note:** This is distinct from [`VercelServerlessSandbox`](https://mastra.ai/reference/workspace/vercel-serverless), which runs commands as stateless Vercel serverless **Functions**. `VercelSandbox` runs a full Linux MicroVM with a persistent filesystem and long-running processes.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -36,7 +36,7 @@ bun add @mastra/vercel
|
|
|
36
36
|
|
|
37
37
|
## Authentication
|
|
38
38
|
|
|
39
|
-
The `@vercel/sandbox` SDK uses a Vercel OIDC token automatically when
|
|
39
|
+
The `@vercel/sandbox` SDK uses a Vercel OIDC token automatically when no explicit credentials are provided. If you provide `token`, `teamId`, or `projectId`, provide all three values together.
|
|
40
40
|
|
|
41
41
|
**OIDC (recommended)**:
|
|
42
42
|
|
|
@@ -62,7 +62,7 @@ VERCEL_PROJECT_ID=your-project-id
|
|
|
62
62
|
**Constructor**:
|
|
63
63
|
|
|
64
64
|
```typescript
|
|
65
|
-
new
|
|
65
|
+
new VercelSandbox({
|
|
66
66
|
token: 'your-token',
|
|
67
67
|
teamId: 'your-team-id',
|
|
68
68
|
projectId: 'your-project-id',
|
|
@@ -71,15 +71,15 @@ new VercelMicroVMSandbox({
|
|
|
71
71
|
|
|
72
72
|
## Usage
|
|
73
73
|
|
|
74
|
-
Add a `
|
|
74
|
+
Add a `VercelSandbox` to a workspace and assign it to an agent:
|
|
75
75
|
|
|
76
76
|
```typescript
|
|
77
77
|
import { Agent } from '@mastra/core/agent'
|
|
78
78
|
import { Workspace } from '@mastra/core/workspace'
|
|
79
|
-
import {
|
|
79
|
+
import { VercelSandbox } from '@mastra/vercel'
|
|
80
80
|
|
|
81
81
|
const workspace = new Workspace({
|
|
82
|
-
sandbox: new
|
|
82
|
+
sandbox: new VercelSandbox({
|
|
83
83
|
runtime: 'node24',
|
|
84
84
|
timeout: 600_000,
|
|
85
85
|
}),
|
|
@@ -103,14 +103,14 @@ console.log(response.text)
|
|
|
103
103
|
Allocate vCPUs (2048 MB of memory per vCPU) and expose ports to reach network services running inside the sandbox:
|
|
104
104
|
|
|
105
105
|
```typescript
|
|
106
|
-
const sandbox = new
|
|
106
|
+
const sandbox = new VercelSandbox({
|
|
107
107
|
runtime: 'node24',
|
|
108
108
|
resources: { vcpus: 4 },
|
|
109
109
|
ports: [3000],
|
|
110
110
|
})
|
|
111
111
|
|
|
112
112
|
const workspace = new Workspace({ sandbox })
|
|
113
|
-
await sandbox.
|
|
113
|
+
await sandbox.start()
|
|
114
114
|
|
|
115
115
|
// The public HTTPS domain for an exposed port is available via getInfo()
|
|
116
116
|
const { metadata } = sandbox.getInfo()
|
|
@@ -156,26 +156,32 @@ Both callbacks are optional and can be used independently.
|
|
|
156
156
|
|
|
157
157
|
**instructions** (`string | ((opts) => string)`): Override the default instructions returned by getInstructions(). Pass a string to replace them, or a function to extend the defaults.
|
|
158
158
|
|
|
159
|
+
**onStart** (`SandboxLifecycleHook`): Lifecycle hook called after the sandbox reaches running status.
|
|
160
|
+
|
|
161
|
+
**onStop** (`SandboxLifecycleHook`): Lifecycle hook called before the sandbox stops.
|
|
162
|
+
|
|
163
|
+
**onDestroy** (`SandboxLifecycleHook`): Lifecycle hook called before the sandbox is destroyed.
|
|
164
|
+
|
|
159
165
|
## Properties
|
|
160
166
|
|
|
161
167
|
**id** (`string`): Sandbox instance identifier.
|
|
162
168
|
|
|
163
|
-
**name** (`
|
|
169
|
+
**name** (`'VercelSandbox'`): Human-readable name.
|
|
164
170
|
|
|
165
|
-
**provider** (`
|
|
171
|
+
**provider** (`'vercel-sandbox'`): Provider type identifier.
|
|
166
172
|
|
|
167
173
|
**status** (`ProviderStatus`): 'pending' | 'starting' | 'running' | 'stopping' | 'stopped' | 'destroying' | 'destroyed' | 'error'
|
|
168
174
|
|
|
169
175
|
**sandbox** (`Sandbox`): The underlying @vercel/sandbox Sandbox instance. Throws SandboxNotReadyError if the sandbox has not been started.
|
|
170
176
|
|
|
171
|
-
**processes** (`
|
|
177
|
+
**processes** (`VercelSandboxProcessManager`): Background process manager. See SandboxProcessManager reference.
|
|
172
178
|
|
|
173
179
|
## Background processes
|
|
174
180
|
|
|
175
|
-
`
|
|
181
|
+
`VercelSandbox` includes a process manager for spawning and managing background processes. Each spawned process runs as a detached command inside the MicroVM, with output streamed through the command logs.
|
|
176
182
|
|
|
177
183
|
```typescript
|
|
178
|
-
const sandbox = new
|
|
184
|
+
const sandbox = new VercelSandbox({ runtime: 'node24', ports: [3000] })
|
|
179
185
|
await sandbox.start()
|
|
180
186
|
|
|
181
187
|
const handle = await sandbox.processes.spawn('node server.js', {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# VercelServerlessSandbox
|
|
4
4
|
|
|
5
|
-
Executes commands as [Vercel](https://vercel.com) serverless functions. Provides globally
|
|
5
|
+
Executes commands as [Vercel](https://vercel.com) serverless functions. Provides globally distributed, zero-infrastructure execution with automatic scaling.
|
|
6
6
|
|
|
7
7
|
> **Info:** For interface details, see [WorkspaceSandbox interface](https://mastra.ai/reference/workspace/sandbox).
|
|
8
8
|
|
|
9
|
-
> **Warning:**
|
|
9
|
+
> **Warning:** VercelServerlessSandbox is stateless. It doesn't provide a persistent filesystem, interactive shell, or long-running background processes. Only `/tmp` is writable, and it is ephemeral between invocations.
|
|
10
10
|
|
|
11
|
-
> **Note:** For a full Linux MicroVM with a persistent filesystem, `sudo` access, exposed ports, and background processes, use [`
|
|
11
|
+
> **Note:** For a full Linux MicroVM with a persistent filesystem, `sudo` access, exposed ports, and background processes, use [`VercelSandbox`](https://mastra.ai/reference/workspace/vercel-sandbox), which is backed by the [Vercel Sandbox](https://vercel.com/docs/vercel-sandbox) product.
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -38,15 +38,15 @@ bun add @mastra/vercel
|
|
|
38
38
|
|
|
39
39
|
## Usage
|
|
40
40
|
|
|
41
|
-
Add a `
|
|
41
|
+
Add a `VercelServerlessSandbox` to a workspace and assign it to an agent:
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
44
44
|
import { Agent } from '@mastra/core/agent'
|
|
45
45
|
import { Workspace } from '@mastra/core/workspace'
|
|
46
|
-
import {
|
|
46
|
+
import { VercelServerlessSandbox } from '@mastra/vercel'
|
|
47
47
|
|
|
48
48
|
const workspace = new Workspace({
|
|
49
|
-
sandbox: new
|
|
49
|
+
sandbox: new VercelServerlessSandbox({
|
|
50
50
|
token: process.env.VERCEL_TOKEN,
|
|
51
51
|
}),
|
|
52
52
|
})
|
|
@@ -54,6 +54,7 @@ const workspace = new Workspace({
|
|
|
54
54
|
const agent = new Agent({
|
|
55
55
|
id: 'dev-agent',
|
|
56
56
|
name: 'dev-agent',
|
|
57
|
+
instructions: 'You are a coding assistant working in this workspace.',
|
|
57
58
|
model: 'anthropic/claude-sonnet-4-6',
|
|
58
59
|
workspace,
|
|
59
60
|
})
|
|
@@ -63,7 +64,7 @@ const agent = new Agent({
|
|
|
63
64
|
|
|
64
65
|
```typescript
|
|
65
66
|
const workspace = new Workspace({
|
|
66
|
-
sandbox: new
|
|
67
|
+
sandbox: new VercelServerlessSandbox({
|
|
67
68
|
token: process.env.VERCEL_TOKEN,
|
|
68
69
|
teamId: 'team_abc123',
|
|
69
70
|
regions: ['iad1', 'sfo1'],
|
|
@@ -78,7 +79,7 @@ const workspace = new Workspace({
|
|
|
78
79
|
|
|
79
80
|
## Constructor parameters
|
|
80
81
|
|
|
81
|
-
**token** (`string`): Vercel API token. Falls back to
|
|
82
|
+
**token** (`string`): Vercel API token. Falls back to VERCEL\_TOKEN environment variable.
|
|
82
83
|
|
|
83
84
|
**teamId** (`string`): Vercel team ID for team-scoped deployments.
|
|
84
85
|
|
|
@@ -94,21 +95,27 @@ const workspace = new Workspace({
|
|
|
94
95
|
|
|
95
96
|
**commandTimeout** (`number`): Per-invocation command timeout in milliseconds. (Default: `55000`)
|
|
96
97
|
|
|
97
|
-
**instructions** (`string | ((opts) => string)`): Custom instructions that override the default instructions returned by
|
|
98
|
+
**instructions** (`string | ((opts) => string)`): Custom instructions that override the default instructions returned by getInstructions(). Pass a string to fully replace, or a function to extend the defaults.
|
|
99
|
+
|
|
100
|
+
**onStart** (`SandboxLifecycleHook`): Lifecycle hook called after the sandbox reaches running status.
|
|
101
|
+
|
|
102
|
+
**onStop** (`SandboxLifecycleHook`): Lifecycle hook called before the sandbox stops.
|
|
103
|
+
|
|
104
|
+
**onDestroy** (`SandboxLifecycleHook`): Lifecycle hook called before the sandbox is destroyed.
|
|
98
105
|
|
|
99
106
|
## Properties
|
|
100
107
|
|
|
101
108
|
**id** (`string`): Unique identifier for this sandbox instance.
|
|
102
109
|
|
|
103
|
-
**name** (`'
|
|
110
|
+
**name** (`'VercelServerlessSandbox'`): Human-readable name.
|
|
104
111
|
|
|
105
|
-
**provider** (`'vercel'`): Provider type identifier.
|
|
112
|
+
**provider** (`'vercel-serverless'`): Provider type identifier.
|
|
106
113
|
|
|
107
|
-
**status** (`ProviderStatus`): Current lifecycle status:
|
|
114
|
+
**status** (`ProviderStatus`): Current lifecycle status: 'pending', 'starting', 'running', 'stopping', 'stopped', 'destroying', 'destroyed', or 'error'.
|
|
108
115
|
|
|
109
116
|
## Limitations
|
|
110
117
|
|
|
111
|
-
|
|
118
|
+
VercelServerlessSandbox uses serverless functions under the hood, which means:
|
|
112
119
|
|
|
113
120
|
- **No persistent filesystem**: Files written to `/tmp` are ephemeral and cleared between invocations.
|
|
114
121
|
- **No interactive shell**: Commands run via `/bin/sh -c` with no stdin streaming.
|
|
@@ -31,19 +31,19 @@ const workspace = new Workspace({
|
|
|
31
31
|
|
|
32
32
|
**name** (`string`): Human-readable name (Default: `workspace-{id}`)
|
|
33
33
|
|
|
34
|
-
**filesystem** (`WorkspaceFilesystem | WorkspaceFilesystemResolver`): Filesystem provider instance, or a resolver function that receives
|
|
34
|
+
**filesystem** (`WorkspaceFilesystem | WorkspaceFilesystemResolver`): Filesystem provider instance, or a resolver function that receives requestContext and returns a filesystem per request. See dynamic filesystem.
|
|
35
35
|
|
|
36
|
-
**sandbox** (`WorkspaceSandbox | WorkspaceSandboxResolver`): Sandbox provider instance, or a resolver function that receives
|
|
36
|
+
**sandbox** (`WorkspaceSandbox | WorkspaceSandboxResolver`): Sandbox provider instance, or a resolver function that receives requestContext and returns a sandbox per request. See dynamic sandbox.
|
|
37
37
|
|
|
38
|
-
**instructions.dynamicSandbox** (`'placeholder' | 'resolve' | (({ requestContext }) => string)`): Controls how a resolver-backed
|
|
38
|
+
**instructions.dynamicSandbox** (`'placeholder' | 'resolve' | (({ requestContext }) => string)`): Controls how a resolver-backed sandbox contributes to workspace instructions. 'placeholder' (default) emits stable text without calling the resolver. 'resolve' calls the resolver and uses the sandbox's own instructions. A function returns custom text without resolving. Has no effect on a static sandbox. (Default: `'placeholder'`)
|
|
39
39
|
|
|
40
|
-
**sandboxCacheKey** (`({ requestContext }) => string | undefined`): Stable cache key for a resolver-backed
|
|
40
|
+
**sandboxCacheKey** (`({ requestContext }) => string | undefined`): Stable cache key for a resolver-backed sandbox. When set, resolved sandboxes are memoized per key instead of per RequestContext instance, so background-process tools reach the same sandbox across follow-up requests. Has no effect on a static sandbox.
|
|
41
41
|
|
|
42
42
|
**bm25** (`boolean | BM25Config`): Enable BM25 keyword search. Pass true for defaults or a config object. (Default: `undefined`)
|
|
43
43
|
|
|
44
44
|
**vectorStore** (`MastraVector`): Vector store for semantic search
|
|
45
45
|
|
|
46
|
-
**embedder** (`Embedder`): Function that turns text into vectors. Required when
|
|
46
|
+
**embedder** (`Embedder`): Function that turns text into vectors. Required when vectorStore is set. Accepts either a single-text function (text: string) => Promise\<number\[]> or a batch-capable function (texts: string\[]) => Promise\<number\[]\[]> that has a batch: true property and an optional maxBatchSize. See Batch embedding.
|
|
47
47
|
|
|
48
48
|
**autoIndexPaths** (`string[]`): Paths or glob patterns to auto-index on init(). Supports glob patterns like '\*\*/\*.md' for selective indexing.
|
|
49
49
|
|
|
@@ -61,7 +61,7 @@ const workspace = new Workspace({
|
|
|
61
61
|
|
|
62
62
|
**tools.requireApproval** (`boolean`): Whether the tool requires user approval before execution
|
|
63
63
|
|
|
64
|
-
**tools.name** (`string`): Custom name to expose this tool as. Replaces the default
|
|
64
|
+
**tools.name** (`string`): Custom name to expose this tool as. Replaces the default mastra\_workspace\_\* name. The config key must still use the original WORKSPACE\_TOOLS constant.
|
|
65
65
|
|
|
66
66
|
**tools.requireReadBeforeWrite** (`boolean`): For write tools: require reading the file first to prevent overwrites
|
|
67
67
|
|
|
@@ -144,9 +144,9 @@ const workspace = new Workspace({
|
|
|
144
144
|
})
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
**beforeToolCall** (`(context: WorkspaceToolHookContext) => void | WorkspaceToolBeforeHookResult | Promise<void | WorkspaceToolBeforeHookResult>`): Runs before a workspace tool executes. Receives
|
|
147
|
+
**beforeToolCall** (`(context: WorkspaceToolHookContext) => void | WorkspaceToolBeforeHookResult | Promise<void | WorkspaceToolBeforeHookResult>`): Runs before a workspace tool executes. Receives { toolName, workspaceToolName, input, context }. Return { proceed: false, output } to skip the tool call and use output as its result.
|
|
148
148
|
|
|
149
|
-
**afterToolCall** (`(context: WorkspaceToolAfterHookContext) => void | Promise<void>`): Runs after a workspace tool executes. Receives
|
|
149
|
+
**afterToolCall** (`(context: WorkspaceToolAfterHookContext) => void | Promise<void>`): Runs after a workspace tool executes. Receives { toolName, workspaceToolName, input, context, output, error }. output is undefined when the tool throws, and error is set instead.
|
|
150
150
|
|
|
151
151
|
If the owning agent also defines [tool hooks](https://mastra.ai/reference/agents/agent), workspace hooks run inside the agent hook wrapper: agent `beforeToolCall` runs first, then workspace `beforeToolCall`, then the tool, then workspace `afterToolCall`, then agent `afterToolCall`.
|
|
152
152
|
|
|
@@ -158,9 +158,9 @@ If the owning agent also defines [tool hooks](https://mastra.ai/reference/agents
|
|
|
158
158
|
|
|
159
159
|
**status** (`WorkspaceStatus`): 'pending' | 'initializing' | 'ready' | 'paused' | 'error' | 'destroying' | 'destroyed'
|
|
160
160
|
|
|
161
|
-
**filesystem** (`WorkspaceFilesystem | undefined`): The static filesystem provider. Returns
|
|
161
|
+
**filesystem** (`WorkspaceFilesystem | undefined`): The static filesystem provider. Returns undefined when a resolver function is configured — use hasFilesystemConfig() to check availability.
|
|
162
162
|
|
|
163
|
-
**sandbox** (`WorkspaceSandbox | undefined`): The static sandbox provider. Returns
|
|
163
|
+
**sandbox** (`WorkspaceSandbox | undefined`): The static sandbox provider. Returns undefined when a resolver function is configured — use hasSandboxConfig() to check availability.
|
|
164
164
|
|
|
165
165
|
**skills** (`WorkspaceSkills | undefined`): Skills interface for accessing SKILL.md files
|
|
166
166
|
|
|
@@ -250,9 +250,9 @@ const info = await workspace.getInfo({ resolveDynamicProviders: false })
|
|
|
250
250
|
|
|
251
251
|
**options.includeFileCount** (`boolean`): Whether to count total files. This can be slow for large workspaces.
|
|
252
252
|
|
|
253
|
-
**options.requestContext** (`RequestContext`): Passed to dynamic provider resolvers when
|
|
253
|
+
**options.requestContext** (`RequestContext`): Passed to dynamic provider resolvers when resolveDynamicProviders is enabled.
|
|
254
254
|
|
|
255
|
-
**options.resolveDynamicProviders** (`boolean`): Whether to invoke dynamic provider resolvers. Set to
|
|
255
|
+
**options.resolveDynamicProviders** (`boolean`): Whether to invoke dynamic provider resolvers. Set to false when you only need metadata and want resolver-backed providers reported as dynamic. (Default: `true`)
|
|
256
256
|
|
|
257
257
|
#### `getInstructions(opts?)`
|
|
258
258
|
|
|
@@ -270,7 +270,7 @@ const instructions = workspace.getInstructions({ requestContext })
|
|
|
270
270
|
|
|
271
271
|
**Parameters:**
|
|
272
272
|
|
|
273
|
-
**opts.requestContext** (`RequestContext`): Forwarded to the
|
|
273
|
+
**opts.requestContext** (`RequestContext`): Forwarded to the instructions function on the filesystem or sandbox provider, if one is configured.
|
|
274
274
|
|
|
275
275
|
**Returns:** `string`
|
|
276
276
|
|
|
@@ -284,7 +284,7 @@ const instructions = await workspace.getInstructionsAsync({ requestContext })
|
|
|
284
284
|
|
|
285
285
|
**Parameters:**
|
|
286
286
|
|
|
287
|
-
**opts.requestContext** (`RequestContext`): Passed to the dynamic filesystem resolver, and to the dynamic sandbox resolver when
|
|
287
|
+
**opts.requestContext** (`RequestContext`): Passed to the dynamic filesystem resolver, and to the dynamic sandbox resolver when instructions.dynamicSandbox is 'resolve'.
|
|
288
288
|
|
|
289
289
|
**Returns:** `Promise<string>`
|
|
290
290
|
|
|
@@ -425,7 +425,7 @@ With a static filesystem, write tools (`write_file`, `edit_file`, `delete`, `mkd
|
|
|
425
425
|
|
|
426
426
|
The `read_file` tool accepts `mediaTypes` and `maxMediaBytes` options to control which mime types are surfaced to the model as native media parts and how large those files can be:
|
|
427
427
|
|
|
428
|
-
**mediaTypes** (`string[] | ((mimeType: string) => boolean) | false`): Which mime types to surface to the model as media parts (file/image parts) rather than as text. Accepts an array of globs (e.g.
|
|
428
|
+
**mediaTypes** (`string[] | ((mimeType: string) => boolean) | false`): Which mime types to surface to the model as media parts (file/image parts) rather than as text. Accepts an array of globs (e.g. \['image/\*']), a custom predicate function, or false to disable media detection. Defaults to the cross-provider-safe intersection of image formats plus PDF. Only applies when the caller doesn't pass an explicit encoding. (Default: `['image/png', 'image/jpeg', 'image/webp', 'application/pdf']`)
|
|
429
429
|
|
|
430
430
|
**maxMediaBytes** (`number`): Maximum file size (in bytes) to inline as a media part. Files larger than this fall back to metadata-only output rather than being fully base64-encoded into context and persisted in storage on rehydration. (Default: `10 * 1024 * 1024 (10 MiB)`)
|
|
431
431
|
|