@mastra/mcp-docs-server 1.2.8-alpha.0 → 1.2.8-alpha.19
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 -0
- package/.docs/docs/agent-builder/integrations.md +1 -3
- package/.docs/docs/agent-builder/overview.md +1 -1
- package/.docs/docs/agent-controller/overview.md +1 -1
- package/.docs/docs/agents/overview.md +17 -13
- package/.docs/docs/agents/skills.md +1 -3
- package/.docs/docs/agents/structured-output.md +14 -7
- package/.docs/docs/agents/using-tools.md +80 -26
- package/.docs/docs/browser/agent-browser.md +1 -0
- package/.docs/docs/browser/firecrawl.md +129 -0
- package/.docs/docs/browser/overview.md +16 -2
- package/.docs/docs/capabilities/channels/other-adapters.md +1 -1
- package/.docs/docs/capabilities/channels/overview.md +1 -0
- package/.docs/docs/capabilities/channels/slack.md +113 -3
- package/.docs/docs/deployment/mastra-server.md +35 -0
- package/.docs/docs/deployment/monorepo.md +2 -0
- package/.docs/docs/deployment/overview.md +6 -0
- package/.docs/docs/deployment/sandbox.md +277 -0
- package/.docs/docs/editor/overview.md +2 -6
- package/.docs/docs/editor/tools.md +2 -6
- package/.docs/docs/evals/multi-turn.md +178 -0
- package/.docs/docs/evals/overview.md +1 -0
- package/.docs/docs/evals/running-in-ci.md +3 -9
- package/.docs/docs/getting-started/file-based-agents.md +2 -2
- package/.docs/docs/index.md +17 -13
- package/.docs/docs/long-running-agents/background-tasks.md +2 -2
- package/.docs/docs/long-running-agents/durable-agents.md +2 -1
- package/.docs/docs/long-running-agents/schedules.md +2 -2
- package/.docs/docs/mastra-platform/database.md +13 -6
- package/.docs/docs/mastra-platform/deploy.md +17 -8
- package/.docs/docs/mastra-platform/environments.md +5 -4
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/mastra-platform/regions.md +73 -0
- package/.docs/docs/mastra-platform/workspace.md +111 -0
- package/.docs/docs/mcp/overview.md +1 -1
- package/.docs/docs/memory/multi-user-threads.md +4 -4
- package/.docs/docs/memory/observational-memory.md +78 -3
- package/.docs/docs/memory/overview.md +4 -0
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/integrations/bridges/otel.md +1 -3
- package/.docs/docs/observability/integrations/exporters/braintrust.md +34 -2
- package/.docs/docs/observability/integrations/exporters/otel.md +1 -3
- package/.docs/docs/server/auth/simple-auth.md +1 -3
- package/.docs/docs/server/request-context.md +2 -0
- package/.docs/docs/studio/overview.md +2 -0
- package/.docs/docs/voice/livekit.md +1 -1
- package/.docs/docs/workflows/control-flow.md +1 -3
- package/.docs/docs/workspace/filesystem.md +1 -0
- package/.docs/docs/workspace/sandbox.md +1 -0
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +1 -0
- package/.docs/guides/guide/signal-provider.md +2 -0
- package/.docs/guides/migrations/vnext-to-standard-apis.md +1 -3
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/gateways/openrouter.md +340 -345
- package/.docs/models/gateways/vercel.md +6 -5
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba-token-plan-cn.md +22 -21
- package/.docs/models/providers/alibaba-token-plan.md +22 -21
- package/.docs/models/providers/ambient.md +12 -10
- package/.docs/models/providers/baseten.md +3 -2
- package/.docs/models/providers/crossmodel.md +2 -1
- package/.docs/models/providers/deepinfra.md +4 -7
- package/.docs/models/providers/empiriolabs.md +2 -1
- package/.docs/models/providers/evroc.md +3 -2
- package/.docs/models/providers/google.md +2 -2
- package/.docs/models/providers/kilo.md +1 -1
- package/.docs/models/providers/kimi-for-coding.md +10 -11
- package/.docs/models/providers/llmgateway.md +3 -8
- package/.docs/models/providers/moonshotai-cn.md +3 -2
- package/.docs/models/providers/moonshotai.md +3 -2
- package/.docs/models/providers/nebius.md +3 -1
- package/.docs/models/providers/novita-ai.md +3 -1
- package/.docs/models/providers/ollama-cloud.md +25 -42
- package/.docs/models/providers/opencode-go.md +5 -3
- package/.docs/models/providers/orcarouter.md +1 -1
- package/.docs/models/providers/privatemode-ai.md +10 -10
- package/.docs/models/providers/thinkingmachines.md +73 -0
- package/.docs/models/providers/togetherai.md +2 -6
- package/.docs/models/providers/zenmux.md +3 -1
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/acp/acp-agent.md +2 -0
- package/.docs/reference/acp/create-acp-tool.md +28 -0
- package/.docs/reference/agent-controller/agent-controller-class.md +1 -1
- package/.docs/reference/agent-controller/session.md +15 -0
- package/.docs/reference/agents/agent.md +14 -2
- package/.docs/reference/agents/durable-agent.md +23 -0
- package/.docs/reference/agents/generate.md +19 -1
- package/.docs/reference/browser/firecrawl-browser.md +71 -0
- package/.docs/reference/cli/mastra.md +14 -6
- package/.docs/reference/code-sdk/mount-agent-controller.md +1 -3
- package/.docs/reference/core/getMCPServer.md +1 -3
- package/.docs/reference/core/getMCPServerById.md +1 -3
- package/.docs/reference/core/getTool.md +33 -0
- package/.docs/reference/core/getToolById.md +48 -0
- package/.docs/reference/core/getWorkflow.md +1 -3
- package/.docs/reference/core/listMCPServers.md +2 -6
- package/.docs/reference/core/listTools.md +38 -0
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/datasets/addItem.md +1 -3
- package/.docs/reference/datasets/addItems.md +1 -3
- package/.docs/reference/datasets/compareExperiments.md +1 -3
- package/.docs/reference/datasets/create.md +1 -3
- package/.docs/reference/datasets/dataset.md +2 -6
- package/.docs/reference/datasets/datasets-manager.md +5 -15
- package/.docs/reference/datasets/delete.md +1 -3
- package/.docs/reference/datasets/deleteExperiment.md +1 -3
- package/.docs/reference/datasets/deleteItem.md +1 -3
- package/.docs/reference/datasets/deleteItems.md +1 -3
- package/.docs/reference/datasets/get.md +1 -3
- package/.docs/reference/datasets/getDetails.md +1 -3
- package/.docs/reference/datasets/getExperiment.md +1 -3
- package/.docs/reference/datasets/getItem.md +1 -3
- package/.docs/reference/datasets/getItemHistory.md +1 -3
- package/.docs/reference/datasets/list.md +1 -3
- package/.docs/reference/datasets/listExperimentResults.md +1 -3
- package/.docs/reference/datasets/listExperiments.md +1 -3
- package/.docs/reference/datasets/listItems.md +1 -3
- package/.docs/reference/datasets/listVersions.md +1 -3
- package/.docs/reference/datasets/startExperiment.md +1 -3
- package/.docs/reference/datasets/startExperimentAsync.md +1 -3
- package/.docs/reference/datasets/update.md +1 -3
- package/.docs/reference/datasets/updateItem.md +1 -3
- package/.docs/reference/editor/mastra-editor.md +1 -3
- package/.docs/reference/evals/context-recall.md +205 -0
- package/.docs/reference/evals/create-scorer.md +4 -10
- package/.docs/reference/evals/mastra-scorer.md +1 -3
- package/.docs/reference/evals/run-evals.md +94 -2
- package/.docs/reference/file-based-agents/logger.md +1 -1
- package/.docs/reference/file-based-agents/tools.md +7 -6
- package/.docs/reference/index.md +8 -0
- package/.docs/reference/memory/observational-memory.md +21 -0
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -3
- package/.docs/reference/processors/token-limiter-processor.md +1 -3
- package/.docs/reference/rag/database-config.md +12 -0
- package/.docs/reference/storage/clickhouse.md +1 -1
- package/.docs/reference/storage/convex.md +17 -10
- package/.docs/reference/storage/retention.md +1 -1
- package/.docs/reference/streaming/agents/stream.md +3 -1
- package/.docs/reference/tools/create-tool.md +78 -52
- package/.docs/reference/tools/mcp-client.md +104 -24
- package/.docs/reference/tools/mcp-server.md +143 -44
- package/.docs/reference/tools/task-tools.md +2 -2
- package/.docs/reference/tools/tavily.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +22 -0
- package/.docs/reference/vectors/mongodb.md +2 -0
- package/.docs/reference/vectors/turbopuffer.md +4 -0
- package/.docs/reference/voice/mistral.md +127 -0
- package/.docs/reference/workspace/daytona-sandbox.md +2 -6
- package/.docs/reference/workspace/platform-filesystem.md +182 -0
- package/.docs/reference/workspace/platform-sandbox.md +200 -0
- package/CHANGELOG.md +71 -0
- package/dist/{chunk-GLPCVXXO.js → chunk-HGADBLKG.js} +2 -2
- package/dist/{chunk-GLPCVXXO.js.map → chunk-HGADBLKG.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/stdio.js +1 -1
- package/dist/tools/docs.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Ollama Cloud
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 18 Ollama Cloud models through Mastra's model router. Authentication is handled automatically using the `OLLAMA_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Ollama Cloud documentation](https://docs.ollama.com/cloud).
|
|
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: "ollama-cloud/deepseek-
|
|
20
|
+
model: "ollama-cloud/deepseek-v4-flash"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -34,43 +34,26 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
## Models
|
|
36
36
|
|
|
37
|
-
| Model
|
|
38
|
-
|
|
|
39
|
-
| `ollama-cloud/deepseek-
|
|
40
|
-
| `ollama-cloud/deepseek-
|
|
41
|
-
| `ollama-cloud/
|
|
42
|
-
| `ollama-cloud/
|
|
43
|
-
| `ollama-cloud/
|
|
44
|
-
| `ollama-cloud/
|
|
45
|
-
| `ollama-cloud/
|
|
46
|
-
| `ollama-cloud/
|
|
47
|
-
| `ollama-cloud/
|
|
48
|
-
| `ollama-cloud/
|
|
49
|
-
| `ollama-cloud/
|
|
50
|
-
| `ollama-cloud/
|
|
51
|
-
| `ollama-cloud/
|
|
52
|
-
| `ollama-cloud/
|
|
53
|
-
| `ollama-cloud/
|
|
54
|
-
| `ollama-cloud/
|
|
55
|
-
| `ollama-cloud/
|
|
56
|
-
| `ollama-cloud/
|
|
57
|
-
| `ollama-cloud/kimi-k2.6` | 262K | | | | | | — | — |
|
|
58
|
-
| `ollama-cloud/kimi-k2.7-code` | 262K | | | | | | — | — |
|
|
59
|
-
| `ollama-cloud/minimax-m2.1` | 205K | | | | | | — | — |
|
|
60
|
-
| `ollama-cloud/minimax-m2.5` | 205K | | | | | | — | — |
|
|
61
|
-
| `ollama-cloud/minimax-m2.7` | 197K | | | | | | — | — |
|
|
62
|
-
| `ollama-cloud/minimax-m3` | 512K | | | | | | — | — |
|
|
63
|
-
| `ollama-cloud/ministral-3:14b` | 262K | | | | | | — | — |
|
|
64
|
-
| `ollama-cloud/ministral-3:3b` | 262K | | | | | | — | — |
|
|
65
|
-
| `ollama-cloud/ministral-3:8b` | 262K | | | | | | — | — |
|
|
66
|
-
| `ollama-cloud/mistral-large-3:675b` | 262K | | | | | | — | — |
|
|
67
|
-
| `ollama-cloud/nemotron-3-nano:30b` | 1.0M | | | | | | — | — |
|
|
68
|
-
| `ollama-cloud/nemotron-3-super` | 262K | | | | | | — | — |
|
|
69
|
-
| `ollama-cloud/nemotron-3-ultra` | 262K | | | | | | — | — |
|
|
70
|
-
| `ollama-cloud/qwen3-coder-next` | 262K | | | | | | — | — |
|
|
71
|
-
| `ollama-cloud/qwen3-coder:480b` | 262K | | | | | | — | — |
|
|
72
|
-
| `ollama-cloud/qwen3.5:397b` | 262K | | | | | | — | — |
|
|
73
|
-
| `ollama-cloud/rnj-1:8b` | 33K | | | | | | — | — |
|
|
37
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
+
| ----------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `ollama-cloud/deepseek-v4-flash` | 1.0M | | | | | | — | — |
|
|
40
|
+
| `ollama-cloud/deepseek-v4-pro` | 1.0M | | | | | | — | — |
|
|
41
|
+
| `ollama-cloud/gemma4:31b` | 262K | | | | | | — | — |
|
|
42
|
+
| `ollama-cloud/glm-5.1` | 203K | | | | | | — | — |
|
|
43
|
+
| `ollama-cloud/glm-5.2` | 976K | | | | | | — | — |
|
|
44
|
+
| `ollama-cloud/gpt-oss:120b` | 131K | | | | | | — | — |
|
|
45
|
+
| `ollama-cloud/gpt-oss:20b` | 131K | | | | | | — | — |
|
|
46
|
+
| `ollama-cloud/kimi-k2.5` | 262K | | | | | | — | — |
|
|
47
|
+
| `ollama-cloud/kimi-k2.6` | 262K | | | | | | — | — |
|
|
48
|
+
| `ollama-cloud/kimi-k2.7-code` | 262K | | | | | | — | — |
|
|
49
|
+
| `ollama-cloud/minimax-m2.5` | 205K | | | | | | — | — |
|
|
50
|
+
| `ollama-cloud/minimax-m2.7` | 197K | | | | | | — | — |
|
|
51
|
+
| `ollama-cloud/minimax-m3` | 512K | | | | | | — | — |
|
|
52
|
+
| `ollama-cloud/mistral-large-3:675b` | 262K | | | | | | — | — |
|
|
53
|
+
| `ollama-cloud/nemotron-3-nano:30b` | 1.0M | | | | | | — | — |
|
|
54
|
+
| `ollama-cloud/nemotron-3-super` | 262K | | | | | | — | — |
|
|
55
|
+
| `ollama-cloud/nemotron-3-ultra` | 262K | | | | | | — | — |
|
|
56
|
+
| `ollama-cloud/qwen3.5:397b` | 262K | | | | | | — | — |
|
|
74
57
|
|
|
75
58
|
## Advanced configuration
|
|
76
59
|
|
|
@@ -82,7 +65,7 @@ const agent = new Agent({
|
|
|
82
65
|
name: "custom-agent",
|
|
83
66
|
model: {
|
|
84
67
|
url: "https://ollama.com/v1",
|
|
85
|
-
id: "ollama-cloud/deepseek-
|
|
68
|
+
id: "ollama-cloud/deepseek-v4-flash",
|
|
86
69
|
apiKey: process.env.OLLAMA_API_KEY,
|
|
87
70
|
headers: {
|
|
88
71
|
"X-Custom-Header": "value"
|
|
@@ -100,8 +83,8 @@ const agent = new Agent({
|
|
|
100
83
|
model: ({ requestContext }) => {
|
|
101
84
|
const useAdvanced = requestContext.task === "complex";
|
|
102
85
|
return useAdvanced
|
|
103
|
-
? "ollama-cloud/
|
|
104
|
-
: "ollama-cloud/deepseek-
|
|
86
|
+
? "ollama-cloud/qwen3.5:397b"
|
|
87
|
+
: "ollama-cloud/deepseek-v4-flash";
|
|
105
88
|
}
|
|
106
89
|
});
|
|
107
90
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# OpenCode Go
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 15 OpenCode Go models through Mastra's model router. Authentication is handled automatically using the `OPENCODE_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [OpenCode Go documentation](https://opencode.ai/docs/zen).
|
|
8
8
|
|
|
@@ -37,13 +37,15 @@ for await (const chunk of stream) {
|
|
|
37
37
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
38
|
| ------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
39
|
| `opencode-go/deepseek-v4-flash` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
40
|
-
| `opencode-go/deepseek-v4-pro` | 1.0M | | | | | | $
|
|
40
|
+
| `opencode-go/deepseek-v4-pro` | 1.0M | | | | | | $0.43 | $0.87 |
|
|
41
41
|
| `opencode-go/glm-5.1` | 203K | | | | | | $1 | $4 |
|
|
42
42
|
| `opencode-go/glm-5.2` | 1.0M | | | | | | $1 | $4 |
|
|
43
|
+
| `opencode-go/grok-4.5` | 500K | | | | | | $2 | $6 |
|
|
43
44
|
| `opencode-go/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
|
|
44
45
|
| `opencode-go/kimi-k2.7-code` | 262K | | | | | | $0.95 | $4 |
|
|
46
|
+
| `opencode-go/kimi-k3` | 1.0M | | | | | | $3 | $15 |
|
|
45
47
|
| `opencode-go/mimo-v2.5` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
46
|
-
| `opencode-go/mimo-v2.5-pro` | 1.0M | | | | | | $
|
|
48
|
+
| `opencode-go/mimo-v2.5-pro` | 1.0M | | | | | | $0.43 | $0.87 |
|
|
47
49
|
| `opencode-go/minimax-m2.7` | 205K | | | | | | $0.30 | $1 |
|
|
48
50
|
| `opencode-go/minimax-m3` | 1.0M | | | | | | $0.30 | $1 |
|
|
49
51
|
| `opencode-go/qwen3.6-plus` | 1.0M | | | | | | $0.50 | $3 |
|
|
@@ -57,7 +57,7 @@ for await (const chunk of stream) {
|
|
|
57
57
|
| `orcarouter/google/gemini-3.1-flash-lite-preview` | 1.0M | | | | | | $0.25 | $2 |
|
|
58
58
|
| `orcarouter/google/gemini-3.1-pro-preview` | 1.0M | | | | | | $4 | $18 |
|
|
59
59
|
| `orcarouter/google/gemini-3.1-pro-preview-customtools` | 1.0M | | | | | | $4 | $18 |
|
|
60
|
-
| `orcarouter/google/gemini-flash-latest` | 1.0M | | | | | | $
|
|
60
|
+
| `orcarouter/google/gemini-flash-latest` | 1.0M | | | | | | $2 | $9 |
|
|
61
61
|
| `orcarouter/google/gemini-flash-lite-latest` | 1.0M | | | | | | $0.25 | $2 |
|
|
62
62
|
| `orcarouter/google/gemma-4-26b-a4b-it` | 262K | | | | | | $0.06 | $0.33 |
|
|
63
63
|
| `orcarouter/google/gemma-4-31b-it` | 262K | | | | | | $0.13 | $0.38 |
|
|
@@ -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: "privatemode-ai/
|
|
20
|
+
model: "privatemode-ai/gpt-oss-120b"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -34,13 +34,13 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
## Models
|
|
36
36
|
|
|
37
|
-
| Model
|
|
38
|
-
|
|
|
39
|
-
| `privatemode-ai/
|
|
40
|
-
| `privatemode-ai/
|
|
41
|
-
| `privatemode-ai/qwen3-
|
|
42
|
-
| `privatemode-ai/
|
|
43
|
-
| `privatemode-ai/whisper-large-v3`
|
|
37
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
+
| ----------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `privatemode-ai/gpt-oss-120b` | 128K | | | | | | — | — |
|
|
40
|
+
| `privatemode-ai/kimi-k2.6` | 262K | | | | | | — | — |
|
|
41
|
+
| `privatemode-ai/qwen3-embedding-4b` | 32K | | | | | | — | — |
|
|
42
|
+
| `privatemode-ai/voxtral-mini-3b` | 32K | | | | | | — | — |
|
|
43
|
+
| `privatemode-ai/whisper-large-v3` | — | | | | | | — | — |
|
|
44
44
|
|
|
45
45
|
## Advanced configuration
|
|
46
46
|
|
|
@@ -52,7 +52,7 @@ const agent = new Agent({
|
|
|
52
52
|
name: "custom-agent",
|
|
53
53
|
model: {
|
|
54
54
|
url: "http://localhost:8080/v1",
|
|
55
|
-
id: "privatemode-ai/
|
|
55
|
+
id: "privatemode-ai/gpt-oss-120b",
|
|
56
56
|
apiKey: process.env.PRIVATEMODE_API_KEY,
|
|
57
57
|
headers: {
|
|
58
58
|
"X-Custom-Header": "value"
|
|
@@ -71,7 +71,7 @@ const agent = new Agent({
|
|
|
71
71
|
const useAdvanced = requestContext.task === "complex";
|
|
72
72
|
return useAdvanced
|
|
73
73
|
? "privatemode-ai/whisper-large-v3"
|
|
74
|
-
: "privatemode-ai/
|
|
74
|
+
: "privatemode-ai/gpt-oss-120b";
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
```
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Thinking Machines
|
|
4
|
+
|
|
5
|
+
Access 1 Thinking Machines model through Mastra's model router. Authentication is handled automatically using the `TINKER_API_KEY` environment variable.
|
|
6
|
+
|
|
7
|
+
Learn more in the [Thinking Machines documentation](https://tinker-docs.thinkingmachines.ai/tinker/compatible-apis/openai/).
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
TINKER_API_KEY=your-api-key
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Agent } from "@mastra/core/agent";
|
|
15
|
+
|
|
16
|
+
const agent = new Agent({
|
|
17
|
+
id: "my-agent",
|
|
18
|
+
name: "My Agent",
|
|
19
|
+
instructions: "You are a helpful assistant",
|
|
20
|
+
model: "thinkingmachines/inkling"
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Generate a response
|
|
24
|
+
const response = await agent.generate("Hello!");
|
|
25
|
+
|
|
26
|
+
// Stream a response
|
|
27
|
+
const stream = await agent.stream("Tell me a story");
|
|
28
|
+
for await (const chunk of stream) {
|
|
29
|
+
console.log(chunk);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Thinking Machines documentation](https://tinker-docs.thinkingmachines.ai/tinker/compatible-apis/openai/) for details.
|
|
34
|
+
|
|
35
|
+
## Models
|
|
36
|
+
|
|
37
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
+
| -------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `thinkingmachines/inkling` | 256K | | | | | | $4 | $9 |
|
|
40
|
+
|
|
41
|
+
## Advanced configuration
|
|
42
|
+
|
|
43
|
+
### Custom headers
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
const agent = new Agent({
|
|
47
|
+
id: "custom-agent",
|
|
48
|
+
name: "custom-agent",
|
|
49
|
+
model: {
|
|
50
|
+
url: "https://tinker.thinkingmachines.dev/services/tinker-prod/oai/api/v1",
|
|
51
|
+
id: "thinkingmachines/inkling",
|
|
52
|
+
apiKey: process.env.TINKER_API_KEY,
|
|
53
|
+
headers: {
|
|
54
|
+
"X-Custom-Header": "value"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Dynamic model selection
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
const agent = new Agent({
|
|
64
|
+
id: "dynamic-agent",
|
|
65
|
+
name: "Dynamic Agent",
|
|
66
|
+
model: ({ requestContext }) => {
|
|
67
|
+
const useAdvanced = requestContext.task === "complex";
|
|
68
|
+
return useAdvanced
|
|
69
|
+
? "thinkingmachines/inkling"
|
|
70
|
+
: "thinkingmachines/inkling";
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Together AI
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 21 Together AI models through Mastra's model router. Authentication is handled automatically using the `TOGETHER_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Together AI documentation](https://docs.together.ai/docs/serverless-models).
|
|
8
8
|
|
|
@@ -36,7 +36,6 @@ for await (const chunk of stream) {
|
|
|
36
36
|
| ----------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
37
|
| `togetherai/deepcogito/cogito-v2-1-671b` | 164K | | | | | | $1 | $1 |
|
|
38
38
|
| `togetherai/deepseek-ai/DeepSeek-V4-Pro` | 512K | | | | | | $2 | $3 |
|
|
39
|
-
| `togetherai/essentialai/Rnj-1-Instruct` | 33K | | | | | | $0.15 | $0.15 |
|
|
40
39
|
| `togetherai/google/gemma-3n-E4B-it` | 33K | | | | | | $0.06 | $0.12 |
|
|
41
40
|
| `togetherai/google/gemma-4-31B-it` | 262K | | | | | | $0.39 | $0.97 |
|
|
42
41
|
| `togetherai/LiquidAI/LFM2-24B-A2B` | 33K | | | | | | $0.03 | $0.12 |
|
|
@@ -51,13 +50,10 @@ for await (const chunk of stream) {
|
|
|
51
50
|
| `togetherai/openai/gpt-oss-20b` | 131K | | | | | | $0.05 | $0.20 |
|
|
52
51
|
| `togetherai/pearl-ai/gemma-4-31b-it` | 32K | | | | | | $0.28 | $0.86 |
|
|
53
52
|
| `togetherai/Qwen/Qwen2.5-7B-Instruct-Turbo` | 33K | | | | | | $0.30 | $0.30 |
|
|
54
|
-
| `togetherai/Qwen/Qwen3-235B-A22B-Instruct-2507-tput` | 262K | | | | | | $0.20 | $0.60 |
|
|
55
|
-
| `togetherai/Qwen/Qwen3.5-397B-A17B` | 262K | | | | | | $0.60 | $4 |
|
|
56
53
|
| `togetherai/Qwen/Qwen3.5-9B` | 262K | | | | | | $0.17 | $0.25 |
|
|
57
54
|
| `togetherai/Qwen/Qwen3.6-Plus` | 1.0M | | | | | | $0.50 | $3 |
|
|
58
55
|
| `togetherai/Qwen/Qwen3.7-Max` | 1.0M | | | | | | $1 | $4 |
|
|
59
|
-
| `togetherai/
|
|
60
|
-
| `togetherai/zai-org/GLM-5.1` | 203K | | | | | | $1 | $4 |
|
|
56
|
+
| `togetherai/thinkingmachines/Inkling` | 524K | | | | | | $1 | $4 |
|
|
61
57
|
| `togetherai/zai-org/GLM-5.2` | 262K | | | | | | $1 | $4 |
|
|
62
58
|
|
|
63
59
|
## Advanced configuration
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# ZenMux
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 120 ZenMux models through Mastra's model router. Authentication is handled automatically using the `ZENMUX_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [ZenMux documentation](https://docs.zenmux.ai).
|
|
8
8
|
|
|
@@ -83,6 +83,8 @@ for await (const chunk of stream) {
|
|
|
83
83
|
| `zenmux/moonshotai/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
|
|
84
84
|
| `zenmux/moonshotai/kimi-k2.7-code` | 262K | | | | | | $0.95 | $4 |
|
|
85
85
|
| `zenmux/moonshotai/kimi-k2.7-code-free` | 262K | | | | | | — | — |
|
|
86
|
+
| `zenmux/moonshotai/kimi-k3` | 1.0M | | | | | | $3 | $15 |
|
|
87
|
+
| `zenmux/moonshotai/kimi-k3-free` | 1.0M | | | | | | — | — |
|
|
86
88
|
| `zenmux/openai/gpt-5` | 400K | | | | | | $1 | $10 |
|
|
87
89
|
| `zenmux/openai/gpt-5-codex` | 400K | | | | | | $1 | $10 |
|
|
88
90
|
| `zenmux/openai/gpt-5.1` | 400K | | | | | | $1 | $10 |
|
|
@@ -131,6 +131,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
131
131
|
- [Tencent Token Plan](https://mastra.ai/models/providers/tencent-token-plan)
|
|
132
132
|
- [Tencent TokenHub](https://mastra.ai/models/providers/tencent-tokenhub)
|
|
133
133
|
- [The Grid AI](https://mastra.ai/models/providers/the-grid-ai)
|
|
134
|
+
- [Thinking Machines](https://mastra.ai/models/providers/thinkingmachines)
|
|
134
135
|
- [Tinfoil](https://mastra.ai/models/providers/tinfoil)
|
|
135
136
|
- [Together AI](https://mastra.ai/models/providers/togetherai)
|
|
136
137
|
- [TrustedRouter](https://mastra.ai/models/providers/trustedrouter)
|
|
@@ -76,6 +76,8 @@ export const claudeCodeAgent = new AcpAgent({
|
|
|
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
|
+
**createClient** (`(defaultClient: Client) => Client`): Customize the ACP client used to answer agent requests. Receives the default client so it can be wrapped or extended, for example with extMethod and extNotification handlers. See Extension methods.
|
|
80
|
+
|
|
79
81
|
**workspace** (`Workspace`): Workspace used for ACP file read and write requests. Defaults to a Workspace backed by LocalFilesystem at cwd or process.cwd().
|
|
80
82
|
|
|
81
83
|
**model** (`ModelId`): Model ID to select after ACP session creation using the ACP session/set\_model method.
|
|
@@ -57,6 +57,8 @@ export const codeSupervisor = new Agent({
|
|
|
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
|
+
**createClient** (`(defaultClient: Client) => Client`): Customize the ACP client used to answer agent requests. Receives the default client so it can be wrapped or extended, for example with extMethod and extNotification handlers.
|
|
61
|
+
|
|
60
62
|
**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
63
|
|
|
62
64
|
**model** (`ModelId`): Model ID to select after ACP session creation using the ACP session/set\_model method.
|
|
@@ -124,6 +126,32 @@ export const codeAgentTool = createACPTool({
|
|
|
124
126
|
|
|
125
127
|
Use this callback to enforce local policy, inspect the permission title, or route the decision to your own approval flow.
|
|
126
128
|
|
|
129
|
+
## Extension methods
|
|
130
|
+
|
|
131
|
+
Some ACP agents call custom extension methods on the client, outside the standard ACP request set. The default client rejects unknown methods with a "Method not found" error, which can abort the agent's turn.
|
|
132
|
+
|
|
133
|
+
Pass `createClient` to extend or replace the default client. The callback receives the default client and returns the client used for the connection:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { createACPTool } from '@mastra/acp'
|
|
137
|
+
|
|
138
|
+
export const codeAgentTool = createACPTool({
|
|
139
|
+
id: 'code-agent',
|
|
140
|
+
description: 'Use an ACP-compatible coding agent',
|
|
141
|
+
command: 'acp-agent',
|
|
142
|
+
args: ['--stdio'],
|
|
143
|
+
createClient: defaultClient =>
|
|
144
|
+
Object.assign(defaultClient, {
|
|
145
|
+
async extMethod(method: string, params: Record<string, unknown>) {
|
|
146
|
+
return {}
|
|
147
|
+
},
|
|
148
|
+
async extNotification(method: string, params: Record<string, unknown>) {},
|
|
149
|
+
}),
|
|
150
|
+
})
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Return a fully custom `Client` implementation when you need to change the standard handlers as well. The `Client` type is re-exported from `@mastra/acp`.
|
|
154
|
+
|
|
127
155
|
## Related
|
|
128
156
|
|
|
129
157
|
- [Agent Client Protocol docs](https://mastra.ai/docs/agents/acp)
|
|
@@ -22,7 +22,7 @@ import { z } from 'zod'
|
|
|
22
22
|
const agentController = new AgentController({
|
|
23
23
|
id: 'my-coding-agent',
|
|
24
24
|
agent: myAgent,
|
|
25
|
-
storage: new LibSQLStore({ url: 'file:./data.db' }),
|
|
25
|
+
storage: new LibSQLStore({ id: 'agent-storage', url: 'file:./data.db' }),
|
|
26
26
|
stateSchema: z.object({
|
|
27
27
|
currentModelId: z.string().optional(),
|
|
28
28
|
}),
|
|
@@ -57,6 +57,19 @@ The session is organized into sub-objects, each owning one domain of per-convers
|
|
|
57
57
|
|
|
58
58
|
## Methods
|
|
59
59
|
|
|
60
|
+
### Workspace
|
|
61
|
+
|
|
62
|
+
#### `getWorkspace()`
|
|
63
|
+
|
|
64
|
+
Return the workspace resolved for this session. This preserves session-level overrides and workspaces selected from the session scope.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
const workspace = agentController.session.getWorkspace()
|
|
68
|
+
const skill = await workspace.skills?.get('code-review')
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Returns: `Workspace`
|
|
72
|
+
|
|
60
73
|
### Permissions
|
|
61
74
|
|
|
62
75
|
Session-scoped grants auto-approve tools without prompting. Grants are ephemeral — they reset when the session restarts and are never persisted.
|
|
@@ -211,6 +224,8 @@ Retrieve messages for a specific thread.
|
|
|
211
224
|
const messages = await agentController.session.thread.listMessages({ threadId: 'thread-abc123' })
|
|
212
225
|
```
|
|
213
226
|
|
|
227
|
+
The message-reading methods `listActiveMessages`, `listMessages`, and `firstUserMessage` return `MastraDBMessage` objects, while `firstUserMessages` returns a `Map<string, MastraDBMessage>` keyed by thread ID. Each message has a `role`, an `id`, a `createdAt`, and a `content` object with `content.format` and a `content.parts` array. Read text, reasoning, tool calls, and attachments from `content.parts`. Signals such as system reminders and notifications are returned as separate messages with `role: 'signal'`.
|
|
228
|
+
|
|
214
229
|
### `session.thread.firstUserMessage({ threadId })`
|
|
215
230
|
|
|
216
231
|
Retrieve the first user message for a thread, or `null` if none.
|
|
@@ -96,6 +96,18 @@ export const agent = new Agent({
|
|
|
96
96
|
})
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
+
## Model strings
|
|
100
|
+
|
|
101
|
+
For the simplest setup, pass `model` as a string in `provider/model` format. Separate the provider and model name with a slash. Mastra reads the matching provider credentials from the environment, so this format doesn't require a provider package or import.
|
|
102
|
+
|
|
103
|
+
Popular provider strings and credentials:
|
|
104
|
+
|
|
105
|
+
- **OpenAI**: `openai/gpt-5.5` uses `OPENAI_API_KEY`.
|
|
106
|
+
- **Anthropic**: `anthropic/claude-sonnet-4-6` uses `ANTHROPIC_API_KEY`.
|
|
107
|
+
- **Google**: `google/gemini-2.5-pro` uses `GOOGLE_API_KEY` or `GOOGLE_GENERATIVE_AI_API_KEY`.
|
|
108
|
+
|
|
109
|
+
See [models](https://mastra.ai/models) for supported model IDs and [environment variables](https://mastra.ai/models/environment-variables) for the complete provider list.
|
|
110
|
+
|
|
99
111
|
## Thread signals
|
|
100
112
|
|
|
101
113
|
Use Agent signals to send real-time input and context into a memory thread. Message APIs are for user-authored input. `sendSignal()` is the lower-level API for system-generated context.
|
|
@@ -435,11 +447,11 @@ Returns an `AgentThreadSubscription` object with these members:
|
|
|
435
447
|
|
|
436
448
|
**instructions** (`SystemMessage | ({ requestContext: RequestContext }) => SystemMessage | Promise<SystemMessage>`): Instructions that guide the agent's behavior. Can be a string, array of strings, system message object, array of system messages, or a function that returns any of these types dynamically. SystemMessage types: string | string\[] | CoreSystemMessage | CoreSystemMessage\[] | SystemModelMessage | SystemModelMessage\[]
|
|
437
449
|
|
|
438
|
-
**model** (`MastraLanguageModel | ({ requestContext: RequestContext }) => MastraLanguageModel | Promise<MastraLanguageModel>`): The language model used by the agent.
|
|
450
|
+
**model** (`MastraLanguageModel | ({ requestContext: RequestContext }) => MastraLanguageModel | Promise<MastraLanguageModel>`): The language model used by the agent. Pass a model router string in provider/model format, a model configuration or provider instance, or a function that resolves the model at runtime. See Model strings for common providers and environment variables.
|
|
439
451
|
|
|
440
452
|
**agents** (`Record<string, Agent> | ({ requestContext: RequestContext }) => Record<string, Agent> | Promise<Record<string, Agent>>`): Subagents that the agent can access. Can be provided statically or resolved dynamically.
|
|
441
453
|
|
|
442
|
-
**tools** (`ToolsInput | ({ requestContext: RequestContext }) => ToolsInput | Promise<ToolsInput>`): Tools that the agent can access. Can be provided statically or resolved dynamically.
|
|
454
|
+
**tools** (`ToolsInput | ({ requestContext: RequestContext, mastra?: Mastra }) => ToolsInput | Promise<ToolsInput>`): Tools that the agent can access. Can be provided statically or resolved dynamically from the request context and associated Mastra instance when available.
|
|
443
455
|
|
|
444
456
|
**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
457
|
|
|
@@ -37,6 +37,29 @@ const text = await output.text
|
|
|
37
37
|
cleanup()
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
### Using the `durable` config flag
|
|
41
|
+
|
|
42
|
+
Set `durable: true` on `AgentConfig` and the agent is automatically wrapped with `createDurableAgent` when it is attached to a `Mastra` instance. Use an object to forward advanced options such as `cache`, `pubsub`, `maxSteps`, or `cleanupTimeoutMs`.
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { Mastra } from '@mastra/core'
|
|
46
|
+
import { Agent } from '@mastra/core/agent'
|
|
47
|
+
|
|
48
|
+
const myAgent = new Agent({
|
|
49
|
+
id: 'my-agent',
|
|
50
|
+
name: 'My Agent',
|
|
51
|
+
instructions: 'You are a helpful assistant',
|
|
52
|
+
model: 'openai/gpt-5.5',
|
|
53
|
+
durable: true, // or: { maxSteps: 10, cleanupTimeoutMs: 60_000 }
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
export const mastra = new Mastra({
|
|
57
|
+
agents: { myAgent },
|
|
58
|
+
})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`mastra.getAgent('myAgent')` returns the wrapped `DurableAgent`. Standalone agents (constructed but never registered on a `Mastra` instance) do not become durable; the wrapping is applied at registration.
|
|
62
|
+
|
|
40
63
|
## `createDurableAgent(options)`
|
|
41
64
|
|
|
42
65
|
Wraps an `Agent` with durable execution and resumable streams. This is the recommended way to create a `DurableAgent`.
|
|
@@ -106,7 +106,7 @@ const result = await agent.generate('message for agent')
|
|
|
106
106
|
|
|
107
107
|
**options.structuredOutput.instructions** (`string`): Additional instructions for the structured output model.
|
|
108
108
|
|
|
109
|
-
**options.structuredOutput.jsonPromptInjection** (`boolean`):
|
|
109
|
+
**options.structuredOutput.jsonPromptInjection** (`boolean | 'system' | 'inline' | 'auto'`): Controls how the JSON schema reaches the model. Set to 'auto' to use native structured output when supported and inline prompt injection otherwise.
|
|
110
110
|
|
|
111
111
|
**options.structuredOutput.logger** (`IMastraLogger`): Optional logger instance for structured logging during output generation.
|
|
112
112
|
|
|
@@ -132,6 +132,8 @@ const result = await agent.generate('message for agent')
|
|
|
132
132
|
|
|
133
133
|
**options.memory.options** (`MemoryConfig`): Additional memory configuration options including lastMessages, readOnly, semanticRecall, workingMemory, and filterIncompleteToolCalls.
|
|
134
134
|
|
|
135
|
+
**options.memory.onTitleGenerated** (`(title: string) => void | Promise<void>`): Callback fired asynchronously when a thread title is generated and persisted to storage. Title generation runs in the background and may complete after generate() returns. Only fires when generateTitle is enabled in memory options and the thread has no existing title.
|
|
136
|
+
|
|
135
137
|
**options.onFinish** (`LoopConfig['onFinish']`): Callback fired when generation completes.
|
|
136
138
|
|
|
137
139
|
**options.onStepFinish** (`LoopConfig['onStepFinish']`): Callback fired after each generation step.
|
|
@@ -456,4 +458,20 @@ const response = await agent.generate('Help me organize my day', {
|
|
|
456
458
|
console.log({ text, toolCalls, toolResults, finishReason, usage })
|
|
457
459
|
},
|
|
458
460
|
})
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### Using `onTitleGenerated`
|
|
464
|
+
|
|
465
|
+
When `generateTitle` is enabled in memory options, title generation runs asynchronously after the response completes. Use `onTitleGenerated` to react when the title is ready — for example, to push it to the client via SSE.
|
|
466
|
+
|
|
467
|
+
```typescript
|
|
468
|
+
const response = await agent.generate('What is quantum computing?', {
|
|
469
|
+
memory: {
|
|
470
|
+
thread: threadId,
|
|
471
|
+
resource: userId,
|
|
472
|
+
onTitleGenerated: title => {
|
|
473
|
+
console.log('Thread title:', title)
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
})
|
|
459
477
|
```
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# FirecrawlBrowser class
|
|
4
|
+
|
|
5
|
+
The `FirecrawlBrowser` class provides browser automation backed by the [Firecrawl Browser Sandbox](https://docs.firecrawl.dev/features/browser). It provisions remote browser sessions through the Firecrawl API and connects to them over the Chrome DevTools Protocol (CDP).
|
|
6
|
+
|
|
7
|
+
`FirecrawlBrowser` extends [`AgentBrowser`](https://mastra.ai/reference/browser/agent-browser) and exposes the same deterministic toolset. Use it when you want hosted browser sessions instead of a local Chromium install. For local automation, see [`AgentBrowser`](https://mastra.ai/reference/browser/agent-browser). For AI-powered interactions using natural language, see [`StagehandBrowser`](https://mastra.ai/reference/browser/stagehand-browser).
|
|
8
|
+
|
|
9
|
+
## Usage example
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Agent } from '@mastra/core/agent'
|
|
13
|
+
import { FirecrawlBrowser } from '@mastra/browser-firecrawl'
|
|
14
|
+
|
|
15
|
+
const browser = new FirecrawlBrowser({
|
|
16
|
+
apiKey: process.env.FIRECRAWL_API_KEY,
|
|
17
|
+
firecrawl: {
|
|
18
|
+
ttl: 600,
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export const browserAgent = new Agent({
|
|
23
|
+
id: 'browser-agent',
|
|
24
|
+
name: 'Browser Agent',
|
|
25
|
+
instructions: `You can browse the web. Use browser_snapshot to see the page structure,
|
|
26
|
+
then interact with elements using their refs (e.g., @e5).`,
|
|
27
|
+
model: 'openai/gpt-5.5',
|
|
28
|
+
browser,
|
|
29
|
+
})
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Constructor parameters
|
|
33
|
+
|
|
34
|
+
`FirecrawlBrowser` accepts all [`AgentBrowser` constructor parameters](https://mastra.ai/reference/browser/agent-browser) plus the following:
|
|
35
|
+
|
|
36
|
+
**apiKey** (`string`): Firecrawl API key. Falls back to the FIRECRAWL\_API\_KEY environment variable. The constructor throws if neither is set.
|
|
37
|
+
|
|
38
|
+
**apiUrl** (`string`): Base URL for a self-hosted Firecrawl API.
|
|
39
|
+
|
|
40
|
+
**firecrawl** (`FirecrawlBrowserSessionOptions`): Session options passed to the Firecrawl browser() API when creating sandbox sessions.
|
|
41
|
+
|
|
42
|
+
**firecrawl.ttl** (`number`): Maximum session lifetime in seconds.
|
|
43
|
+
|
|
44
|
+
**firecrawl.activityTtl** (`number`): Idle timeout in seconds before the sandbox recycles the session.
|
|
45
|
+
|
|
46
|
+
**firecrawl.streamWebView** (`boolean`): When true, Firecrawl may stream WebView frames for the remote session.
|
|
47
|
+
|
|
48
|
+
**firecrawl.profile** (`{ name: string; saveChanges?: boolean }`): Named Firecrawl sandbox profile. Set saveChanges: true to persist cookies and login state when the session ends; naming a profile alone does not save changes. Distinct from the top-level AgentBrowser profile option, which is a local Playwright user-data directory path.
|
|
49
|
+
|
|
50
|
+
**firecrawl.integration** (`string`): Integration label for Firecrawl analytics and routing.
|
|
51
|
+
|
|
52
|
+
**firecrawl.origin** (`string`): Origin hint for the Firecrawl browser session.
|
|
53
|
+
|
|
54
|
+
## Session lifecycle
|
|
55
|
+
|
|
56
|
+
Session provisioning depends on the `scope` option inherited from `AgentBrowser`:
|
|
57
|
+
|
|
58
|
+
- `'thread'` (default): Each conversation thread gets its own Firecrawl sandbox session, created on first use and deleted when the thread's browser session is destroyed.
|
|
59
|
+
- `'shared'`: One Firecrawl sandbox session is created when the browser launches and shared across all threads. The session is deleted when the browser closes.
|
|
60
|
+
|
|
61
|
+
In both cases, `FirecrawlBrowser` deletes the remote Firecrawl session when the browser closes, including when session creation or connection fails partway through.
|
|
62
|
+
|
|
63
|
+
## Tools
|
|
64
|
+
|
|
65
|
+
`FirecrawlBrowser` provides the same toolset as `AgentBrowser`, including `browser_goto`, `browser_snapshot`, `browser_click`, `browser_type`, and `browser_screenshot`. See the [`AgentBrowser` tool reference](https://mastra.ai/reference/browser/agent-browser) for the full list and tool parameters.
|
|
66
|
+
|
|
67
|
+
## Related
|
|
68
|
+
|
|
69
|
+
- [Firecrawl docs](https://mastra.ai/docs/browser/firecrawl)
|
|
70
|
+
- [`AgentBrowser` reference](https://mastra.ai/reference/browser/agent-browser)
|
|
71
|
+
- [Browser overview](https://mastra.ai/docs/browser/overview)
|