@mastra/mcp-docs-server 1.2.17-alpha.13 → 1.2.17-alpha.16
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/course/02-agent-tools-mcp/32-conclusion.md +1 -1
- package/.docs/docs/agents/code-mode.md +3 -3
- package/.docs/docs/agents/guardrails.md +1 -1
- package/.docs/docs/agents/{agent-approval.md → human-in-the-loop.md} +5 -5
- package/.docs/docs/agents/networks.md +3 -3
- package/.docs/docs/agents/overview.md +7 -7
- package/.docs/docs/agents/processors.md +2 -2
- package/.docs/docs/agents/{using-tools.md → tools.md} +7 -7
- package/.docs/docs/{server/auth → auth}/custom-auth-provider.md +1 -1
- package/.docs/docs/{server/auth → auth}/fga.md +27 -1
- package/.docs/docs/{server/auth.md → auth/overview.md} +4 -4
- package/.docs/docs/{server/auth → auth}/simple-auth.md +1 -1
- package/.docs/docs/{server/auth → auth}/workers.md +2 -2
- package/.docs/docs/{capabilities/channels.md → channels.md} +2 -2
- package/.docs/docs/{agents → connections}/a2a.md +2 -2
- package/.docs/docs/{agents → connections}/acp.md +1 -1
- package/.docs/docs/{mcp/overview.md → connections/mcp.md} +1 -1
- package/.docs/docs/connections/overview.md +5 -5
- package/.docs/docs/{agents → connections}/sdk-agents.md +1 -1
- package/.docs/docs/deployment/mastra-server.md +2 -2
- package/.docs/docs/deployment/overview.md +1 -1
- package/.docs/docs/deployment/sandbox.md +3 -3
- package/.docs/docs/deployment/workers.md +4 -4
- package/.docs/docs/guides/multi-agent-systems.md +7 -7
- package/.docs/docs/guides/streaming.md +1 -1
- package/.docs/docs/harness/agent-controller.md +5 -3
- package/.docs/docs/{long-running-agents → harness}/background-tasks.md +5 -5
- package/.docs/docs/{long-running-agents → harness}/durable-agents.md +2 -2
- package/.docs/docs/{long-running-agents → harness}/goals.md +6 -6
- package/.docs/docs/harness/overview.md +11 -10
- package/.docs/docs/{long-running-agents → harness}/schedules.md +5 -5
- package/.docs/docs/{long-running-agents → harness}/signal-providers.md +4 -4
- package/.docs/docs/mastra-platform/deploy.md +1 -1
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/mastra-platform/server.md +1 -1
- package/.docs/docs/memory/message-history.md +1 -1
- package/.docs/docs/memory/overview.md +4 -4
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +1 -1
- package/.docs/docs/{workspace → sandbox}/filesystem.md +2 -2
- package/.docs/docs/{workspace → sandbox}/lsp.md +3 -3
- package/.docs/docs/{workspace/sandbox.md → sandbox/overview.md} +3 -3
- package/.docs/docs/{workspace → sandbox}/search.md +2 -2
- package/.docs/docs/{workspace → sandbox}/skills.md +5 -5
- package/.docs/docs/server/custom-api-routes.md +2 -2
- package/.docs/docs/server/mastra-client.md +2 -2
- package/.docs/docs/server/{mastra-server.md → overview.md} +3 -3
- package/.docs/docs/server/pubsub.md +2 -2
- package/.docs/docs/server/server-adapters.md +4 -4
- package/.docs/docs/{agents/skills.md → skills.md} +4 -4
- package/.docs/docs/{storage/overview.md → storage.md} +1 -1
- package/.docs/docs/studio/auth.md +4 -4
- package/.docs/docs/studio/overview.md +2 -2
- package/.docs/docs/{capabilities/subagents.md → subagents.md} +35 -5
- package/.docs/docs/workflows/agents-and-tools.md +1 -1
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/docs/workflows/scheduled-workflows.md +2 -2
- package/.docs/docs/workflows/snapshots.md +1 -1
- package/.docs/integrations/agentic-ui/ai-sdk-ui.md +1 -1
- package/.docs/integrations/agentic-ui/copilotkit.md +1 -1
- package/.docs/integrations/auth/google.md +2 -2
- package/.docs/integrations/auth/workos.md +1 -1
- package/.docs/integrations/browsers/agent-browser.md +2 -2
- package/.docs/integrations/browsers/browser-viewer.md +6 -6
- package/.docs/integrations/browsers/firecrawl.md +1 -1
- package/.docs/integrations/browsers/stagehand.md +2 -2
- package/.docs/integrations/channels/discord.md +2 -2
- package/.docs/integrations/channels/github.md +1 -1
- package/.docs/integrations/channels/imessage.md +4 -4
- package/.docs/integrations/channels/slack.md +5 -5
- package/.docs/integrations/channels/teams.md +2 -2
- package/.docs/integrations/channels/telegram.md +2 -2
- package/.docs/integrations/channels/whatsapp.md +2 -2
- package/.docs/integrations/databases/postgresql.md +1 -0
- package/.docs/integrations/deploy/amazon-ec2.md +2 -2
- package/.docs/integrations/deploy/aws-lambda.md +3 -3
- package/.docs/integrations/deploy/azure-app-services.md +2 -2
- package/.docs/integrations/deploy/cloudflare.md +2 -2
- package/.docs/integrations/deploy/digital-ocean.md +3 -3
- package/.docs/integrations/deploy/kubernetes.md +11 -11
- package/.docs/integrations/deploy/netlify.md +3 -3
- package/.docs/integrations/deploy/vercel.md +2 -2
- package/.docs/integrations/file-storage/amazon-s3.md +1 -1
- package/.docs/integrations/file-storage/azure-blob.md +1 -1
- package/.docs/integrations/file-storage/google-cloud-storage.md +1 -1
- package/.docs/integrations/file-storage/mesa.md +2 -2
- package/.docs/integrations/file-storage/vercel-files.md +1 -1
- package/.docs/integrations/frameworks/astro.md +1 -1
- package/.docs/integrations/frameworks/electron.md +1 -1
- package/.docs/integrations/frameworks/express.md +1 -1
- package/.docs/integrations/frameworks/hono.md +1 -1
- package/.docs/integrations/frameworks/nestjs.md +1 -1
- package/.docs/integrations/frameworks/next-js.md +1 -1
- package/.docs/integrations/frameworks/nuxt.md +1 -1
- package/.docs/integrations/frameworks/sveltekit.md +1 -1
- package/.docs/integrations/frameworks/vite-react.md +1 -1
- package/.docs/integrations/sandboxes/agentcore.md +1 -1
- package/.docs/integrations/sandboxes/apple-container.md +1 -1
- package/.docs/integrations/sandboxes/daytona.md +1 -1
- package/.docs/integrations/sandboxes/docker.md +4 -3
- package/.docs/integrations/sandboxes/e2b.md +1 -1
- package/.docs/integrations/sandboxes/modal.md +1 -1
- package/.docs/models/environment-variables.md +2 -0
- package/.docs/models/gateways/vercel.md +3 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/arcee.md +79 -0
- package/.docs/models/providers/baseten.md +1 -1
- package/.docs/models/providers/cerebras.md +2 -3
- package/.docs/models/providers/cloudflare-workers-ai.md +1 -1
- package/.docs/models/providers/cortecs.md +2 -1
- package/.docs/models/providers/crof.md +1 -1
- package/.docs/models/providers/crossmodel.md +1 -1
- package/.docs/models/providers/deepinfra.md +2 -1
- package/.docs/models/providers/edenai.md +11 -5
- package/.docs/models/providers/huggingface.md +3 -1
- package/.docs/models/providers/hyper.md +5 -5
- package/.docs/models/providers/jalapeno.md +89 -0
- package/.docs/models/providers/kilo.md +8 -7
- package/.docs/models/providers/merge-gateway.md +3 -1
- package/.docs/models/providers/nano-gpt.md +3 -9
- package/.docs/models/providers/vivgrid.md +2 -1
- package/.docs/models/providers.md +2 -0
- package/.docs/reference/acp/acp-agent.md +2 -2
- package/.docs/reference/acp/create-acp-tool.md +1 -1
- package/.docs/reference/agent-controller/agent-controller-class.md +2 -2
- package/.docs/reference/agents/agent.md +2 -2
- package/.docs/reference/agents/channels.md +2 -2
- package/.docs/reference/agents/createSkill.md +2 -2
- package/.docs/reference/agents/durable-agent.md +1 -1
- package/.docs/reference/agents/generate.md +1 -1
- package/.docs/reference/agents/getSkill.md +1 -1
- package/.docs/reference/agents/listSkills.md +1 -1
- package/.docs/reference/agents/listSuspendedRuns.md +6 -6
- package/.docs/reference/agents/listTools.md +2 -2
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/ai-sdk/handle-network-stream.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +1 -1
- package/.docs/reference/auth/fga.md +7 -5
- package/.docs/reference/auth/jwt.md +1 -1
- package/.docs/reference/browser/agent-browser.md +2 -2
- package/.docs/reference/browser/browser-viewer.md +2 -2
- package/.docs/reference/browser/firecrawl-browser.md +1 -1
- package/.docs/reference/browser/mastra-browser.md +1 -1
- package/.docs/reference/browser/stagehand-browser.md +2 -2
- package/.docs/reference/build-with-ai.md +2 -2
- package/.docs/reference/channels/channel-provider.md +1 -1
- package/.docs/reference/channels/slack-provider.md +1 -1
- package/.docs/reference/cli/mastra.md +2 -0
- package/.docs/reference/client-js/agents.md +4 -4
- package/.docs/reference/coding-agent/create-coding-agent.md +142 -13
- package/.docs/reference/configuration.md +6 -6
- package/.docs/reference/core/getEditor.md +1 -1
- package/.docs/reference/core/getMCPServer.md +1 -1
- package/.docs/reference/core/getMCPServerById.md +1 -1
- package/.docs/reference/core/getTool.md +1 -1
- package/.docs/reference/core/getToolById.md +1 -1
- package/.docs/reference/core/listMCPServers.md +1 -1
- package/.docs/reference/core/listTools.md +1 -1
- package/.docs/reference/core/removeWorkspace.md +1 -1
- package/.docs/reference/editor/mastra-editor.md +2 -2
- package/.docs/reference/editor/prompt-blocks.md +2 -2
- package/.docs/reference/editor/tool-provider.md +1 -1
- package/.docs/reference/editor/tools.md +1 -1
- package/.docs/reference/editor/versioning.md +3 -3
- package/.docs/reference/evals/prompt-alignment.md +18 -0
- package/.docs/reference/evals/rubric.md +1 -1
- package/.docs/reference/file-based-agents/memory.md +2 -2
- package/.docs/reference/file-based-agents/server.md +3 -3
- package/.docs/reference/file-based-agents/skills.md +1 -1
- package/.docs/reference/file-based-agents/storage.md +3 -3
- package/.docs/reference/file-based-agents/subagents.md +1 -1
- package/.docs/reference/file-based-agents/workspace.md +3 -3
- package/.docs/reference/index.md +1 -0
- package/.docs/reference/manual-install.md +3 -3
- package/.docs/reference/memory/memory-class.md +1 -0
- package/.docs/reference/memory/settled.md +57 -0
- package/.docs/reference/migrations/network-to-supervisor.md +2 -2
- package/.docs/reference/processors/skill-search-processor.md +1 -1
- package/.docs/reference/processors/tool-call-filter.md +7 -7
- package/.docs/reference/processors/tool-search-processor.md +1 -1
- package/.docs/reference/project-structure.md +1 -1
- package/.docs/reference/pubsub/lease-provider.md +3 -3
- package/.docs/reference/pubsub/redis-streams.md +1 -1
- package/.docs/reference/rag/graph-rag.md +71 -8
- package/.docs/reference/schedules/overview.md +1 -1
- package/.docs/reference/streaming/ChunkType.md +2 -2
- package/.docs/reference/streaming/agents/stream.md +7 -4
- package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
- package/.docs/reference/tools/ask-user-tool.md +1 -1
- package/.docs/reference/tools/create-code-mode.md +1 -1
- package/.docs/reference/tools/create-tool.md +4 -4
- package/.docs/reference/tools/mcp-server.md +47 -2
- package/.docs/reference/tools/submit-plan-tool.md +1 -1
- package/.docs/reference/tools/task-tools.md +2 -2
- package/.docs/reference/vectors/vectorize.md +12 -2
- package/.docs/reference/workers/overview.md +2 -2
- package/.docs/reference/workspace/local-filesystem.md +1 -1
- package/.docs/reference/workspace/local-sandbox.md +4 -3
- package/.docs/reference/workspace/process-manager.md +20 -4
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +5 -5
- package/CHANGELOG.md +15 -0
- package/package.json +4 -4
- /package/.docs/docs/{server/auth → auth}/composite-auth.md +0 -0
- /package/.docs/docs/{server/auth → auth}/jwt.md +0 -0
- /package/.docs/docs/{browser/overview.md → browser.md} +0 -0
- /package/.docs/docs/{getting-started/develop.md → develop.md} +0 -0
- /package/.docs/docs/{long-running-agents → harness}/signals.md +0 -0
- /package/.docs/docs/{editor/overview.md → studio/editor.md} +0 -0
|
@@ -166,6 +166,36 @@ The `context` object includes:
|
|
|
166
166
|
| `error` | Error if the delegation failed |
|
|
167
167
|
| `bail()` | Function to stop the parent agent's loop |
|
|
168
168
|
|
|
169
|
+
### Hook errors
|
|
170
|
+
|
|
171
|
+
If a delegation hook throws, the delegation continues by default: `onDelegationStart` proceeds with the original prompt, `messageFilter` falls back to the unfiltered context, and `onDelegationComplete` keeps the subagent's original result. Set `hookErrorStrategy: 'throw'` to fail the delegation instead.
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
const stream = await parentAgent.stream('Research AI trends', {
|
|
175
|
+
maxSteps: 10,
|
|
176
|
+
delegation: {
|
|
177
|
+
hookErrorStrategy: 'throw',
|
|
178
|
+
onDelegationComplete: async ({ result }) => {
|
|
179
|
+
// If this throws, the parent sees a failed delegation instead of a
|
|
180
|
+
// successful one whose result was silently dropped.
|
|
181
|
+
await reportToAnalytics(result)
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
})
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Either way, every hook failure is recorded on the run's request context under `__mastra_delegationHookErrors` as a list of `{ hook, primitiveId, toolCallId, runId, name, message }` entries, so you can detect a hook failure programmatically:
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
const requestContext = new RequestContext()
|
|
191
|
+
|
|
192
|
+
await parentAgent.generate('Research AI trends', { maxSteps: 10, requestContext })
|
|
193
|
+
|
|
194
|
+
const hookErrors = requestContext.get('__mastra_delegationHookErrors') ?? []
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
When `hookErrorStrategy` is `'throw'`, a throwing `onDelegationStart` blocks the subagent from running at all, and a throwing `messageFilter` or `onDelegationComplete` surfaces to the parent as a failed tool call. If `onDelegationComplete` throws while handling a failed delegation, the original delegation error is still what surfaces, and the hook is never re-invoked for its own failure.
|
|
198
|
+
|
|
169
199
|
## Message filtering
|
|
170
200
|
|
|
171
201
|
By default, subagents receive the full conversation context from the parent agent. Use `messageFilter` to control what messages are shared, for example, to remove sensitive data or limit context size.
|
|
@@ -399,7 +429,7 @@ Success criteria:
|
|
|
399
429
|
|
|
400
430
|
## Running subagents in the background
|
|
401
431
|
|
|
402
|
-
Subagent invocations are dispatched as tool calls, so they can run as [background tasks](https://mastra.ai/docs/
|
|
432
|
+
Subagent invocations are dispatched as tool calls, so they can run as [background tasks](https://mastra.ai/docs/harness/background-tasks). This is useful when one or more delegations are long-running and you don't want them to block the parent agent's response.
|
|
403
433
|
|
|
404
434
|
Enable the [backgroundTasks manager](https://mastra.ai/reference/configuration) on the Mastra instance, then opt subagents in on the parent agent:
|
|
405
435
|
|
|
@@ -424,11 +454,11 @@ const stream = await parentAgent.streamUntilIdle('Research AI in education and w
|
|
|
424
454
|
|
|
425
455
|
Use [`streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) instead of `stream()` so the stream stays open until the subagents complete and the parent agent has had a chance to respond to their results.
|
|
426
456
|
|
|
427
|
-
If a subagent isn't listed under the parent agent's `backgroundTasks.tools` but has its own background-eligible tools, the parent agent still dispatches the subagent as a background task and inherits its config. See [Inheriting from the subagent](https://mastra.ai/docs/
|
|
457
|
+
If a subagent isn't listed under the parent agent's `backgroundTasks.tools` but has its own background-eligible tools, the parent agent still dispatches the subagent as a background task and inherits its config. See [Inheriting from the subagent](https://mastra.ai/docs/harness/background-tasks) for details.
|
|
428
458
|
|
|
429
459
|
## Subagent versioning
|
|
430
460
|
|
|
431
|
-
When using the [editor](https://mastra.ai/docs/editor
|
|
461
|
+
When using the [editor](https://mastra.ai/docs/studio/editor), you can control which stored version of each subagent the parent agent uses at runtime. Set version overrides on the Mastra instance or per invocation:
|
|
432
462
|
|
|
433
463
|
```typescript
|
|
434
464
|
const result = await parentAgent.generate('Research and write about AI safety', {
|
|
@@ -445,13 +475,13 @@ Version overrides propagate automatically through delegation. See [Subagent vers
|
|
|
445
475
|
|
|
446
476
|
## Related
|
|
447
477
|
|
|
448
|
-
- [Background tasks](https://mastra.ai/docs/
|
|
478
|
+
- [Background tasks](https://mastra.ai/docs/harness/background-tasks)
|
|
449
479
|
- [Subagent versioning](https://mastra.ai/reference/editor/versioning)
|
|
450
480
|
- [Guide: Research coordinator](https://mastra.ai/blog/build-a-research-coordinator-with-supervisor-agents)
|
|
451
481
|
- [Agent.stream() reference](https://mastra.ai/reference/streaming/agents/stream)
|
|
452
482
|
- [Agent.streamUntilIdle() reference](https://mastra.ai/reference/streaming/agents/streamUntilIdle)
|
|
453
483
|
- [Agent.generate() reference](https://mastra.ai/reference/agents/generate)
|
|
454
|
-
- [Agent approval](https://mastra.ai/docs/agents/
|
|
484
|
+
- [Agent approval](https://mastra.ai/docs/agents/human-in-the-loop)
|
|
455
485
|
- [Memory in multi-agent systems](https://mastra.ai/docs/memory/overview)
|
|
456
486
|
- [Concept: Multi-agent systems](https://mastra.ai/docs/guides/multi-agent-systems)
|
|
457
487
|
- 📹 [Mastra supervisor agents workshop](https://www.youtube.com/watch?v=FNb2fL9WhQg\&t=1872s)
|
|
@@ -189,4 +189,4 @@ Like `.agent()`, `.tool()` records a declarative entry, so the workflow can be p
|
|
|
189
189
|
## Related
|
|
190
190
|
|
|
191
191
|
- [Using Agents](https://mastra.ai/docs/agents/overview)
|
|
192
|
-
- [MCP Overview](https://mastra.ai/docs/mcp
|
|
192
|
+
- [MCP Overview](https://mastra.ai/docs/connections/mcp)
|
|
@@ -105,7 +105,7 @@ Visit [`Step`](https://mastra.ai/reference/workflows/step) for a full list of co
|
|
|
105
105
|
|
|
106
106
|
### Using agents and tools
|
|
107
107
|
|
|
108
|
-
Workflow steps can also call registered agents or import and execute tools directly, visit the [Using Tools](https://mastra.ai/docs/agents/
|
|
108
|
+
Workflow steps can also call registered agents or import and execute tools directly, visit the [Using Tools](https://mastra.ai/docs/agents/tools) page for more information.
|
|
109
109
|
|
|
110
110
|
## Creating a workflow
|
|
111
111
|
|
|
@@ -137,7 +137,7 @@ A few rules worth knowing:
|
|
|
137
137
|
- Resume recomputes `nextFireAt` from now. A schedule paused for a week doesn't fire seven backlogged runs the moment you resume it. It fires on the next regular cron tick.
|
|
138
138
|
- Unpause with `resumeSchedule` or the **Resume** button in Studio. Editing the workflow's `schedule` config doesn't unpause a paused row.
|
|
139
139
|
- Pause and resume are idempotent. Calling pause on an already-paused schedule is a no-op.
|
|
140
|
-
- This operational override controls existing schedules. Author declarative schedules in code. Declarative schedules are created, deleted, and edited in code via the `schedule` field on `createWorkflow`. To create schedules imperatively at runtime instead, use the unified [`mastra.schedules`](https://mastra.ai/docs/
|
|
140
|
+
- This operational override controls existing schedules. Author declarative schedules in code. Declarative schedules are created, deleted, and edited in code via the `schedule` field on `createWorkflow`. To create schedules imperatively at runtime instead, use the unified [`mastra.schedules`](https://mastra.ai/docs/harness/schedules) service with a `workflowId`.
|
|
141
141
|
|
|
142
142
|
The underlying HTTP routes are `POST /api/schedules/:scheduleId/pause` and `POST /api/schedules/:scheduleId/resume`. Both require the `schedules:write` permission.
|
|
143
143
|
|
|
@@ -182,4 +182,4 @@ Manage Inngest schedules from the [Inngest dashboard](https://www.inngest.com/do
|
|
|
182
182
|
- [Workflow overview](https://mastra.ai/docs/workflows/overview)
|
|
183
183
|
- [Suspend and resume](https://mastra.ai/docs/workflows/suspend-and-resume)
|
|
184
184
|
- [Workers](https://mastra.ai/docs/deployment/workers): The [scheduler worker](https://mastra.ai/docs/deployment/workers) runs cron schedules in a dedicated process
|
|
185
|
-
- [Agent schedules](https://mastra.ai/docs/
|
|
185
|
+
- [Agent schedules](https://mastra.ai/docs/harness/schedules): Run an agent rather than a workflow on a cron schedule, and manage both schedule types at runtime through `mastra.schedules`.
|
|
@@ -147,7 +147,7 @@ export const mastra = new Mastra({
|
|
|
147
147
|
- [Upstash Storage](https://mastra.ai/integrations/databases/upstash)
|
|
148
148
|
- [Cloudflare D1](https://mastra.ai/integrations/databases/cloudflare-d1)
|
|
149
149
|
- [DynamoDB](https://mastra.ai/integrations/databases/dynamodb)
|
|
150
|
-
- [More storage providers](https://mastra.ai/docs/storage
|
|
150
|
+
- [More storage providers](https://mastra.ai/docs/storage)
|
|
151
151
|
|
|
152
152
|
## Best practices
|
|
153
153
|
|
|
@@ -909,7 +909,7 @@ export function TaskChat() {
|
|
|
909
909
|
|
|
910
910
|
### Tool streaming
|
|
911
911
|
|
|
912
|
-
Tools can also stream data using `context.writer.write()` for lower-level control, or pipe an agent's stream directly to the tool's writer. For more details, see [Tool Streaming](https://mastra.ai/docs/agents/
|
|
912
|
+
Tools can also stream data using `context.writer.write()` for lower-level control, or pipe an agent's stream directly to the tool's writer. For more details, see [Tool Streaming](https://mastra.ai/docs/agents/tools).
|
|
913
913
|
|
|
914
914
|
### Examples
|
|
915
915
|
|
|
@@ -545,7 +545,7 @@ export default function Page() {
|
|
|
545
545
|
|
|
546
546
|
Inside `StepsFeedback`, let the user toggle steps and then call `respond({ accepted: true, steps })` to resume the agent, or `respond({ accepted: false })` to reject. The agent reads the returned value and continues accordingly. See the full component in the [UI Dojo](https://ui-dojo.mastra.ai/).
|
|
547
547
|
|
|
548
|
-
The example above uses a client tool: the agent calls `generate_task_steps` and the frontend fulfills it through `respond`. Mastra can also pause on the server, suspending a tool call before it executes so a human approves or supplies input. For that path, see Mastra's [Agent approval](https://mastra.ai/docs/agents/
|
|
548
|
+
The example above uses a client tool: the agent calls `generate_task_steps` and the frontend fulfills it through `respond`. Mastra can also pause on the server, suspending a tool call before it executes so a human approves or supplies input. For that path, see Mastra's [Agent approval](https://mastra.ai/docs/agents/human-in-the-loop) guide for the backend side and CopilotKit's [`useHumanInTheLoop`](https://docs.copilotkit.ai/reference/hooks/useHumanInTheLoop) reference for the frontend.
|
|
549
549
|
|
|
550
550
|
## Channels
|
|
551
551
|
|
|
@@ -278,6 +278,6 @@ curl -X POST http://localhost:4111/api/agents/weatherAgent/generate \
|
|
|
278
278
|
|
|
279
279
|
## Related
|
|
280
280
|
|
|
281
|
-
- [Auth overview](https://mastra.ai/docs/
|
|
282
|
-
- [Composite Auth](https://mastra.ai/docs/
|
|
281
|
+
- [Auth overview](https://mastra.ai/docs/auth/overview)
|
|
282
|
+
- [Composite Auth](https://mastra.ai/docs/auth/composite-auth)
|
|
283
283
|
- [MastraAuthGoogle reference](https://mastra.ai/reference/auth/google)
|
|
@@ -89,7 +89,7 @@ By default, `MastraAuthWorkos` grants access to any authenticated WorkOS user. T
|
|
|
89
89
|
|
|
90
90
|
### FGA membership loading
|
|
91
91
|
|
|
92
|
-
Set `fetchMemberships: true` when you use [`MastraFGAWorkos`](https://mastra.ai/docs/
|
|
92
|
+
Set `fetchMemberships: true` when you use [`MastraFGAWorkos`](https://mastra.ai/docs/auth/fga). This tells the auth provider to load the user's WorkOS organization memberships during authentication so FGA checks can resolve the correct organization membership ID.
|
|
93
93
|
|
|
94
94
|
```typescript
|
|
95
95
|
import { MastraAuthWorkos, MastraFGAWorkos } from '@mastra/auth-workos'
|
|
@@ -99,11 +99,11 @@ const browser = new AgentBrowser({
|
|
|
99
99
|
})
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
This adds `browser_record` and `browser_record_caption` to the agent's toolset. See [Browser recording (Beta)](https://mastra.ai/docs/browser
|
|
102
|
+
This adds `browser_record` and `browser_record_caption` to the agent's toolset. See [Browser recording (Beta)](https://mastra.ai/docs/browser) for details. See [AgentBrowser reference](https://mastra.ai/reference/browser/agent-browser) for all configuration options and tool details.
|
|
103
103
|
|
|
104
104
|
## Related
|
|
105
105
|
|
|
106
|
-
- [Browser overview](https://mastra.ai/docs/browser
|
|
106
|
+
- [Browser overview](https://mastra.ai/docs/browser)
|
|
107
107
|
- [Stagehand](https://mastra.ai/integrations/browsers/stagehand)
|
|
108
108
|
- [Firecrawl](https://mastra.ai/integrations/browsers/firecrawl)
|
|
109
109
|
- [AgentBrowser reference](https://mastra.ai/reference/browser/agent-browser)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# BrowserViewer
|
|
4
4
|
|
|
5
|
-
The `@mastra/browser-viewer` package provides browser automation for CLI-based tools like [agent-browser](https://www.npmjs.com/package/agent-browser), [browser-use](https://pypi.org/project/browser-use/), and [browse](https://www.npmjs.com/package/browse). BrowserViewer launches Chrome via Playwright, exposes a Chrome DevTools Protocol (CDP) URL, and automatically injects it into CLI commands run through [sandbox tools](https://mastra.ai/docs/
|
|
5
|
+
The `@mastra/browser-viewer` package provides browser automation for CLI-based tools like [agent-browser](https://www.npmjs.com/package/agent-browser), [browser-use](https://pypi.org/project/browser-use/), and [browse](https://www.npmjs.com/package/browse). BrowserViewer launches Chrome via Playwright, exposes a Chrome DevTools Protocol (CDP) URL, and automatically injects it into CLI commands run through [sandbox tools](https://mastra.ai/docs/sandbox/overview).
|
|
6
6
|
|
|
7
7
|
## When to use BrowserViewer
|
|
8
8
|
|
|
@@ -49,7 +49,7 @@ Install the CLI tool in your workspace environment. This example uses `browser-u
|
|
|
49
49
|
pip install browser-use
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
Install the corresponding [skill](https://mastra.ai/docs/
|
|
52
|
+
Install the corresponding [skill](https://mastra.ai/docs/sandbox/skills) so the agent knows how to use the CLI:
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
55
|
npx skills add browser-use/browser-use --skill browser-use
|
|
@@ -104,7 +104,7 @@ When the agent runs a CLI command like `browser-use open https://example.com`, M
|
|
|
104
104
|
|
|
105
105
|
## Supported CLIs
|
|
106
106
|
|
|
107
|
-
BrowserViewer supports three CLI providers. Each CLI must be installed separately in your workspace environment. Each CLI also publishes a [skill](https://mastra.ai/docs/
|
|
107
|
+
BrowserViewer supports three CLI providers. Each CLI must be installed separately in your workspace environment. Each CLI also publishes a [skill](https://mastra.ai/docs/sandbox/skills) that teaches the agent its commands and workflows.
|
|
108
108
|
|
|
109
109
|
Set the `cli` option to match the CLI your agent uses:
|
|
110
110
|
|
|
@@ -144,8 +144,8 @@ CDP flag: `--ws` See [BrowserViewer reference](https://mastra.ai/reference/brows
|
|
|
144
144
|
|
|
145
145
|
## Related
|
|
146
146
|
|
|
147
|
-
- [Browser overview](https://mastra.ai/docs/browser
|
|
147
|
+
- [Browser overview](https://mastra.ai/docs/browser)
|
|
148
148
|
- [AgentBrowser](https://mastra.ai/integrations/browsers/agent-browser)
|
|
149
149
|
- [Stagehand](https://mastra.ai/integrations/browsers/stagehand)
|
|
150
|
-
- [Sandbox](https://mastra.ai/docs/
|
|
151
|
-
- [Workspace skills](https://mastra.ai/docs/
|
|
150
|
+
- [Sandbox](https://mastra.ai/docs/sandbox/overview)
|
|
151
|
+
- [Workspace skills](https://mastra.ai/docs/sandbox/skills)
|
|
@@ -123,6 +123,6 @@ const browser = new FirecrawlBrowser({
|
|
|
123
123
|
|
|
124
124
|
## Related
|
|
125
125
|
|
|
126
|
-
- [Browser overview](https://mastra.ai/docs/browser
|
|
126
|
+
- [Browser overview](https://mastra.ai/docs/browser)
|
|
127
127
|
- [AgentBrowser](https://mastra.ai/integrations/browsers/agent-browser)
|
|
128
128
|
- [FirecrawlBrowser reference](https://mastra.ai/reference/browser/firecrawl-browser)
|
|
@@ -162,10 +162,10 @@ const browser = new StagehandBrowser({
|
|
|
162
162
|
})
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
-
This adds `browser_record` and `browser_record_caption` to the agent's toolset. See [Browser recording (Beta)](https://mastra.ai/docs/browser
|
|
165
|
+
This adds `browser_record` and `browser_record_caption` to the agent's toolset. See [Browser recording (Beta)](https://mastra.ai/docs/browser) for details.
|
|
166
166
|
|
|
167
167
|
## Related
|
|
168
168
|
|
|
169
|
-
- [Browser overview](https://mastra.ai/docs/browser
|
|
169
|
+
- [Browser overview](https://mastra.ai/docs/browser)
|
|
170
170
|
- [AgentBrowser](https://mastra.ai/integrations/browsers/agent-browser)
|
|
171
171
|
- [StagehandBrowser reference](https://mastra.ai/reference/browser/stagehand-browser)
|
|
@@ -94,5 +94,5 @@ Use this URL anywhere the Discord adapter docs ask for the interactions endpoint
|
|
|
94
94
|
|
|
95
95
|
## Related
|
|
96
96
|
|
|
97
|
-
- [Channels overview](https://mastra.ai/docs/
|
|
98
|
-
- [More](https://mastra.ai/docs/
|
|
97
|
+
- [Channels overview](https://mastra.ai/docs/channels)
|
|
98
|
+
- [More](https://mastra.ai/docs/channels)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# GitHub
|
|
4
4
|
|
|
5
|
-
The `@mastra/github-signals` provider lets an agent follow pull requests (PRs). It polls subscribed PRs and sends [notification signals](https://mastra.ai/docs/
|
|
5
|
+
The `@mastra/github-signals` provider lets an agent follow pull requests (PRs). It polls subscribed PRs and sends [notification signals](https://mastra.ai/docs/harness/signals) to the agent thread when relevant activity occurs.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -110,7 +110,7 @@ https://your-app.example.com/api/agents/imessage-agent/channels/imessage/webhook
|
|
|
110
110
|
|
|
111
111
|
Register this URL in the [Photon dashboard](https://app.photon.codes), then set the signing secret it returns as `IMESSAGE_WEBHOOK_SECRET`. The secret is shown once at registration. The adapter verifies the signature on every delivery and rejects requests that don't match. Webhooks are available in hosted mode only.
|
|
112
112
|
|
|
113
|
-
> **Note:** Photon delivers to public HTTPS endpoints only. It won't deliver to `http://`, to private addresses like `localhost`, or through a redirect. For local development, use a tunnel as described in the [Channels overview](https://mastra.ai/docs/
|
|
113
|
+
> **Note:** Photon delivers to public HTTPS endpoints only. It won't deliver to `http://`, to private addresses like `localhost`, or through a redirect. For local development, use a tunnel as described in the [Channels overview](https://mastra.ai/docs/channels).
|
|
114
114
|
|
|
115
115
|
## Duplicate deliveries
|
|
116
116
|
|
|
@@ -181,9 +181,9 @@ imessage: {
|
|
|
181
181
|
},
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
On serverless platforms, prefer webhooks. A gateway listener needs a process that stays alive. See [Serverless deployment](https://mastra.ai/docs/
|
|
184
|
+
On serverless platforms, prefer webhooks. A gateway listener needs a process that stays alive. See [Serverless deployment](https://mastra.ai/docs/channels).
|
|
185
185
|
|
|
186
186
|
## Related
|
|
187
187
|
|
|
188
|
-
- [Channels overview](https://mastra.ai/docs/
|
|
189
|
-
- [More](https://mastra.ai/docs/
|
|
188
|
+
- [Channels overview](https://mastra.ai/docs/channels)
|
|
189
|
+
- [More](https://mastra.ai/docs/channels)
|
|
@@ -273,7 +273,7 @@ For finer control, gate on the sender's identity. Every request carries the send
|
|
|
273
273
|
|
|
274
274
|
### Server authentication
|
|
275
275
|
|
|
276
|
-
The Slack webhook route is exempt from Mastra's [server authentication](https://mastra.ai/docs/
|
|
276
|
+
The Slack webhook route is exempt from Mastra's [server authentication](https://mastra.ai/docs/auth/overview). Slack can't send a bearer token, so Mastra registers the channel webhook as a public route and verifies each request with the Slack signing secret instead. This holds even when you enable a provider like [`MastraAuthSimple`](https://mastra.ai/docs/auth/simple-auth): the rest of your API stays protected, but the webhook route relies on the signing secret rather than your server auth. Keep `SLACK_SIGNING_SECRET` set so the adapter can reject requests that Slack didn't sign.
|
|
277
277
|
|
|
278
278
|
### External channels
|
|
279
279
|
|
|
@@ -315,13 +315,13 @@ The channel context includes:
|
|
|
315
315
|
- `platform`: The platform identifier, `slack` for this adapter.
|
|
316
316
|
- `userId` and `userName`: The sender's Slack user ID and display name.
|
|
317
317
|
|
|
318
|
-
Mastra also turns this context into a short system message. The agent learns the platform and its own identity, plus whether the conversation is a direct message or a public channel. See [thread context](https://mastra.ai/docs/
|
|
318
|
+
Mastra also turns this context into a short system message. The agent learns the platform and its own identity, plus whether the conversation is a direct message or a public channel. See [thread context](https://mastra.ai/docs/channels) in the channels overview for how to change that behavior.
|
|
319
319
|
|
|
320
320
|
## Production deployment
|
|
321
321
|
|
|
322
322
|
When you deploy the Mastra server, update both request URLs in the Slack app settings to the production webhook URL. The tunnel URL used for local development is temporary and changes when the tunnel restarts.
|
|
323
323
|
|
|
324
|
-
Channels on serverless platforms may need `waitUntil` and shared pub/sub configuration so background responses and thread leases work across short-lived instances. See [serverless deployment](https://mastra.ai/docs/
|
|
324
|
+
Channels on serverless platforms may need `waitUntil` and shared pub/sub configuration so background responses and thread leases work across short-lived instances. See [serverless deployment](https://mastra.ai/docs/channels) in the channels overview.
|
|
325
325
|
|
|
326
326
|
### Idle servers
|
|
327
327
|
|
|
@@ -329,7 +329,7 @@ Platform servers scale down to idle when they aren't receiving traffic, and that
|
|
|
329
329
|
|
|
330
330
|
## Related
|
|
331
331
|
|
|
332
|
-
- [Channels overview](https://mastra.ai/docs/
|
|
333
|
-
- [More](https://mastra.ai/docs/
|
|
332
|
+
- [Channels overview](https://mastra.ai/docs/channels)
|
|
333
|
+
- [More](https://mastra.ai/docs/channels)
|
|
334
334
|
- [Channels reference](https://mastra.ai/reference/agents/channels)
|
|
335
335
|
- [Deployment overview](https://mastra.ai/docs/deployment/overview)
|
|
@@ -96,5 +96,5 @@ Use this URL anywhere the Teams adapter docs ask for the bot endpoint or webhook
|
|
|
96
96
|
|
|
97
97
|
## Related
|
|
98
98
|
|
|
99
|
-
- [Channels overview](https://mastra.ai/docs/
|
|
100
|
-
- [More](https://mastra.ai/docs/
|
|
99
|
+
- [Channels overview](https://mastra.ai/docs/channels)
|
|
100
|
+
- [More](https://mastra.ai/docs/channels)
|
|
@@ -94,5 +94,5 @@ Use this URL anywhere the Telegram adapter docs ask for the webhook URL. Telegra
|
|
|
94
94
|
|
|
95
95
|
## Related
|
|
96
96
|
|
|
97
|
-
- [Channels overview](https://mastra.ai/docs/
|
|
98
|
-
- [More](https://mastra.ai/docs/
|
|
97
|
+
- [Channels overview](https://mastra.ai/docs/channels)
|
|
98
|
+
- [More](https://mastra.ai/docs/channels)
|
|
@@ -95,5 +95,5 @@ Use this URL for incoming WhatsApp event delivery. The generated Mastra route ha
|
|
|
95
95
|
|
|
96
96
|
## Related
|
|
97
97
|
|
|
98
|
-
- [Channels overview](https://mastra.ai/docs/
|
|
99
|
-
- [More](https://mastra.ai/docs/
|
|
98
|
+
- [Channels overview](https://mastra.ai/docs/channels)
|
|
99
|
+
- [More](https://mastra.ai/docs/channels)
|
|
@@ -408,6 +408,7 @@ PostgreSQL storage creates composite indexes during initialization for common qu
|
|
|
408
408
|
- `mastra_ai_spans_scope_startedat_idx`: (scope, startedAt DESC)
|
|
409
409
|
- `mastra_scores_trace_id_span_id_created_at_idx`: (traceId, spanId, createdAt DESC)
|
|
410
410
|
- `mastra_workflow_snapshot_name_createdat_idx`: (workflow\_name, createdAt DESC)
|
|
411
|
+
- `mastra_workflow_snapshot_name_status_createdat_idx`: (workflow\_name, snapshot->>'status', createdAt DESC), created only when the `snapshot` column is `jsonb`
|
|
411
412
|
|
|
412
413
|
These indexes improve performance for filtered queries with sorting, including `dateRange` filters on message queries and Studio's workflow runs-list.
|
|
413
414
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Deploy your Mastra server to Amazon EC2. The server runs on infrastructure you manage and can support long-running agents and workflows.
|
|
6
6
|
|
|
7
|
-
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/
|
|
7
|
+
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/overview). If you're using a [server adapter](https://mastra.ai/docs/server/server-adapters) or [web framework](https://mastra.ai/docs/deployment/web-framework), deploy the way you normally would for that framework.
|
|
8
8
|
|
|
9
9
|
## Before you begin
|
|
10
10
|
|
|
@@ -114,7 +114,7 @@ For production, you'll also need:
|
|
|
114
114
|
|
|
115
115
|
This is a basic example. In production, use a process manager like [PM2](https://pm2.keymetrics.io/) or [systemd](https://systemd.io/) to keep your application running and handle restarts.
|
|
116
116
|
|
|
117
|
-
> **Warning:** Set up [authentication](https://mastra.ai/docs/
|
|
117
|
+
> **Warning:** Set up [authentication](https://mastra.ai/docs/auth/overview) before exposing your endpoints publicly.
|
|
118
118
|
|
|
119
119
|
6. Your Mastra server is now running on port 4111, but it's only accessible locally.
|
|
120
120
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Deploy your Mastra application to AWS Lambda using Docker containers and the [AWS Lambda Web Adapter](https://github.com/awslabs/aws-lambda-web-adapter). This approach runs your Mastra server as a containerized Lambda function with automatic scaling.
|
|
6
6
|
|
|
7
|
-
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/
|
|
7
|
+
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/overview). If you're using a [server adapter](https://mastra.ai/docs/server/server-adapters) or [web framework](https://mastra.ai/docs/deployment/web-framework), deploy the way you normally would for that framework.
|
|
8
8
|
|
|
9
9
|
## Before you begin
|
|
10
10
|
|
|
@@ -146,7 +146,7 @@ CMD ["node", ".mastra/output/index.mjs"]
|
|
|
146
146
|
|
|
147
147
|
2. You can now call your Mastra endpoints over HTTP.
|
|
148
148
|
|
|
149
|
-
> **Warning:** For production deployments, set up [authentication](https://mastra.ai/docs/
|
|
149
|
+
> **Warning:** For production deployments, set up [authentication](https://mastra.ai/docs/auth/overview) before exposing your endpoints publicly, restrict CORS origins to your trusted domains, use AWS IAM roles for secure access to other AWS services, and store sensitive environment variables in AWS Secrets Manager or Parameter Store.
|
|
150
150
|
|
|
151
151
|
## Next steps
|
|
152
152
|
|
|
@@ -155,7 +155,7 @@ This guide provides a quickstart for deploying Mastra to AWS Lambda. For product
|
|
|
155
155
|
## Related
|
|
156
156
|
|
|
157
157
|
- [Deployment overview](https://mastra.ai/docs/deployment/overview)
|
|
158
|
-
- [Mastra server](https://mastra.ai/docs/server/
|
|
158
|
+
- [Mastra server](https://mastra.ai/docs/server/overview)
|
|
159
159
|
- [Server adapters](https://mastra.ai/docs/server/server-adapters)
|
|
160
160
|
- [AWS Lambda documentation](https://docs.aws.amazon.com/lambda/)
|
|
161
161
|
- [AWS Lambda Web Adapter](https://github.com/awslabs/aws-lambda-web-adapter)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Deploy your Mastra applications to Azure App Services.
|
|
6
6
|
|
|
7
|
-
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/
|
|
7
|
+
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/overview). If you're using a [server adapter](https://mastra.ai/docs/server/server-adapters) or [web framework](https://mastra.ai/docs/deployment/web-framework), deploy the way you normally would for that framework.
|
|
8
8
|
|
|
9
9
|
## Before you begin
|
|
10
10
|
|
|
@@ -83,7 +83,7 @@ Copy the URL from the Azure portal and visit `https://<your-app-name>.azurewebsi
|
|
|
83
83
|
|
|
84
84
|
You can now call your Mastra endpoints over HTTP.
|
|
85
85
|
|
|
86
|
-
> **Warning:** Set up [authentication](https://mastra.ai/docs/
|
|
86
|
+
> **Warning:** Set up [authentication](https://mastra.ai/docs/auth/overview) before exposing your endpoints publicly.
|
|
87
87
|
|
|
88
88
|
## Next steps
|
|
89
89
|
|
|
@@ -94,8 +94,8 @@ After setting up your project, push it to your remote Git provider of choice (e.
|
|
|
94
94
|
|
|
95
95
|
3. Try out your newly deployed function by going to `https://<your-project-name>.<slug>.workers.dev/api/agents`. You should get a JSON response listing all available agents.
|
|
96
96
|
|
|
97
|
-
Since the [Mastra server](https://mastra.ai/docs/server/
|
|
97
|
+
Since the [Mastra server](https://mastra.ai/docs/server/overview) prefixes every API endpoint with `/api`, you have to add it to your URLs when making requests.
|
|
98
98
|
|
|
99
99
|
4. You can now call your Mastra endpoints over HTTP.
|
|
100
100
|
|
|
101
|
-
> **Note:** Set up [authentication](https://mastra.ai/docs/
|
|
101
|
+
> **Note:** Set up [authentication](https://mastra.ai/docs/auth/overview) before exposing your endpoints publicly.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
This guide covers Digital Ocean's App Platform and Droplets. Each of these offerings has its own set of strengths and is suited for different types of projects and developer expertise. Read [Digital Ocean's comparison](https://www.digitalocean.com/community/conceptual-articles/digitalocean-app-platform-vs-doks-vs-droplets) to understand the differences and choose the best option for your project.
|
|
6
6
|
|
|
7
|
-
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/
|
|
7
|
+
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/overview). If you're using a [server adapter](https://mastra.ai/docs/server/server-adapters) or [web framework](https://mastra.ai/docs/deployment/web-framework), deploy the way you normally would for that framework.
|
|
8
8
|
|
|
9
9
|
## Before you begin
|
|
10
10
|
|
|
@@ -50,7 +50,7 @@ After setting up your project, push it to your remote Git provider of choice (e.
|
|
|
50
50
|
|
|
51
51
|
5. You can now call your Mastra endpoints over HTTP.
|
|
52
52
|
|
|
53
|
-
> **Warning:** Set up [authentication](https://mastra.ai/docs/
|
|
53
|
+
> **Warning:** Set up [authentication](https://mastra.ai/docs/auth/overview) before exposing your endpoints publicly.
|
|
54
54
|
|
|
55
55
|
## Droplets
|
|
56
56
|
|
|
@@ -162,7 +162,7 @@ After setting up your project, push it to your remote Git provider of choice (e.
|
|
|
162
162
|
|
|
163
163
|
6. You can now call your Mastra endpoints over HTTP.
|
|
164
164
|
|
|
165
|
-
> **Warning:** Set up [authentication](https://mastra.ai/docs/
|
|
165
|
+
> **Warning:** Set up [authentication](https://mastra.ai/docs/auth/overview) before exposing your endpoints publicly.
|
|
166
166
|
|
|
167
167
|
## Related
|
|
168
168
|
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
Run a Mastra application across multiple pods on [Kubernetes](https://kubernetes.io/), so it scales horizontally behind a load balancer. Because each pod is a separate process, the pods must share a pub/sub backend and a database, otherwise work started on one pod is invisible to the others.
|
|
6
6
|
|
|
7
|
-
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/
|
|
7
|
+
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/overview). If you're using a [server adapter](https://mastra.ai/docs/server/server-adapters) or [web framework](https://mastra.ai/docs/deployment/web-framework), deploy the way you normally would for that framework.
|
|
8
8
|
|
|
9
|
-
> **Beta:** Multi-pod support relies on [durable agents](https://mastra.ai/docs/
|
|
9
|
+
> **Beta:** Multi-pod support relies on [durable agents](https://mastra.ai/docs/harness/durable-agents). Breaking changes may occur without a major version bump until the API is stable. Read [Known limitations](#known-limitations) before you rely on this in production.
|
|
10
10
|
|
|
11
11
|
## Before you begin
|
|
12
12
|
|
|
@@ -25,7 +25,7 @@ A single pod keeps run state in its own memory. With one pod that's fine, becaus
|
|
|
25
25
|
Redis and Postgres close that gap:
|
|
26
26
|
|
|
27
27
|
- **Pub/sub** carries events between pods. When an event is published on one pod, the others receive it. Mastra uses [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), which also provides the per-thread leasing that keeps a single pod as the owner of a conversation at a time. See [PubSub](https://mastra.ai/docs/server/pubsub).
|
|
28
|
-
- **Storage** persists run state. [Durable agents](https://mastra.ai/docs/
|
|
28
|
+
- **Storage** persists run state. [Durable agents](https://mastra.ai/docs/harness/durable-agents) save each run as a workflow snapshot, so any pod can resume a run from the database after a restart or when a request is routed elsewhere.
|
|
29
29
|
|
|
30
30
|
## Configure shared infrastructure
|
|
31
31
|
|
|
@@ -87,7 +87,7 @@ The `cache` is what makes resumable streams work across pods. A reconnecting cli
|
|
|
87
87
|
|
|
88
88
|
## Use durable agents
|
|
89
89
|
|
|
90
|
-
A plain [`Agent`](https://mastra.ai/docs/agents/overview) keeps its stream and approval state in one pod's memory, so those don't survive a request landing on another pod. A [durable agent](https://mastra.ai/docs/
|
|
90
|
+
A plain [`Agent`](https://mastra.ai/docs/agents/overview) keeps its stream and approval state in one pod's memory, so those don't survive a request landing on another pod. A [durable agent](https://mastra.ai/docs/harness/durable-agents) runs the agentic loop inside a workflow and persists its state, so any pod can observe or resume the same run.
|
|
91
91
|
|
|
92
92
|
Wrap the agent with `createDurableAgent()`:
|
|
93
93
|
|
|
@@ -109,7 +109,7 @@ Register the durable agent with the `Mastra` instance above. Its run state now l
|
|
|
109
109
|
|
|
110
110
|
## Deploy
|
|
111
111
|
|
|
112
|
-
1. Build and containerize the Mastra server, then push the image to your registry. Follow the [Mastra server](https://mastra.ai/docs/server/
|
|
112
|
+
1. Build and containerize the Mastra server, then push the image to your registry. Follow the [Mastra server](https://mastra.ai/docs/server/overview) guide for the build, and ensure the server reads `process.env.PORT` and listens on `0.0.0.0`.
|
|
113
113
|
|
|
114
114
|
2. Store the shared connection strings as a Secret:
|
|
115
115
|
|
|
@@ -242,7 +242,7 @@ Register the durable agent with the `Mastra` instance above. Its run state now l
|
|
|
242
242
|
|
|
243
243
|
A JSON list of your agents means the deployment is serving.
|
|
244
244
|
|
|
245
|
-
> **Warning:** Set up [authentication](https://mastra.ai/docs/
|
|
245
|
+
> **Warning:** Set up [authentication](https://mastra.ai/docs/auth/overview) before exposing your endpoints publicly.
|
|
246
246
|
|
|
247
247
|
## Streaming and reconnection
|
|
248
248
|
|
|
@@ -258,7 +258,7 @@ for await (const chunk of output.fullStream) {
|
|
|
258
258
|
cleanup()
|
|
259
259
|
```
|
|
260
260
|
|
|
261
|
-
Because the run state is in Postgres and the events are in Redis, the reconnecting request can be served by any pod, not only the one that started the run. See [Resumable streams](https://mastra.ai/docs/
|
|
261
|
+
Because the run state is in Postgres and the events are in Redis, the reconnecting request can be served by any pod, not only the one that started the run. See [Resumable streams](https://mastra.ai/docs/harness/durable-agents).
|
|
262
262
|
|
|
263
263
|
Multiple clients can observe the same run at once. Each `observe()` call receives the full stream, so a user watching from two devices, or two people following the same run, stay in sync.
|
|
264
264
|
|
|
@@ -281,11 +281,11 @@ The run suspends before the tool runs. Approve it later, from any pod:
|
|
|
281
281
|
await durableAssistant.resume(runId, { approved: true })
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
-
The pod that handles the approval loads the suspended run from Postgres. It then runs the approved tool and publishes the result over the shared pub/sub, so a client observing the run receives the continuation. See [Tool approval](https://mastra.ai/docs/
|
|
284
|
+
The pod that handles the approval loads the suspended run from Postgres. It then runs the approved tool and publishes the result over the shared pub/sub, so a client observing the run receives the continuation. See [Tool approval](https://mastra.ai/docs/harness/durable-agents).
|
|
285
285
|
|
|
286
286
|
## Known limitations
|
|
287
287
|
|
|
288
|
-
- The default in-process setup keeps run state in one pod's memory and doesn't share it across pods. Use [durable agents](https://mastra.ai/docs/
|
|
288
|
+
- The default in-process setup keeps run state in one pod's memory and doesn't share it across pods. Use [durable agents](https://mastra.ai/docs/harness/durable-agents) with shared Redis and Postgres so streaming, approvals, and reconnection work across pods.
|
|
289
289
|
- Cross-pod streaming, approvals, and reconnection require the durable-agent path. A plain agent keeps run state in memory and doesn't resume on another pod.
|
|
290
290
|
- When multiple pods start at once against an uninitialized database, they can race to create the schema and a pod may fail to start. Start with one replica so the schema is created once, then scale up.
|
|
291
291
|
- For a stricter setup, initialize the schema outside the app (for example, a one-off Kubernetes Job) and set `disableInit: true` on the `PostgresStore` in every pod.
|
|
@@ -293,7 +293,7 @@ The pod that handles the approval loads the suspended run from Postgres. It then
|
|
|
293
293
|
## Related
|
|
294
294
|
|
|
295
295
|
- [PubSub](https://mastra.ai/docs/server/pubsub)
|
|
296
|
-
- [Durable agents](https://mastra.ai/docs/
|
|
296
|
+
- [Durable agents](https://mastra.ai/docs/harness/durable-agents)
|
|
297
297
|
- [Workers](https://mastra.ai/docs/deployment/workers): Split background processing into separate containers on Kubernetes
|
|
298
|
-
- [Mastra server](https://mastra.ai/docs/server/
|
|
298
|
+
- [Mastra server](https://mastra.ai/docs/server/overview)
|
|
299
299
|
- [Deployment overview](https://mastra.ai/docs/deployment/overview)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Use `@mastra/deployer-netlify` to deploy your Mastra server on Netlify. The deployer bundles your code and generates a `.netlify` directory conforming to Netlify's [Frameworks API](https://docs.netlify.com/build/frameworks/frameworks-api/), ready to deploy. You can deploy as serverless functions (default) or as [edge functions](https://docs.netlify.com/build/edge-functions/overview/) for lower latency and longer execution times.
|
|
6
6
|
|
|
7
|
-
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/
|
|
7
|
+
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/overview). If you're using a [server adapter](https://mastra.ai/docs/server/server-adapters) or [web framework](https://mastra.ai/docs/deployment/web-framework), deploy the way you normally would for that framework.
|
|
8
8
|
|
|
9
9
|
## Before you begin
|
|
10
10
|
|
|
@@ -85,10 +85,10 @@ After setting up your project, push it to your remote Git provider of choice (e.
|
|
|
85
85
|
|
|
86
86
|
3. Verify your deployment at `https://<random-slug>.netlify.app/api/agents`, which should return a JSON list of your agents.
|
|
87
87
|
|
|
88
|
-
Since the [Mastra server](https://mastra.ai/docs/server/
|
|
88
|
+
Since the [Mastra server](https://mastra.ai/docs/server/overview) prefixes every API endpoint with `/api`, you have to add it to your URLs when making requests.
|
|
89
89
|
|
|
90
90
|
> **Note:** Netlify functions are typically deployed at `https://<random-slug>.netlify.app/.netlify/functions/api`. The `NetlifyDeployer` redirects any request from `/*` to `/.netlify/functions/api/:splat`, so you don't need to include the `.netlify/functions` prefix in your URLs.
|
|
91
91
|
|
|
92
92
|
4. You can now call your Mastra endpoints over HTTP.
|
|
93
93
|
|
|
94
|
-
> **Warning:** Set up [authentication](https://mastra.ai/docs/
|
|
94
|
+
> **Warning:** Set up [authentication](https://mastra.ai/docs/auth/overview) before exposing your endpoints publicly.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Use `@mastra/deployer-vercel` to deploy your Mastra server as serverless functions on Vercel. The deployer bundles your code and generates a `.vercel/output` directory conforming to Vercel's [Build Output API](https://vercel.com/docs/build-output-api/v3), ready to deploy with no additional configuration.
|
|
6
6
|
|
|
7
|
-
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/
|
|
7
|
+
> **Note:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/overview). If you're using a [server adapter](https://mastra.ai/docs/server/server-adapters) or [web framework](https://mastra.ai/docs/deployment/web-framework), deploy the way you normally would for that framework.
|
|
8
8
|
|
|
9
9
|
## Before you begin
|
|
10
10
|
|
|
@@ -67,7 +67,7 @@ export const mastra = new Mastra({
|
|
|
67
67
|
|
|
68
68
|
4. You can now call your Mastra endpoints over HTTP.
|
|
69
69
|
|
|
70
|
-
> **Warning:** Set up [authentication](https://mastra.ai/docs/
|
|
70
|
+
> **Warning:** Set up [authentication](https://mastra.ai/docs/auth/overview) before exposing your endpoints publicly.
|
|
71
71
|
|
|
72
72
|
## Studio
|
|
73
73
|
|
|
@@ -271,4 +271,4 @@ See [E2BSandbox reference](https://mastra.ai/integrations/sandboxes/e2b) for mor
|
|
|
271
271
|
- [GCSFilesystem reference](https://mastra.ai/integrations/file-storage/google-cloud-storage)
|
|
272
272
|
- [AzureBlobFilesystem reference](https://mastra.ai/integrations/file-storage/azure-blob)
|
|
273
273
|
- [E2BSandbox reference](https://mastra.ai/integrations/sandboxes/e2b)
|
|
274
|
-
- [Filesystem](https://mastra.ai/docs/
|
|
274
|
+
- [Filesystem](https://mastra.ai/docs/sandbox/filesystem)
|