@mastra/mcp-docs-server 1.2.14-alpha.1 → 1.2.14-alpha.4
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/a2a.md +1 -1
- package/.docs/docs/agents/acp.md +1 -1
- package/.docs/docs/agents/agent-approval.md +1 -1
- package/.docs/docs/agents/networks.md +2 -2
- package/.docs/docs/agents/overview.md +2 -2
- package/.docs/docs/agents/processors.md +25 -1
- package/.docs/docs/agents/using-tools.md +2 -2
- package/.docs/docs/capabilities/channels/overview.md +1 -1
- package/.docs/docs/{agents/supervisor-agents.md → capabilities/subagents.md} +58 -58
- package/.docs/docs/deployment/sandbox.md +95 -1
- package/.docs/docs/getting-started/develop.md +2 -0
- package/.docs/docs/harness/agent-controller.md +370 -0
- package/.docs/docs/long-running-agents/background-tasks.md +1 -1
- package/.docs/docs/long-running-agents/goals.md +3 -3
- package/.docs/docs/mcp/overview.md +222 -281
- package/.docs/docs/memory/overview.md +2 -2
- package/.docs/docs/observability/integrations/exporters/confident-ai.md +140 -0
- package/.docs/docs/observability/integrations/overview.md +1 -1
- package/.docs/docs/observability/overview.md +122 -8
- package/.docs/docs/observability/tracing/overview.md +2 -2
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/server-adapters.md +2 -0
- package/.docs/docs/storage/overview.md +2 -2
- package/.docs/docs/workflows/agents-and-tools.md +29 -0
- package/.docs/docs/workflows/stored-workflows.md +146 -0
- package/.docs/guides/build-your-ui/copilotkit/channels.md +49 -39
- package/.docs/guides/concepts/multi-agent-systems.md +7 -7
- package/.docs/guides/guide/coding-agent.md +2 -2
- package/.docs/guides/guide/research-coordinator.md +1 -1
- package/.docs/guides/migrations/network-to-supervisor.md +1 -1
- package/.docs/models/environment-variables.md +1 -1
- package/.docs/models/gateways/neon.md +71 -0
- package/.docs/models/gateways/netlify.md +6 -6
- package/.docs/models/gateways/openrouter.md +6 -6
- package/.docs/models/gateways/vercel.md +6 -6
- package/.docs/models/gateways.md +1 -0
- package/.docs/models/index.md +96 -97
- package/.docs/models/providers/alibaba-cn.md +23 -25
- package/.docs/models/providers/alibaba-token-plan-cn.md +24 -24
- package/.docs/models/providers/alibaba-token-plan.md +23 -25
- package/.docs/models/providers/alibaba.md +23 -25
- package/.docs/models/providers/ambient.md +23 -25
- package/.docs/models/providers/baseten.md +23 -25
- package/.docs/models/providers/chutes.md +23 -25
- package/.docs/models/providers/cortecs.md +23 -25
- package/.docs/models/providers/crof.md +23 -25
- package/.docs/models/providers/crossmodel.md +23 -25
- package/.docs/models/providers/deepinfra.md +22 -24
- package/.docs/models/providers/digitalocean.md +32 -34
- package/.docs/models/providers/empiriolabs.md +23 -25
- package/.docs/models/providers/fireworks-ai.md +24 -24
- package/.docs/models/providers/greenpt.md +23 -25
- package/.docs/models/providers/groq.md +23 -25
- package/.docs/models/providers/huggingface.md +23 -25
- package/.docs/models/providers/hyper.md +23 -25
- package/.docs/models/providers/impossibl.md +23 -25
- package/.docs/models/providers/infomaniak.md +24 -24
- package/.docs/models/providers/kilo.md +24 -26
- package/.docs/models/providers/llmgateway.md +24 -26
- package/.docs/models/providers/mistral.md +23 -25
- package/.docs/models/providers/modal.md +23 -25
- package/.docs/models/providers/modelis.md +23 -25
- package/.docs/models/providers/nano-gpt.md +23 -25
- package/.docs/models/providers/neuralwatt.md +23 -25
- package/.docs/models/providers/ofox.md +23 -25
- package/.docs/models/providers/ollama-cloud.md +23 -25
- package/.docs/models/providers/opencode-go.md +23 -25
- package/.docs/models/providers/opencode.md +25 -26
- package/.docs/models/providers/pioneer.md +23 -25
- package/.docs/models/providers/requesty.md +23 -25
- package/.docs/models/providers/routing-run.md +23 -25
- package/.docs/models/providers/scx.md +23 -25
- package/.docs/models/providers/tensorx.md +23 -25
- package/.docs/models/providers/togetherai.md +22 -24
- package/.docs/models/providers/umans-ai-coding-plan.md +24 -24
- package/.docs/models/providers/umans-ai.md +23 -25
- package/.docs/models/providers/wandb.md +23 -25
- package/.docs/models/providers/xai.md +26 -28
- package/.docs/models/providers/zai-coding-plan.md +23 -25
- package/.docs/models/providers/zhipuai-coding-plan.md +23 -25
- package/.docs/models/providers.md +0 -1
- package/.docs/reference/acp/acp-agent.md +1 -1
- package/.docs/reference/agent-controller/agent-controller-class.md +195 -506
- package/.docs/reference/agent-controller/session.md +274 -111
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/ai-sdk/handle-network-stream.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +1 -1
- package/.docs/reference/cli/create-mastra.md +1 -1
- package/.docs/reference/client-js/workflows.md +92 -0
- package/.docs/reference/core/addStoredWorkflow.md +62 -0
- package/.docs/reference/core/addStoredWorkflows.md +40 -0
- package/.docs/reference/editor/versioning.md +1 -1
- package/.docs/reference/evals/rubric.md +1 -1
- package/.docs/reference/file-based-agents/observability.md +2 -2
- package/.docs/reference/file-based-agents/storage.md +1 -1
- package/.docs/reference/file-based-agents/subagents.md +1 -1
- package/.docs/reference/file-based-agents/tools.md +1 -1
- package/.docs/reference/index.md +5 -0
- package/.docs/reference/observability/tracing/configuration.md +1 -1
- package/.docs/reference/observability/tracing/exporters/confident-ai.md +138 -0
- package/.docs/reference/observability/tracing/interfaces.md +29 -0
- package/.docs/reference/processors/processor-interface.md +121 -10
- package/.docs/reference/server/routes.md +13 -0
- package/.docs/reference/signals/signal-provider.md +2 -0
- package/.docs/reference/storage/overview.md +9 -8
- package/.docs/reference/streaming/workflows/observeStream.md +1 -1
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/streaming/workflows/stream.md +1 -1
- package/.docs/reference/tools/mcp-server.md +1 -1
- package/.docs/reference/tools/submit-plan-tool.md +1 -1
- package/.docs/reference/workflows/stored-workflow-definition.md +292 -0
- package/.docs/reference/workflows/workflow-methods/agent.md +62 -0
- package/.docs/reference/workflows/workflow-methods/tool.md +43 -0
- package/.docs/reference/workspace/railway-sandbox.md +5 -5
- package/CHANGELOG.md +14 -0
- package/package.json +4 -4
- package/.docs/docs/agent-controller/channels.md +0 -111
- package/.docs/docs/agent-controller/modes.md +0 -147
- package/.docs/docs/agent-controller/overview.md +0 -136
- package/.docs/docs/agent-controller/session.md +0 -161
- package/.docs/docs/agent-controller/subagents.md +0 -110
- package/.docs/docs/agent-controller/threads-and-state.md +0 -148
- package/.docs/docs/agent-controller/tool-approvals.md +0 -147
- package/.docs/docs/mcp/mcp-apps.md +0 -306
- package/.docs/docs/observability/config.md +0 -140
- package/.docs/docs/observability/storage.md +0 -81
- package/.docs/models/providers/neon.md +0 -109
|
@@ -11,22 +11,22 @@ NEURALWATT_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'neuralwatt/Qwen/Qwen3.5-397B-A17B-FP8',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -64,30 +64,28 @@ for await (const chunk of stream) {
|
|
|
64
64
|
|
|
65
65
|
```typescript
|
|
66
66
|
const agent = new Agent({
|
|
67
|
-
id:
|
|
68
|
-
name:
|
|
67
|
+
id: 'custom-agent',
|
|
68
|
+
name: 'custom-agent',
|
|
69
69
|
model: {
|
|
70
|
-
url:
|
|
71
|
-
id:
|
|
70
|
+
url: 'https://api.neuralwatt.com/v1',
|
|
71
|
+
id: 'neuralwatt/Qwen/Qwen3.5-397B-A17B-FP8',
|
|
72
72
|
apiKey: process.env.NEURALWATT_API_KEY,
|
|
73
73
|
headers: {
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
})
|
|
74
|
+
'X-Custom-Header': 'value',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
})
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
### Dynamic model selection
|
|
81
81
|
|
|
82
82
|
```typescript
|
|
83
83
|
const agent = new Agent({
|
|
84
|
-
id:
|
|
85
|
-
name:
|
|
84
|
+
id: 'dynamic-agent',
|
|
85
|
+
name: 'Dynamic Agent',
|
|
86
86
|
model: ({ requestContext }) => {
|
|
87
|
-
const useAdvanced = requestContext.task ===
|
|
88
|
-
return useAdvanced
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
});
|
|
87
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
88
|
+
return useAdvanced ? 'neuralwatt/qwen3.6-35b-fast' : 'neuralwatt/Qwen/Qwen3.5-397B-A17B-FP8'
|
|
89
|
+
},
|
|
90
|
+
})
|
|
93
91
|
```
|
|
@@ -11,22 +11,22 @@ OFOX_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'ofox/anthropic/claude-fable-5',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -56,30 +56,28 @@ for await (const chunk of stream) {
|
|
|
56
56
|
|
|
57
57
|
```typescript
|
|
58
58
|
const agent = new Agent({
|
|
59
|
-
id:
|
|
60
|
-
name:
|
|
59
|
+
id: 'custom-agent',
|
|
60
|
+
name: 'custom-agent',
|
|
61
61
|
model: {
|
|
62
|
-
url:
|
|
63
|
-
id:
|
|
62
|
+
url: 'https://api.ofox.ai/v1',
|
|
63
|
+
id: 'ofox/anthropic/claude-fable-5',
|
|
64
64
|
apiKey: process.env.OFOX_API_KEY,
|
|
65
65
|
headers: {
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
})
|
|
66
|
+
'X-Custom-Header': 'value',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
})
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
### Dynamic model selection
|
|
73
73
|
|
|
74
74
|
```typescript
|
|
75
75
|
const agent = new Agent({
|
|
76
|
-
id:
|
|
77
|
-
name:
|
|
76
|
+
id: 'dynamic-agent',
|
|
77
|
+
name: 'Dynamic Agent',
|
|
78
78
|
model: ({ requestContext }) => {
|
|
79
|
-
const useAdvanced = requestContext.task ===
|
|
80
|
-
return useAdvanced
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
});
|
|
79
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
80
|
+
return useAdvanced ? 'ofox/z-ai/glm-5.2' : 'ofox/anthropic/claude-fable-5'
|
|
81
|
+
},
|
|
82
|
+
})
|
|
85
83
|
```
|
|
@@ -11,22 +11,22 @@ OLLAMA_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'ollama-cloud/deepseek-v4-flash',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -63,30 +63,28 @@ for await (const chunk of stream) {
|
|
|
63
63
|
|
|
64
64
|
```typescript
|
|
65
65
|
const agent = new Agent({
|
|
66
|
-
id:
|
|
67
|
-
name:
|
|
66
|
+
id: 'custom-agent',
|
|
67
|
+
name: 'custom-agent',
|
|
68
68
|
model: {
|
|
69
|
-
url:
|
|
70
|
-
id:
|
|
69
|
+
url: 'https://ollama.com/v1',
|
|
70
|
+
id: 'ollama-cloud/deepseek-v4-flash',
|
|
71
71
|
apiKey: process.env.OLLAMA_API_KEY,
|
|
72
72
|
headers: {
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
})
|
|
73
|
+
'X-Custom-Header': 'value',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
### Dynamic model selection
|
|
80
80
|
|
|
81
81
|
```typescript
|
|
82
82
|
const agent = new Agent({
|
|
83
|
-
id:
|
|
84
|
-
name:
|
|
83
|
+
id: 'dynamic-agent',
|
|
84
|
+
name: 'Dynamic Agent',
|
|
85
85
|
model: ({ requestContext }) => {
|
|
86
|
-
const useAdvanced = requestContext.task ===
|
|
87
|
-
return useAdvanced
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
});
|
|
86
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
87
|
+
return useAdvanced ? 'ollama-cloud/qwen3.5:397b' : 'ollama-cloud/deepseek-v4-flash'
|
|
88
|
+
},
|
|
89
|
+
})
|
|
92
90
|
```
|
|
@@ -11,22 +11,22 @@ OPENCODE_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'opencode-go/deepseek-v4-flash',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -61,30 +61,28 @@ for await (const chunk of stream) {
|
|
|
61
61
|
|
|
62
62
|
```typescript
|
|
63
63
|
const agent = new Agent({
|
|
64
|
-
id:
|
|
65
|
-
name:
|
|
64
|
+
id: 'custom-agent',
|
|
65
|
+
name: 'custom-agent',
|
|
66
66
|
model: {
|
|
67
|
-
url:
|
|
68
|
-
id:
|
|
67
|
+
url: 'https://opencode.ai/zen/go/v1',
|
|
68
|
+
id: 'opencode-go/deepseek-v4-flash',
|
|
69
69
|
apiKey: process.env.OPENCODE_API_KEY,
|
|
70
70
|
headers: {
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
})
|
|
71
|
+
'X-Custom-Header': 'value',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
### Dynamic model selection
|
|
78
78
|
|
|
79
79
|
```typescript
|
|
80
80
|
const agent = new Agent({
|
|
81
|
-
id:
|
|
82
|
-
name:
|
|
81
|
+
id: 'dynamic-agent',
|
|
82
|
+
name: 'Dynamic Agent',
|
|
83
83
|
model: ({ requestContext }) => {
|
|
84
|
-
const useAdvanced = requestContext.task ===
|
|
85
|
-
return useAdvanced
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
});
|
|
84
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
85
|
+
return useAdvanced ? 'opencode-go/qwen3.8-max' : 'opencode-go/deepseek-v4-flash'
|
|
86
|
+
},
|
|
87
|
+
})
|
|
90
88
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# OpenCode Zen
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 86 OpenCode Zen 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 Zen documentation](https://opencode.ai/docs/zen).
|
|
8
8
|
|
|
@@ -11,22 +11,22 @@ OPENCODE_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'opencode/big-pickle',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -88,6 +88,7 @@ for await (const chunk of stream) {
|
|
|
88
88
|
| `opencode/kimi-k3` | 1.0M | | | | | | $3 | $15 |
|
|
89
89
|
| `opencode/laguna-s-2.1-free` | 256K | | | | | | — | — |
|
|
90
90
|
| `opencode/ling-3.0-flash-free` | 262K | | | | | | — | — |
|
|
91
|
+
| `opencode/longcat-2.0-free` | 1.0M | | | | | | — | — |
|
|
91
92
|
| `opencode/mimo-v2.5-free` | 200K | | | | | | — | — |
|
|
92
93
|
| `opencode/minimax-m2.5` | 205K | | | | | | $0.30 | $1 |
|
|
93
94
|
| `opencode/minimax-m2.7` | 205K | | | | | | $0.30 | $1 |
|
|
@@ -103,30 +104,28 @@ for await (const chunk of stream) {
|
|
|
103
104
|
|
|
104
105
|
```typescript
|
|
105
106
|
const agent = new Agent({
|
|
106
|
-
id:
|
|
107
|
-
name:
|
|
107
|
+
id: 'custom-agent',
|
|
108
|
+
name: 'custom-agent',
|
|
108
109
|
model: {
|
|
109
|
-
url:
|
|
110
|
-
id:
|
|
110
|
+
url: 'https://opencode.ai/zen/v1',
|
|
111
|
+
id: 'opencode/big-pickle',
|
|
111
112
|
apiKey: process.env.OPENCODE_API_KEY,
|
|
112
113
|
headers: {
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
})
|
|
114
|
+
'X-Custom-Header': 'value',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
})
|
|
117
118
|
```
|
|
118
119
|
|
|
119
120
|
### Dynamic model selection
|
|
120
121
|
|
|
121
122
|
```typescript
|
|
122
123
|
const agent = new Agent({
|
|
123
|
-
id:
|
|
124
|
-
name:
|
|
124
|
+
id: 'dynamic-agent',
|
|
125
|
+
name: 'Dynamic Agent',
|
|
125
126
|
model: ({ requestContext }) => {
|
|
126
|
-
const useAdvanced = requestContext.task ===
|
|
127
|
-
return useAdvanced
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
});
|
|
127
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
128
|
+
return useAdvanced ? 'opencode/trinity-large-preview-free' : 'opencode/big-pickle'
|
|
129
|
+
},
|
|
130
|
+
})
|
|
132
131
|
```
|
|
@@ -11,22 +11,22 @@ PIONEER_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'pioneer/HuggingFaceTB/SmolLM3-3B-Base',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -119,30 +119,28 @@ for await (const chunk of stream) {
|
|
|
119
119
|
|
|
120
120
|
```typescript
|
|
121
121
|
const agent = new Agent({
|
|
122
|
-
id:
|
|
123
|
-
name:
|
|
122
|
+
id: 'custom-agent',
|
|
123
|
+
name: 'custom-agent',
|
|
124
124
|
model: {
|
|
125
|
-
url:
|
|
126
|
-
id:
|
|
125
|
+
url: 'https://api.pioneer.ai/v1',
|
|
126
|
+
id: 'pioneer/HuggingFaceTB/SmolLM3-3B-Base',
|
|
127
127
|
apiKey: process.env.PIONEER_API_KEY,
|
|
128
128
|
headers: {
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
})
|
|
129
|
+
'X-Custom-Header': 'value',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
### Dynamic model selection
|
|
136
136
|
|
|
137
137
|
```typescript
|
|
138
138
|
const agent = new Agent({
|
|
139
|
-
id:
|
|
140
|
-
name:
|
|
139
|
+
id: 'dynamic-agent',
|
|
140
|
+
name: 'Dynamic Agent',
|
|
141
141
|
model: ({ requestContext }) => {
|
|
142
|
-
const useAdvanced = requestContext.task ===
|
|
143
|
-
return useAdvanced
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
});
|
|
142
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
143
|
+
return useAdvanced ? 'pioneer/zai-org/GLM-5.2' : 'pioneer/HuggingFaceTB/SmolLM3-3B-Base'
|
|
144
|
+
},
|
|
145
|
+
})
|
|
148
146
|
```
|
|
@@ -11,22 +11,22 @@ REQUESTY_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'requesty/claude-fable-5',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -90,30 +90,28 @@ for await (const chunk of stream) {
|
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
92
|
const agent = new Agent({
|
|
93
|
-
id:
|
|
94
|
-
name:
|
|
93
|
+
id: 'custom-agent',
|
|
94
|
+
name: 'custom-agent',
|
|
95
95
|
model: {
|
|
96
|
-
url:
|
|
97
|
-
id:
|
|
96
|
+
url: 'https://router.requesty.ai/v1',
|
|
97
|
+
id: 'requesty/claude-fable-5',
|
|
98
98
|
apiKey: process.env.REQUESTY_API_KEY,
|
|
99
99
|
headers: {
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
})
|
|
100
|
+
'X-Custom-Header': 'value',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
})
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
### Dynamic model selection
|
|
107
107
|
|
|
108
108
|
```typescript
|
|
109
109
|
const agent = new Agent({
|
|
110
|
-
id:
|
|
111
|
-
name:
|
|
110
|
+
id: 'dynamic-agent',
|
|
111
|
+
name: 'Dynamic Agent',
|
|
112
112
|
model: ({ requestContext }) => {
|
|
113
|
-
const useAdvanced = requestContext.task ===
|
|
114
|
-
return useAdvanced
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
});
|
|
113
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
114
|
+
return useAdvanced ? 'requesty/o4-mini@eu' : 'requesty/claude-fable-5'
|
|
115
|
+
},
|
|
116
|
+
})
|
|
119
117
|
```
|
|
@@ -11,22 +11,22 @@ ROUTING_RUN_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'routing-run/claude-opus-4-8',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -58,30 +58,28 @@ for await (const chunk of stream) {
|
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
60
|
const agent = new Agent({
|
|
61
|
-
id:
|
|
62
|
-
name:
|
|
61
|
+
id: 'custom-agent',
|
|
62
|
+
name: 'custom-agent',
|
|
63
63
|
model: {
|
|
64
|
-
url:
|
|
65
|
-
id:
|
|
64
|
+
url: 'https://api.routing.run/v1',
|
|
65
|
+
id: 'routing-run/claude-opus-4-8',
|
|
66
66
|
apiKey: process.env.ROUTING_RUN_API_KEY,
|
|
67
67
|
headers: {
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
})
|
|
68
|
+
'X-Custom-Header': 'value',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
### Dynamic model selection
|
|
75
75
|
|
|
76
76
|
```typescript
|
|
77
77
|
const agent = new Agent({
|
|
78
|
-
id:
|
|
79
|
-
name:
|
|
78
|
+
id: 'dynamic-agent',
|
|
79
|
+
name: 'Dynamic Agent',
|
|
80
80
|
model: ({ requestContext }) => {
|
|
81
|
-
const useAdvanced = requestContext.task ===
|
|
82
|
-
return useAdvanced
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
});
|
|
81
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
82
|
+
return useAdvanced ? 'routing-run/qwen3.5-9b' : 'routing-run/claude-opus-4-8'
|
|
83
|
+
},
|
|
84
|
+
})
|
|
87
85
|
```
|