@mastra/mcp-docs-server 1.1.35-alpha.6 → 1.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +48 -4
- package/.docs/docs/agents/background-tasks.md +62 -2
- package/.docs/docs/agents/processors.md +9 -1
- package/.docs/docs/agents/response-caching.md +148 -0
- package/.docs/docs/agents/signals.md +151 -0
- package/.docs/docs/agents/using-tools.md +8 -0
- package/.docs/docs/browser/agent-browser.md +15 -0
- package/.docs/docs/browser/stagehand.md +25 -1
- package/.docs/docs/editor/tools.md +1 -1
- package/.docs/docs/index.md +2 -2
- package/.docs/docs/mastra-platform/configuration.md +1 -1
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/memory/observational-memory.md +61 -13
- package/.docs/docs/memory/semantic-recall.md +68 -6
- package/.docs/docs/observability/logging.md +2 -2
- package/.docs/docs/observability/metrics/overview.md +4 -4
- package/.docs/docs/observability/overview.md +6 -6
- package/.docs/docs/observability/tracing/bridges/otel.md +25 -0
- package/.docs/docs/observability/tracing/exporters/arize.md +5 -5
- package/.docs/docs/observability/tracing/exporters/braintrust.md +37 -0
- package/.docs/docs/observability/tracing/exporters/langfuse.md +21 -0
- package/.docs/docs/observability/tracing/exporters/{cloud.md → mastra-platform.md} +28 -26
- package/.docs/docs/observability/tracing/exporters/{default.md → mastra-storage.md} +56 -19
- package/.docs/docs/observability/tracing/exporters/otel.md +79 -2
- package/.docs/docs/observability/tracing/overview.md +30 -29
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +6 -6
- package/.docs/docs/server/mastra-server.md +30 -19
- package/.docs/docs/studio/observability.md +4 -4
- package/.docs/docs/studio/overview.md +6 -0
- package/.docs/docs/voice/overview.md +84 -0
- package/.docs/docs/workflows/suspend-and-resume.md +28 -1
- package/.docs/guides/deployment/inngest.md +23 -0
- package/.docs/guides/guide/web-search.md +7 -7
- package/.docs/guides/migrations/mastra-cloud.md +6 -6
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +19 -17
- package/.docs/models/gateways/azure-openai.md +94 -23
- package/.docs/models/gateways/netlify.md +2 -1
- package/.docs/models/gateways/openrouter.md +4 -1
- package/.docs/models/gateways/vercel.md +2 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/chutes.md +23 -54
- package/.docs/models/providers/databricks.md +96 -0
- package/.docs/models/providers/deepseek.md +3 -1
- package/.docs/models/providers/digitalocean.md +9 -2
- package/.docs/models/providers/firepass.md +71 -0
- package/.docs/models/providers/google.md +3 -2
- package/.docs/models/providers/kilo.md +5 -3
- package/.docs/models/providers/llmgateway.md +7 -1
- package/.docs/models/providers/nebius.md +37 -55
- package/.docs/models/providers/novita-ai.md +5 -5
- package/.docs/models/providers/nvidia.md +59 -49
- package/.docs/models/providers/ollama-cloud.md +1 -1
- package/.docs/models/providers/openai.md +2 -0
- package/.docs/models/providers/opencode.md +44 -43
- package/.docs/models/providers/poe.md +4 -1
- package/.docs/models/providers/sarvam.md +72 -0
- package/.docs/models/providers/wafer.ai.md +2 -1
- package/.docs/models/providers/xiaomi-token-plan-ams.md +6 -5
- package/.docs/models/providers/xiaomi-token-plan-cn.md +6 -5
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +6 -5
- package/.docs/models/providers.md +3 -1
- package/.docs/reference/agents/agent.md +85 -0
- package/.docs/reference/browser/agent-browser.md +37 -11
- package/.docs/reference/browser/stagehand-browser.md +35 -9
- package/.docs/reference/cli/mastra.md +497 -1
- package/.docs/reference/client-js/agents.md +115 -1
- package/.docs/reference/client-js/responses.md +4 -0
- package/.docs/reference/configuration.md +6 -6
- package/.docs/reference/editor/tool-provider.md +3 -3
- package/.docs/reference/harness/harness-class.md +21 -8
- package/.docs/reference/index.md +5 -0
- package/.docs/reference/memory/observational-memory.md +11 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +2 -4
- package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
- package/.docs/reference/observability/tracing/bridges/otel.md +26 -4
- package/.docs/reference/observability/tracing/configuration.md +6 -3
- package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
- package/.docs/reference/observability/tracing/exporters/braintrust.md +2 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -1
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +2 -2
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +7 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +263 -0
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +194 -0
- package/.docs/reference/observability/tracing/exporters/otel.md +12 -8
- package/.docs/reference/observability/tracing/instances.md +2 -2
- package/.docs/reference/observability/tracing/interfaces.md +37 -2
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +22 -0
- package/.docs/reference/observability/tracing/span-filtering.md +2 -2
- package/.docs/reference/processors/prefill-error-handler.md +3 -3
- package/.docs/reference/processors/response-cache.md +114 -0
- package/.docs/reference/processors/tool-call-filter.md +28 -0
- package/.docs/reference/storage/clickhouse.md +8 -8
- package/.docs/reference/storage/cloudflare-d1.md +1 -1
- package/.docs/reference/storage/cloudflare.md +1 -1
- package/.docs/reference/storage/composite.md +1 -1
- package/.docs/reference/storage/convex.md +1 -1
- package/.docs/reference/storage/dsql.md +428 -0
- package/.docs/reference/storage/duckdb.md +3 -3
- package/.docs/reference/storage/dynamodb.md +1 -1
- package/.docs/reference/storage/lance.md +1 -1
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/postgresql.md +1 -1
- package/.docs/reference/storage/upstash.md +1 -1
- package/.docs/reference/streaming/ChunkType.md +44 -0
- package/.docs/reference/streaming/agents/stream.md +18 -2
- package/.docs/reference/tools/brightdata.md +167 -0
- package/.docs/reference/tools/create-tool.md +46 -0
- package/.docs/reference/voice/inworld.md +133 -0
- package/.docs/reference/workflows/workflow-state-reader.md +113 -0
- package/CHANGELOG.md +113 -0
- package/package.json +6 -6
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Sarvam AI
|
|
2
|
+
|
|
3
|
+
Access 2 Sarvam AI models through Mastra's model router. Authentication is handled automatically using the `SARVAM_API_KEY` environment variable.
|
|
4
|
+
|
|
5
|
+
Learn more in the [Sarvam AI documentation](https://docs.sarvam.ai).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
SARVAM_API_KEY=your-api-key
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Agent } from "@mastra/core/agent";
|
|
13
|
+
|
|
14
|
+
const agent = new Agent({
|
|
15
|
+
id: "my-agent",
|
|
16
|
+
name: "My Agent",
|
|
17
|
+
instructions: "You are a helpful assistant",
|
|
18
|
+
model: "sarvam/sarvam-105b"
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Generate a response
|
|
22
|
+
const response = await agent.generate("Hello!");
|
|
23
|
+
|
|
24
|
+
// Stream a response
|
|
25
|
+
const stream = await agent.stream("Tell me a story");
|
|
26
|
+
for await (const chunk of stream) {
|
|
27
|
+
console.log(chunk);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Sarvam AI documentation](https://docs.sarvam.ai) for details.
|
|
32
|
+
|
|
33
|
+
## Models
|
|
34
|
+
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| -------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `sarvam/sarvam-105b` | 131K | | | | | | — | — |
|
|
38
|
+
| `sarvam/sarvam-30b` | 66K | | | | | | — | — |
|
|
39
|
+
|
|
40
|
+
## Advanced configuration
|
|
41
|
+
|
|
42
|
+
### Custom headers
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
const agent = new Agent({
|
|
46
|
+
id: "custom-agent",
|
|
47
|
+
name: "custom-agent",
|
|
48
|
+
model: {
|
|
49
|
+
url: "https://api.sarvam.ai/v1",
|
|
50
|
+
id: "sarvam/sarvam-105b",
|
|
51
|
+
apiKey: process.env.SARVAM_API_KEY,
|
|
52
|
+
headers: {
|
|
53
|
+
"X-Custom-Header": "value"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Dynamic model selection
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
const agent = new Agent({
|
|
63
|
+
id: "dynamic-agent",
|
|
64
|
+
name: "Dynamic Agent",
|
|
65
|
+
model: ({ requestContext }) => {
|
|
66
|
+
const useAdvanced = requestContext.task === "complex";
|
|
67
|
+
return useAdvanced
|
|
68
|
+
? "sarvam/sarvam-30b"
|
|
69
|
+
: "sarvam/sarvam-105b";
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Wafer
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 4 Wafer models through Mastra's model router. Authentication is handled automatically using the `WAFER_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Wafer documentation](https://docs.wafer.ai/wafer-pass).
|
|
6
6
|
|
|
@@ -36,6 +36,7 @@ for await (const chunk of stream) {
|
|
|
36
36
|
| ---------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
37
|
| `wafer.ai/DeepSeek-V4-Pro` | 1.0M | | | | | | — | — |
|
|
38
38
|
| `wafer.ai/GLM-5.1` | 203K | | | | | | — | — |
|
|
39
|
+
| `wafer.ai/MiniMax-M2.7` | 205K | | | | | | — | — |
|
|
39
40
|
| `wafer.ai/Qwen3.5-397B-A17B` | 262K | | | | | | — | — |
|
|
40
41
|
|
|
41
42
|
## Advanced configuration
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Xiaomi Token Plan (Europe)
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 6 Xiaomi Token Plan (Europe) models through Mastra's model router. Authentication is handled automatically using the `XIAOMI_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Xiaomi Token Plan (Europe) documentation](https://platform.xiaomimimo.com/#/docs).
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ const agent = new Agent({
|
|
|
15
15
|
id: "my-agent",
|
|
16
16
|
name: "My Agent",
|
|
17
17
|
instructions: "You are a helpful assistant",
|
|
18
|
-
model: "xiaomi-token-plan-ams/mimo-v2-
|
|
18
|
+
model: "xiaomi-token-plan-ams/mimo-v2-flash"
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
// Generate a response
|
|
@@ -34,7 +34,8 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
36
|
| ------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
-
| `xiaomi-token-plan-ams/mimo-v2-
|
|
37
|
+
| `xiaomi-token-plan-ams/mimo-v2-flash` | 262K | | | | | | — | — |
|
|
38
|
+
| `xiaomi-token-plan-ams/mimo-v2-omni` | 262K | | | | | | — | — |
|
|
38
39
|
| `xiaomi-token-plan-ams/mimo-v2-pro` | 1.0M | | | | | | — | — |
|
|
39
40
|
| `xiaomi-token-plan-ams/mimo-v2-tts` | 8K | | | | | | — | — |
|
|
40
41
|
| `xiaomi-token-plan-ams/mimo-v2.5` | 1.0M | | | | | | — | — |
|
|
@@ -50,7 +51,7 @@ const agent = new Agent({
|
|
|
50
51
|
name: "custom-agent",
|
|
51
52
|
model: {
|
|
52
53
|
url: "https://token-plan-ams.xiaomimimo.com/v1",
|
|
53
|
-
id: "xiaomi-token-plan-ams/mimo-v2-
|
|
54
|
+
id: "xiaomi-token-plan-ams/mimo-v2-flash",
|
|
54
55
|
apiKey: process.env.XIAOMI_API_KEY,
|
|
55
56
|
headers: {
|
|
56
57
|
"X-Custom-Header": "value"
|
|
@@ -69,7 +70,7 @@ const agent = new Agent({
|
|
|
69
70
|
const useAdvanced = requestContext.task === "complex";
|
|
70
71
|
return useAdvanced
|
|
71
72
|
? "xiaomi-token-plan-ams/mimo-v2.5-pro"
|
|
72
|
-
: "xiaomi-token-plan-ams/mimo-v2-
|
|
73
|
+
: "xiaomi-token-plan-ams/mimo-v2-flash";
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Xiaomi Token Plan (China)
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 6 Xiaomi Token Plan (China) models through Mastra's model router. Authentication is handled automatically using the `XIAOMI_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Xiaomi Token Plan (China) documentation](https://platform.xiaomimimo.com/#/docs).
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ const agent = new Agent({
|
|
|
15
15
|
id: "my-agent",
|
|
16
16
|
name: "My Agent",
|
|
17
17
|
instructions: "You are a helpful assistant",
|
|
18
|
-
model: "xiaomi-token-plan-cn/mimo-v2-
|
|
18
|
+
model: "xiaomi-token-plan-cn/mimo-v2-flash"
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
// Generate a response
|
|
@@ -34,7 +34,8 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
36
|
| ------------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
-
| `xiaomi-token-plan-cn/mimo-v2-
|
|
37
|
+
| `xiaomi-token-plan-cn/mimo-v2-flash` | 262K | | | | | | — | — |
|
|
38
|
+
| `xiaomi-token-plan-cn/mimo-v2-omni` | 262K | | | | | | — | — |
|
|
38
39
|
| `xiaomi-token-plan-cn/mimo-v2-pro` | 1.0M | | | | | | — | — |
|
|
39
40
|
| `xiaomi-token-plan-cn/mimo-v2-tts` | 8K | | | | | | — | — |
|
|
40
41
|
| `xiaomi-token-plan-cn/mimo-v2.5` | 1.0M | | | | | | — | — |
|
|
@@ -50,7 +51,7 @@ const agent = new Agent({
|
|
|
50
51
|
name: "custom-agent",
|
|
51
52
|
model: {
|
|
52
53
|
url: "https://token-plan-cn.xiaomimimo.com/v1",
|
|
53
|
-
id: "xiaomi-token-plan-cn/mimo-v2-
|
|
54
|
+
id: "xiaomi-token-plan-cn/mimo-v2-flash",
|
|
54
55
|
apiKey: process.env.XIAOMI_API_KEY,
|
|
55
56
|
headers: {
|
|
56
57
|
"X-Custom-Header": "value"
|
|
@@ -69,7 +70,7 @@ const agent = new Agent({
|
|
|
69
70
|
const useAdvanced = requestContext.task === "complex";
|
|
70
71
|
return useAdvanced
|
|
71
72
|
? "xiaomi-token-plan-cn/mimo-v2.5-pro"
|
|
72
|
-
: "xiaomi-token-plan-cn/mimo-v2-
|
|
73
|
+
: "xiaomi-token-plan-cn/mimo-v2-flash";
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Xiaomi Token Plan (Singapore)
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 6 Xiaomi Token Plan (Singapore) models through Mastra's model router. Authentication is handled automatically using the `XIAOMI_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Xiaomi Token Plan (Singapore) documentation](https://platform.xiaomimimo.com/#/docs).
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ const agent = new Agent({
|
|
|
15
15
|
id: "my-agent",
|
|
16
16
|
name: "My Agent",
|
|
17
17
|
instructions: "You are a helpful assistant",
|
|
18
|
-
model: "xiaomi-token-plan-sgp/mimo-v2-
|
|
18
|
+
model: "xiaomi-token-plan-sgp/mimo-v2-flash"
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
// Generate a response
|
|
@@ -34,7 +34,8 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
36
|
| ------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
-
| `xiaomi-token-plan-sgp/mimo-v2-
|
|
37
|
+
| `xiaomi-token-plan-sgp/mimo-v2-flash` | 262K | | | | | | — | — |
|
|
38
|
+
| `xiaomi-token-plan-sgp/mimo-v2-omni` | 262K | | | | | | — | — |
|
|
38
39
|
| `xiaomi-token-plan-sgp/mimo-v2-pro` | 1.0M | | | | | | — | — |
|
|
39
40
|
| `xiaomi-token-plan-sgp/mimo-v2-tts` | 8K | | | | | | — | — |
|
|
40
41
|
| `xiaomi-token-plan-sgp/mimo-v2.5` | 1.0M | | | | | | — | — |
|
|
@@ -50,7 +51,7 @@ const agent = new Agent({
|
|
|
50
51
|
name: "custom-agent",
|
|
51
52
|
model: {
|
|
52
53
|
url: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
53
|
-
id: "xiaomi-token-plan-sgp/mimo-v2-
|
|
54
|
+
id: "xiaomi-token-plan-sgp/mimo-v2-flash",
|
|
54
55
|
apiKey: process.env.XIAOMI_API_KEY,
|
|
55
56
|
headers: {
|
|
56
57
|
"X-Custom-Header": "value"
|
|
@@ -69,7 +70,7 @@ const agent = new Agent({
|
|
|
69
70
|
const useAdvanced = requestContext.task === "complex";
|
|
70
71
|
return useAdvanced
|
|
71
72
|
? "xiaomi-token-plan-sgp/mimo-v2.5-pro"
|
|
72
|
-
: "xiaomi-token-plan-sgp/mimo-v2-
|
|
73
|
+
: "xiaomi-token-plan-sgp/mimo-v2-flash";
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
```
|
|
@@ -26,11 +26,13 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
26
26
|
- [Cloudflare Workers AI](https://mastra.ai/models/providers/cloudflare-workers-ai)
|
|
27
27
|
- [Cortecs](https://mastra.ai/models/providers/cortecs)
|
|
28
28
|
- [D.Run (China)](https://mastra.ai/models/providers/drun)
|
|
29
|
+
- [Databricks](https://mastra.ai/models/providers/databricks)
|
|
29
30
|
- [Deep Infra](https://mastra.ai/models/providers/deepinfra)
|
|
30
31
|
- [DigitalOcean](https://mastra.ai/models/providers/digitalocean)
|
|
31
32
|
- [DInference](https://mastra.ai/models/providers/dinference)
|
|
32
33
|
- [evroc](https://mastra.ai/models/providers/evroc)
|
|
33
34
|
- [FastRouter](https://mastra.ai/models/providers/fastrouter)
|
|
35
|
+
- [Fireworks (Firepass)](https://mastra.ai/models/providers/firepass)
|
|
34
36
|
- [Fireworks AI](https://mastra.ai/models/providers/fireworks-ai)
|
|
35
37
|
- [Friendli](https://mastra.ai/models/providers/friendli)
|
|
36
38
|
- [FrogBot](https://mastra.ai/models/providers/frogbot)
|
|
@@ -45,7 +47,6 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
45
47
|
- [Jiekou.AI](https://mastra.ai/models/providers/jiekou)
|
|
46
48
|
- [Kilo Gateway](https://mastra.ai/models/providers/kilo)
|
|
47
49
|
- [Kimi For Coding](https://mastra.ai/models/providers/kimi-for-coding)
|
|
48
|
-
- [Kiro](https://mastra.ai/models/providers/kiro)
|
|
49
50
|
- [KUAE Cloud Coding Plan](https://mastra.ai/models/providers/kuae-cloud-coding-plan)
|
|
50
51
|
- [Llama](https://mastra.ai/models/providers/llama)
|
|
51
52
|
- [LLM Gateway](https://mastra.ai/models/providers/llmgateway)
|
|
@@ -80,6 +81,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
80
81
|
- [Qiniu](https://mastra.ai/models/providers/qiniu-ai)
|
|
81
82
|
- [Regolo AI](https://mastra.ai/models/providers/regolo-ai)
|
|
82
83
|
- [Requesty](https://mastra.ai/models/providers/requesty)
|
|
84
|
+
- [Sarvam AI](https://mastra.ai/models/providers/sarvam)
|
|
83
85
|
- [Scaleway](https://mastra.ai/models/providers/scaleway)
|
|
84
86
|
- [SiliconFlow](https://mastra.ai/models/providers/siliconflow)
|
|
85
87
|
- [SiliconFlow (China)](https://mastra.ai/models/providers/siliconflow-cn)
|
|
@@ -94,6 +94,89 @@ export const agent = new Agent({
|
|
|
94
94
|
})
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
## Thread signals
|
|
98
|
+
|
|
99
|
+
Use Agent signals to send real-time context into a memory thread. Signals are useful when a user adds input while an agent is already streaming, or when another process needs to add structured context to the thread.
|
|
100
|
+
|
|
101
|
+
A `user-message` signal represents user input. When the target thread is running, Mastra delivers the signal into the active agent loop. When the thread is idle, Mastra starts a stream with the signal as the first input by default.
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
const subscription = await agent.subscribeToThread({
|
|
105
|
+
resourceId: 'user-123',
|
|
106
|
+
threadId: 'thread-abc',
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
void (async () => {
|
|
110
|
+
for await (const chunk of subscription.stream) {
|
|
111
|
+
console.log(chunk)
|
|
112
|
+
}
|
|
113
|
+
})()
|
|
114
|
+
|
|
115
|
+
agent.sendSignal(
|
|
116
|
+
{ type: 'user-message', contents: 'Use the latest customer note too.' },
|
|
117
|
+
{
|
|
118
|
+
resourceId: 'user-123',
|
|
119
|
+
threadId: 'thread-abc',
|
|
120
|
+
ifIdle: {
|
|
121
|
+
streamOptions: {
|
|
122
|
+
maxSteps: 3,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Use a custom signal type for contextual messages that should reach the model as XML-wrapped context instead of normal user input:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
agent.sendSignal(
|
|
133
|
+
{
|
|
134
|
+
type: 'system-reminder',
|
|
135
|
+
contents: 'Continue from the previous tool result.',
|
|
136
|
+
attributes: { reminderType: 'tool-result' },
|
|
137
|
+
},
|
|
138
|
+
{ resourceId: 'user-123', threadId: 'thread-abc' },
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### `sendSignal(signal, options)`
|
|
143
|
+
|
|
144
|
+
Sends a signal to an active run or memory thread.
|
|
145
|
+
|
|
146
|
+
**signal** (`{ type: 'user-message'; contents: MessageListInput } | { type: string; contents: string }`): \`user-message\` signals are treated as user input. Other signal types are converted to XML context before the next model call.
|
|
147
|
+
|
|
148
|
+
**options.runId** (`string`): Run ID to target directly. Use this when you already know the active run ID.
|
|
149
|
+
|
|
150
|
+
**options.resourceId** (`string`): Resource ID for the memory thread. Required with \`threadId\` for thread-targeted signals.
|
|
151
|
+
|
|
152
|
+
**options.threadId** (`string`): Thread ID to target. Required with \`resourceId\` for thread-targeted signals.
|
|
153
|
+
|
|
154
|
+
**options.ifActive.behavior** (`'deliver' | 'persist' | 'discard'`): Controls what happens when the target thread is active. Defaults to \`deliver\`.
|
|
155
|
+
|
|
156
|
+
**options.ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): Controls what happens when the target thread is idle. Defaults to \`wake\`.
|
|
157
|
+
|
|
158
|
+
**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.
|
|
159
|
+
|
|
160
|
+
Returns `{ accepted: true, runId: string, signal: CreatedAgentSignal, persisted?: Promise<void> }`. `persisted` is only present for `persist` behavior and resolves when Mastra finishes writing the signal to memory.
|
|
161
|
+
|
|
162
|
+
### `subscribeToThread(options)`
|
|
163
|
+
|
|
164
|
+
Subscribes to raw stream chunks for a memory thread. Use this before calling `sendSignal()` when you need to render stream output, observe signal echoes, or abort the active run.
|
|
165
|
+
|
|
166
|
+
**options.resourceId** (`string`): Resource ID for the memory thread.
|
|
167
|
+
|
|
168
|
+
**options.threadId** (`string`): Thread ID to subscribe to.
|
|
169
|
+
|
|
170
|
+
Returns an `AgentThreadSubscription` object with these members:
|
|
171
|
+
|
|
172
|
+
**stream** (`AsyncIterable<AgentChunkType>`): Raw agent stream chunks for the subscribed thread.
|
|
173
|
+
|
|
174
|
+
**activeRunId** (`() => string | null`): Returns the active run ID for the thread, or \`null\` when no run is active.
|
|
175
|
+
|
|
176
|
+
**abort** (`() => boolean`): Aborts the active run for the thread. Returns \`true\` when a run was aborted.
|
|
177
|
+
|
|
178
|
+
**unsubscribe** (`() => void`): Stops the subscription without aborting the active run.
|
|
179
|
+
|
|
97
180
|
## Constructor parameters
|
|
98
181
|
|
|
99
182
|
**id** (`string`): Unique identifier for the agent. Defaults to \`name\` if not provided.
|
|
@@ -110,6 +193,8 @@ export const agent = new Agent({
|
|
|
110
193
|
|
|
111
194
|
**tools** (`ToolsInput | ({ requestContext: RequestContext }) => ToolsInput | Promise<ToolsInput>`): Tools that the agent can access. Can be provided statically or resolved dynamically.
|
|
112
195
|
|
|
196
|
+
**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.
|
|
197
|
+
|
|
113
198
|
**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.
|
|
114
199
|
|
|
115
200
|
**defaultOptions** (`AgentExecutionOptions | ({ requestContext: RequestContext }) => AgentExecutionOptions | Promise<AgentExecutionOptions>`): Default options used when calling \`stream()\` and \`generate()\`.
|
|
@@ -44,22 +44,25 @@ then interact with elements using their refs (e.g., @e5).`,
|
|
|
44
44
|
|
|
45
45
|
**screencast** (`ScreencastOptions`): Configuration for streaming browser frames to Studio.
|
|
46
46
|
|
|
47
|
+
**excludeTools** (`BrowserToolName[]`): Tool names to exclude from the browser toolset. Use this to disable specific tools for models that do not support certain capabilities, such as vision.
|
|
48
|
+
|
|
47
49
|
## Tools
|
|
48
50
|
|
|
49
|
-
`AgentBrowser` provides
|
|
51
|
+
`AgentBrowser` provides 16 deterministic tools for browser automation. All tools that interact with elements use refs from the accessibility tree snapshot.
|
|
50
52
|
|
|
51
53
|
### Core tools
|
|
52
54
|
|
|
53
|
-
| Tool
|
|
54
|
-
|
|
|
55
|
-
| `browser_goto`
|
|
56
|
-
| `browser_snapshot`
|
|
57
|
-
| `browser_click`
|
|
58
|
-
| `browser_type`
|
|
59
|
-
| `browser_press`
|
|
60
|
-
| `browser_select`
|
|
61
|
-
| `browser_scroll`
|
|
62
|
-
| `
|
|
55
|
+
| Tool | Description |
|
|
56
|
+
| -------------------- | ------------------------------------------------------------------------------------- |
|
|
57
|
+
| `browser_goto` | Navigate to a URL |
|
|
58
|
+
| `browser_snapshot` | Get accessibility tree snapshot with element refs |
|
|
59
|
+
| `browser_click` | Click an element by ref |
|
|
60
|
+
| `browser_type` | Type text into an element |
|
|
61
|
+
| `browser_press` | Press keyboard keys |
|
|
62
|
+
| `browser_select` | Select option from dropdown |
|
|
63
|
+
| `browser_scroll` | Scroll the page or element |
|
|
64
|
+
| `browser_screenshot` | Capture a screenshot as PNG (viewport by default; set `fullPage: true` for full page) |
|
|
65
|
+
| `browser_close` | Close the browser |
|
|
63
66
|
|
|
64
67
|
### Extended tools
|
|
65
68
|
|
|
@@ -73,6 +76,14 @@ then interact with elements using their refs (e.g., @e5).`,
|
|
|
73
76
|
| `browser_drag` | Drag and drop elements |
|
|
74
77
|
| `browser_evaluate` | Execute JavaScript in the page (escape hatch) |
|
|
75
78
|
|
|
79
|
+
To exclude specific tools, pass `excludeTools` in the constructor:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
const browser = new AgentBrowser({
|
|
83
|
+
excludeTools: ['browser_screenshot'],
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
76
87
|
## Tool reference
|
|
77
88
|
|
|
78
89
|
### `browser_goto`
|
|
@@ -339,6 +350,21 @@ Execute JavaScript in the page context. Use as an escape hatch when other tools
|
|
|
339
350
|
| `script` | `string` | JavaScript to execute (required) |
|
|
340
351
|
| `returnValue` | `boolean` | Whether to return the result (optional) |
|
|
341
352
|
|
|
353
|
+
### `browser_screenshot`
|
|
354
|
+
|
|
355
|
+
Capture a screenshot of the current page as PNG (viewport by default; set `fullPage: true` for full-page capture). Returns image content that vision-capable models can interpret directly. Use `browser_snapshot` when you only need text or structured data.
|
|
356
|
+
|
|
357
|
+
```text
|
|
358
|
+
// Viewport only (default)
|
|
359
|
+
|
|
360
|
+
// Full scrollable page
|
|
361
|
+
{ "fullPage": true }
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
| Parameter | Type | Description |
|
|
365
|
+
| ---------- | --------- | ---------------------------------------------------------------------------------------- |
|
|
366
|
+
| `fullPage` | `boolean` | Capture the full scrollable page instead of just the viewport (optional, default: false) |
|
|
367
|
+
|
|
342
368
|
### `browser_close`
|
|
343
369
|
|
|
344
370
|
Close the browser and clean up resources.
|
|
@@ -61,18 +61,29 @@ Use stagehand_extract to get data from pages.`,
|
|
|
61
61
|
|
|
62
62
|
**screencast** (`ScreencastOptions`): Configuration for streaming browser frames to Studio.
|
|
63
63
|
|
|
64
|
+
**excludeTools** (`StagehandToolName[]`): Tool names to exclude from the browser toolset. Use this to disable specific tools for models that do not support certain capabilities, such as vision.
|
|
65
|
+
|
|
64
66
|
## Tools
|
|
65
67
|
|
|
66
|
-
`StagehandBrowser` provides
|
|
68
|
+
`StagehandBrowser` provides 7 AI-powered tools for browser automation:
|
|
69
|
+
|
|
70
|
+
| Tool | Description |
|
|
71
|
+
| ---------------------- | ------------------------------------------------------------------------------------- |
|
|
72
|
+
| `stagehand_act` | Perform actions using natural language instructions |
|
|
73
|
+
| `stagehand_extract` | Extract structured data from pages |
|
|
74
|
+
| `stagehand_observe` | Discover actionable elements on a page |
|
|
75
|
+
| `stagehand_navigate` | Navigate to a URL |
|
|
76
|
+
| `stagehand_tabs` | Manage browser tabs |
|
|
77
|
+
| `stagehand_screenshot` | Capture a screenshot as PNG (viewport by default; set `fullPage: true` for full page) |
|
|
78
|
+
| `stagehand_close` | Close the browser |
|
|
67
79
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
| `stagehand_close` | Close the browser |
|
|
80
|
+
To exclude specific tools, pass `excludeTools` in the constructor:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
const browser = new StagehandBrowser({
|
|
84
|
+
excludeTools: ['stagehand_screenshot'],
|
|
85
|
+
})
|
|
86
|
+
```
|
|
76
87
|
|
|
77
88
|
## Tool reference
|
|
78
89
|
|
|
@@ -224,6 +235,21 @@ Manage browser tabs.
|
|
|
224
235
|
{ "action": "close", "index": 1 }
|
|
225
236
|
```
|
|
226
237
|
|
|
238
|
+
### `stagehand_screenshot`
|
|
239
|
+
|
|
240
|
+
Capture a screenshot of the current page as PNG (viewport by default; set `fullPage: true` for full-page capture). Returns image content that vision-capable models can interpret directly. Use `stagehand_observe` or `stagehand_extract` when you only need text or structured data.
|
|
241
|
+
|
|
242
|
+
```text
|
|
243
|
+
// Viewport only (default)
|
|
244
|
+
|
|
245
|
+
// Full scrollable page
|
|
246
|
+
{ "fullPage": true }
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
| Parameter | Type | Description |
|
|
250
|
+
| ---------- | --------- | ---------------------------------------------------------------------------------------- |
|
|
251
|
+
| `fullPage` | `boolean` | Capture the full scrollable page instead of just the viewport (optional, default: false) |
|
|
252
|
+
|
|
227
253
|
### `stagehand_close`
|
|
228
254
|
|
|
229
255
|
Close the browser and clean up resources.
|