@mastra/mcp-docs-server 1.2.14-alpha.4 → 1.2.14
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/models/gateways/neon.md +6 -6
- package/.docs/models/gateways/netlify.md +6 -6
- package/.docs/models/gateways/openrouter.md +6 -6
- package/.docs/models/gateways/vercel.md +7 -7
- package/.docs/models/index.md +97 -96
- package/.docs/models/providers/alibaba-cn.md +25 -23
- package/.docs/models/providers/alibaba-token-plan-cn.md +24 -24
- package/.docs/models/providers/alibaba-token-plan.md +25 -23
- package/.docs/models/providers/alibaba.md +25 -23
- package/.docs/models/providers/ambient.md +26 -24
- package/.docs/models/providers/baseten.md +25 -23
- package/.docs/models/providers/chutes.md +25 -23
- package/.docs/models/providers/cortecs.md +133 -85
- package/.docs/models/providers/crof.md +25 -23
- package/.docs/models/providers/crossmodel.md +25 -23
- package/.docs/models/providers/deepinfra.md +24 -22
- package/.docs/models/providers/digitalocean.md +25 -23
- package/.docs/models/providers/empiriolabs.md +25 -23
- package/.docs/models/providers/fireworks-ai.md +24 -24
- package/.docs/models/providers/greenpt.md +25 -23
- package/.docs/models/providers/groq.md +25 -23
- package/.docs/models/providers/huggingface.md +25 -23
- package/.docs/models/providers/hyper.md +31 -29
- package/.docs/models/providers/impossibl.md +25 -23
- package/.docs/models/providers/infomaniak.md +24 -24
- package/.docs/models/providers/kilo.md +26 -24
- package/.docs/models/providers/llmgateway.md +26 -24
- package/.docs/models/providers/minimax.md +23 -25
- package/.docs/models/providers/mistral.md +25 -23
- package/.docs/models/providers/modal.md +25 -23
- package/.docs/models/providers/modelis.md +25 -23
- package/.docs/models/providers/nano-gpt.md +26 -24
- package/.docs/models/providers/neuralwatt.md +25 -23
- package/.docs/models/providers/ofox.md +25 -23
- package/.docs/models/providers/ollama-cloud.md +25 -23
- package/.docs/models/providers/openai.md +26 -28
- package/.docs/models/providers/opencode-go.md +25 -23
- package/.docs/models/providers/opencode.md +25 -23
- package/.docs/models/providers/perplexity-agent.md +24 -24
- package/.docs/models/providers/pioneer.md +25 -23
- package/.docs/models/providers/requesty.md +25 -23
- package/.docs/models/providers/routing-run.md +25 -23
- package/.docs/models/providers/scx.md +25 -23
- package/.docs/models/providers/tensorx.md +25 -23
- package/.docs/models/providers/togetherai.md +24 -22
- package/.docs/models/providers/umans-ai-coding-plan.md +24 -24
- package/.docs/models/providers/umans-ai.md +25 -23
- package/.docs/models/providers/wandb.md +25 -23
- package/.docs/models/providers/xai.md +28 -26
- package/.docs/models/providers/zai-coding-plan.md +25 -23
- package/.docs/models/providers/zhipuai-coding-plan.md +25 -23
- package/CHANGELOG.md +7 -0
- package/package.json +6 -6
|
@@ -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,28 +56,30 @@ 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
|
-
|
|
79
|
+
const useAdvanced = requestContext.task === "complex";
|
|
80
|
+
return useAdvanced
|
|
81
|
+
? "ofox/z-ai/glm-5.2"
|
|
82
|
+
: "ofox/anthropic/claude-fable-5";
|
|
83
|
+
}
|
|
84
|
+
});
|
|
83
85
|
```
|
|
@@ -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,28 +63,30 @@ 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
|
-
|
|
86
|
+
const useAdvanced = requestContext.task === "complex";
|
|
87
|
+
return useAdvanced
|
|
88
|
+
? "ollama-cloud/qwen3.5:397b"
|
|
89
|
+
: "ollama-cloud/deepseek-v4-flash";
|
|
90
|
+
}
|
|
91
|
+
});
|
|
90
92
|
```
|
|
@@ -11,22 +11,22 @@ OPENAI_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: 'openai/chatgpt-image-latest',
|
|
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
|
|
|
@@ -78,31 +78,29 @@ for await (const chunk of stream) {
|
|
|
78
78
|
|
|
79
79
|
```typescript
|
|
80
80
|
const agent = new Agent({
|
|
81
|
-
id:
|
|
82
|
-
name:
|
|
81
|
+
id: 'custom-agent',
|
|
82
|
+
name: 'custom-agent',
|
|
83
83
|
model: {
|
|
84
|
-
id:
|
|
84
|
+
id: 'openai/chatgpt-image-latest',
|
|
85
85
|
apiKey: process.env.OPENAI_API_KEY,
|
|
86
86
|
headers: {
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
})
|
|
87
|
+
'X-Custom-Header': 'value',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
### Dynamic model selection
|
|
94
94
|
|
|
95
95
|
```typescript
|
|
96
96
|
const agent = new Agent({
|
|
97
|
-
id:
|
|
98
|
-
name:
|
|
97
|
+
id: 'dynamic-agent',
|
|
98
|
+
name: 'Dynamic Agent',
|
|
99
99
|
model: ({ requestContext }) => {
|
|
100
|
-
const useAdvanced = requestContext.task ===
|
|
101
|
-
return useAdvanced
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
});
|
|
100
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
101
|
+
return useAdvanced ? 'openai/text-embedding-ada-002' : 'openai/chatgpt-image-latest'
|
|
102
|
+
},
|
|
103
|
+
})
|
|
106
104
|
```
|
|
107
105
|
|
|
108
106
|
## Provider Options
|
|
@@ -110,13 +108,13 @@ const agent = new Agent({
|
|
|
110
108
|
OpenAI supports the following provider-specific options via the `providerOptions` parameter:
|
|
111
109
|
|
|
112
110
|
```typescript
|
|
113
|
-
const response = await agent.generate(
|
|
111
|
+
const response = await agent.generate('Hello!', {
|
|
114
112
|
providerOptions: {
|
|
115
113
|
openai: {
|
|
116
114
|
// See available options in the table below
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
})
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
})
|
|
120
118
|
```
|
|
121
119
|
|
|
122
120
|
### Available Options
|
|
@@ -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,28 +61,30 @@ 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
|
-
|
|
84
|
+
const useAdvanced = requestContext.task === "complex";
|
|
85
|
+
return useAdvanced
|
|
86
|
+
? "opencode-go/qwen3.8-max"
|
|
87
|
+
: "opencode-go/deepseek-v4-flash";
|
|
88
|
+
}
|
|
89
|
+
});
|
|
88
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/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
|
|
|
@@ -104,28 +104,30 @@ for await (const chunk of stream) {
|
|
|
104
104
|
|
|
105
105
|
```typescript
|
|
106
106
|
const agent = new Agent({
|
|
107
|
-
id:
|
|
108
|
-
name:
|
|
107
|
+
id: "custom-agent",
|
|
108
|
+
name: "custom-agent",
|
|
109
109
|
model: {
|
|
110
|
-
url:
|
|
111
|
-
id:
|
|
110
|
+
url: "https://opencode.ai/zen/v1",
|
|
111
|
+
id: "opencode/big-pickle",
|
|
112
112
|
apiKey: process.env.OPENCODE_API_KEY,
|
|
113
113
|
headers: {
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
})
|
|
114
|
+
"X-Custom-Header": "value"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
### Dynamic model selection
|
|
121
121
|
|
|
122
122
|
```typescript
|
|
123
123
|
const agent = new Agent({
|
|
124
|
-
id:
|
|
125
|
-
name:
|
|
124
|
+
id: "dynamic-agent",
|
|
125
|
+
name: "Dynamic Agent",
|
|
126
126
|
model: ({ requestContext }) => {
|
|
127
|
-
const useAdvanced = requestContext.task ===
|
|
128
|
-
return useAdvanced
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
const useAdvanced = requestContext.task === "complex";
|
|
128
|
+
return useAdvanced
|
|
129
|
+
? "opencode/trinity-large-preview-free"
|
|
130
|
+
: "opencode/big-pickle";
|
|
131
|
+
}
|
|
132
|
+
});
|
|
131
133
|
```
|
|
@@ -11,22 +11,22 @@ PERPLEXITY_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: 'perplexity-agent/anthropic/claude-haiku-4-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
|
|
|
@@ -63,32 +63,32 @@ 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://api.perplexity.ai/v1',
|
|
70
|
+
id: 'perplexity-agent/anthropic/claude-haiku-4-5',
|
|
71
71
|
apiKey: process.env.PERPLEXITY_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 ===
|
|
86
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
87
87
|
return useAdvanced
|
|
88
|
-
?
|
|
89
|
-
:
|
|
90
|
-
}
|
|
91
|
-
})
|
|
88
|
+
? 'perplexity-agent/xai/grok-4-1-fast-non-reasoning'
|
|
89
|
+
: 'perplexity-agent/anthropic/claude-haiku-4-5'
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
## Direct provider installation
|
|
@@ -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,28 +119,30 @@ 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
|
-
|
|
142
|
+
const useAdvanced = requestContext.task === "complex";
|
|
143
|
+
return useAdvanced
|
|
144
|
+
? "pioneer/zai-org/GLM-5.2"
|
|
145
|
+
: "pioneer/HuggingFaceTB/SmolLM3-3B-Base";
|
|
146
|
+
}
|
|
147
|
+
});
|
|
146
148
|
```
|
|
@@ -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,28 +90,30 @@ 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
|
-
|
|
113
|
+
const useAdvanced = requestContext.task === "complex";
|
|
114
|
+
return useAdvanced
|
|
115
|
+
? "requesty/o4-mini@eu"
|
|
116
|
+
: "requesty/claude-fable-5";
|
|
117
|
+
}
|
|
118
|
+
});
|
|
117
119
|
```
|