@mastra/mcp-docs-server 1.2.5-alpha.1 → 1.2.5-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agent-builder/deploying.md +1 -1
- package/.docs/docs/agent-controller/overview.md +1 -1
- package/.docs/docs/agent-controller/session.md +1 -1
- package/.docs/docs/agents/overview.md +1 -1
- package/.docs/docs/agents/processors.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +3 -3
- package/.docs/docs/agents/using-tools.md +1 -1
- package/.docs/docs/{agents → long-running-agents}/background-tasks.md +2 -2
- package/.docs/docs/{agents → long-running-agents}/durable-agents.md +2 -2
- package/.docs/docs/{agents → long-running-agents}/goals.md +1 -1
- package/.docs/docs/{agents → long-running-agents}/heartbeats.md +5 -5
- package/.docs/docs/{agents → long-running-agents}/signal-providers.md +4 -4
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/config.md +1 -2
- package/.docs/docs/server/pubsub.md +2 -2
- package/.docs/docs/voice/overview.md +3 -3
- package/.docs/docs/voice/speech-to-speech.md +81 -1
- package/.docs/docs/voice/speech-to-text.md +19 -1
- package/.docs/docs/voice/text-to-speech.md +21 -1
- package/.docs/docs/workflows/control-flow.md +1 -1
- package/.docs/docs/workflows/error-handling.md +1 -1
- package/.docs/docs/workflows/human-in-the-loop.md +1 -1
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/docs/workflows/snapshots.md +1 -1
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workflows/time-travel.md +1 -1
- package/.docs/docs/workflows/workflow-state.md +1 -1
- package/.docs/guides/build-your-ui/copilotkit/channels.md +76 -0
- package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +174 -0
- package/.docs/guides/build-your-ui/copilotkit/overview.md +411 -0
- package/.docs/guides/concepts/streaming.md +1 -1
- package/.docs/guides/deployment/vercel.md +1 -2
- package/.docs/guides/guide/signal-provider.md +5 -5
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +2 -1
- package/.docs/models/providers/friendli.md +1 -2
- package/.docs/models/providers/nvidia.md +3 -2
- package/.docs/models/providers/tencent-token-plan.md +7 -7
- package/.docs/models/providers/tencent-tokenhub.md +5 -4
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/acp/acp-agent.md +5 -5
- package/.docs/reference/acp/create-acp-tool.md +5 -5
- package/.docs/reference/agent-controller/agent-controller-class.md +27 -27
- package/.docs/reference/agents/agent.md +34 -34
- package/.docs/reference/agents/channels.md +19 -19
- package/.docs/reference/agents/createSkill.md +2 -2
- package/.docs/reference/agents/durable-agent.md +22 -22
- package/.docs/reference/agents/generate.md +10 -10
- package/.docs/reference/agents/generateLegacy.md +12 -12
- package/.docs/reference/agents/getMetadata.md +1 -1
- package/.docs/reference/agents/getVoice.md +1 -1
- package/.docs/reference/agents/inngest-agent.md +9 -9
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/ai-sdk/chat-route.md +4 -4
- package/.docs/reference/ai-sdk/handle-chat-stream.md +6 -6
- package/.docs/reference/ai-sdk/handle-network-stream.md +3 -3
- package/.docs/reference/ai-sdk/handle-workflow-stream.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +4 -4
- package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
- package/.docs/reference/ai-sdk/with-mastra.md +2 -2
- package/.docs/reference/ai-sdk/workflow-route.md +2 -2
- package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +1 -1
- package/.docs/reference/auth/google.md +10 -10
- package/.docs/reference/auth/okta.md +11 -11
- package/.docs/reference/auth/workos.md +3 -3
- package/.docs/reference/channels/slack-provider.md +15 -15
- package/.docs/reference/cli/mastra.md +145 -0
- package/.docs/reference/client-js/agents.md +9 -9
- package/.docs/reference/client-js/mastra-client.md +5 -5
- package/.docs/reference/client-js/responses.md +3 -3
- package/.docs/reference/configuration.md +1 -1
- package/.docs/reference/core/getAgentById.md +3 -3
- package/.docs/reference/core/getWorkflow.md +1 -1
- package/.docs/reference/core/listWorkflows.md +1 -1
- package/.docs/reference/core/mastra-class.md +3 -3
- package/.docs/reference/core/removeWorkspace.md +2 -2
- package/.docs/reference/datasets/compareExperiments.md +1 -1
- package/.docs/reference/datasets/getItemHistory.md +1 -1
- package/.docs/reference/datasets/list.md +5 -5
- package/.docs/reference/datasets/listExperimentResults.md +4 -4
- package/.docs/reference/datasets/listExperiments.md +4 -4
- package/.docs/reference/datasets/listItems.md +5 -5
- package/.docs/reference/datasets/listVersions.md +3 -3
- package/.docs/reference/datasets/startExperiment.md +8 -8
- package/.docs/reference/datasets/startExperimentAsync.md +1 -1
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +4 -4
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +7 -7
- package/.docs/reference/editor/agent-builder/builder-models.md +4 -4
- package/.docs/reference/editor/blob-store-provider.md +2 -2
- package/.docs/reference/editor/browser-provider.md +2 -2
- package/.docs/reference/editor/filesystem-provider.md +2 -2
- package/.docs/reference/editor/mastra-editor.md +2 -2
- package/.docs/reference/editor/processor-provider.md +4 -4
- package/.docs/reference/editor/sandbox-provider.md +2 -2
- package/.docs/reference/editor/storage-browser-ref.md +2 -2
- package/.docs/reference/editor/storage-workspace-ref.md +7 -7
- package/.docs/reference/evals/create-scorer.md +8 -8
- package/.docs/reference/evals/rubric.md +1 -1
- package/.docs/reference/evals/run-evals.md +7 -7
- package/.docs/reference/evals/trajectory-accuracy.md +1 -1
- package/.docs/reference/index.md +2 -2
- package/.docs/reference/logging/pino-logger.md +4 -4
- package/.docs/reference/memory/cloneThread.md +35 -4
- package/.docs/reference/memory/memory-class.md +5 -5
- package/.docs/reference/memory/observational-memory.md +43 -43
- package/.docs/reference/memory/recall.md +4 -4
- package/.docs/reference/memory/serialized-memory-config.md +6 -6
- package/.docs/reference/observability/tracing/configuration.md +4 -4
- package/.docs/reference/processors/language-detector.md +1 -1
- package/.docs/reference/processors/moderation-processor.md +1 -1
- package/.docs/reference/processors/pii-detector.md +1 -1
- package/.docs/reference/processors/processor-interface.md +20 -20
- package/.docs/reference/processors/prompt-injection-detector.md +1 -1
- package/.docs/reference/processors/response-cache.md +6 -6
- package/.docs/reference/processors/unicode-normalizer.md +1 -1
- package/.docs/reference/pubsub/base.md +7 -7
- package/.docs/reference/pubsub/caching-pubsub.md +1 -1
- package/.docs/reference/pubsub/event-emitter.md +2 -2
- package/.docs/reference/pubsub/google-cloud-pubsub.md +1 -1
- package/.docs/reference/pubsub/lease-provider.md +3 -3
- package/.docs/reference/pubsub/redis-streams.md +6 -6
- package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
- package/.docs/reference/rag/chunk.md +2 -2
- package/.docs/reference/server/create-route.md +3 -3
- package/.docs/reference/server/express-adapter.md +4 -4
- package/.docs/reference/server/fastify-adapter.md +4 -4
- package/.docs/reference/server/hono-adapter.md +4 -4
- package/.docs/reference/server/koa-adapter.md +4 -4
- package/.docs/reference/server/mastra-server.md +1 -1
- package/.docs/reference/server/nestjs-adapter.md +3 -3
- package/.docs/reference/server/register-api-route.md +3 -3
- package/.docs/reference/signals/create-notification-inbox-tool.md +3 -3
- package/.docs/reference/signals/signal-provider.md +7 -7
- package/.docs/reference/signals/webhook-signal-provider.md +2 -2
- package/.docs/reference/storage/clickhouse.md +7 -7
- package/.docs/reference/storage/composite.md +2 -2
- package/.docs/reference/storage/duckdb.md +1 -1
- package/.docs/reference/storage/dynamodb.md +1 -1
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/postgresql.md +2 -2
- package/.docs/reference/storage/redis.md +2 -2
- package/.docs/reference/storage/retention.md +5 -5
- package/.docs/reference/storage/spanner.md +6 -6
- package/.docs/reference/streaming/ChunkType.md +3 -3
- package/.docs/reference/streaming/agents/stream.md +14 -14
- package/.docs/reference/streaming/agents/streamLegacy.md +10 -10
- package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/templates/overview.md +1 -140
- package/.docs/reference/tools/brightdata.md +4 -4
- package/.docs/reference/tools/create-code-mode.md +5 -5
- package/.docs/reference/tools/create-tool.md +15 -15
- package/.docs/reference/tools/graph-rag-tool.md +1 -1
- package/.docs/reference/tools/mcp-client.md +2 -2
- package/.docs/reference/tools/mcp-server.md +12 -12
- package/.docs/reference/tools/perplexity.md +3 -3
- package/.docs/reference/tools/tavily.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +1 -1
- package/.docs/reference/vectors/chroma.md +1 -1
- package/.docs/reference/vectors/mongodb.md +1 -1
- package/.docs/reference/vectors/pg.md +1 -1
- package/.docs/reference/vectors/s3vectors.md +4 -4
- package/.docs/reference/voice/google-gemini-live.md +3 -3
- package/.docs/reference/voice/inworld-realtime.md +12 -12
- package/.docs/reference/voice/inworld.md +2 -2
- package/.docs/reference/voice/voice.on.md +1 -1
- package/.docs/reference/workflows/run-methods/resume.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workspace/agentcore-runtime-sandbox.md +4 -4
- package/.docs/reference/workspace/agentfs-filesystem.md +1 -1
- package/.docs/reference/workspace/apple-container-sandbox.md +5 -5
- package/.docs/reference/workspace/archil-filesystem.md +5 -5
- package/.docs/reference/workspace/blaxel-sandbox.md +1 -1
- package/.docs/reference/workspace/daytona-sandbox.md +1 -1
- package/.docs/reference/workspace/docker-sandbox.md +2 -2
- package/.docs/reference/workspace/e2b-sandbox.md +2 -2
- package/.docs/reference/workspace/files-sdk-filesystem.md +1 -1
- package/.docs/reference/workspace/filesystem.md +1 -1
- package/.docs/reference/workspace/local-filesystem.md +3 -3
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/mesa-filesystem.md +3 -3
- package/.docs/reference/workspace/modal-sandbox.md +1 -1
- package/.docs/reference/workspace/railway-sandbox.md +1 -1
- package/.docs/reference/workspace/s3-filesystem.md +4 -4
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/{vercel-microvm-sandbox.md → vercel-sandbox.md} +21 -15
- package/.docs/reference/workspace/{vercel.md → vercel-serverless.md} +21 -14
- package/.docs/reference/workspace/workspace-class.md +15 -15
- package/CHANGELOG.md +15 -0
- package/package.json +4 -4
- package/.docs/docs/agents/adding-voice.md +0 -383
- package/.docs/docs/community/contributing-templates.md +0 -5
- package/.docs/docs/community/discord.md +0 -11
- package/.docs/guides/build-your-ui/copilotkit.md +0 -291
- package/LICENSE.md +0 -30
- /package/.docs/docs/{community/licensing.md → license.md} +0 -0
- /package/.docs/docs/{agents → long-running-agents}/signals.md +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Friendli
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 6 Friendli models through Mastra's model router. Authentication is handled automatically using the `FRIENDLI_TOKEN` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Friendli documentation](https://friendli.ai/docs/guides/serverless_endpoints/introduction).
|
|
8
8
|
|
|
@@ -40,7 +40,6 @@ for await (const chunk of stream) {
|
|
|
40
40
|
| `friendli/google/gemma-4-31B-it` | 262K | | | | | | $0.14 | $0.40 |
|
|
41
41
|
| `friendli/MiniMaxAI/MiniMax-M2.5` | 197K | | | | | | $0.30 | $1 |
|
|
42
42
|
| `friendli/Qwen/Qwen3-235B-A22B-Instruct-2507` | 262K | | | | | | $0.20 | $0.80 |
|
|
43
|
-
| `friendli/zai-org/GLM-5` | 203K | | | | | | $1 | $3 |
|
|
44
43
|
| `friendli/zai-org/GLM-5.1` | 203K | | | | | | $1 | $4 |
|
|
45
44
|
| `friendli/zai-org/GLM-5.2` | 1.0M | | | | | | $1 | $4 |
|
|
46
45
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Nvidia
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 84 Nvidia models through Mastra's model router. Authentication is handled automatically using the `NVIDIA_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Nvidia documentation](https://docs.api.nvidia.com/nim/).
|
|
8
8
|
|
|
@@ -119,6 +119,7 @@ for await (const chunk of stream) {
|
|
|
119
119
|
| `nvidia/stepfun-ai/step-3.5-flash` | 256K | | | | | | — | — |
|
|
120
120
|
| `nvidia/stepfun-ai/step-3.7-flash` | 256K | | | | | | — | — |
|
|
121
121
|
| `nvidia/upstage/solar-10_7b-instruct` | 128K | | | | | | — | — |
|
|
122
|
+
| `nvidia/z-ai/glm-5.2` | 1.0M | | | | | | — | — |
|
|
122
123
|
|
|
123
124
|
## Advanced configuration
|
|
124
125
|
|
|
@@ -148,7 +149,7 @@ const agent = new Agent({
|
|
|
148
149
|
model: ({ requestContext }) => {
|
|
149
150
|
const useAdvanced = requestContext.task === "complex";
|
|
150
151
|
return useAdvanced
|
|
151
|
-
? "nvidia/
|
|
152
|
+
? "nvidia/z-ai/glm-5.2"
|
|
152
153
|
: "nvidia/abacusai/dracarys-llama-3_1-70b-instruct";
|
|
153
154
|
}
|
|
154
155
|
});
|
|
@@ -17,7 +17,7 @@ const agent = new Agent({
|
|
|
17
17
|
id: "my-agent",
|
|
18
18
|
name: "My Agent",
|
|
19
19
|
instructions: "You are a helpful assistant",
|
|
20
|
-
model: "tencent-token-plan/hy3
|
|
20
|
+
model: "tencent-token-plan/hy3"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -34,9 +34,9 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
## Models
|
|
36
36
|
|
|
37
|
-
| Model
|
|
38
|
-
|
|
|
39
|
-
| `tencent-token-plan/hy3
|
|
37
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
+
| ------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `tencent-token-plan/hy3` | 256K | | | | | | — | — |
|
|
40
40
|
|
|
41
41
|
## Advanced configuration
|
|
42
42
|
|
|
@@ -48,7 +48,7 @@ const agent = new Agent({
|
|
|
48
48
|
name: "custom-agent",
|
|
49
49
|
model: {
|
|
50
50
|
url: "https://api.lkeap.cloud.tencent.com/plan/v3",
|
|
51
|
-
id: "tencent-token-plan/hy3
|
|
51
|
+
id: "tencent-token-plan/hy3",
|
|
52
52
|
apiKey: process.env.TENCENT_TOKEN_PLAN_API_KEY,
|
|
53
53
|
headers: {
|
|
54
54
|
"X-Custom-Header": "value"
|
|
@@ -66,8 +66,8 @@ const agent = new Agent({
|
|
|
66
66
|
model: ({ requestContext }) => {
|
|
67
67
|
const useAdvanced = requestContext.task === "complex";
|
|
68
68
|
return useAdvanced
|
|
69
|
-
? "tencent-token-plan/hy3
|
|
70
|
-
: "tencent-token-plan/hy3
|
|
69
|
+
? "tencent-token-plan/hy3"
|
|
70
|
+
: "tencent-token-plan/hy3";
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Tencent TokenHub
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 2 Tencent TokenHub models through Mastra's model router. Authentication is handled automatically using the `TENCENT_TOKENHUB_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Tencent TokenHub documentation](https://cloud.tencent.com/document/product/1823/130050).
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ const agent = new Agent({
|
|
|
17
17
|
id: "my-agent",
|
|
18
18
|
name: "My Agent",
|
|
19
19
|
instructions: "You are a helpful assistant",
|
|
20
|
-
model: "tencent-tokenhub/hy3
|
|
20
|
+
model: "tencent-tokenhub/hy3"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -36,6 +36,7 @@ for await (const chunk of stream) {
|
|
|
36
36
|
|
|
37
37
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
38
|
| ------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `tencent-tokenhub/hy3` | 256K | | | | | | — | — |
|
|
39
40
|
| `tencent-tokenhub/hy3-preview` | 256K | | | | | | — | — |
|
|
40
41
|
|
|
41
42
|
## Advanced configuration
|
|
@@ -48,7 +49,7 @@ const agent = new Agent({
|
|
|
48
49
|
name: "custom-agent",
|
|
49
50
|
model: {
|
|
50
51
|
url: "https://tokenhub.tencentmaas.com/v1",
|
|
51
|
-
id: "tencent-tokenhub/hy3
|
|
52
|
+
id: "tencent-tokenhub/hy3",
|
|
52
53
|
apiKey: process.env.TENCENT_TOKENHUB_API_KEY,
|
|
53
54
|
headers: {
|
|
54
55
|
"X-Custom-Header": "value"
|
|
@@ -67,7 +68,7 @@ const agent = new Agent({
|
|
|
67
68
|
const useAdvanced = requestContext.task === "complex";
|
|
68
69
|
return useAdvanced
|
|
69
70
|
? "tencent-tokenhub/hy3-preview"
|
|
70
|
-
: "tencent-tokenhub/hy3
|
|
71
|
+
: "tencent-tokenhub/hy3";
|
|
71
72
|
}
|
|
72
73
|
});
|
|
73
74
|
```
|
|
@@ -114,6 +114,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
114
114
|
- [submodel](https://mastra.ai/models/providers/submodel)
|
|
115
115
|
- [Synthetic](https://mastra.ai/models/providers/synthetic)
|
|
116
116
|
- [Tencent Coding Plan (China)](https://mastra.ai/models/providers/tencent-coding-plan)
|
|
117
|
+
- [Tencent Token Plan](https://mastra.ai/models/providers/tencent-token-plan)
|
|
117
118
|
- [Tencent TokenHub](https://mastra.ai/models/providers/tencent-tokenhub)
|
|
118
119
|
- [The Grid AI](https://mastra.ai/models/providers/the-grid-ai)
|
|
119
120
|
- [Tinfoil](https://mastra.ai/models/providers/tinfoil)
|
|
@@ -54,7 +54,7 @@ export const claudeCodeAgent = new AcpAgent({
|
|
|
54
54
|
|
|
55
55
|
**id** (`string`): Unique identifier for the subagent.
|
|
56
56
|
|
|
57
|
-
**name** (`string`): Display name used during agent delegation. Defaults to
|
|
57
|
+
**name** (`string`): Display name used during agent delegation. Defaults to id.
|
|
58
58
|
|
|
59
59
|
**description** (`string`): Description shown to the model when it can delegate to this subagent.
|
|
60
60
|
|
|
@@ -66,19 +66,19 @@ export const claudeCodeAgent = new AcpAgent({
|
|
|
66
66
|
|
|
67
67
|
**cwd** (`string`): Working directory for the ACP process and ACP session. Also used as the default local filesystem base path. (Default: `process.cwd()`)
|
|
68
68
|
|
|
69
|
-
**session** (`Partial<NewSessionRequest>`): ACP session creation options. Defaults to
|
|
69
|
+
**session** (`Partial<NewSessionRequest>`): ACP session creation options. Defaults to cwd or process.cwd() and an empty MCP server list.
|
|
70
70
|
|
|
71
71
|
**initialize** (`Partial<InitializeRequest>`): ACP initialization options. Defaults to Mastra client information, the current ACP protocol version, and read/write filesystem capabilities.
|
|
72
72
|
|
|
73
73
|
**authMethodId** (`string`): ACP authentication method ID to invoke after initialization and before session creation.
|
|
74
74
|
|
|
75
|
-
**persistSession** (`boolean`): Whether to keep the ACP process and session alive after each prompt. Set to
|
|
75
|
+
**persistSession** (`boolean`): Whether to keep the ACP process and session alive after each prompt. Set to false to stop the process after each prompt completes. (Default: `true`)
|
|
76
76
|
|
|
77
77
|
**onPermissionRequest** (`(request: RequestPermissionRequest) => Promise<RequestPermissionResponse>`): Callback invoked when the ACP agent requests permission. Defaults to selecting the first permission option, or cancelling when no option is available.
|
|
78
78
|
|
|
79
|
-
**workspace** (`Workspace`): Workspace used for ACP file read and write requests. Defaults to a
|
|
79
|
+
**workspace** (`Workspace`): Workspace used for ACP file read and write requests. Defaults to a Workspace backed by LocalFilesystem at cwd or process.cwd().
|
|
80
80
|
|
|
81
|
-
**model** (`ModelId`): Model ID to select after ACP session creation using the ACP
|
|
81
|
+
**model** (`ModelId`): Model ID to select after ACP session creation using the ACP session/set\_model method.
|
|
82
82
|
|
|
83
83
|
## Properties
|
|
84
84
|
|
|
@@ -47,19 +47,19 @@ export const codeSupervisor = new Agent({
|
|
|
47
47
|
|
|
48
48
|
**cwd** (`string`): Working directory for the ACP process and ACP session. Also used as the default local filesystem base path. (Default: `process.cwd()`)
|
|
49
49
|
|
|
50
|
-
**session** (`Partial<NewSessionRequest>`): ACP session creation options. Defaults to
|
|
50
|
+
**session** (`Partial<NewSessionRequest>`): ACP session creation options. Defaults to cwd or process.cwd() and an empty MCP server list.
|
|
51
51
|
|
|
52
52
|
**initialize** (`Partial<InitializeRequest>`): ACP initialization options. Defaults to Mastra client information, the current ACP protocol version, and read/write filesystem capabilities.
|
|
53
53
|
|
|
54
54
|
**authMethodId** (`string`): ACP authentication method ID to invoke after initialization and before session creation.
|
|
55
55
|
|
|
56
|
-
**persistSession** (`boolean`): Whether the ACP connection created for a tool execution disconnects after the prompt. Set to
|
|
56
|
+
**persistSession** (`boolean`): Whether the ACP connection created for a tool execution disconnects after the prompt. Set to false to stop the process after each prompt completes. (Default: `true`)
|
|
57
57
|
|
|
58
58
|
**onPermissionRequest** (`(request: RequestPermissionRequest) => Promise<RequestPermissionResponse>`): Callback invoked when the ACP agent requests permission. Defaults to selecting the first permission option, or cancelling when no option is available.
|
|
59
59
|
|
|
60
|
-
**workspace** (`Workspace`): Workspace option from the shared ACP connection options. During tool execution,
|
|
60
|
+
**workspace** (`Workspace`): Workspace option from the shared ACP connection options. During tool execution, createACPTool() passes the current Mastra workspace from the execution context when one is available; otherwise the ACP connection falls back to a local filesystem workspace. Use AcpAgent when you need to provide an explicit workspace instance.
|
|
61
61
|
|
|
62
|
-
**model** (`ModelId`): Model ID to select after ACP session creation using the ACP
|
|
62
|
+
**model** (`ModelId`): Model ID to select after ACP session creation using the ACP session/set\_model method.
|
|
63
63
|
|
|
64
64
|
## Input schema
|
|
65
65
|
|
|
@@ -79,7 +79,7 @@ export const codeSupervisor = new Agent({
|
|
|
79
79
|
|
|
80
80
|
### Resume payload
|
|
81
81
|
|
|
82
|
-
**optionId** (`string`): Permission option ID to select when resuming with
|
|
82
|
+
**optionId** (`string`): Permission option ID to select when resuming with outcome: "selected".
|
|
83
83
|
|
|
84
84
|
**outcome** (`"selected" | "cancelled"`): Permission decision used to continue or cancel the ACP request.
|
|
85
85
|
|
|
@@ -52,7 +52,7 @@ await agentController.sendMessage({ content: 'Hello!' })
|
|
|
52
52
|
|
|
53
53
|
**id** (`string`): Unique identifier for this agentController instance.
|
|
54
54
|
|
|
55
|
-
**resourceId** (`string`): Resource ID for grouping threads (e.g., project identifier). Threads are scoped to this resource ID. Defaults to
|
|
55
|
+
**resourceId** (`string`): Resource ID for grouping threads (e.g., project identifier). Threads are scoped to this resource ID. Defaults to id.
|
|
56
56
|
|
|
57
57
|
**storage** (`MastraCompositeStore`): Storage backend for persistence (threads, messages, state).
|
|
58
58
|
|
|
@@ -62,35 +62,35 @@ await agentController.sendMessage({ content: 'Hello!' })
|
|
|
62
62
|
|
|
63
63
|
**memory** (`MastraMemory`): Memory configuration shared across all modes. Propagated to mode agents that don't have their own memory.
|
|
64
64
|
|
|
65
|
-
**modes** (`AgentControllerMode[]`): Available agent modes. At least one mode is required. When a top-level
|
|
65
|
+
**modes** (`AgentControllerMode[]`): Available agent modes. At least one mode is required. When a top-level agent is provided, each mode layers its own instructions and tool overrides on top of the shared agent.
|
|
66
66
|
|
|
67
|
-
**modes.id** (`string`): Unique identifier for this mode (e.g.,
|
|
67
|
+
**modes.id** (`string`): Unique identifier for this mode (e.g., "plan", "build").
|
|
68
68
|
|
|
69
69
|
**modes.name** (`string`): Human-readable name for display.
|
|
70
70
|
|
|
71
|
-
**modes.default** (`boolean`): Whether this is the default mode when the agentController starts. Deprecated in favor of
|
|
71
|
+
**modes.default** (`boolean`): Whether this is the default mode when the agentController starts. Deprecated in favor of metadata.default or the top-level defaultModeId.
|
|
72
72
|
|
|
73
|
-
**modes.defaultModelId** (`string`): Default model ID for this mode (e.g.,
|
|
73
|
+
**modes.defaultModelId** (`string`): Default model ID for this mode (e.g., "anthropic/claude-sonnet-4-20250514"). Used when no per-mode model has been explicitly selected.
|
|
74
74
|
|
|
75
75
|
**modes.description** (`string`): Description surfaced in mode pickers and Studio UI.
|
|
76
76
|
|
|
77
77
|
**modes.instructions** (`string`): Additional instructions layered above the backing agent's own instructions for this mode.
|
|
78
78
|
|
|
79
|
-
**modes.transitionsTo** (`string`): Target mode ID to switch to on
|
|
79
|
+
**modes.transitionsTo** (`string`): Target mode ID to switch to on submit\_plan approval. Must reference another mode's id.
|
|
80
80
|
|
|
81
|
-
**modes.metadata** (`Record<string, unknown>`): Arbitrary metadata.
|
|
81
|
+
**modes.metadata** (`Record<string, unknown>`): Arbitrary metadata. metadata.default === true marks the default mode when defaultModeId is unset.
|
|
82
82
|
|
|
83
|
-
**modes.tools** (`ToolsInput`): Replaces the backing agent's tools for this mode. Mutually exclusive with
|
|
83
|
+
**modes.tools** (`ToolsInput`): Replaces the backing agent's tools for this mode. Mutually exclusive with additionalTools.
|
|
84
84
|
|
|
85
|
-
**modes.additionalTools** (`ToolsInput`): Tools layered on top of the backing agent's tools. Mutually exclusive with
|
|
85
|
+
**modes.additionalTools** (`ToolsInput`): Tools layered on top of the backing agent's tools. Mutually exclusive with tools.
|
|
86
86
|
|
|
87
|
-
**modes.availableTools** (`string[]`): Per-mode tool visibility allowlist. When set, only tools whose final exposed names appear in this list are visible to the model and executable during this mode's runs.
|
|
87
|
+
**modes.availableTools** (`string[]`): Per-mode tool visibility allowlist. When set, only tools whose final exposed names appear in this list are visible to the model and executable during this mode's runs. undefined = all tools visible; \[] = no tools. Per-tool and per-category deny rules take precedence over this list. Workspace tools use the same list — reference them by exposed names (view, write\_file, etc.).
|
|
88
88
|
|
|
89
|
-
**modes.agent** (`Agent`): The agent for this mode. Deprecated in favor of the top-level
|
|
89
|
+
**modes.agent** (`Agent`): The agent for this mode. Deprecated in favor of the top-level agent config with mode-level overrides.
|
|
90
90
|
|
|
91
91
|
**agent** (`Agent`): Shared backing agent that each mode forks and decorates. When provided, modes layer instructions and tool overrides on top of this agent instead of providing their own.
|
|
92
92
|
|
|
93
|
-
**defaultModeId** (`string`): Default mode to enter when a thread has no persisted mode. Takes precedence over
|
|
93
|
+
**defaultModeId** (`string`): Default mode to enter when a thread has no persisted mode. Takes precedence over metadata.default on individual modes.
|
|
94
94
|
|
|
95
95
|
**instructions** (`string`): Base instructions shared across all modes. Appended to the backing agent's instructions.
|
|
96
96
|
|
|
@@ -100,9 +100,9 @@ await agentController.sendMessage({ content: 'Hello!' })
|
|
|
100
100
|
|
|
101
101
|
**browser** (`MastraBrowser | ((ctx) => MastraBrowser)`): Browser automation instance or a dynamic factory function. When omitted, each session created via createSession can provide its own browser.
|
|
102
102
|
|
|
103
|
-
**subagents** (`AgentControllerSubagent[]`): Subagent definitions. When provided, the agentController creates a built-in
|
|
103
|
+
**subagents** (`AgentControllerSubagent[]`): Subagent definitions. When provided, the agentController creates a built-in subagent tool that parent agents can call to spawn focused subagents.
|
|
104
104
|
|
|
105
|
-
**subagents.id** (`string`): Unique identifier for this subagent type (e.g.,
|
|
105
|
+
**subagents.id** (`string`): Unique identifier for this subagent type (e.g., "explore", "execute").
|
|
106
106
|
|
|
107
107
|
**subagents.name** (`string`): Human-readable name shown in tool output.
|
|
108
108
|
|
|
@@ -112,43 +112,43 @@ await agentController.sendMessage({ content: 'Hello!' })
|
|
|
112
112
|
|
|
113
113
|
**subagents.tools** (`ToolsInput`): Tools this subagent has direct access to.
|
|
114
114
|
|
|
115
|
-
**subagents.allowedAgentControllerTools** (`string[]`): Tool IDs from the agentController's shared
|
|
115
|
+
**subagents.allowedAgentControllerTools** (`string[]`): Tool IDs from the agentController's shared tools config. Merged with tools above to let subagents use a subset of agentController tools.
|
|
116
116
|
|
|
117
117
|
**subagents.allowedWorkspaceTools** (`string[]`): Workspace tool names the subagent is allowed to use. Uses the exposed names (after any renames via workspace tool config). When set, workspace tools not in this list are hidden from the model. Non-workspace tools are never affected. When omitted, all workspace tools are visible.
|
|
118
118
|
|
|
119
119
|
**subagents.defaultModelId** (`string`): Default model ID for this subagent type.
|
|
120
120
|
|
|
121
|
-
**subagents.maxSteps** (`number`): Optional maximum number of steps for the spawned subagent. Defaults to
|
|
121
|
+
**subagents.maxSteps** (`number`): Optional maximum number of steps for the spawned subagent. Defaults to 50 when omitted.
|
|
122
122
|
|
|
123
123
|
**subagents.stopWhen** (`LoopOptions['stopWhen']`): Optional stop condition for the spawned subagent.
|
|
124
124
|
|
|
125
|
-
**subagents.forked** (`boolean`): When
|
|
125
|
+
**subagents.forked** (`boolean`): When true, calls to this subagent default to forked mode: the subagent runs on a clone of the parent thread, reusing the parent agent’s instructions, tools, and model so the prompt-cache prefix stays intact. Requires memory to be configured. The subagent definition’s own instructions, tools, allowedAgentControllerTools, allowedWorkspaceTools, defaultModelId, maxSteps, and stopWhen are ignored in forked mode. Callers can still override per-invocation via forked: false in the subagent tool input. See the Forked subagents section below for full semantics.
|
|
126
126
|
|
|
127
|
-
**resolveModel** (`(modelId: string) => MastraLanguageModel`): Converts a model ID string (e.g.,
|
|
127
|
+
**resolveModel** (`(modelId: string) => MastraLanguageModel`): Converts a model ID string (e.g., "anthropic/claude-sonnet-4") to a language model instance. Used by subagents and observational memory model resolution.
|
|
128
128
|
|
|
129
129
|
**omConfig** (`AgentControllerOMConfig`): Default configuration for observational memory (observer/reflector model IDs and thresholds).
|
|
130
130
|
|
|
131
|
-
**disableBuiltinTools** (`BuiltinToolId[]`): Built-in tool IDs to remove from the
|
|
131
|
+
**disableBuiltinTools** (`BuiltinToolId[]`): Built-in tool IDs to remove from the controllerBuiltIn toolset. Valid values are ask\_user, submit\_plan, task\_write, task\_update, task\_complete, task\_check, and subagent.
|
|
132
132
|
|
|
133
|
-
**intervalHandlers** (`IntervalHandler[]`): Periodic background tasks started during
|
|
133
|
+
**intervalHandlers** (`IntervalHandler[]`): Periodic background tasks started during init(). Use for gateway sync, cache refresh, and similar tasks.
|
|
134
134
|
|
|
135
135
|
**idGenerator** (`() => string`): Custom ID generator for AgentController-managed IDs such as threads and mode-run identifiers. (Default: `timestamp + random string`)
|
|
136
136
|
|
|
137
|
-
**modelAuthChecker** (`ModelAuthChecker`): Custom auth checker for model providers. Return
|
|
137
|
+
**modelAuthChecker** (`ModelAuthChecker`): Custom auth checker for model providers. Return true/false to override the default environment variable check, or undefined to fall back to defaults.
|
|
138
138
|
|
|
139
|
-
**modelUseCountProvider** (`ModelUseCountProvider`): Provides per-model use counts for sorting and display in
|
|
139
|
+
**modelUseCountProvider** (`ModelUseCountProvider`): Provides per-model use counts for sorting and display in listAvailableModels().
|
|
140
140
|
|
|
141
|
-
**modelUseCountTracker** (`ModelUseCountTracker`): Callback invoked when a model is selected via
|
|
141
|
+
**modelUseCountTracker** (`ModelUseCountTracker`): Callback invoked when a model is selected via session.model.switch(). Use to track and persist model usage for ranking.
|
|
142
142
|
|
|
143
|
-
**customModelCatalogProvider** (`CustomModelCatalogProvider`): Catalog hook for additional models (e.g., user-defined custom providers). Returned entries are merged into
|
|
143
|
+
**customModelCatalogProvider** (`CustomModelCatalogProvider`): Catalog hook for additional models (e.g., user-defined custom providers). Returned entries are merged into listAvailableModels().
|
|
144
144
|
|
|
145
|
-
**gateways** (`MastraModelGatewayInterface[]`): Model gateways registered on the internal Mastra instance. Apps that need gateway-backed model resolution should also provide
|
|
145
|
+
**gateways** (`MastraModelGatewayInterface[]`): Model gateways registered on the internal Mastra instance. Apps that need gateway-backed model resolution should also provide resolveModel.
|
|
146
146
|
|
|
147
|
-
**toolCategoryResolver** (`(toolName: string) => ToolCategory | null`): Maps tool names to permission categories (
|
|
147
|
+
**toolCategoryResolver** (`(toolName: string) => ToolCategory | null`): Maps tool names to permission categories ('read', 'edit', 'execute', 'mcp', 'other'). Used by the permission system to resolve category-level policies.
|
|
148
148
|
|
|
149
149
|
**pubsub** (`PubSub`): PubSub instance used by the internal Mastra instance and mode agents for event coordination.
|
|
150
150
|
|
|
151
|
-
**threadLock** (`{ acquire, release }`): Thread locking callbacks to prevent concurrent access from multiple processes.
|
|
151
|
+
**threadLock** (`{ acquire, release }`): Thread locking callbacks to prevent concurrent access from multiple processes. acquire should throw if the lock is held.
|
|
152
152
|
|
|
153
153
|
**observability** (`ObservabilityEntrypoint`): Observability entrypoint for tracing, scoring, and feedback. When provided, the internal Mastra instance produces trace spans for agent runs.
|
|
154
154
|
|
|
@@ -178,27 +178,27 @@ The UI sees the message contents and can also read `attributes` and `metadata` o
|
|
|
178
178
|
|
|
179
179
|
Sends a user message to an active run or memory thread. Use this when the active agent should receive the message immediately.
|
|
180
180
|
|
|
181
|
-
**message** (`string | Array<TextPart | FilePart> | { contents: string | Array<TextPart | FilePart>; attributes?: Record<string, JSONValue>; metadata?: Record<string, unknown>; providerOptions?: ProviderMetadata }`): User-authored input. Bare strings and parts without attributes are sent to the model as normal user input. When
|
|
181
|
+
**message** (`string | Array<TextPart | FilePart> | { contents: string | Array<TextPart | FilePart>; attributes?: Record<string, JSONValue>; metadata?: Record<string, unknown>; providerOptions?: ProviderMetadata }`): User-authored input. Bare strings and parts without attributes are sent to the model as normal user input. When attributes are present, Mastra renders the message as a \<user> XML element with the attributes included.
|
|
182
182
|
|
|
183
183
|
**options** (`object`): Targeting and delivery behavior for the message.
|
|
184
184
|
|
|
185
185
|
**options.runId** (`string`): Run ID to target directly. Use this when you already know the active run ID.
|
|
186
186
|
|
|
187
|
-
**options.resourceId** (`string`): Resource ID for the memory thread. Required with
|
|
187
|
+
**options.resourceId** (`string`): Resource ID for the memory thread. Required with threadId for thread-targeted messages.
|
|
188
188
|
|
|
189
|
-
**options.threadId** (`string`): Thread ID to target. Required with
|
|
189
|
+
**options.threadId** (`string`): Thread ID to target. Required with resourceId for thread-targeted messages.
|
|
190
190
|
|
|
191
191
|
**options.ifActive** (`object`): Controls what happens when the target thread is active.
|
|
192
192
|
|
|
193
|
-
**options.ifActive.behavior** (`'deliver' | 'persist' | 'discard'`): Controls what happens when the target thread is active. Defaults to
|
|
193
|
+
**options.ifActive.behavior** (`'deliver' | 'persist' | 'discard'`): Controls what happens when the target thread is active. Defaults to deliver.
|
|
194
194
|
|
|
195
195
|
**options.ifActive.attributes** (`Record<string, string | number | boolean>`): Attributes merged into the message when Mastra accepts it while the target thread is active.
|
|
196
196
|
|
|
197
197
|
**options.ifIdle** (`object`): Controls what happens when the target thread is idle.
|
|
198
198
|
|
|
199
|
-
**options.ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): Controls what happens when the target thread is idle. Defaults to
|
|
199
|
+
**options.ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): Controls what happens when the target thread is idle. Defaults to wake.
|
|
200
200
|
|
|
201
|
-
**options.ifIdle.streamOptions** (`AgentExecutionOptions`): Options for the stream that starts when
|
|
201
|
+
**options.ifIdle.streamOptions** (`AgentExecutionOptions`): Options for the stream that starts when ifIdle.behavior is wake. Mastra uses the top-level resourceId and threadId for memory context.
|
|
202
202
|
|
|
203
203
|
**options.ifIdle.attributes** (`Record<string, string | number | boolean>`): Attributes merged into the message when Mastra accepts it while the target thread is idle.
|
|
204
204
|
|
|
@@ -236,27 +236,27 @@ agent.queueMessage('Also check whether the tests need updates.', {
|
|
|
236
236
|
|
|
237
237
|
Sends a signal to an active run or memory thread.
|
|
238
238
|
|
|
239
|
-
**signal** (`{ type: 'user' | 'state' | 'reactive' | 'notification' | 'user-message' | 'system-reminder'; tagName?: string; contents: string | Array<TextPart | FilePart>; attributes?: Record<string, JSONValue>; metadata?: Record<string, unknown>; providerOptions?: ProviderMetadata }`): Signal context to send to the thread.
|
|
239
|
+
**signal** (`{ type: 'user' | 'state' | 'reactive' | 'notification' | 'user-message' | 'system-reminder'; tagName?: string; contents: string | Array<TextPart | FilePart>; attributes?: Record<string, JSONValue>; metadata?: Record<string, unknown>; providerOptions?: ProviderMetadata }`): Signal context to send to the thread. type is the semantic signal category. tagName controls the XML tag the model sees. For example, { type: 'notification', tagName: 'github-review' } renders as \<github-review>...\</github-review>. Legacy user-message and system-reminder payloads are still accepted and normalized. Unknown type values are rejected; use tagName for custom XML tags.
|
|
240
240
|
|
|
241
241
|
**options** (`object`): Targeting and delivery behavior for the signal.
|
|
242
242
|
|
|
243
243
|
**options.runId** (`string`): Run ID to target directly. Use this when you already know the active run ID.
|
|
244
244
|
|
|
245
|
-
**options.resourceId** (`string`): Resource ID for the memory thread. Required with
|
|
245
|
+
**options.resourceId** (`string`): Resource ID for the memory thread. Required with threadId for thread-targeted signals.
|
|
246
246
|
|
|
247
|
-
**options.threadId** (`string`): Thread ID to target. Required with
|
|
247
|
+
**options.threadId** (`string`): Thread ID to target. Required with resourceId for thread-targeted signals.
|
|
248
248
|
|
|
249
249
|
**options.ifActive** (`object`): Controls what happens when the target thread is active.
|
|
250
250
|
|
|
251
|
-
**options.ifActive.behavior** (`'deliver' | 'persist' | 'discard'`): Controls what happens when the target thread is active. Defaults to
|
|
251
|
+
**options.ifActive.behavior** (`'deliver' | 'persist' | 'discard'`): Controls what happens when the target thread is active. Defaults to deliver.
|
|
252
252
|
|
|
253
253
|
**options.ifActive.attributes** (`Record<string, string | number | boolean>`): Attributes merged into the signal when Mastra accepts it while the target thread is active.
|
|
254
254
|
|
|
255
255
|
**options.ifIdle** (`object`): Controls what happens when the target thread is idle.
|
|
256
256
|
|
|
257
|
-
**options.ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): Controls what happens when the target thread is idle. Defaults to
|
|
257
|
+
**options.ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): Controls what happens when the target thread is idle. Defaults to wake.
|
|
258
258
|
|
|
259
|
-
**options.ifIdle.streamOptions** (`AgentExecutionOptions`): Options for the stream that starts when
|
|
259
|
+
**options.ifIdle.streamOptions** (`AgentExecutionOptions`): Options for the stream that starts when ifIdle.behavior is wake. Mastra uses the top-level resourceId and threadId for memory context.
|
|
260
260
|
|
|
261
261
|
**options.ifIdle.attributes** (`Record<string, string | number | boolean>`): Attributes merged into the signal when Mastra accepts it while the target thread is idle.
|
|
262
262
|
|
|
@@ -301,25 +301,25 @@ const result = await agent.sendStateSignal(
|
|
|
301
301
|
|
|
302
302
|
**state** (`object`): State signal to send to the thread.
|
|
303
303
|
|
|
304
|
-
**state.id** (`string`): State lane name, such as
|
|
304
|
+
**state.id** (`string`): State lane name, such as browser or editor.
|
|
305
305
|
|
|
306
306
|
**state.cacheKey** (`string`): Producer-owned key Mastra uses to skip duplicate state for the same lane and mode.
|
|
307
307
|
|
|
308
308
|
**state.contents** (`string | Array<TextPart | FilePart>`): LLM-facing representation of the state.
|
|
309
309
|
|
|
310
|
-
**state.mode** (`'snapshot' | 'delta'`): Whether the state is an authoritative snapshot or a change event. Defaults to
|
|
310
|
+
**state.mode** (`'snapshot' | 'delta'`): Whether the state is an authoritative snapshot or a change event. Defaults to snapshot.
|
|
311
311
|
|
|
312
|
-
**state.value** (`unknown`): Structured snapshot value for
|
|
312
|
+
**state.value** (`unknown`): Structured snapshot value for mode: 'snapshot'.
|
|
313
313
|
|
|
314
|
-
**state.delta** (`unknown`): Structured change value for
|
|
314
|
+
**state.delta** (`unknown`): Structured change value for mode: 'delta'.
|
|
315
315
|
|
|
316
316
|
**state.attributes** (`Record<string, string | number | boolean>`): Attributes rendered on the state signal tag.
|
|
317
317
|
|
|
318
318
|
**state.metadata** (`Record<string, unknown>`): Application metadata stored with the state signal.
|
|
319
319
|
|
|
320
|
-
**state.tagName** (`string`): XML tag name shown to the model. Defaults to
|
|
320
|
+
**state.tagName** (`string`): XML tag name shown to the model. Defaults to state.
|
|
321
321
|
|
|
322
|
-
**options** (`object`): Targeting and delivery behavior for the state signal. Accepts the same options as
|
|
322
|
+
**options** (`object`): Targeting and delivery behavior for the state signal. Accepts the same options as sendSignal().
|
|
323
323
|
|
|
324
324
|
Returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void>, skipped?: false }` when Mastra accepts new state. Returns `{ skipped: true, reason: 'unchanged' }` when the same `cacheKey` and mode are already current for the state lane. `accepted` resolves at decision-time, once Mastra decides what to do with the signal: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run (including when this process loses a cross-process wake race), or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` is the authoritative id of the run that handled the signal and is present only on `wake` and `deliver`; for `persist`/`discard` use `result.signal.id` to correlate the stored signal. On the `wake` action, `output` is the agent stream for in-process consumption.
|
|
325
325
|
|
|
@@ -345,13 +345,13 @@ const result = await agent.sendNotificationSignal(
|
|
|
345
345
|
|
|
346
346
|
**notification** (`object`): Notification inbox record to create or coalesce.
|
|
347
347
|
|
|
348
|
-
**notification.source** (`string`): External system that produced the notification, such as
|
|
348
|
+
**notification.source** (`string`): External system that produced the notification, such as github, slack, or email.
|
|
349
349
|
|
|
350
|
-
**notification.kind** (`string`): Notification kind within the source, such as
|
|
350
|
+
**notification.kind** (`string`): Notification kind within the source, such as ci-status, mention, or direct-message.
|
|
351
351
|
|
|
352
352
|
**notification.summary** (`string`): LLM-facing summary used as the notification signal contents.
|
|
353
353
|
|
|
354
|
-
**notification.priority** (`'low' | 'medium' | 'high' | 'urgent'`): Priority used by the notification delivery policy. Defaults to
|
|
354
|
+
**notification.priority** (`'low' | 'medium' | 'high' | 'urgent'`): Priority used by the notification delivery policy. Defaults to medium.
|
|
355
355
|
|
|
356
356
|
**notification.payload** (`unknown`): Structured payload stored on the inbox record for tools or application code.
|
|
357
357
|
|
|
@@ -375,7 +375,7 @@ const result = await agent.sendNotificationSignal(
|
|
|
375
375
|
|
|
376
376
|
Returns `{ record: NotificationRecord, decision: NotificationDeliveryDecision, runId?: string, signal?: CreatedAgentSignal, persisted?: Promise<void>, accepted?: Promise<SendAgentSignalAccepted> }`. `record` is the stored inbox record. `decision` is the delivery-policy result. `signal` and `runId` are present when ingress emits a signal immediately, including the immediate summary emitted for active high-priority notifications. `persisted` is present when the emitted signal is persisted without waking an idle thread. `accepted` is present when a signal is emitted and resolves at decision-time, once Mastra decides what to do with it: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run, or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` on the accepted result is present only on `wake` and `deliver`. On the `wake` action, `output` is the agent stream for in-process consumption.
|
|
377
377
|
|
|
378
|
-
Default delivery is priority-aware. `urgent` notifications deliver immediately. `high` notifications deliver immediately when the thread is idle; when the thread is active, Mastra emits a summary immediately and keeps `deliverAt` for later full delivery when the thread is idle. `medium` notifications deliver immediately when idle and batch into summaries when active. `low` notifications batch into summaries in both active and idle threads; idle low-priority summaries reach subscribers without waking the model loop. For the full flow, visit [Signals](https://mastra.ai/docs/agents/signals).
|
|
378
|
+
Default delivery is priority-aware. `urgent` notifications deliver immediately. `high` notifications deliver immediately when the thread is idle; when the thread is active, Mastra emits a summary immediately and keeps `deliverAt` for later full delivery when the thread is idle. `medium` notifications deliver immediately when idle and batch into summaries when active. `low` notifications batch into summaries in both active and idle threads; idle low-priority summaries reach subscribers without waking the model loop. For the full flow, visit [Signals](https://mastra.ai/docs/long-running-agents/signals).
|
|
379
379
|
|
|
380
380
|
Configure `notifications.deliveryPolicy` on the agent when some notifications should wait for a different dispatch window or summary rollup:
|
|
381
381
|
|
|
@@ -417,9 +417,9 @@ Returns an `AgentThreadSubscription` object with these members:
|
|
|
417
417
|
|
|
418
418
|
**stream** (`AsyncIterable<AgentChunkType>`): Raw agent stream chunks for the subscribed thread.
|
|
419
419
|
|
|
420
|
-
**activeRunId** (`() => string | null`): Returns the active run ID for the thread, or
|
|
420
|
+
**activeRunId** (`() => string | null`): Returns the active run ID for the thread, or null when no run is active.
|
|
421
421
|
|
|
422
|
-
**abort** (`() => boolean`): Aborts the active run for the thread. Returns
|
|
422
|
+
**abort** (`() => boolean`): Aborts the active run for the thread. Returns true when a run was aborted.
|
|
423
423
|
|
|
424
424
|
**unsubscribe** (`() => void`): Stops the subscription without aborting the active run.
|
|
425
425
|
|
|
@@ -441,21 +441,21 @@ Returns an `AgentThreadSubscription` object with these members:
|
|
|
441
441
|
|
|
442
442
|
**tools** (`ToolsInput | ({ requestContext: RequestContext }) => ToolsInput | Promise<ToolsInput>`): Tools that the agent can access. Can be provided statically or resolved dynamically.
|
|
443
443
|
|
|
444
|
-
**hooks** (`ToolHooks`): Hooks that run before and after every tool call made by this agent. Per-execution hooks passed to
|
|
444
|
+
**hooks** (`ToolHooks`): Hooks that run before and after every tool call made by this agent. Per-execution hooks passed to generate() or stream() override matching hooks set here. See Tool hooks below.
|
|
445
445
|
|
|
446
|
-
**hooks.beforeToolCall** (`(context: ToolHookContext) => void | ToolBeforeHookResult | Promise<void | ToolBeforeHookResult>`): Runs before a tool executes. Receives
|
|
446
|
+
**hooks.beforeToolCall** (`(context: ToolHookContext) => void | ToolBeforeHookResult | Promise<void | ToolBeforeHookResult>`): Runs before a tool executes. Receives { toolName, input, context, metadata }. Return { proceed: false, output } to skip the tool call and use output as its result.
|
|
447
447
|
|
|
448
|
-
**hooks.afterToolCall** (`(context: ToolAfterHookContext) => void | Promise<void>`): Runs after a tool executes. Receives
|
|
448
|
+
**hooks.afterToolCall** (`(context: ToolAfterHookContext) => void | Promise<void>`): Runs after a tool executes. Receives { toolName, input, context, metadata, output, error }. output is undefined when the tool throws, and error is set instead.
|
|
449
449
|
|
|
450
|
-
**transform** (`ToolPayloadTransformPolicy`): Shared policy for transforming tool payloads before display streams or user-visible transcript messages receive them. Use per-tool
|
|
450
|
+
**transform** (`ToolPayloadTransformPolicy`): Shared policy for transforming tool payloads before display streams or user-visible transcript messages receive them. Use per-tool transform on createTool() for tool-local rules.
|
|
451
451
|
|
|
452
452
|
**workflows** (`Record<string, Workflow> | ({ requestContext: RequestContext }) => Record<string, Workflow> | Promise<Record<string, Workflow>>`): Workflows that the agent can execute. Can be static or dynamically resolved.
|
|
453
453
|
|
|
454
|
-
**defaultOptions** (`AgentExecutionOptions | ({ requestContext: RequestContext }) => AgentExecutionOptions | Promise<AgentExecutionOptions>`): Default options used when calling
|
|
454
|
+
**defaultOptions** (`AgentExecutionOptions | ({ requestContext: RequestContext }) => AgentExecutionOptions | Promise<AgentExecutionOptions>`): Default options used when calling stream() and generate().
|
|
455
455
|
|
|
456
|
-
**defaultGenerateOptionsLegacy** (`AgentGenerateOptions | ({ requestContext: RequestContext }) => AgentGenerateOptions | Promise<AgentGenerateOptions>`): Default options used when calling
|
|
456
|
+
**defaultGenerateOptionsLegacy** (`AgentGenerateOptions | ({ requestContext: RequestContext }) => AgentGenerateOptions | Promise<AgentGenerateOptions>`): Default options used when calling generateLegacy().
|
|
457
457
|
|
|
458
|
-
**defaultStreamOptionsLegacy** (`AgentStreamOptions | ({ requestContext: RequestContext }) => AgentStreamOptions | Promise<AgentStreamOptions>`): Default options used when calling
|
|
458
|
+
**defaultStreamOptionsLegacy** (`AgentStreamOptions | ({ requestContext: RequestContext }) => AgentStreamOptions | Promise<AgentStreamOptions>`): Default options used when calling streamLegacy().
|
|
459
459
|
|
|
460
460
|
**mastra** (`Mastra`): Reference to the Mastra runtime instance (injected automatically).
|
|
461
461
|
|
|
@@ -465,11 +465,11 @@ Returns an `AgentThreadSubscription` object with these members:
|
|
|
465
465
|
|
|
466
466
|
**notifications** (`object`): Notification delivery configuration for durable notification signals.
|
|
467
467
|
|
|
468
|
-
**notifications.deliveryPolicy** (`NotificationDeliveryPolicyConfig`): Controls how notification records are delivered. Configure a default decision, per-priority decisions, per-source decisions, or a custom
|
|
468
|
+
**notifications.deliveryPolicy** (`NotificationDeliveryPolicyConfig`): Controls how notification records are delivered. Configure a default decision, per-priority decisions, per-source decisions, or a custom decide() function.
|
|
469
469
|
|
|
470
470
|
**voice** (`CompositeVoice`): Voice settings for speech input and output.
|
|
471
471
|
|
|
472
|
-
**inputProcessors** (`(Processor | ProcessorWorkflow)[] | ({ requestContext: RequestContext }) => (Processor | ProcessorWorkflow)[] | Promise<(Processor | ProcessorWorkflow)[]>`): Input processors that can modify or validate messages before they are processed by the agent. Can be individual Processor objects or workflows created with
|
|
472
|
+
**inputProcessors** (`(Processor | ProcessorWorkflow)[] | ({ requestContext: RequestContext }) => (Processor | ProcessorWorkflow)[] | Promise<(Processor | ProcessorWorkflow)[]>`): Input processors that can modify or validate messages before they are processed by the agent. Can be individual Processor objects or workflows created with createWorkflow() using ProcessorStepSchema.
|
|
473
473
|
|
|
474
474
|
**outputProcessors** (`(Processor | ProcessorWorkflow)[] | ({ requestContext: RequestContext }) => (Processor | ProcessorWorkflow)[] | Promise<(Processor | ProcessorWorkflow)[]>`): Output processors that can modify or validate messages from the agent before they are sent to the client. Can be individual Processor objects or workflows.
|
|
475
475
|
|
|
@@ -550,7 +550,7 @@ The hook context `metadata` includes `agentId` and `agentName`. Per-execution ho
|
|
|
550
550
|
|
|
551
551
|
When you register the [`MastraEditor`](https://mastra.ai/reference/editor/mastra-editor), the `editor` field controls which parts of a code-defined agent can be changed through the editor. Fields owned by code are read-only in Studio and are stripped from saved overrides.
|
|
552
552
|
|
|
553
|
-
**editor** (`false | { instructions?: boolean; tools?: boolean | { description?: boolean } }`): Omit to allow editing instructions and tools. Set to
|
|
553
|
+
**editor** (`false | { instructions?: boolean; tools?: boolean | { description?: boolean } }`): Omit to allow editing instructions and tools. Set to false to lock the agent. Set instructions: true to allow instruction edits. Set tools: true to allow tool membership and description edits, or tools: { description: true } to allow only description edits.
|
|
554
554
|
|
|
555
555
|
The agent's `id`, `name`, and `model` always come from code and can't be overridden through the editor. See the [Editor overview](https://mastra.ai/docs/editor/overview) for usage.
|
|
556
556
|
|