@mastra/mcp-docs-server 1.2.14-alpha.3 → 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/processors.md +25 -1
- package/.docs/docs/workflows/agents-and-tools.md +29 -0
- package/.docs/docs/workflows/stored-workflows.md +146 -0
- 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 +95 -96
- 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 +23 -25
- 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 +23 -25
- package/.docs/models/providers/llmgateway.md +23 -25
- 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 +23 -25
- 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/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/index.md +5 -0
- package/.docs/reference/processors/processor-interface.md +121 -10
- package/.docs/reference/server/routes.md +13 -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/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/CHANGELOG.md +7 -0
- package/package.json +5 -5
- package/.docs/models/providers/neon.md +0 -109
|
@@ -11,22 +11,22 @@ AMBIENT_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: 'ambient/ambient/large',
|
|
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
|
|
|
@@ -53,30 +53,28 @@ for await (const chunk of stream) {
|
|
|
53
53
|
|
|
54
54
|
```typescript
|
|
55
55
|
const agent = new Agent({
|
|
56
|
-
id:
|
|
57
|
-
name:
|
|
56
|
+
id: 'custom-agent',
|
|
57
|
+
name: 'custom-agent',
|
|
58
58
|
model: {
|
|
59
|
-
url:
|
|
60
|
-
id:
|
|
59
|
+
url: 'https://api.ambient.xyz/v1',
|
|
60
|
+
id: 'ambient/ambient/large',
|
|
61
61
|
apiKey: process.env.AMBIENT_API_KEY,
|
|
62
62
|
headers: {
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
})
|
|
63
|
+
'X-Custom-Header': 'value',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
### Dynamic model selection
|
|
70
70
|
|
|
71
71
|
```typescript
|
|
72
72
|
const agent = new Agent({
|
|
73
|
-
id:
|
|
74
|
-
name:
|
|
73
|
+
id: 'dynamic-agent',
|
|
74
|
+
name: 'Dynamic Agent',
|
|
75
75
|
model: ({ requestContext }) => {
|
|
76
|
-
const useAdvanced = requestContext.task ===
|
|
77
|
-
return useAdvanced
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
});
|
|
76
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
77
|
+
return useAdvanced ? 'ambient/zai-org/GLM-5.2-FP8' : 'ambient/ambient/large'
|
|
78
|
+
},
|
|
79
|
+
})
|
|
82
80
|
```
|
|
@@ -11,22 +11,22 @@ BASETEN_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: 'baseten/MiniMaxAI/MiniMax-M2.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
|
|
|
@@ -59,30 +59,28 @@ for await (const chunk of stream) {
|
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
61
|
const agent = new Agent({
|
|
62
|
-
id:
|
|
63
|
-
name:
|
|
62
|
+
id: 'custom-agent',
|
|
63
|
+
name: 'custom-agent',
|
|
64
64
|
model: {
|
|
65
|
-
url:
|
|
66
|
-
id:
|
|
65
|
+
url: 'https://inference.baseten.co/v1',
|
|
66
|
+
id: 'baseten/MiniMaxAI/MiniMax-M2.5',
|
|
67
67
|
apiKey: process.env.BASETEN_API_KEY,
|
|
68
68
|
headers: {
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
})
|
|
69
|
+
'X-Custom-Header': 'value',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
### Dynamic model selection
|
|
76
76
|
|
|
77
77
|
```typescript
|
|
78
78
|
const agent = new Agent({
|
|
79
|
-
id:
|
|
80
|
-
name:
|
|
79
|
+
id: 'dynamic-agent',
|
|
80
|
+
name: 'Dynamic Agent',
|
|
81
81
|
model: ({ requestContext }) => {
|
|
82
|
-
const useAdvanced = requestContext.task ===
|
|
83
|
-
return useAdvanced
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
});
|
|
82
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
83
|
+
return useAdvanced ? 'baseten/zai-org/GLM-5.2-Fast' : 'baseten/MiniMaxAI/MiniMax-M2.5'
|
|
84
|
+
},
|
|
85
|
+
})
|
|
88
86
|
```
|
|
@@ -11,22 +11,22 @@ CHUTES_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: 'chutes/Nemotron-3-Nano-Omni-30B-TEE',
|
|
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://llm.chutes.ai/v1',
|
|
63
|
+
id: 'chutes/Nemotron-3-Nano-Omni-30B-TEE',
|
|
64
64
|
apiKey: process.env.CHUTES_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 ? 'chutes/zai-org/GLM-5.2-TEE' : 'chutes/Nemotron-3-Nano-Omni-30B-TEE'
|
|
81
|
+
},
|
|
82
|
+
})
|
|
85
83
|
```
|
|
@@ -11,22 +11,22 @@ CORTECS_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: 'cortecs/claude-4-5-sonnet',
|
|
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
|
|
|
@@ -102,30 +102,28 @@ for await (const chunk of stream) {
|
|
|
102
102
|
|
|
103
103
|
```typescript
|
|
104
104
|
const agent = new Agent({
|
|
105
|
-
id:
|
|
106
|
-
name:
|
|
105
|
+
id: 'custom-agent',
|
|
106
|
+
name: 'custom-agent',
|
|
107
107
|
model: {
|
|
108
|
-
url:
|
|
109
|
-
id:
|
|
108
|
+
url: 'https://api.cortecs.ai/v1',
|
|
109
|
+
id: 'cortecs/claude-4-5-sonnet',
|
|
110
110
|
apiKey: process.env.CORTECS_API_KEY,
|
|
111
111
|
headers: {
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
})
|
|
112
|
+
'X-Custom-Header': 'value',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
})
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
### Dynamic model selection
|
|
119
119
|
|
|
120
120
|
```typescript
|
|
121
121
|
const agent = new Agent({
|
|
122
|
-
id:
|
|
123
|
-
name:
|
|
122
|
+
id: 'dynamic-agent',
|
|
123
|
+
name: 'Dynamic Agent',
|
|
124
124
|
model: ({ requestContext }) => {
|
|
125
|
-
const useAdvanced = requestContext.task ===
|
|
126
|
-
return useAdvanced
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
});
|
|
125
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
126
|
+
return useAdvanced ? 'cortecs/qwen3.5-397b-a17b' : 'cortecs/claude-4-5-sonnet'
|
|
127
|
+
},
|
|
128
|
+
})
|
|
131
129
|
```
|
|
@@ -11,22 +11,22 @@ CROF_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: 'crof/deepseek-v3.2',
|
|
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
|
|
|
@@ -69,30 +69,28 @@ for await (const chunk of stream) {
|
|
|
69
69
|
|
|
70
70
|
```typescript
|
|
71
71
|
const agent = new Agent({
|
|
72
|
-
id:
|
|
73
|
-
name:
|
|
72
|
+
id: 'custom-agent',
|
|
73
|
+
name: 'custom-agent',
|
|
74
74
|
model: {
|
|
75
|
-
url:
|
|
76
|
-
id:
|
|
75
|
+
url: 'https://crof.ai/v1',
|
|
76
|
+
id: 'crof/deepseek-v3.2',
|
|
77
77
|
apiKey: process.env.CROF_API_KEY,
|
|
78
78
|
headers: {
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
})
|
|
79
|
+
'X-Custom-Header': 'value',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
})
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
### Dynamic model selection
|
|
86
86
|
|
|
87
87
|
```typescript
|
|
88
88
|
const agent = new Agent({
|
|
89
|
-
id:
|
|
90
|
-
name:
|
|
89
|
+
id: 'dynamic-agent',
|
|
90
|
+
name: 'Dynamic Agent',
|
|
91
91
|
model: ({ requestContext }) => {
|
|
92
|
-
const useAdvanced = requestContext.task ===
|
|
93
|
-
return useAdvanced
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
});
|
|
92
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
93
|
+
return useAdvanced ? 'crof/qwen3.6-27b' : 'crof/deepseek-v3.2'
|
|
94
|
+
},
|
|
95
|
+
})
|
|
98
96
|
```
|
|
@@ -11,22 +11,22 @@ CROSSMODEL_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: 'crossmodel/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
|
|
|
@@ -93,30 +93,28 @@ for await (const chunk of stream) {
|
|
|
93
93
|
|
|
94
94
|
```typescript
|
|
95
95
|
const agent = new Agent({
|
|
96
|
-
id:
|
|
97
|
-
name:
|
|
96
|
+
id: 'custom-agent',
|
|
97
|
+
name: 'custom-agent',
|
|
98
98
|
model: {
|
|
99
|
-
url:
|
|
100
|
-
id:
|
|
99
|
+
url: 'https://api.crossmodel.ai/v1',
|
|
100
|
+
id: 'crossmodel/anthropic/claude-fable-5',
|
|
101
101
|
apiKey: process.env.CROSSMODEL_API_KEY,
|
|
102
102
|
headers: {
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
})
|
|
103
|
+
'X-Custom-Header': 'value',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
### Dynamic model selection
|
|
110
110
|
|
|
111
111
|
```typescript
|
|
112
112
|
const agent = new Agent({
|
|
113
|
-
id:
|
|
114
|
-
name:
|
|
113
|
+
id: 'dynamic-agent',
|
|
114
|
+
name: 'Dynamic Agent',
|
|
115
115
|
model: ({ requestContext }) => {
|
|
116
|
-
const useAdvanced = requestContext.task ===
|
|
117
|
-
return useAdvanced
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
});
|
|
116
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
117
|
+
return useAdvanced ? 'crossmodel/z-ai/glm-5.2' : 'crossmodel/anthropic/claude-fable-5'
|
|
118
|
+
},
|
|
119
|
+
})
|
|
122
120
|
```
|
|
@@ -11,22 +11,22 @@ DEEPINFRA_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: 'deepinfra/MiniMaxAI/MiniMax-M2.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
|
|
|
@@ -86,31 +86,29 @@ for await (const chunk of stream) {
|
|
|
86
86
|
|
|
87
87
|
```typescript
|
|
88
88
|
const agent = new Agent({
|
|
89
|
-
id:
|
|
90
|
-
name:
|
|
89
|
+
id: 'custom-agent',
|
|
90
|
+
name: 'custom-agent',
|
|
91
91
|
model: {
|
|
92
|
-
id:
|
|
92
|
+
id: 'deepinfra/MiniMaxAI/MiniMax-M2.5',
|
|
93
93
|
apiKey: process.env.DEEPINFRA_API_KEY,
|
|
94
94
|
headers: {
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
})
|
|
95
|
+
'X-Custom-Header': 'value',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
})
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
### Dynamic model selection
|
|
102
102
|
|
|
103
103
|
```typescript
|
|
104
104
|
const agent = new Agent({
|
|
105
|
-
id:
|
|
106
|
-
name:
|
|
105
|
+
id: 'dynamic-agent',
|
|
106
|
+
name: 'Dynamic Agent',
|
|
107
107
|
model: ({ requestContext }) => {
|
|
108
|
-
const useAdvanced = requestContext.task ===
|
|
109
|
-
return useAdvanced
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
});
|
|
108
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
109
|
+
return useAdvanced ? 'deepinfra/zai-org/GLM-5.2' : 'deepinfra/MiniMaxAI/MiniMax-M2.5'
|
|
110
|
+
},
|
|
111
|
+
})
|
|
114
112
|
```
|
|
115
113
|
|
|
116
114
|
## Direct provider installation
|
|
@@ -11,22 +11,22 @@ DIGITALOCEAN_ACCESS_TOKEN=your-api-token
|
|
|
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: 'digitalocean/alibaba-qwen3-32b',
|
|
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
|
|
|
@@ -127,30 +127,28 @@ for await (const chunk of stream) {
|
|
|
127
127
|
|
|
128
128
|
```typescript
|
|
129
129
|
const agent = new Agent({
|
|
130
|
-
id:
|
|
131
|
-
name:
|
|
130
|
+
id: 'custom-agent',
|
|
131
|
+
name: 'custom-agent',
|
|
132
132
|
model: {
|
|
133
|
-
url:
|
|
134
|
-
id:
|
|
133
|
+
url: 'https://inference.do-ai.run/v1',
|
|
134
|
+
id: 'digitalocean/alibaba-qwen3-32b',
|
|
135
135
|
apiKey: process.env.DIGITALOCEAN_ACCESS_TOKEN,
|
|
136
136
|
headers: {
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
})
|
|
137
|
+
'X-Custom-Header': 'value',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
})
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
### Dynamic model selection
|
|
144
144
|
|
|
145
145
|
```typescript
|
|
146
146
|
const agent = new Agent({
|
|
147
|
-
id:
|
|
148
|
-
name:
|
|
147
|
+
id: 'dynamic-agent',
|
|
148
|
+
name: 'Dynamic Agent',
|
|
149
149
|
model: ({ requestContext }) => {
|
|
150
|
-
const useAdvanced = requestContext.task ===
|
|
151
|
-
return useAdvanced
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
});
|
|
150
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
151
|
+
return useAdvanced ? 'digitalocean/wan2-2-t2v-a14b' : 'digitalocean/alibaba-qwen3-32b'
|
|
152
|
+
},
|
|
153
|
+
})
|
|
156
154
|
```
|