@mastra/mcp-docs-server 1.3.9-alpha.8 → 1.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agents/guardrails.md +3 -0
- package/.docs/docs/agents/overview.md +1 -0
- package/.docs/docs/agents/processors.md +9 -4
- package/.docs/docs/auth/composite-auth.md +4 -2
- package/.docs/docs/auth/custom-auth-provider.md +1 -1
- package/.docs/docs/auth/overview.md +3 -1
- package/.docs/docs/connections/sdk-agents.md +18 -7
- package/.docs/docs/evals/experiments.md +27 -2
- package/.docs/docs/guides/mcp-authentication-authorization.md +2 -2
- package/.docs/docs/guides/mcp-events.md +306 -0
- package/.docs/docs/harness/agent-controller.md +11 -14
- package/.docs/docs/harness/background-tasks.md +11 -0
- package/.docs/docs/harness/durable-agents.md +10 -4
- package/.docs/docs/harness/schedules.md +8 -6
- package/.docs/docs/index.md +1 -0
- package/.docs/docs/mastra-platform/connect/end-user-connections.md +116 -0
- package/.docs/docs/mastra-platform/environments.md +1 -1
- package/.docs/docs/mastra-platform/server.md +1 -1
- package/.docs/docs/mastra-platform/studio.md +1 -1
- package/.docs/docs/memory/memory-processors.md +14 -8
- package/.docs/docs/memory/semantic-recall.md +20 -0
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/sandbox/filesystem.md +25 -11
- package/.docs/docs/server/overview.md +27 -0
- package/.docs/docs/studio/auth.md +2 -2
- package/.docs/docs/studio/observability.md +5 -1
- package/.docs/docs/workflows/control-flow.md +14 -14
- package/.docs/docs/workflows/error-handling.md +1 -1
- package/.docs/integrations/deploy/aws-bedrock-agentcore.md +1 -0
- package/.docs/integrations/sandboxes/e2b.md +2 -0
- package/.docs/models/embeddings.md +2 -1
- package/.docs/models/environment-variables.md +1 -1
- package/.docs/models/gateways/merge-gateway.md +7 -1
- package/.docs/models/gateways/vercel.md +6 -2
- package/.docs/models/index.md +2 -2
- package/.docs/models/providers/aixy.md +3 -1
- package/.docs/models/providers/alibaba-cn.md +7 -55
- package/.docs/models/providers/alibaba-coding-plan-cn.md +8 -12
- package/.docs/models/providers/alibaba-coding-plan.md +8 -12
- package/.docs/models/providers/alibaba-token-plan-cn.md +0 -2
- package/.docs/models/providers/alibaba-token-plan.md +29 -30
- package/.docs/models/providers/alibaba.md +32 -61
- package/.docs/models/providers/ambient.md +0 -8
- package/.docs/models/providers/amd.md +13 -9
- package/.docs/models/providers/anthropic.md +4 -2
- package/.docs/models/providers/arcee.md +6 -4
- package/.docs/models/providers/baseten.md +0 -10
- package/.docs/models/providers/cloudflare-workers-ai.md +1 -1
- package/.docs/models/providers/crossmodel.md +70 -72
- package/.docs/models/providers/databricks.md +5 -10
- package/.docs/models/providers/digitalocean.md +2 -14
- package/.docs/models/providers/edenai.md +18 -4
- package/.docs/models/providers/empiriolabs.md +1 -7
- package/.docs/models/providers/fireworks-ai.md +22 -26
- package/.docs/models/providers/google.md +4 -1
- package/.docs/models/providers/groq.md +2 -7
- package/.docs/models/providers/huggingface.md +2 -5
- package/.docs/models/providers/inception.md +3 -2
- package/.docs/models/providers/iteracompute.md +2 -2
- package/.docs/models/providers/jalapeno.md +1 -1
- package/.docs/models/providers/kenari.md +1 -1
- package/.docs/models/providers/kilo.md +15 -30
- package/.docs/models/providers/liquid.md +77 -0
- package/.docs/models/providers/llmgateway-providers.md +3 -12
- package/.docs/models/providers/llmgateway.md +5 -15
- package/.docs/models/providers/longcat.md +6 -5
- package/.docs/models/providers/melious.md +16 -15
- package/.docs/models/providers/minimax-cn-coding-plan.md +4 -11
- package/.docs/models/providers/minimax-cn.md +4 -10
- package/.docs/models/providers/minimax-coding-plan.md +4 -11
- package/.docs/models/providers/minimax.md +4 -10
- package/.docs/models/providers/mistral.md +4 -4
- package/.docs/models/providers/modal.md +11 -7
- package/.docs/models/providers/moonshotai-cn.md +2 -2
- package/.docs/models/providers/nano-gpt.md +17 -26
- package/.docs/models/providers/nearai.md +1 -1
- package/.docs/models/providers/ofox.md +148 -156
- package/.docs/models/providers/ollama-cloud.md +6 -11
- package/.docs/models/providers/openai.md +4 -2
- package/.docs/models/providers/opencode.md +2 -1
- package/.docs/models/providers/perplexity-agent.md +53 -29
- package/.docs/models/providers/perplexity.md +2 -8
- package/.docs/models/providers/pioneer.md +8 -113
- package/.docs/models/providers/requesty.md +0 -4
- package/.docs/models/providers/runinfra.md +2 -1
- package/.docs/models/providers/scaleway.md +1 -3
- package/.docs/models/providers/snowflake-cortex.md +22 -22
- package/.docs/models/providers/stepfun-ai.md +1 -3
- package/.docs/models/providers/stepfun.md +4 -6
- package/.docs/models/providers/synthetic.md +2 -1
- package/.docs/models/providers/thinkingmachines.md +45 -9
- package/.docs/models/providers/togetherai.md +17 -23
- package/.docs/models/providers/wandb.md +1 -1
- package/.docs/models/providers/xai.md +3 -2
- package/.docs/models/providers/xiaomi-token-plan-ams.md +0 -1
- package/.docs/models/providers/xiaomi-token-plan-cn.md +0 -1
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +0 -1
- package/.docs/models/providers/zai-coding-plan.md +0 -4
- package/.docs/models/providers/zhipuai-coding-plan.md +0 -1
- package/.docs/models/providers/zhipuai.md +12 -12
- package/.docs/models/providers.md +1 -1
- package/.docs/reference/agent-controller/agent-controller-class.md +17 -22
- package/.docs/reference/agent-controller/session.md +3 -3
- package/.docs/reference/agents/channels.md +7 -1
- package/.docs/reference/agents/durable-agent.md +12 -8
- package/.docs/reference/agents/getSkill.md +1 -1
- package/.docs/reference/agents/listSkills.md +1 -4
- package/.docs/reference/browser/mastra-browser.md +1 -1
- package/.docs/reference/client-js/agent-controller.md +13 -3
- package/.docs/reference/client-js/agents.md +20 -0
- package/.docs/reference/client-js/mastra-client.md +1 -1
- package/.docs/reference/client-js/observability.md +3 -3
- package/.docs/reference/configuration.md +30 -0
- package/.docs/reference/connect/credential.md +1 -1
- package/.docs/reference/connect/tools.md +3 -1
- package/.docs/reference/connect/user-connect-routes.md +68 -0
- package/.docs/reference/core/mastra-class.md +2 -2
- package/.docs/reference/core/mastra-model-gateway.md +33 -4
- package/.docs/reference/datasets/delete.md +6 -0
- package/.docs/reference/editor/mastra-editor.md +9 -7
- package/.docs/reference/editor/tool-provider.md +2 -2
- package/.docs/reference/evals/create-classifier-scorer.md +6 -2
- package/.docs/reference/file-based-agents/instructions.md +1 -1
- package/.docs/reference/file-based-agents/processors.md +2 -0
- package/.docs/reference/file-based-agents/schedules.md +1 -1
- package/.docs/reference/file-based-agents/skills.md +1 -1
- package/.docs/reference/file-based-agents/subagents.md +1 -1
- package/.docs/reference/index.md +1 -0
- package/.docs/reference/manual-install.md +1 -0
- package/.docs/reference/memory/cloneThread.md +1 -1
- package/.docs/reference/memory/copyThread.md +1 -1
- package/.docs/reference/memory/deleteMessages.md +4 -1
- package/.docs/reference/memory/memory-class.md +2 -0
- package/.docs/reference/memory/serialized-memory-config.md +1 -1
- package/.docs/reference/memory/settled.md +13 -5
- package/.docs/reference/observability/tracing/advanced-queries.md +40 -31
- package/.docs/reference/processors/processor-interface.md +10 -2
- package/.docs/reference/rag/embeddings.md +18 -0
- package/.docs/reference/server/routes.md +159 -0
- package/.docs/reference/signals/signal-provider.md +2 -0
- package/.docs/reference/signals/task-signal-provider.md +1 -1
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/tools/mcp-client.md +236 -0
- package/.docs/reference/tools/mcp-server.md +170 -0
- package/.docs/reference/workflows/workflow-methods/branch.md +1 -1
- package/.docs/reference/workspace/filesystem.md +17 -17
- package/.docs/reference/workspace/local-filesystem.md +51 -26
- package/.docs/reference/workspace/platform-sandbox.md +2 -0
- package/.docs/reference/workspace/sandbox.md +16 -0
- package/.docs/reference/workspace/workspace-class.md +13 -12
- package/dist/index.js +1 -2
- package/dist/{src-Baf8l9Sp.js → src-DnH_jHt9.js} +2 -3
- package/dist/{src-Baf8l9Sp.js.map → src-DnH_jHt9.js.map} +1 -1
- package/dist/stdio.js +1 -1
- package/package.json +6 -6
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Thinking Machines
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 38 Thinking Machines models through Mastra's model router. Authentication is handled automatically using the `TINKER_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Thinking Machines documentation](https://tinker-docs.thinkingmachines.ai/tinker/compatible-apis/anthropic/).
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ const agent = new Agent({
|
|
|
19
19
|
id: "my-agent",
|
|
20
20
|
name: "My Agent",
|
|
21
21
|
instructions: "You are a helpful assistant",
|
|
22
|
-
model: "thinkingmachines/
|
|
22
|
+
model: "thinkingmachines/Qwen/Qwen3-8B"
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
// Generate a response
|
|
@@ -36,10 +36,46 @@ for await (const chunk of stream) {
|
|
|
36
36
|
|
|
37
37
|
## Models
|
|
38
38
|
|
|
39
|
-
| Model
|
|
40
|
-
|
|
|
41
|
-
| `thinkingmachines/
|
|
42
|
-
| `thinkingmachines/
|
|
39
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
|
+
| --------------------------------------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
|
+
| `thinkingmachines/deepseek-ai/DeepSeek-V3.1` | 33K | | | | | | $2 | $4 |
|
|
42
|
+
| `thinkingmachines/deepseek-ai/DeepSeek-V4.1-Flash-1017:peft:262144` | 262K | | | | | | $0.60 | $4 |
|
|
43
|
+
| `thinkingmachines/deepseek-ai/DeepSeek-V4.1-Flash:peft:262144` | 262K | | | | | | $0.60 | $4 |
|
|
44
|
+
| `thinkingmachines/moonshotai/Kimi-K2.6` | 33K | | | | | | $2 | $5 |
|
|
45
|
+
| `thinkingmachines/moonshotai/Kimi-K2.6:peft:131072` | 131K | | | | | | $2 | $5 |
|
|
46
|
+
| `thinkingmachines/nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16` | 66K | | | | | | $0.20 | $0.49 |
|
|
47
|
+
| `thinkingmachines/nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16` | 66K | | | | | | $0.57 | $1 |
|
|
48
|
+
| `thinkingmachines/nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16:peft:262144` | 262K | | | | | | $0.57 | $1 |
|
|
49
|
+
| `thinkingmachines/nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16` | 66K | | | | | | $2 | $6 |
|
|
50
|
+
| `thinkingmachines/nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16:peft:262144` | 262K | | | | | | $2 | $6 |
|
|
51
|
+
| `thinkingmachines/nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-BF16` | 66K | | | | | | $0.18 | $0.49 |
|
|
52
|
+
| `thinkingmachines/nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-BF16:peft:262144` | 262K | | | | | | $0.18 | $0.49 |
|
|
53
|
+
| `thinkingmachines/nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-BF16` | 66K | | | | | | $0.57 | $1 |
|
|
54
|
+
| `thinkingmachines/nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-BF16:peft:262144` | 262K | | | | | | $0.57 | $1 |
|
|
55
|
+
| `thinkingmachines/openai/gpt-oss-120b` | 33K | | | | | | $0.33 | $0.84 |
|
|
56
|
+
| `thinkingmachines/openai/gpt-oss-120b:peft:131072` | 131K | | | | | | $0.33 | $0.84 |
|
|
57
|
+
| `thinkingmachines/openai/gpt-oss-20b` | 33K | | | | | | $0.18 | $0.45 |
|
|
58
|
+
| `thinkingmachines/Qwen/Qwen3-8B` | 33K | | | | | | $0.20 | $0.60 |
|
|
59
|
+
| `thinkingmachines/Qwen/Qwen3.5-35B-A3B-Base` | 66K | | | | | | $0.54 | $1 |
|
|
60
|
+
| `thinkingmachines/Qwen/Qwen3.5-397B-A17B` | 66K | | | | | | $2 | $8 |
|
|
61
|
+
| `thinkingmachines/Qwen/Qwen3.5-397B-A17B:peft:262144` | 262K | | | | | | $2 | $8 |
|
|
62
|
+
| `thinkingmachines/Qwen/Qwen3.5-4B` | 66K | | | | | | $0.33 | $1 |
|
|
63
|
+
| `thinkingmachines/Qwen/Qwen3.5-4B:peft:262144` | 262K | | | | | | $0.33 | $1 |
|
|
64
|
+
| `thinkingmachines/Qwen/Qwen3.5-9B` | 66K | | | | | | $0.30 | $0.81 |
|
|
65
|
+
| `thinkingmachines/Qwen/Qwen3.5-9B-Base` | 66K | | | | | | $0.30 | $0.81 |
|
|
66
|
+
| `thinkingmachines/Qwen/Qwen3.6-27B` | 66K | | | | | | $2 | $6 |
|
|
67
|
+
| `thinkingmachines/Qwen/Qwen3.6-35B-A3B` | 66K | | | | | | $0.45 | $1 |
|
|
68
|
+
| `thinkingmachines/Qwen/Qwen3.6-35B-A3B:peft:262144` | 262K | | | | | | $0.45 | $1 |
|
|
69
|
+
| `thinkingmachines/Qwen/Qwen3.8-27B` | 66K | | | | | | $0.70 | $6 |
|
|
70
|
+
| `thinkingmachines/Qwen/Qwen3.8-27B:peft:262144` | 262K | | | | | | $0.70 | $6 |
|
|
71
|
+
| `thinkingmachines/thinkingmachines/Inkling` | 66K | | | | | | $2 | $5 |
|
|
72
|
+
| `thinkingmachines/thinkingmachines/Inkling-Small` | 66K | | | | | | $0.58 | $1 |
|
|
73
|
+
| `thinkingmachines/thinkingmachines/Inkling-Small:peft:262144` | 262K | | | | | | $0.58 | $1 |
|
|
74
|
+
| `thinkingmachines/thinkingmachines/Inkling-Small:peft:262144:sampling-nvfp4` | 262K | | | | | | $0.30 | $1 |
|
|
75
|
+
| `thinkingmachines/thinkingmachines/Inkling:peft:262144` | 262K | | | | | | $2 | $5 |
|
|
76
|
+
| `thinkingmachines/thinkingmachines/Inkling:peft:262144:sampling-nvfp4` | 262K | | | | | | $1 | $4 |
|
|
77
|
+
| `thinkingmachines/zai-org/GLM-5.3-Flash:peft:262144` | 262K | | | | | | $0.84 | $2 |
|
|
78
|
+
| `thinkingmachines/zai-org/GLM-5.3:peft:262144` | 262K | | | | | | $4 | $12 |
|
|
43
79
|
|
|
44
80
|
Model availability, capabilities, context windows, and pricing are sourced from [models.dev](https://models.dev) and may change.
|
|
45
81
|
|
|
@@ -53,7 +89,7 @@ const agent = new Agent({
|
|
|
53
89
|
name: "custom-agent",
|
|
54
90
|
model: {
|
|
55
91
|
url: "https://tinker.thinkingmachines.dev/services/tinker-prod/anthropic/api/v1",
|
|
56
|
-
id: "thinkingmachines/
|
|
92
|
+
id: "thinkingmachines/Qwen/Qwen3-8B",
|
|
57
93
|
apiKey: process.env.TINKER_API_KEY,
|
|
58
94
|
headers: {
|
|
59
95
|
"X-Custom-Header": "value"
|
|
@@ -71,8 +107,8 @@ const agent = new Agent({
|
|
|
71
107
|
model: ({ requestContext }) => {
|
|
72
108
|
const useAdvanced = requestContext.task === "complex";
|
|
73
109
|
return useAdvanced
|
|
74
|
-
? "thinkingmachines/
|
|
75
|
-
: "thinkingmachines/
|
|
110
|
+
? "thinkingmachines/zai-org/GLM-5.3:peft:262144"
|
|
111
|
+
: "thinkingmachines/Qwen/Qwen3-8B";
|
|
76
112
|
}
|
|
77
113
|
});
|
|
78
114
|
```
|
|
@@ -34,29 +34,23 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
## Models
|
|
36
36
|
|
|
37
|
-
| Model
|
|
38
|
-
|
|
|
39
|
-
| `togetherai/deepseek-ai/DeepSeek-V4-
|
|
40
|
-
| `togetherai/deepseek-ai/DeepSeek-V4-
|
|
41
|
-
| `togetherai/
|
|
42
|
-
| `togetherai/
|
|
43
|
-
| `togetherai/
|
|
44
|
-
| `togetherai/
|
|
45
|
-
| `togetherai/
|
|
46
|
-
| `togetherai/
|
|
47
|
-
| `togetherai/
|
|
48
|
-
| `togetherai/
|
|
49
|
-
| `togetherai/
|
|
50
|
-
| `togetherai/
|
|
51
|
-
| `togetherai/
|
|
52
|
-
| `togetherai/
|
|
53
|
-
| `togetherai/
|
|
54
|
-
| `togetherai/Qwen/Qwen3.7-Max` | 1.0M | | | | | | $1 | $4 |
|
|
55
|
-
| `togetherai/reflection/Beam-1.0-501B-A23B` | 1.0M | | | | | | $0.40 | $1 |
|
|
56
|
-
| `togetherai/thinkingmachines/Inkling` | 524K | | | | | | $1 | $4 |
|
|
57
|
-
| `togetherai/zai-org/GLM-5.2` | 1.0M | | | | | | $1 | $4 |
|
|
58
|
-
| `togetherai/zai-org/GLM-5.3` | 1.0M | | | | | | $1 | $4 |
|
|
59
|
-
| `togetherai/zai-org/GLM-5.3-Flash` | 1.0M | | | | | | $0.15 | $0.50 |
|
|
37
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
+
| -------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `togetherai/deepseek-ai/DeepSeek-V4-Pro-0813` | 1.0M | | | | | | $1 | $4 |
|
|
40
|
+
| `togetherai/deepseek-ai/DeepSeek-V4.1-Flash` | 1.0M | | | | | | $0.30 | $1 |
|
|
41
|
+
| `togetherai/meta-models/Muse-Spark-Open-816B-A42B` | 1.0M | | | | | | $1 | $4 |
|
|
42
|
+
| `togetherai/MiniMaxAI/MiniMax-M3` | 524K | | | | | | $0.30 | $1 |
|
|
43
|
+
| `togetherai/moonshotai/Kimi-K3` | 1.0M | | | | | | $3 | $15 |
|
|
44
|
+
| `togetherai/nvidia/NVIDIA-Nemotron-3.5-Super-VL` | 262K | | | | | | $0.15 | $0.50 |
|
|
45
|
+
| `togetherai/openai/gpt-oss-120b` | 131K | | | | | | $0.15 | $0.60 |
|
|
46
|
+
| `togetherai/Qwen/Qwen3.5-9B` | 262K | | | | | | $0.17 | $0.25 |
|
|
47
|
+
| `togetherai/Qwen/Qwen3.6-Plus` | 1.0M | | | | | | $0.50 | $3 |
|
|
48
|
+
| `togetherai/Qwen/Qwen3.7-Max` | 1.0M | | | | | | $3 | $8 |
|
|
49
|
+
| `togetherai/reflection/Beam-1.0-501B-A23B` | 1.0M | | | | | | $0.40 | $1 |
|
|
50
|
+
| `togetherai/thinkingmachines/Inkling` | 524K | | | | | | $1 | $4 |
|
|
51
|
+
| `togetherai/zai-org/GLM-5.2` | 1.0M | | | | | | $1 | $4 |
|
|
52
|
+
| `togetherai/zai-org/GLM-5.3` | 1.0M | | | | | | $1 | $4 |
|
|
53
|
+
| `togetherai/zai-org/GLM-5.3-Flash` | 1.0M | | | | | | $0.15 | $0.50 |
|
|
60
54
|
|
|
61
55
|
Model availability, capabilities, context windows, and pricing are sourced from [models.dev](https://models.dev) and may change.
|
|
62
56
|
|
|
@@ -57,7 +57,7 @@ for await (const chunk of stream) {
|
|
|
57
57
|
| `wandb/openai/gpt-oss-20b` | 131K | | | | | | $0.03 | $0.13 |
|
|
58
58
|
| `wandb/Qwen/Qwen3.6-35B-A3B` | 262K | | | | | | $0.25 | $1 |
|
|
59
59
|
| `wandb/Qwen/Qwen3.8-27B` | 262K | | | | | | $0.40 | $3 |
|
|
60
|
-
| `wandb/reflection/Beam-1.0-501B-A23B` | 1.0M | | | | | | $
|
|
60
|
+
| `wandb/reflection/Beam-1.0-501B-A23B` | 1.0M | | | | | | $0.30 | $1 |
|
|
61
61
|
| `wandb/zai-org/GLM-5.2` | 1.0M | | | | | | $0.62 | $2 |
|
|
62
62
|
| `wandb/zai-org/GLM-5.3` | 1.0M | | | | | | $1 | $4 |
|
|
63
63
|
| `wandb/zai-org/GLM-5.3-Flash` | 1.0M | | | | | | $0.15 | $0.50 |
|
|
@@ -45,7 +45,6 @@ for await (const chunk of stream) {
|
|
|
45
45
|
| `xai/grok-4.7` | 500K | | | | | | $2 | $6 |
|
|
46
46
|
| `xai/grok-build-0.1` | 256K | | | | | | $1 | $2 |
|
|
47
47
|
| `xai/grok-imagine-image` | 16K | | | | | | — | — |
|
|
48
|
-
| `xai/grok-imagine-image-quality` | 16K | | | | | | — | — |
|
|
49
48
|
| `xai/grok-imagine-video` | 1K | | | | | | — | — |
|
|
50
49
|
| `xai/grok-imagine-video-1.5` | 1K | | | | | | — | — |
|
|
51
50
|
| `xai/grok-imagine-video-1.5-lite` | 1K | | | | | | — | — |
|
|
@@ -101,12 +100,14 @@ const response = await agent.generate("Hello!", {
|
|
|
101
100
|
|
|
102
101
|
### Available Options
|
|
103
102
|
|
|
104
|
-
**reasoningEffort** (`"none" | "low" | "medium" | "high" | undefined`)
|
|
103
|
+
**reasoningEffort** (`"none" | "low" | "medium" | "high" | "xhigh" | undefined`)
|
|
105
104
|
|
|
106
105
|
**logprobs** (`boolean | undefined`)
|
|
107
106
|
|
|
108
107
|
**topLogprobs** (`number | undefined`)
|
|
109
108
|
|
|
109
|
+
**serviceTier** (`"default" | "priority" | undefined`)
|
|
110
|
+
|
|
110
111
|
**parallel\_function\_calling** (`boolean | undefined`)
|
|
111
112
|
|
|
112
113
|
**searchParameters** (`{ mode: "off" | "auto" | "on"; returnCitations?: boolean | undefined; fromDate?: string | undefined; toDate?: string | undefined; maxSearchResults?: number | undefined; sources?: ({ ...; } | ... 2 more ... | { ...; })[] | undefined; } | undefined`)
|
|
@@ -38,7 +38,6 @@ for await (const chunk of stream) {
|
|
|
38
38
|
|
|
39
39
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
40
|
| ------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
|
-
| `xiaomi-token-plan-ams/mimo-v2-tts` | 8K | | | | | | — | — |
|
|
42
41
|
| `xiaomi-token-plan-ams/mimo-v2.5-tts` | 8K | | | | | | — | — |
|
|
43
42
|
| `xiaomi-token-plan-ams/mimo-v2.5-tts-voiceclone` | 8K | | | | | | — | — |
|
|
44
43
|
| `xiaomi-token-plan-ams/mimo-v2.5-tts-voicedesign` | 8K | | | | | | — | — |
|
|
@@ -38,7 +38,6 @@ for await (const chunk of stream) {
|
|
|
38
38
|
|
|
39
39
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
40
|
| ------------------------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
|
-
| `xiaomi-token-plan-cn/mimo-v2-tts` | 8K | | | | | | — | — |
|
|
42
41
|
| `xiaomi-token-plan-cn/mimo-v2.5-tts` | 8K | | | | | | — | — |
|
|
43
42
|
| `xiaomi-token-plan-cn/mimo-v2.5-tts-voiceclone` | 8K | | | | | | — | — |
|
|
44
43
|
| `xiaomi-token-plan-cn/mimo-v2.5-tts-voicedesign` | 8K | | | | | | — | — |
|
|
@@ -38,7 +38,6 @@ for await (const chunk of stream) {
|
|
|
38
38
|
|
|
39
39
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
40
|
| ------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
|
-
| `xiaomi-token-plan-sgp/mimo-v2-tts` | 8K | | | | | | — | — |
|
|
42
41
|
| `xiaomi-token-plan-sgp/mimo-v2.5-tts` | 8K | | | | | | — | — |
|
|
43
42
|
| `xiaomi-token-plan-sgp/mimo-v2.5-tts-voiceclone` | 8K | | | | | | — | — |
|
|
44
43
|
| `xiaomi-token-plan-sgp/mimo-v2.5-tts-voicedesign` | 8K | | | | | | — | — |
|
|
@@ -38,10 +38,6 @@ for await (const chunk of stream) {
|
|
|
38
38
|
|
|
39
39
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
40
|
| ----------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
|
-
| `zai-coding-plan/glm-4.7` | 205K | | | | | | — | — |
|
|
42
|
-
| `zai-coding-plan/glm-5-turbo` | 200K | | | | | | — | — |
|
|
43
|
-
| `zai-coding-plan/glm-5.2` | 1.0M | | | | | | — | — |
|
|
44
|
-
| `zai-coding-plan/glm-5.2-highspeed` | 1.0M | | | | | | — | — |
|
|
45
41
|
| `zai-coding-plan/glm-5.3` | 1.0M | | | | | | — | — |
|
|
46
42
|
| `zai-coding-plan/glm-5.3-flash` | 1.0M | | | | | | — | — |
|
|
47
43
|
| `zai-coding-plan/glm-5.3-highspeed` | 1.0M | | | | | | — | — |
|
|
@@ -38,7 +38,6 @@ for await (const chunk of stream) {
|
|
|
38
38
|
|
|
39
39
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
40
|
| --------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
|
-
| `zhipuai-coding-plan/glm-4.6v` | 128K | | | | | | $0.30 | $0.90 |
|
|
42
41
|
| `zhipuai-coding-plan/glm-5.3` | 1.0M | | | | | | — | — |
|
|
43
42
|
| `zhipuai-coding-plan/glm-5.3-flash` | 1.0M | | | | | | — | — |
|
|
44
43
|
| `zhipuai-coding-plan/glm-5.3-highspeed` | 1.0M | | | | | | — | — |
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Access 17 Zhipu AI models through Mastra's model router. Authentication is handled automatically using the `ZHIPU_API_KEY` environment variable.
|
|
8
8
|
|
|
9
|
-
Learn more in the [Zhipu AI documentation](https://docs.
|
|
9
|
+
Learn more in the [Zhipu AI documentation](https://docs.bigmodel.cn/cn/guide/start/pricing).
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
ZHIPU_API_KEY=your-api-key
|
|
@@ -32,29 +32,29 @@ for await (const chunk of stream) {
|
|
|
32
32
|
}
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
> **Note:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Zhipu AI documentation](https://docs.
|
|
35
|
+
> **Note:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Zhipu AI documentation](https://docs.bigmodel.cn/cn/guide/start/pricing) for details.
|
|
36
36
|
|
|
37
37
|
## Models
|
|
38
38
|
|
|
39
39
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
40
|
| ------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
41
|
| `zhipuai/glm-4.5` | 131K | | | | | | $0.60 | $2 |
|
|
42
|
-
| `zhipuai/glm-4.5-air` | 131K | | | | | | $0.
|
|
42
|
+
| `zhipuai/glm-4.5-air` | 131K | | | | | | $0.12 | $0.90 |
|
|
43
43
|
| `zhipuai/glm-4.5-flash` | 131K | | | | | | — | — |
|
|
44
|
-
| `zhipuai/glm-4.5v` | 64K | | | | | | $0.
|
|
44
|
+
| `zhipuai/glm-4.5v` | 64K | | | | | | $0.30 | $0.90 |
|
|
45
45
|
| `zhipuai/glm-4.6` | 205K | | | | | | $0.60 | $2 |
|
|
46
|
-
| `zhipuai/glm-4.6v` | 128K | | | | | | $0.
|
|
46
|
+
| `zhipuai/glm-4.6v` | 128K | | | | | | $0.15 | $0.45 |
|
|
47
47
|
| `zhipuai/glm-4.6v-flash` | 128K | | | | | | — | — |
|
|
48
|
-
| `zhipuai/glm-4.7` | 205K | | | | | | $0.
|
|
48
|
+
| `zhipuai/glm-4.7` | 205K | | | | | | $0.45 | $2 |
|
|
49
49
|
| `zhipuai/glm-4.7-flash` | 200K | | | | | | — | — |
|
|
50
|
-
| `zhipuai/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.
|
|
51
|
-
| `zhipuai/glm-5` | 205K | | | | | | $
|
|
52
|
-
| `zhipuai/glm-5.1` | 200K | | | | | | $
|
|
50
|
+
| `zhipuai/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.45 |
|
|
51
|
+
| `zhipuai/glm-5` | 205K | | | | | | $0.60 | $3 |
|
|
52
|
+
| `zhipuai/glm-5.1` | 200K | | | | | | $0.90 | $4 |
|
|
53
53
|
| `zhipuai/glm-5.2` | 1.0M | | | | | | $1 | $4 |
|
|
54
54
|
| `zhipuai/glm-5.3` | 1.0M | | | | | | $1 | $4 |
|
|
55
|
-
| `zhipuai/glm-5.3-flash` | 1.0M | | | | | | $0.
|
|
56
|
-
| `zhipuai/glm-5.3-flashx` | 1.0M | | | | | | $0.
|
|
57
|
-
| `zhipuai/glm-5v-turbo` | 200K | | | | | | $
|
|
55
|
+
| `zhipuai/glm-5.3-flash` | 1.0M | | | | | | $0.12 | $0.42 |
|
|
56
|
+
| `zhipuai/glm-5.3-flashx` | 1.0M | | | | | | $0.30 | $1 |
|
|
57
|
+
| `zhipuai/glm-5v-turbo` | 200K | | | | | | $0.75 | $3 |
|
|
58
58
|
|
|
59
59
|
Model availability, capabilities, context windows, and pricing are sourced from [models.dev](https://models.dev) and may change.
|
|
60
60
|
|
|
@@ -57,7 +57,6 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
57
57
|
- [CoralBricks](https://mastra.ai/models/providers/coralbricks)
|
|
58
58
|
- [CoreWeave](https://mastra.ai/models/providers/wandb)
|
|
59
59
|
- [Cortecs](https://mastra.ai/models/providers/cortecs)
|
|
60
|
-
- [CrofAI](https://mastra.ai/models/providers/crof)
|
|
61
60
|
- [CrossModel](https://mastra.ai/models/providers/crossmodel)
|
|
62
61
|
- [Crusoe](https://mastra.ai/models/providers/crusoe)
|
|
63
62
|
- [D.Run (China)](https://mastra.ai/models/providers/drun)
|
|
@@ -105,6 +104,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
105
104
|
- [Kosmik Compute](https://mastra.ai/models/providers/kosmik)
|
|
106
105
|
- [KUAE Cloud Coding Plan](https://mastra.ai/models/providers/kuae-cloud-coding-plan)
|
|
107
106
|
- [Lilac](https://mastra.ai/models/providers/lilac)
|
|
107
|
+
- [Liquid Inference](https://mastra.ai/models/providers/liquid)
|
|
108
108
|
- [Llama](https://mastra.ai/models/providers/llama)
|
|
109
109
|
- [LLM Gateway](https://mastra.ai/models/providers/llmgateway-providers)
|
|
110
110
|
- [LLM Tech](https://mastra.ai/models/providers/llmtech)
|
|
@@ -172,27 +172,25 @@ A message lifecycle starts with the initial message in `message_start`. Compact
|
|
|
172
172
|
|
|
173
173
|
#### `createSession(options)`
|
|
174
174
|
|
|
175
|
-
Get or create the live session registered
|
|
175
|
+
Get or create the live session registered under `id`. Call `init()` before this method.
|
|
176
176
|
|
|
177
177
|
```typescript
|
|
178
178
|
const session = await controller.createSession({
|
|
179
|
+
id: 'run-a',
|
|
179
180
|
resourceId: 'project-42',
|
|
180
|
-
scope: 'editor-window-1',
|
|
181
181
|
threadId: 'thread-7',
|
|
182
182
|
})
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
The same `
|
|
185
|
+
The same `id` returns the same `Session` instance. Sessions with different ids are independent even when they share a `resourceId`: each has its own run loop, thread binding, mode, model, and state, while their stored threads and resource-scoped memory belong to the shared resource. When `id` is omitted, it defaults to `resourceId`, so one session per resource needs no id. When `threadId` is supplied, the method switches a cached session to that thread or creates the thread when it doesn't exist.
|
|
186
186
|
|
|
187
|
-
**resourceId** (`string`): Memory resource and
|
|
188
|
-
|
|
189
|
-
**scope** (`string`): Optional registry namespace that allows multiple live sessions for one resource.
|
|
187
|
+
**resourceId** (`string`): Memory resource that owns the session's threads and resource-scoped memory. Defaults to the configured resourceId or controller id.
|
|
190
188
|
|
|
191
189
|
**threadId** (`string`): Exact thread to bind. Missing threads are created with this identifier.
|
|
192
190
|
|
|
193
191
|
**createInitialThread** (`boolean`): Create a thread when no existing thread matches. Set false to start the session without a thread; the first message or session.thread.ensureId() creates it, so unused sessions leave no empty thread behind. (Default: `true`)
|
|
194
192
|
|
|
195
|
-
**id** (`string`):
|
|
193
|
+
**id** (`string`): Session identifier and live-session registry key. Defaults to resourceId.
|
|
196
194
|
|
|
197
195
|
**ownerId** (`string`): Stable identity of the process-local Session host. Defaults to id. New threads use it as their initial owner, but later transfers do not change this value.
|
|
198
196
|
|
|
@@ -206,12 +204,12 @@ The same `resourceId` and `scope` return the same `Session` instance. A differen
|
|
|
206
204
|
|
|
207
205
|
Returns: `Promise<Session<TState>>`
|
|
208
206
|
|
|
209
|
-
#### `
|
|
207
|
+
#### `getSession(sessionId, requestContext?)`
|
|
210
208
|
|
|
211
|
-
Return the live session registered
|
|
209
|
+
Return the live session registered under `sessionId`, or `undefined` when none is live.
|
|
212
210
|
|
|
213
211
|
```typescript
|
|
214
|
-
const session = await controller.
|
|
212
|
+
const session = await controller.getSession('run-a')
|
|
215
213
|
```
|
|
216
214
|
|
|
217
215
|
Returns: `Promise<Session<TState> | undefined>`
|
|
@@ -220,7 +218,7 @@ Returns: `Promise<Session<TState> | undefined>`
|
|
|
220
218
|
|
|
221
219
|
Subscribe to process-local notifications after `createSession()` materializes a new live session, with isolated listener errors prevented from affecting other listeners. Call the returned function to unsubscribe.
|
|
222
220
|
|
|
223
|
-
By default listeners are fire-and-forget. Pass `{ blocking: true }` to make `createSession()` await the listener before resolving the new session, so the host can prepare session state before the caller can start a run. Blocking listeners run sequentially in registration order, before fire-and-forget listeners are notified. A blocking listener must not call `createSession()` for the same
|
|
221
|
+
By default listeners are fire-and-forget. Pass `{ blocking: true }` to make `createSession()` await the listener before resolving the new session, so the host can prepare session state before the caller can start a run. Blocking listeners run sequentially in registration order, before fire-and-forget listeners are notified. A blocking listener must not call `createSession()` for the same session `id`. That call would await its own hydration and deadlock.
|
|
224
222
|
|
|
225
223
|
```typescript
|
|
226
224
|
const unsubscribe = controller.onSessionCreated(
|
|
@@ -251,7 +249,7 @@ const unsubscribe = controller.onSessionDeleted(session => {
|
|
|
251
249
|
})
|
|
252
250
|
|
|
253
251
|
await controller.createSession({ resourceId: 'project-42' })
|
|
254
|
-
await controller.deleteSession({
|
|
252
|
+
await controller.deleteSession({ sessionId: 'project-42' })
|
|
255
253
|
unsubscribe()
|
|
256
254
|
```
|
|
257
255
|
|
|
@@ -259,22 +257,19 @@ This listener is best-effort and runs only in the current process. It isn't a pe
|
|
|
259
257
|
|
|
260
258
|
Returns: `() => void`
|
|
261
259
|
|
|
262
|
-
#### `deleteSession({
|
|
260
|
+
#### `deleteSession({ sessionId })`
|
|
263
261
|
|
|
264
|
-
Tear down the materialized session
|
|
262
|
+
Tear down the materialized session registered under `sessionId`. The method aborts active work, then removes thread subscriptions, the active thread lock, and the live session from the controller registry. It doesn't delete persisted threads or messages.
|
|
265
263
|
|
|
266
264
|
```typescript
|
|
267
|
-
const deleted = await controller.deleteSession({
|
|
268
|
-
resourceId: 'project-42',
|
|
269
|
-
scope: 'editor-window-1',
|
|
270
|
-
})
|
|
265
|
+
const deleted = await controller.deleteSession({ sessionId: 'run-a' })
|
|
271
266
|
```
|
|
272
267
|
|
|
273
|
-
Returns: `Promise<boolean>`. The result is `true` when a live session was removed and `false` when no matching live session exists or when another deletion is already in progress for the same
|
|
268
|
+
Returns: `Promise<boolean>`. The result is `true` when a live session was removed and `false` when no matching live session exists or when another deletion is already in progress for the same session.
|
|
274
269
|
|
|
275
270
|
#### `setResourceId(session, { resourceId })`
|
|
276
271
|
|
|
277
|
-
Move a live session to another resource and clear its active thread binding.
|
|
272
|
+
Move a live session to another resource and clear its active thread binding. The session stays registered under its id.
|
|
278
273
|
|
|
279
274
|
```typescript
|
|
280
275
|
await controller.setResourceId(session, { resourceId: 'project-43' })
|
|
@@ -353,12 +348,12 @@ Returns: `Promise<StorageListMessagesOutput>` with controller-format messages.
|
|
|
353
348
|
|
|
354
349
|
#### `generateThreadTitle(options)`
|
|
355
350
|
|
|
356
|
-
Generate and store a title from a thread's conversation without creating a Session. `threadId` is required. `
|
|
351
|
+
Generate and store a title from a thread's conversation without creating a Session. `threadId` is required. `sessionId`, `model`, and `requestContext` are optional; pass `sessionId` to borrow a live session's agent and request context. The method throws when the thread doesn't exist and returns `undefined` when the model produces no title.
|
|
357
352
|
|
|
358
353
|
```typescript
|
|
359
354
|
const title = await controller.generateThreadTitle({
|
|
360
355
|
threadId: 'thread-7',
|
|
361
|
-
|
|
356
|
+
sessionId: 'run-a',
|
|
362
357
|
})
|
|
363
358
|
```
|
|
364
359
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Session
|
|
6
6
|
|
|
7
|
-
A `Session` is the isolated runtime
|
|
7
|
+
A `Session` is the isolated runtime registered under one session id. Several sessions can share a resource, which owns their stored threads and resource-scoped memory. It owns its event bus, thread binding, state, mode and model selections, run control, approvals, suspensions, follow-ups, and display state. The [`AgentController`](https://mastra.ai/reference/agent-controller/agent-controller-class) supplies shared agents, configuration, storage, workspaces, and services.
|
|
8
8
|
|
|
9
9
|
Create sessions through `controller.createSession()`. Direct construction and controller wiring methods aren't application APIs.
|
|
10
10
|
|
|
@@ -164,7 +164,7 @@ session.abort()
|
|
|
164
164
|
|
|
165
165
|
#### `getWorkspace()`
|
|
166
166
|
|
|
167
|
-
Return the workspace resolved for this session. This preserves session-level overrides
|
|
167
|
+
Return the workspace resolved for this session. This preserves session-level overrides.
|
|
168
168
|
|
|
169
169
|
A workspace is optional. When neither the session nor the `AgentController` configures one, the session still runs without filesystem or sandbox access, and this returns `undefined`. Check the result before using it.
|
|
170
170
|
|
|
@@ -838,7 +838,7 @@ Thread-owned preferences include thinking level, observational memory settings,
|
|
|
838
838
|
|
|
839
839
|
A queued write keeps its source thread through asynchronous updates and validation. Switching from A to B while a write is pending doesn't apply A's preferences to B. Host-field updates still affect the host. A retained run and the active view of the same thread share update ordering. A resumed run sees edits made while it was parked. Events without a source address that affect the conversation display are emitted only while that source is active.
|
|
840
840
|
|
|
841
|
-
Inside a tool's controller request context, `state` is a snapshot taken when the context was built. Use `getState()` or `session.state.get()` to read the latest source-thread state after a write.
|
|
841
|
+
Inside a tool's controller request context, `sessionId`, `resourceId`, and `threadId` identify the session, its resource, and its active thread. `state` is a snapshot taken when the context was built. Use `getState()` or `session.state.get()` to read the latest source-thread state after a write.
|
|
842
842
|
|
|
843
843
|
### `session.state.get()`
|
|
844
844
|
|
|
@@ -100,7 +100,7 @@ const agent = new Agent({
|
|
|
100
100
|
|
|
101
101
|
**formatError** (`(error: Error) => PostableMessage`): Override how errors are rendered in the chat. Return a user-friendly message instead of exposing the raw error. (Default: `"❌ Error: <error.message>"`)
|
|
102
102
|
|
|
103
|
-
**formatToolCall** (`(
|
|
103
|
+
**formatToolCall** (`(info: { toolName: string; args: Record<string, unknown>; result: unknown; isError?: boolean }) => PostableMessage | null`): \*\*Deprecated\*\* — use toolDisplay (function form) instead. When set, runs as a ToolDisplayFn that only fires on result/error events; running and approval events fall through to no render. Mutually exclusive with toolDisplay at the type level.
|
|
104
104
|
|
|
105
105
|
**streaming** (`boolean | { updateIntervalMs?: number }`): Stream agent text deltas to the channel as the agent generates them instead of buffering and posting once per step. Requires the underlying adapter to support post-and-edit streaming. Slack defaults to true; other adapters default to false. (Default: `false (true for Slack)`)
|
|
106
106
|
|
|
@@ -248,6 +248,8 @@ type ChannelHandler = (
|
|
|
248
248
|
type ChannelHandlerContext = {
|
|
249
249
|
mastra?: Mastra
|
|
250
250
|
requestContext: RequestContext
|
|
251
|
+
readonly signalMetadata: Record<string, unknown>
|
|
252
|
+
readonly skipped: readonly Message[]
|
|
251
253
|
}
|
|
252
254
|
```
|
|
253
255
|
|
|
@@ -271,6 +273,10 @@ onDirectMessage: async (thread, message, defaultHandler, ctx) => {
|
|
|
271
273
|
|
|
272
274
|
Anything the run reads from its request context can be decided per message this way, such as which user a platform sender maps to.
|
|
273
275
|
|
|
276
|
+
`ctx.signalMetadata` is the metadata attached to this message's Agent Signal, built fresh for every message. Add JSON-serializable, non-sensitive values before calling `defaultHandler`. Mastra may persist signal metadata and publish it through PubSub. Unlike `ctx.requestContext`, it follows the message whether it starts a new run or is delivered to one that is already active.
|
|
277
|
+
|
|
278
|
+
`ctx.skipped` lists earlier messages from the same sender that the Chat SDK batched into this turn when a `chatOptions.concurrency` strategy such as `burst`, `debounce`, or `queue` is set, oldest first. It's empty when nothing was batched.
|
|
279
|
+
|
|
274
280
|
## Resource ID resolution
|
|
275
281
|
|
|
276
282
|
By default a channel thread's memory `resourceId` is `${platform}:${message.author.userId}`. The sender owns the memory, scoped per platform. For apps with a shared identity, such as single sign-on (SSO), this splits memory: the same user gets `feishu:user_123` in a Feishu DM but `user_123` on the web.
|
|
@@ -181,7 +181,9 @@ Returns: [`Promise<DurableAgentStreamResult>`](#durableagentstreamresult)
|
|
|
181
181
|
|
|
182
182
|
Reconnects to an existing run. Use this after a network disconnection. For the supported general reconnect flow, omit `offset` to replay all available cached events before receiving live events.
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
The observing agent must have the same effective `id` as the agent that started the run, both for live observations in the same process and for persisted observations from another process. The effective ID is the DurableAgent's `id`, including any ID override, rather than the wrapped agent's original ID. Different DurableAgent instances with the same effective ID can observe the same run.
|
|
185
|
+
|
|
186
|
+
If the live or persisted run identifies a different owner agent ID, `observe()` throws `DURABLE_AGENT_OBSERVE_AGENT_MISMATCH`. Legacy live entries without owner metadata retain their existing behavior.
|
|
185
187
|
|
|
186
188
|
For runs configured with `structuredOutput`, an observer in another process reconstructs `output.object` from the persisted schema and replayed text.
|
|
187
189
|
|
|
@@ -328,7 +330,9 @@ interface DurableAgentListActiveRunsResult {
|
|
|
328
330
|
|
|
329
331
|
Discovers runs stuck in `running` status for this agent and re-drives them from the last persisted snapshot. Accepts the same filters and pagination as `listActiveRuns()`, plus `runId`. Returns the outcome for each run.
|
|
330
332
|
|
|
331
|
-
|
|
333
|
+
Up to five run waits proceed concurrently, with results returned in discovery order. Each attempt has a single 30-second wait budget covering both `recover()` setup and settlement of the whole recovered workflow. When the budget expires, another run can use the slot. The outcome is `status: 'skipped'` with `reason: 'recovery-timeout'` and `retryAt` set 30 seconds ahead. The timeout doesn't cancel setup or execution, release a live claim, or count as success or failure. The attempt continues in the background, and its eventual outcome doesn't change the returned results. The concurrency limit bounds waiting, not live executions.
|
|
334
|
+
|
|
335
|
+
[`mastra.recoverAllDurableAgents()`](https://mastra.ai/reference/core/mastra-class) schedules timeout re-checks automatically. Direct callers of `recoverActiveRuns()` must schedule their own calls after `retryAt`. While the original bulk attempt remains pending, re-checks defer with another `recovery-timeout` and a future `retryAt`, without invoking `recover()` again. Once it settles, recovery checks the persisted snapshot and ownership before retrying. Finished or suspended runs aren't restarted.
|
|
332
336
|
|
|
333
337
|
The budget applies only to each run attempt in `recoverActiveRuns()`, not to discovery, a direct `recover()` call, or overridden custom recovery methods. When shutdown begins, recovery stops dispatching new runs. The original attempt remains tracked for Mastra's shared shutdown drain even after the wait times out.
|
|
334
338
|
|
|
@@ -352,12 +356,12 @@ await durableAgent.recoverActiveRuns({ runId: 'run-abc-123' })
|
|
|
352
356
|
|
|
353
357
|
A run that another execution still drives isn't taken over. Its entry has `status: 'skipped'` and a `reason`, and `recoverActiveRuns()` doesn't check it again. For a run held by another process, `retryAt` is the time after which that claim lapses unless renewed. Call `recoverActiveRuns({ runId })` after it to recover the run if its process crashed. [`mastra.recoverAllDurableAgents()`](https://mastra.ai/reference/core/mastra-class) schedules these re-checks itself.
|
|
354
358
|
|
|
355
|
-
| `reason` | Meaning
|
|
356
|
-
| --------------------- |
|
|
357
|
-
| `run-active` | Another execution, possibly in another process, holds the run. Sets `retryAt`.
|
|
358
|
-
| `run-active-locally` | This process is executing the run.
|
|
359
|
-
| `already-in-progress` | This process is already recovering the run.
|
|
360
|
-
| `recovery-timeout` | The
|
|
359
|
+
| `reason` | Meaning |
|
|
360
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
361
|
+
| `run-active` | Another execution, possibly in another process, holds the run. Sets `retryAt`. |
|
|
362
|
+
| `run-active-locally` | This process is executing the run. |
|
|
363
|
+
| `already-in-progress` | This process is already recovering the run. |
|
|
364
|
+
| `recovery-timeout` | The wait expired or an earlier bulk recovery attempt is still pending. Sets `retryAt`; re-checks don't duplicate the pending attempt. |
|
|
361
365
|
|
|
362
366
|
Returns:
|
|
363
367
|
|
|
@@ -35,11 +35,8 @@ interface SkillMetadata {
|
|
|
35
35
|
name: string
|
|
36
36
|
description: string
|
|
37
37
|
path: string
|
|
38
|
-
references: string[]
|
|
39
|
-
scripts: string[]
|
|
40
|
-
assets: string[]
|
|
41
38
|
license?: string
|
|
42
|
-
compatibility?:
|
|
39
|
+
compatibility?: unknown
|
|
43
40
|
'user-invocable'?: boolean
|
|
44
41
|
metadata?: Record<string, unknown>
|
|
45
42
|
}
|
|
@@ -53,7 +53,7 @@ export const browserAgent = new Agent({
|
|
|
53
53
|
|
|
54
54
|
**screencast.format** (`'jpeg' | 'png'`): Image format for screencast frames.
|
|
55
55
|
|
|
56
|
-
**screencast.quality** (`number`): Image quality (
|
|
56
|
+
**screencast.quality** (`number`): Image quality (0-100). Only applies to JPEG format.
|
|
57
57
|
|
|
58
58
|
**screencast.maxWidth** (`number`): Maximum width for screencast frames.
|
|
59
59
|
|
|
@@ -81,11 +81,19 @@ Returns the controller's workspace status.
|
|
|
81
81
|
|
|
82
82
|
Returns: `Promise<AgentControllerWorkspaceStatus>`
|
|
83
83
|
|
|
84
|
-
### `session(
|
|
84
|
+
### `session(sessionId)`
|
|
85
85
|
|
|
86
|
-
Returns an `AgentControllerSession`
|
|
86
|
+
Returns an `AgentControllerSession` addressed by its session id. Every request goes to `/agent-controller/:controllerId/sessions/:sessionId/...`. Sessions are get-or-create on the server, so calling `create()` with the same `sessionId` resumes the existing conversation instead of forking it.
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
Sessions that share a resource but use different session ids each get their own run loop, thread binding, mode, model, and state. Their stored threads and resource-scoped memory belong to the shared resource. Pass the resource to `create()`:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
const runA = client.getAgentController('code').session('run-a')
|
|
92
|
+
await runA.create({ resourceId: 'factory-1' })
|
|
93
|
+
|
|
94
|
+
const runB = client.getAgentController('code').session('run-b')
|
|
95
|
+
await runB.create({ resourceId: 'factory-1' })
|
|
96
|
+
```
|
|
89
97
|
|
|
90
98
|
## Session methods
|
|
91
99
|
|
|
@@ -93,6 +101,8 @@ Pass `scope` to address an independent session over the same `resourceId`. Sessi
|
|
|
93
101
|
|
|
94
102
|
Creates or resumes the session.
|
|
95
103
|
|
|
104
|
+
**resourceId** (`string`): Memory resource that owns the session's threads. Defaults to the session id, so a session created with only an id keeps one resource of its own.
|
|
105
|
+
|
|
96
106
|
**tags** (`Record<string, string>`): Scopes initial thread selection. A thread is a resume candidate only when its metadata matches every tag.
|
|
97
107
|
|
|
98
108
|
**threadId** (`string`): Binds the session to one exact thread, creating it with that ID when it does not exist.
|