@mastra/mcp-docs-server 1.2.17-alpha.13 → 1.2.17-alpha.14
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 +1 -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/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 +5 -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/manual-install.md +3 -3
- 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/schedules/overview.md +1 -1
- package/.docs/reference/streaming/ChunkType.md +2 -2
- package/.docs/reference/streaming/agents/stream.md +3 -1
- 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 +8 -0
- package/package.json +5 -5
- /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
|
@@ -14,4 +14,4 @@ The power of MCP lies in its ability to connect your agent to a wide variety of
|
|
|
14
14
|
|
|
15
15
|
As you continue to develop your Mastra agent, consider exploring other MCP servers and tools that might be useful for your specific use case. The Mastra ecosystem is constantly growing, with new tools and capabilities being added regularly.
|
|
16
16
|
|
|
17
|
-
For more information on MCP and available servers, check out the [Mastra MCP documentation](https://mastra.ai/docs/mcp
|
|
17
|
+
For more information on MCP and available servers, check out the [Mastra MCP documentation](https://mastra.ai/docs/connections/mcp).
|
|
@@ -29,7 +29,7 @@ Each turn adds the full tool response to the agent's context window which can le
|
|
|
29
29
|
|
|
30
30
|
With code mode, your tools keep running on the host with full validation, request context, and tracing. Only the model's orchestration code runs in the sandbox. Each `external_*` call is bridged back to the real tool on the host, and the function can reduce or aggregate results before returning one response to the agent.
|
|
31
31
|
|
|
32
|
-
The function runs in a [Workspace sandbox](https://mastra.ai/docs/
|
|
32
|
+
The function runs in a [Workspace sandbox](https://mastra.ai/docs/sandbox/overview). A sandbox is required, because code mode runs model-authored code and the execution boundary must be chosen deliberately. Pass one via `sandbox`, or run the agent in a workspace that provides one. To execute on the host machine, pass `new LocalSandbox()` explicitly. This runs the function as a host `node` process with host privileges, so only use it for trusted or local development.
|
|
33
33
|
|
|
34
34
|
Transports that bring their own execution boundary are the exception: with [`IsolatedVmCodeModeTransport`](https://mastra.ai/reference/tools/isolated-vm-transport) the program runs in an in-process V8 isolate and no sandbox is needed (see [In-process isolation](#in-process-isolation)).
|
|
35
35
|
|
|
@@ -183,5 +183,5 @@ See [Choosing a transport](https://mastra.ai/reference/tools/quickjs-transport)
|
|
|
183
183
|
- [createCodeMode() reference](https://mastra.ai/reference/tools/create-code-mode)
|
|
184
184
|
- [IsolatedVmCodeModeTransport reference](https://mastra.ai/reference/tools/isolated-vm-transport)
|
|
185
185
|
- [QuickJsCodeModeTransport reference](https://mastra.ai/reference/tools/quickjs-transport)
|
|
186
|
-
- [Tools](https://mastra.ai/docs/agents/
|
|
187
|
-
- [Sandbox](https://mastra.ai/docs/
|
|
186
|
+
- [Tools](https://mastra.ai/docs/agents/tools)
|
|
187
|
+
- [Sandbox](https://mastra.ai/docs/sandbox/overview)
|
|
@@ -130,7 +130,7 @@ const scrubbedAgent = new Agent({
|
|
|
130
130
|
|
|
131
131
|
Visit [`SystemPromptScrubber()`](https://mastra.ai/reference/processors/system-prompt-scrubber) reference for a full list of configuration options.
|
|
132
132
|
|
|
133
|
-
> **Note:** When streaming responses over HTTP, Mastra redacts sensitive request data (system prompts, tool definitions, API keys) from stream chunks at the server level by default. See [Stream data redaction](https://mastra.ai/docs/server/
|
|
133
|
+
> **Note:** When streaming responses over HTTP, Mastra redacts sensitive request data (system prompts, tool definitions, API keys) from stream chunks at the server level by default. See [Stream data redaction](https://mastra.ai/docs/server/overview) for details.
|
|
134
134
|
|
|
135
135
|
## Hybrid processors
|
|
136
136
|
|
|
@@ -48,7 +48,7 @@ for await (const chunk of stream.fullStream) {
|
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
> **Note:** Human-in-the-loop uses snapshots to capture request state. Configure a [storage provider](https://mastra.ai/docs/storage
|
|
51
|
+
> **Note:** Human-in-the-loop uses snapshots to capture request state. Configure a [storage provider](https://mastra.ai/docs/storage) on your Mastra instance or you'll see a "snapshot not found" error.
|
|
52
52
|
>
|
|
53
53
|
> Snapshots for agent runs are minimal resume artifacts: they hold only what's needed to resume the suspended run and are deleted once the run finishes. Use [tracing](https://mastra.ai/docs/observability/overview) for the execution record and [memory](https://mastra.ai/docs/memory/overview) for the conversation history.
|
|
54
54
|
|
|
@@ -510,11 +510,11 @@ Each returned run includes the suspended tool calls (`toolCallId`, `toolName`, `
|
|
|
510
510
|
|
|
511
511
|
The same discovery is available over HTTP as `GET /agents/:agentId/suspended-runs` and in the client SDK as [`agent.listSuspendedRuns()`](https://mastra.ai/reference/client-js/agents), so browser-based approval UIs can rediscover pending runs directly.
|
|
512
512
|
|
|
513
|
-
> **Note:** Suspended runs only survive restarts when your Mastra instance is configured with a persistent [storage provider](https://mastra.ai/docs/storage
|
|
513
|
+
> **Note:** Suspended runs only survive restarts when your Mastra instance is configured with a persistent [storage provider](https://mastra.ai/docs/storage). The default in-memory store loses snapshots when the process exits.
|
|
514
514
|
|
|
515
515
|
## Tool approval: Supervisor agents
|
|
516
516
|
|
|
517
|
-
A [supervisor agent](https://mastra.ai/docs/
|
|
517
|
+
A [supervisor agent](https://mastra.ai/docs/subagents) coordinates multiple subagents using `.stream()` or `.generate()`. When a subagent calls a tool that requires approval, the request propagates up through the delegation chain and surfaces at the supervisor level:
|
|
518
518
|
|
|
519
519
|
1. The supervisor delegates a task to a subagent.
|
|
520
520
|
2. The subagent calls a tool that has `requireApproval: true` or uses `suspend()`.
|
|
@@ -673,8 +673,8 @@ if (output.finishReason === 'suspended') {
|
|
|
673
673
|
|
|
674
674
|
## Related
|
|
675
675
|
|
|
676
|
-
- [Tools](https://mastra.ai/docs/agents/
|
|
676
|
+
- [Tools](https://mastra.ai/docs/agents/tools)
|
|
677
677
|
- [Agent overview](https://mastra.ai/docs/agents/overview)
|
|
678
|
-
- [MCP overview](https://mastra.ai/docs/mcp
|
|
678
|
+
- [MCP overview](https://mastra.ai/docs/connections/mcp)
|
|
679
679
|
- [Memory](https://mastra.ai/docs/memory/overview)
|
|
680
680
|
- [Request context](https://mastra.ai/docs/server/request-context)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Agent networks
|
|
4
4
|
|
|
5
|
-
> **Deprecated:** Agent networks are deprecated and will be removed in a future major release. [Supervisor agents](https://mastra.ai/docs/
|
|
5
|
+
> **Deprecated:** Agent networks are deprecated and will be removed in a future major release. [Supervisor agents](https://mastra.ai/docs/subagents) using `agent.stream()` or `agent.generate()` are now the recommended approach. It provides the same multi-agent coordination with better control, a simpler API, and easier debugging.
|
|
6
6
|
>
|
|
7
7
|
> See the [migration guide](https://mastra.ai/reference/migrations/network-to-supervisor) to upgrade.
|
|
8
8
|
|
|
@@ -95,7 +95,7 @@ console.log(final?.summary)
|
|
|
95
95
|
|
|
96
96
|
When a primitive requires approval, the stream emits an `agent-execution-approval` or `tool-execution-approval` chunk. Use `approveNetworkToolCall()` or `declineNetworkToolCall()` to respond.
|
|
97
97
|
|
|
98
|
-
Network approval uses snapshots to capture execution state. Ensure a [storage provider](https://mastra.ai/docs/storage
|
|
98
|
+
Network approval uses snapshots to capture execution state. Ensure a [storage provider](https://mastra.ai/docs/storage) is enabled in your Mastra instance.
|
|
99
99
|
|
|
100
100
|
```typescript
|
|
101
101
|
const stream = await routingAgent.network('Perform some sensitive action', {
|
|
@@ -180,5 +180,5 @@ Requirements for automatic resumption:
|
|
|
180
180
|
|
|
181
181
|
## Related
|
|
182
182
|
|
|
183
|
-
- [Supervisor agents](https://mastra.ai/docs/
|
|
183
|
+
- [Supervisor agents](https://mastra.ai/docs/subagents)
|
|
184
184
|
- [Migration: `.network()` to supervisor agents](https://mastra.ai/reference/migrations/network-to-supervisor)
|
|
@@ -165,7 +165,7 @@ Visit the [agent reference](https://mastra.ai/reference/agents/agent) for more i
|
|
|
165
165
|
|
|
166
166
|
## Use your agent
|
|
167
167
|
|
|
168
|
-
After registration, retrieve your agent with [`mastra.getAgentById()`](https://mastra.ai/reference/core/getAgentById). Call `.generate()` for a complete response or `.stream()` to deliver tokens in real time. You can call agents from [workflow steps](https://mastra.ai/docs/workflows/agents-and-tools), [tools](https://mastra.ai/docs/agents/
|
|
168
|
+
After registration, retrieve your agent with [`mastra.getAgentById()`](https://mastra.ai/reference/core/getAgentById). Call `.generate()` for a complete response or `.stream()` to deliver tokens in real time. You can call agents from [workflow steps](https://mastra.ai/docs/workflows/agents-and-tools), [tools](https://mastra.ai/docs/agents/tools), the [Mastra Client](https://mastra.ai/reference/client-js/mastra-client), route handlers, [server adapters](https://mastra.ai/docs/server/server-adapters), or the command line. See [Integrations](https://mastra.ai/integrations) to use agents in your application framework.
|
|
169
169
|
|
|
170
170
|
When referencing an agent from your Mastra instance, use `mastra.getAgentById()` to ensure it has access to shared services such as instance-level storage, logging, and agent registry. A directly imported agent can still work with its own local configuration, but it won't have access to those shared services.
|
|
171
171
|
|
|
@@ -202,18 +202,18 @@ Once your agent is running, use this table to find the right page for what you w
|
|
|
202
202
|
|
|
203
203
|
| Goal | Start here |
|
|
204
204
|
| -------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
205
|
-
| Give your agent tools to call external APIs or services | [Tools](https://mastra.ai/docs/agents/
|
|
205
|
+
| Give your agent tools to call external APIs or services | [Tools](https://mastra.ai/docs/agents/tools) |
|
|
206
206
|
| Keep context and preferences across conversations | [Memory](https://mastra.ai/docs/memory/overview) |
|
|
207
207
|
| Get typed objects back instead of plain text | [Structured output](https://mastra.ai/docs/agents/structured-output) |
|
|
208
|
-
| Human-in-the-loop: Pause execution and wait for human approval | [Human-in-the-loop](https://mastra.ai/docs/agents/
|
|
209
|
-
| Build a multi-agent network | [Supervisor agents](https://mastra.ai/docs/
|
|
210
|
-
| Register subagents | [Tools](https://mastra.ai/docs/agents/
|
|
208
|
+
| Human-in-the-loop: Pause execution and wait for human approval | [Human-in-the-loop](https://mastra.ai/docs/agents/human-in-the-loop) |
|
|
209
|
+
| Build a multi-agent network | [Supervisor agents](https://mastra.ai/docs/subagents) |
|
|
210
|
+
| Register subagents | [Tools](https://mastra.ai/docs/agents/tools) |
|
|
211
211
|
| Intercept or transform messages before and after generation | [Processors](https://mastra.ai/docs/agents/processors) |
|
|
212
212
|
| Keep your agent safe | [Guardrails](https://mastra.ai/docs/agents/guardrails) |
|
|
213
|
-
| Build agents that correct their work | [Rubric scorer](https://mastra.ai/docs/
|
|
213
|
+
| Build agents that correct their work | [Rubric scorer](https://mastra.ai/docs/subagents) |
|
|
214
214
|
| Swap instructions or models based on request context | [Dynamic configuration](https://mastra.ai/docs/server/request-context) |
|
|
215
215
|
| Add speech-to-text or text-to-speech | [Voice](https://mastra.ai/reference/voice/overview) |
|
|
216
|
-
| Connect to Slack, Discord, or Telegram | [Channels](https://mastra.ai/docs/
|
|
216
|
+
| Connect to Slack, Discord, or Telegram | [Channels](https://mastra.ai/docs/channels) |
|
|
217
217
|
|
|
218
218
|
## Multi-agent systems
|
|
219
219
|
|
|
@@ -398,7 +398,7 @@ See the [`TokenLimiterProcessor` reference](https://mastra.ai/reference/processo
|
|
|
398
398
|
|
|
399
399
|
Removes tool calls and results from messages sent to the LLM, saving tokens on verbose tool interactions. Optionally exclude only specific tools. This filter only affects the LLM input, filtered messages are still saved to memory.
|
|
400
400
|
|
|
401
|
-
By default, `ToolCallFilter` filters
|
|
401
|
+
By default, `ToolCallFilter` filters tool calls from prior history and leaves tool calls made during the current agent loop in place. Use `filterAfterToolSteps` to also filter during the loop while preserving the most recent tool-producing steps.
|
|
402
402
|
|
|
403
403
|
```typescript
|
|
404
404
|
new ToolCallFilter({
|
|
@@ -640,7 +640,7 @@ Do not mention the reminder to the user or quote the tags back to them.`,
|
|
|
640
640
|
await agent.generate('Your prompt', { maxSteps: MAX_STEPS })
|
|
641
641
|
```
|
|
642
642
|
|
|
643
|
-
> **Note:** Reactive signals default to `tagName: 'system-reminder'`. Visit [Signals](https://mastra.ai/docs/
|
|
643
|
+
> **Note:** Reactive signals default to `tagName: 'system-reminder'`. Visit [Signals](https://mastra.ai/docs/harness/signals) for more on processor-emitted signals.
|
|
644
644
|
|
|
645
645
|
### Deliver a reminder without retaining it
|
|
646
646
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Tools
|
|
4
4
|
|
|
5
|
-
Agents use tools to call APIs or query databases. They can also run custom functions from your codebase. Tools give agents capabilities beyond language generation by providing structured access to data and performing clearly defined operations. You can also load tools from remote [MCP servers](https://mastra.ai/docs/mcp
|
|
5
|
+
Agents use tools to call APIs or query databases. They can also run custom functions from your codebase. Tools give agents capabilities beyond language generation by providing structured access to data and performing clearly defined operations. You can also load tools from remote [MCP servers](https://mastra.ai/docs/connections/mcp) to expand an agent's capabilities.
|
|
6
6
|
|
|
7
7
|
**For AI agents:** Run `npx mastra api tool execute weather-tool '{"location":"San Francisco"}'` to test this tool directly instead of writing a temporary script. The command requires a running Mastra server; start the local server with `npx mastra dev`, or pass the reachable server's base URL with `--url`. Run `npx mastra api tool execute --schema` before constructing different input. Install Mastra's skill with `npx skills add mastra-ai/skills --skill mastra` for complete API CLI discovery, targeting, schema, authentication, and error-handling guidance.
|
|
8
8
|
|
|
@@ -166,7 +166,7 @@ export const weatherAgent = new Agent({
|
|
|
166
166
|
|
|
167
167
|
## Agents as tools
|
|
168
168
|
|
|
169
|
-
Add subagents through the `agents` configuration to create a [supervisor](https://mastra.ai/docs/
|
|
169
|
+
Add subagents through the `agents` configuration to create a [supervisor](https://mastra.ai/docs/subagents). Mastra converts each subagent to an `agent-<key>` tool. Include a `description` on each subagent so the supervisor knows when to delegate.
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
172
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -605,7 +605,7 @@ for await (const chunk of stream.fullStream) {
|
|
|
605
605
|
}
|
|
606
606
|
```
|
|
607
607
|
|
|
608
|
-
`askUserTool` supports free-text, single-select (`options` array), and multi-select (`selectionMode: 'multi_select'`) prompts. Pair it with `autoResumeSuspendedTools` so the agent resumes automatically from the user's next chat message. See [Automatic tool resumption](https://mastra.ai/docs/agents/
|
|
608
|
+
`askUserTool` supports free-text, single-select (`options` array), and multi-select (`selectionMode: 'multi_select'`) prompts. Pair it with `autoResumeSuspendedTools` so the agent resumes automatically from the user's next chat message. See [Automatic tool resumption](https://mastra.ai/docs/agents/human-in-the-loop) for details.
|
|
609
609
|
|
|
610
610
|
### Submit a plan for review
|
|
611
611
|
|
|
@@ -643,7 +643,7 @@ const agent = new Agent({
|
|
|
643
643
|
})
|
|
644
644
|
```
|
|
645
645
|
|
|
646
|
-
Only one task can be `in_progress` at a time. The list is stored in the thread-scoped `threadState` storage domain and projected onto the agent's [state-signal](https://mastra.ai/docs/
|
|
646
|
+
Only one task can be `in_progress` at a time. The list is stored in the thread-scoped `threadState` storage domain and projected onto the agent's [state-signal](https://mastra.ai/docs/harness/signals) lane, so it survives observational-memory truncation. See the [Task tools reference](https://mastra.ai/reference/tools/task-tools) for full schemas.
|
|
647
647
|
|
|
648
648
|
The [AgentController](https://mastra.ai/docs/harness/agent-controller) automatically includes all built-in tools in every mode, you don't need to add them manually. See [Tool approvals](https://mastra.ai/docs/harness/agent-controller) for AgentController-specific behavior.
|
|
649
649
|
|
|
@@ -651,11 +651,11 @@ The [AgentController](https://mastra.ai/docs/harness/agent-controller) automatic
|
|
|
651
651
|
|
|
652
652
|
- [`createTool` reference](https://mastra.ai/reference/tools/create-tool)
|
|
653
653
|
- [`Agent.generate()` reference](https://mastra.ai/reference/agents/generate): Runtime options for tool selection, steps, and callbacks
|
|
654
|
-
- [Background tasks](https://mastra.ai/docs/
|
|
655
|
-
- [MCP overview](https://mastra.ai/docs/mcp
|
|
654
|
+
- [Background tasks](https://mastra.ai/docs/harness/background-tasks): Run long-running tools without blocking the agent loop
|
|
655
|
+
- [MCP overview](https://mastra.ai/docs/connections/mcp)
|
|
656
656
|
- [Dynamic tool search](https://mastra.ai/reference/processors/tool-search-processor): Load tools on demand for agents with large tool libraries
|
|
657
657
|
- [Tools with structured output](https://mastra.ai/docs/agents/structured-output): Model compatibility when combining tools and structured output
|
|
658
|
-
- [Agent approval](https://mastra.ai/docs/agents/
|
|
658
|
+
- [Agent approval](https://mastra.ai/docs/agents/human-in-the-loop)
|
|
659
659
|
- [`askUserTool` reference](https://mastra.ai/reference/tools/ask-user-tool)
|
|
660
660
|
- [`submitPlanTool` reference](https://mastra.ai/reference/tools/submit-plan-tool)
|
|
661
661
|
- [Task tools reference](https://mastra.ai/reference/tools/task-tools)
|
|
@@ -509,5 +509,5 @@ See the [source code](https://github.com/mastra-ai/mastra/tree/main/auth) for im
|
|
|
509
509
|
|
|
510
510
|
## Related
|
|
511
511
|
|
|
512
|
-
- [Auth Overview](https://mastra.ai/docs/
|
|
512
|
+
- [Auth Overview](https://mastra.ai/docs/auth/overview): Authentication concepts and configuration
|
|
513
513
|
- [Custom API Routes](https://mastra.ai/docs/server/custom-api-routes): Controlling authentication on custom endpoints
|
|
@@ -299,5 +299,5 @@ The actor signal is trusted input, so construct it server-side:
|
|
|
299
299
|
## Related
|
|
300
300
|
|
|
301
301
|
- [`IFGAProvider` reference](https://mastra.ai/reference/auth/fga)
|
|
302
|
-
- [Authentication overview](https://mastra.ai/docs/
|
|
302
|
+
- [Authentication overview](https://mastra.ai/docs/auth/overview)
|
|
303
303
|
- [WorkOS authentication](https://mastra.ai/integrations/auth/workos)
|
|
@@ -25,8 +25,8 @@ See [Custom API Routes](https://mastra.ai/docs/server/custom-api-routes) for con
|
|
|
25
25
|
|
|
26
26
|
### Built-in
|
|
27
27
|
|
|
28
|
-
- [Simple Auth](https://mastra.ai/docs/
|
|
29
|
-
- [JSON Web Token](https://mastra.ai/docs/
|
|
28
|
+
- [Simple Auth](https://mastra.ai/docs/auth/simple-auth)
|
|
29
|
+
- [JSON Web Token](https://mastra.ai/docs/auth/jwt)
|
|
30
30
|
|
|
31
31
|
### Third-party integrations
|
|
32
32
|
|
|
@@ -41,5 +41,5 @@ See [Custom API Routes](https://mastra.ai/docs/server/custom-api-routes) for con
|
|
|
41
41
|
|
|
42
42
|
### Advanced
|
|
43
43
|
|
|
44
|
-
- [Composite Auth](https://mastra.ai/docs/
|
|
45
|
-
- [Custom Provider](https://mastra.ai/docs/
|
|
44
|
+
- [Composite Auth](https://mastra.ai/docs/auth/composite-auth)
|
|
45
|
+
- [Custom Provider](https://mastra.ai/docs/auth/custom-auth-provider)
|
|
@@ -171,4 +171,4 @@ SimpleAuth is designed for simplicity, not production security:
|
|
|
171
171
|
- No cryptographic verification
|
|
172
172
|
- All tokens must be known at startup
|
|
173
173
|
|
|
174
|
-
For production applications, consider using [JWT](https://mastra.ai/docs/
|
|
174
|
+
For production applications, consider using [JWT](https://mastra.ai/docs/auth/jwt), [Clerk](https://mastra.ai/integrations/auth/clerk), [Auth0](https://mastra.ai/integrations/auth/auth0), or another identity provider.
|
|
@@ -130,8 +130,8 @@ Your auth provider's `authenticateToken` callback must recognize whatever creden
|
|
|
130
130
|
|
|
131
131
|
## Related
|
|
132
132
|
|
|
133
|
-
- [Auth overview](https://mastra.ai/docs/
|
|
134
|
-
- [Token-based auth](https://mastra.ai/docs/
|
|
133
|
+
- [Auth overview](https://mastra.ai/docs/auth/overview): Available auth providers and how they work
|
|
134
|
+
- [Token-based auth](https://mastra.ai/docs/auth/simple-auth): Token-to-user mapping authentication
|
|
135
135
|
- [Worker deployment](https://mastra.ai/docs/deployment/workers): Set up split worker processes
|
|
136
136
|
- [Workers reference](https://mastra.ai/reference/workers/overview): Configuration details for all worker types
|
|
137
137
|
- [CLI reference](https://mastra.ai/reference/cli/mastra): `mastra worker build` and `mastra worker start`
|
|
@@ -50,7 +50,7 @@ export const yourAgent = new Agent({
|
|
|
50
50
|
|
|
51
51
|
> **Note:** Channel adapters require provider-specific environment variables for credentials and request verification, such as bot tokens, signing secrets, app IDs, and webhook verification tokens. Check the guide for your platform or the [Chat SDK adapter catalog](https://chat-sdk.dev/adapters) for the exact variable names.
|
|
52
52
|
|
|
53
|
-
We recommend configuring [storage](https://mastra.ai/docs/storage
|
|
53
|
+
We recommend configuring [storage](https://mastra.ai/docs/storage) for channels. Storage lets Mastra persist channel state, thread subscriptions, tool approvals, and memory across restarts:
|
|
54
54
|
|
|
55
55
|
```typescript
|
|
56
56
|
import { Mastra } from '@mastra/core'
|
|
@@ -284,7 +284,7 @@ Vercel and AWS Lambda require `waitUntil`, since they freeze the function as soo
|
|
|
284
284
|
|
|
285
285
|
### Coordinate instances with a shared pub/sub
|
|
286
286
|
|
|
287
|
-
Channels route messages through the agent's [signal pipeline](https://mastra.ai/docs/
|
|
287
|
+
Channels route messages through the agent's [signal pipeline](https://mastra.ai/docs/harness/signals), and each run acquires a lease on its thread so one run owns the conversation at a time.
|
|
288
288
|
|
|
289
289
|
The default in-memory pub/sub can't cross instance boundaries, so on serverless a follow-up message can be routed to a different instance than the one running the agent.
|
|
290
290
|
|
|
@@ -80,7 +80,7 @@ Use `A2AAgent` when another Mastra agent should delegate work to a remote agent.
|
|
|
80
80
|
|
|
81
81
|
## Consume A2A agents as subagents
|
|
82
82
|
|
|
83
|
-
Use `A2AAgent` to wrap a remote A2A agent, then add it to a parent agent with the [supervisor agents](https://mastra.ai/docs/
|
|
83
|
+
Use `A2AAgent` to wrap a remote A2A agent, then add it to a parent agent with the [supervisor agents](https://mastra.ai/docs/subagents) pattern. Pass an explicit agent card URL when the remote server hosts multiple agents or uses a custom well-known path.
|
|
84
84
|
|
|
85
85
|
```typescript
|
|
86
86
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -221,7 +221,7 @@ A2A models human-in-the-loop (HITL) work with the `input-required` task state. W
|
|
|
221
221
|
|
|
222
222
|
Mastra maps its agent suspension model to this state in both directions:
|
|
223
223
|
|
|
224
|
-
- **As a server**: when an exposed agent suspends, the task transitions to `input-required`. This includes suspensions caused by [tool approval](https://mastra.ai/docs/agents/
|
|
224
|
+
- **As a server**: when an exposed agent suspends, the task transitions to `input-required`. This includes suspensions caused by [tool approval](https://mastra.ai/docs/agents/human-in-the-loop) or a tool that calls `suspend()`. The task status message includes a text prompt and a data part with the structured `suspendPayload` and `resumeSchema`. A follow-up `message/send` or `message/stream` request with the same `taskId` resumes the suspended run with the provided input.
|
|
225
225
|
- **As a client**: when a remote task reaches `input-required` or `auth-required`, `A2AAgent` returns a suspended result with `finishReason: 'suspended'` and a `suspendPayload`. Calling `resumeGenerate()` or `resumeStream()` sends the input or credentials back to the remote task with the original `taskId`.
|
|
226
226
|
|
|
227
227
|
```typescript
|
|
@@ -151,6 +151,6 @@ See the [AcpAgent workspace integration](https://mastra.ai/reference/acp/acp-age
|
|
|
151
151
|
- [AcpAgent reference](https://mastra.ai/reference/acp/acp-agent)
|
|
152
152
|
- [createACPTool() reference](https://mastra.ai/reference/acp/create-acp-tool)
|
|
153
153
|
- [Agent reference](https://mastra.ai/reference/agents/agent)
|
|
154
|
-
- [Subagents](https://mastra.ai/docs/
|
|
154
|
+
- [Subagents](https://mastra.ai/docs/subagents)
|
|
155
155
|
- [Agent Client Protocol introduction](https://agentclientprotocol.com/overview/introduction)
|
|
156
156
|
- [Agent Client Protocol schema](https://agentclientprotocol.com/protocol/schema)
|
|
@@ -406,7 +406,7 @@ App iframes allow scripts, forms, and popups. They can't access the parent page'
|
|
|
406
406
|
|
|
407
407
|
## Next steps
|
|
408
408
|
|
|
409
|
-
- [Use tools with agents](https://mastra.ai/docs/agents/
|
|
409
|
+
- [Use tools with agents](https://mastra.ai/docs/agents/tools)
|
|
410
410
|
- [`MCPClient` reference](https://mastra.ai/reference/tools/mcp-client)
|
|
411
411
|
- [`MCPServer` reference](https://mastra.ai/reference/tools/mcp-server)
|
|
412
412
|
- [MCP Apps extension specification](https://github.com/modelcontextprotocol/ext-apps)
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
Connections let Mastra work with remote agents, coding agents, provider software development kit (SDK) runtimes, and external tools and resources. Choose a connection type based on which system owns the agent runtime and what you need to exchange.
|
|
6
6
|
|
|
7
|
-
- [**
|
|
8
|
-
- [**Agent
|
|
9
|
-
- [**
|
|
10
|
-
- [**
|
|
7
|
+
- [**Model Context Protocol (MCP)**](https://mastra.ai/docs/connections/mcp): Connect agents to external tools and resources, or expose Mastra agents, tools, workflows, prompts, and resources to MCP-compatible systems.
|
|
8
|
+
- [**Agent-to-Agent (A2A)**](https://mastra.ai/docs/connections/a2a): Expose or consume remote agents across service, framework, vendor, and language boundaries.
|
|
9
|
+
- [**Agent Client Protocol (ACP)**](https://mastra.ai/docs/connections/acp): Run compatible coding-agent processes as Mastra tools or subagents.
|
|
10
|
+
- [**SDK agents**](https://mastra.ai/docs/connections/sdk-agents): Register Claude, Cursor, or OpenAI SDK-backed agents while the provider SDK retains control of the runtime, tools, permissions, and agent loop.
|
|
11
11
|
|
|
12
12
|
## When to use connections
|
|
13
13
|
|
|
@@ -20,7 +20,7 @@ Use connections when you need to:
|
|
|
20
20
|
|
|
21
21
|
## Get started
|
|
22
22
|
|
|
23
|
-
Start with the boundary you need to cross. Use [A2A](https://mastra.ai/docs/
|
|
23
|
+
Start with the boundary you need to cross. Use [A2A](https://mastra.ai/docs/connections/a2a) for remote agent endpoints, [ACP](https://mastra.ai/docs/connections/acp) for coding-agent processes, [SDK agents](https://mastra.ai/docs/connections/sdk-agents) for provider-owned runtimes, or [MCP](https://mastra.ai/docs/connections/mcp) for tools and resources.
|
|
24
24
|
|
|
25
25
|
**A2A**:
|
|
26
26
|
|
|
@@ -423,5 +423,5 @@ For storage and dashboard setup, see [Observability](https://mastra.ai/docs/obse
|
|
|
423
423
|
## Related
|
|
424
424
|
|
|
425
425
|
- [Agents overview](https://mastra.ai/docs/agents/overview)
|
|
426
|
-
- [Tools](https://mastra.ai/docs/agents/
|
|
426
|
+
- [Tools](https://mastra.ai/docs/agents/tools)
|
|
427
427
|
- [Observability](https://mastra.ai/docs/observability/overview)
|
|
@@ -102,7 +102,7 @@ If a `public` folder exists in your Mastra directory (`src/mastra/public`), its
|
|
|
102
102
|
|
|
103
103
|
### Mastra configuration
|
|
104
104
|
|
|
105
|
-
The build process respects configuration in your Mastra instance. For server behavior like CORS, timeouts, and middleware, see [server overview](https://mastra.ai/docs/server/
|
|
105
|
+
The build process respects configuration in your Mastra instance. For server behavior like CORS, timeouts, and middleware, see [server overview](https://mastra.ai/docs/server/overview). For all available options, see the [configuration reference](https://mastra.ai/reference/configuration).
|
|
106
106
|
|
|
107
107
|
## Build process
|
|
108
108
|
|
|
@@ -151,7 +151,7 @@ NODE_OPTIONS="--max-old-space-size=4096" mastra build
|
|
|
151
151
|
|
|
152
152
|
## Related
|
|
153
153
|
|
|
154
|
-
- [Server Overview](https://mastra.ai/docs/server/
|
|
154
|
+
- [Server Overview](https://mastra.ai/docs/server/overview): Configure server behavior, middleware, and authentication
|
|
155
155
|
- [Server Adapters](https://mastra.ai/docs/server/server-adapters): Use Express or Hono instead of `mastra build`
|
|
156
156
|
- [Custom API Routes](https://mastra.ai/docs/server/custom-api-routes): Add custom HTTP endpoints
|
|
157
157
|
- [Configuration Reference](https://mastra.ai/reference/configuration): Full configuration options
|
|
@@ -17,7 +17,7 @@ Mastra can run against any of these runtime environments:
|
|
|
17
17
|
|
|
18
18
|
### Mastra server
|
|
19
19
|
|
|
20
|
-
Mastra provides a [server](https://mastra.ai/docs/server/
|
|
20
|
+
Mastra provides a [server](https://mastra.ai/docs/server/overview) powered by Hono that can be deployed independently. Use the `mastra build` command to build your application and deploy the output to your preferred VM, container, or PaaS platform.
|
|
21
21
|
|
|
22
22
|
Use this option when you need full control over your infrastructure, long-running processes, or WebSocket connections. The [Mastra server deployment guide](https://mastra.ai/docs/deployment/mastra-server) provides more details.
|
|
23
23
|
|
|
@@ -362,12 +362,12 @@ jobs:
|
|
|
362
362
|
|
|
363
363
|
## Security
|
|
364
364
|
|
|
365
|
-
- The sandbox URL is public. Anyone with the URL can reach your Mastra server, including Studio. Enable [server auth](https://mastra.ai/docs/
|
|
365
|
+
- The sandbox URL is public. Anyone with the URL can reach your Mastra server, including Studio. Enable [server auth](https://mastra.ai/docs/auth/overview) for anything beyond throwaway previews.
|
|
366
366
|
- Environment variables from your `.env` files are injected into the remote sandbox VM so the server can run. The deploy logs a warning when this happens. Don't deploy secrets you wouldn't put on a shared preview server.
|
|
367
|
-
- To restrict access to Tier 3 traffic, pass a `secret` to `createSandboxHandler()` or `createSandboxProxy()`. The helpers attach it as the `x-mastra-sandbox-secret` header on forwarded requests. Configure [server auth](https://mastra.ai/docs/
|
|
367
|
+
- To restrict access to Tier 3 traffic, pass a `secret` to `createSandboxHandler()` or `createSandboxProxy()`. The helpers attach it as the `x-mastra-sandbox-secret` header on forwarded requests. Configure [server auth](https://mastra.ai/docs/auth/overview) to require that header, and direct hits to the sandbox URL get rejected while traffic through your domain works.
|
|
368
368
|
|
|
369
369
|
## Related
|
|
370
370
|
|
|
371
371
|
- [Deployment overview](https://mastra.ai/docs/deployment/overview)
|
|
372
|
-
- [Server authentication](https://mastra.ai/docs/
|
|
372
|
+
- [Server authentication](https://mastra.ai/docs/auth/overview)
|
|
373
373
|
- [`WorkspaceSandbox` reference](https://mastra.ai/reference/workspace/sandbox)
|
|
@@ -339,7 +339,7 @@ MASTRA_STEP_EXECUTION_URL=http://api:4111/api
|
|
|
339
339
|
|
|
340
340
|
Without this variable, the orchestration worker attempts to execute steps in its own process, which doesn't have access to the full Mastra runtime in a split deployment.
|
|
341
341
|
|
|
342
|
-
The endpoint uses the server's normal auth pipeline. If the API has an auth provider, set `MASTRA_WORKER_AUTH_TOKEN` to a bearer token that provider accepts. Mastra forwards the value as an `Authorization: Bearer` credential. The configured auth provider validates the token. See [Worker authentication](https://mastra.ai/docs/
|
|
342
|
+
The endpoint uses the server's normal auth pipeline. If the API has an auth provider, set `MASTRA_WORKER_AUTH_TOKEN` to a bearer token that provider accepts. Mastra forwards the value as an `Authorization: Bearer` credential. The configured auth provider validates the token. See [Worker authentication](https://mastra.ai/docs/auth/workers) for server configuration and other credential formats.
|
|
343
343
|
|
|
344
344
|
### Scale workers
|
|
345
345
|
|
|
@@ -365,18 +365,18 @@ A distributed PubSub backend persists unacknowledged events, which lets orchestr
|
|
|
365
365
|
|
|
366
366
|
The scheduler calculates the next fire time from the current time after it restarts. It doesn't replay schedules that elapsed while it was unavailable.
|
|
367
367
|
|
|
368
|
-
If the API crashes while a step is executing, that work can be lost and the workflow run can remain in a `running` state. See [known limitations](#known-limitations) and [durable agent crash recovery](https://mastra.ai/docs/
|
|
368
|
+
If the API crashes while a step is executing, that work can be lost and the workflow run can remain in a `running` state. See [known limitations](#known-limitations) and [durable agent crash recovery](https://mastra.ai/docs/harness/durable-agents).
|
|
369
369
|
|
|
370
370
|
## Known limitations
|
|
371
371
|
|
|
372
372
|
- **No dead-letter queue**: Failed events are nacked and retried, but there's no DLQ for events that fail after all retries.
|
|
373
373
|
- **No built-in health endpoint**: Workers don't expose an HTTP health check. Use container-level liveness probes or process monitoring.
|
|
374
374
|
- **Scheduler is single-instance**: Running multiple scheduler processes causes duplicate schedule fires.
|
|
375
|
-
- **Runs stuck in "running" after API crash**: If the API process crashes while executing a workflow step, the run remains in `running` status with no automatic retry. For [durable agents](https://mastra.ai/docs/
|
|
375
|
+
- **Runs stuck in "running" after API crash**: If the API process crashes while executing a workflow step, the run remains in `running` status with no automatic retry. For [durable agents](https://mastra.ai/docs/harness/durable-agents), set `recovery.durableAgents` to `'auto'` in the Mastra config to automatically re-drive orphaned runs on server restart. See [Crash recovery](https://mastra.ai/docs/harness/durable-agents) for details.
|
|
376
376
|
|
|
377
377
|
## Related
|
|
378
378
|
|
|
379
|
-
- [Worker authentication](https://mastra.ai/docs/
|
|
379
|
+
- [Worker authentication](https://mastra.ai/docs/auth/workers): Secure worker-to-API communication
|
|
380
380
|
- [Workers reference](https://mastra.ai/reference/workers/overview): Details about worker environment variables and types, with a list of supported storage backends
|
|
381
381
|
- [CLI reference](https://mastra.ai/reference/cli/mastra): `mastra worker build` and `mastra worker start`
|
|
382
382
|
- [PubSub](https://mastra.ai/docs/server/pubsub): Event delivery backends
|
|
@@ -44,7 +44,7 @@ A supervisor pattern keeps one lead agent in control for the full task. The supe
|
|
|
44
44
|
|
|
45
45
|
Use this pattern when the task is open-ended and the full sequence isn't known in advance. For example, a research task may require different lines of inquiry based on what earlier steps uncover. A supervisor can adapt as the task unfolds. The tradeoff is that the supervisor becomes the main coordination point. That makes the pattern flexible, but it also means the result depends heavily on good delegation behavior and clear subagent boundaries.
|
|
46
46
|
|
|
47
|
-
In Mastra, this pattern maps directly to [supervisor agents](https://mastra.ai/docs/
|
|
47
|
+
In Mastra, this pattern maps directly to [supervisor agents](https://mastra.ai/docs/subagents). A supervisor agent defines subagents on the `agents` property and uses `stream()` or `generate()` to coordinate them. Mastra also provides delegation hooks, message filtering, and memory isolation to help control this pattern.
|
|
48
48
|
|
|
49
49
|
> **Tip:** Follow the [supervisor agents tutorial](https://mastra.ai/blog/build-a-research-coordinator-with-supervisor-agents) for a step-by-step guide.
|
|
50
50
|
|
|
@@ -60,12 +60,12 @@ Mastra doesn't provide a dedicated council primitive. In Mastra, implement this
|
|
|
60
60
|
|
|
61
61
|
These patterns differ mainly in how they distribute control:
|
|
62
62
|
|
|
63
|
-
| Pattern | Who stays in control | Use when | Tradeoff | Mastra implementation
|
|
64
|
-
| ----------------- | -------------------- | ------------------------------------------------ | -------------------------------------------------------- |
|
|
65
|
-
| Handoffs | Current specialist | Ownership should move between specialists | Context transfer becomes more important | Agents with workflows and memory
|
|
66
|
-
| Workflows | Execution graph | The path is known in advance | Less adaptive when the task changes | [Workflows](https://mastra.ai/docs/workflows/overview)
|
|
67
|
-
| Supervisor agents | One lead agent | Delegation must adapt during execution | Results depend on good coordination and clear boundaries | [Supervisor agents](https://mastra.ai/docs/
|
|
68
|
-
| Council | Final synthesis step | The task needs multiple independent perspectives | Higher cost and latency | Agents with workflow parallelism
|
|
63
|
+
| Pattern | Who stays in control | Use when | Tradeoff | Mastra implementation |
|
|
64
|
+
| ----------------- | -------------------- | ------------------------------------------------ | -------------------------------------------------------- | ------------------------------------------------------ |
|
|
65
|
+
| Handoffs | Current specialist | Ownership should move between specialists | Context transfer becomes more important | Agents with workflows and memory |
|
|
66
|
+
| Workflows | Execution graph | The path is known in advance | Less adaptive when the task changes | [Workflows](https://mastra.ai/docs/workflows/overview) |
|
|
67
|
+
| Supervisor agents | One lead agent | Delegation must adapt during execution | Results depend on good coordination and clear boundaries | [Supervisor agents](https://mastra.ai/docs/subagents) |
|
|
68
|
+
| Council | Final synthesis step | The task needs multiple independent perspectives | Higher cost and latency | Agents with workflow parallelism |
|
|
69
69
|
|
|
70
70
|
In practice, these patterns are often combined:
|
|
71
71
|
|
|
@@ -31,7 +31,7 @@ for await (const chunk of stream.textStream) {
|
|
|
31
31
|
|
|
32
32
|
Visit [Agent.stream()](https://mastra.ai/reference/streaming/agents/stream) for more information.
|
|
33
33
|
|
|
34
|
-
> **Tip:** For agents that dispatch [background tasks](https://mastra.ai/docs/
|
|
34
|
+
> **Tip:** For agents that dispatch [background tasks](https://mastra.ai/docs/harness/background-tasks), use [`Agent.streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) to keep the stream open until those tasks complete and the agent has had a chance to respond to their results.
|
|
35
35
|
|
|
36
36
|
### Output from `Agent.stream()`
|
|
37
37
|
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
[Mastra Code](https://code.mastra.ai) and [Mastra Factory](https://factory.mastra.ai) are the flagship AgentController implementations. They're coding agents with multi-model support, persistent conversations, and plan-then-execute workflows. Read [Building a coding agent](https://mastra.ai/blog/building-a-coding-agent) for a step-by-step TUI guide.
|
|
10
10
|
|
|
11
|
+
When the agent you host works in a codebase, build it with [`createCodingAgent()`](https://mastra.ai/reference/coding-agent/create-coding-agent) instead of `new Agent()`. It returns a standard `Agent` that already has a workspace, task tracking, and retries for transient model errors, which are the defaults Mastra Code runs on.
|
|
12
|
+
|
|
11
13
|
## When to use the Agent Controller
|
|
12
14
|
|
|
13
15
|
Use the Agent Controller when your application needs:
|
|
@@ -388,7 +390,7 @@ channels: {
|
|
|
388
390
|
|
|
389
391
|
Controller channel sessions and auto-approval state are held in memory, so use a long-lived server. Pending approvals and live Session state don't survive process restarts. Adapters that can't render approval controls automatically run tools without an approval prompt so the run doesn't remain suspended.
|
|
390
392
|
|
|
391
|
-
See [Channels](https://mastra.ai/docs/
|
|
393
|
+
See [Channels](https://mastra.ai/docs/channels) for adapter setup and platform-specific webhook configuration.
|
|
392
394
|
|
|
393
395
|
## Connect a UI
|
|
394
396
|
|
|
@@ -412,6 +414,6 @@ Subscriptions are isolated by Session. Events from another Session on the same c
|
|
|
412
414
|
## Related
|
|
413
415
|
|
|
414
416
|
- [Agents](https://mastra.ai/docs/agents/overview)
|
|
415
|
-
- [Workspace](https://mastra.ai/docs/
|
|
417
|
+
- [Workspace](https://mastra.ai/docs/sandbox/overview)
|
|
416
418
|
- [Observational memory](https://mastra.ai/docs/memory/observational-memory)
|
|
417
|
-
- [Channels](https://mastra.ai/docs/
|
|
419
|
+
- [Channels](https://mastra.ai/docs/channels)
|
|
@@ -16,7 +16,7 @@ Use background tasks when a tool call may take long enough that the user shouldn
|
|
|
16
16
|
|
|
17
17
|
For tool calls that return quickly, foreground execution using `agent.stream()` and `agent.generate()` is simpler.
|
|
18
18
|
|
|
19
|
-
> **Note:** Background tasks require a configured [storage](https://mastra.ai/docs/storage
|
|
19
|
+
> **Note:** Background tasks require a configured [storage](https://mastra.ai/docs/storage) backend on the Mastra instance. Tasks are persisted so they survive process restarts.
|
|
20
20
|
|
|
21
21
|
## Quickstart
|
|
22
22
|
|
|
@@ -121,7 +121,7 @@ If the agent has `backgroundTasks.disabled: true`, every tool call runs synchron
|
|
|
121
121
|
|
|
122
122
|
## Background tasks related stream chunks
|
|
123
123
|
|
|
124
|
-
When a tool call dispatches as a background task, two streams may surface lifecycle events for it: the agent's own stream and the [`backgroundTaskManager.stream()`](https://mastra.ai/docs/
|
|
124
|
+
When a tool call dispatches as a background task, two streams may surface lifecycle events for it: the agent's own stream and the [`backgroundTaskManager.stream()`](https://mastra.ai/docs/harness/background-tasks) SSE stream. Each stream covers a different set of chunk types:
|
|
125
125
|
|
|
126
126
|
| Chunk type | When it fires | Emitted by |
|
|
127
127
|
| --------------------------- | -------------------------------------------------------------------------------------- | -------------- |
|
|
@@ -376,7 +376,7 @@ These read from storage rather than the pubsub stream, so they're suitable for p
|
|
|
376
376
|
|
|
377
377
|
- [`Agent.stream()` reference](https://mastra.ai/reference/streaming/agents/stream)
|
|
378
378
|
- [backgroundTasks configuration reference](https://mastra.ai/reference/configuration)
|
|
379
|
-
- [Durable agents](https://mastra.ai/docs/
|
|
380
|
-
- [Supervisor agents](https://mastra.ai/docs/
|
|
379
|
+
- [Durable agents](https://mastra.ai/docs/harness/durable-agents)
|
|
380
|
+
- [Supervisor agents](https://mastra.ai/docs/subagents)
|
|
381
381
|
- [Stream chunk types](https://mastra.ai/reference/streaming/ChunkType)
|
|
382
|
-
- [Storage](https://mastra.ai/docs/storage
|
|
382
|
+
- [Storage](https://mastra.ai/docs/storage)
|
|
@@ -198,7 +198,7 @@ await durableAgent.stream('Research topic', {
|
|
|
198
198
|
})
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
Visit [Background tasks](https://mastra.ai/docs/
|
|
201
|
+
Visit [Background tasks](https://mastra.ai/docs/harness/background-tasks) for the full background task guide, including configuration, subagents, and suspend/resume.
|
|
202
202
|
|
|
203
203
|
## Cleanup
|
|
204
204
|
|
|
@@ -267,7 +267,7 @@ Mastra doesn't provide a distributed lease or lock yet. In multi-replica deploym
|
|
|
267
267
|
|
|
268
268
|
- [DurableAgent reference](https://mastra.ai/reference/agents/durable-agent)
|
|
269
269
|
- [`createInngestAgent()` reference](https://mastra.ai/reference/agents/inngest-agent)
|
|
270
|
-
- [Background tasks](https://mastra.ai/docs/
|
|
270
|
+
- [Background tasks](https://mastra.ai/docs/harness/background-tasks)
|
|
271
271
|
- [Inngest deployment guide](https://mastra.ai/integrations/deploy/inngest)
|
|
272
272
|
- [Agent overview](https://mastra.ai/docs/agents/overview)
|
|
273
273
|
- [Worker overview](https://mastra.ai/docs/deployment/workers)
|