@mastra/mcp-docs-server 1.2.7-alpha.12 → 1.2.7-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/agent-builder/integrations.md +2 -44
- package/.docs/docs/agent-builder/overview.md +3 -4
- package/.docs/docs/agent-builder/skill-registries.md +3 -1
- package/.docs/docs/agent-controller/overview.md +2 -3
- package/.docs/docs/agent-controller/session.md +3 -1
- package/.docs/docs/agents/a2a.md +1 -2
- package/.docs/docs/agents/channels.md +225 -0
- package/.docs/docs/agents/code-mode.md +1 -1
- package/.docs/docs/agents/file-based-agents.md +297 -0
- package/.docs/docs/agents/guardrails.md +9 -10
- package/.docs/docs/agents/overview.md +4 -4
- package/.docs/docs/agents/skills.md +5 -3
- package/.docs/docs/agents/structured-output.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +4 -3
- package/.docs/docs/agents/using-tools.md +4 -2
- package/.docs/docs/browser/agent-browser.md +3 -1
- package/.docs/docs/browser/browser-viewer.md +3 -1
- package/.docs/docs/browser/overview.md +1 -2
- package/.docs/docs/browser/stagehand.md +1 -1
- package/.docs/docs/deployment/mastra-server.md +4 -2
- package/.docs/docs/editor/overview.md +6 -2
- package/.docs/docs/editor/prompts.md +1 -1
- package/.docs/docs/editor/tools.md +5 -3
- package/.docs/docs/evals/custom-scorers.md +3 -1
- package/.docs/docs/evals/datasets/overview.md +5 -4
- package/.docs/docs/evals/datasets/running-experiments.md +2 -4
- package/.docs/docs/evals/evals-with-memory.md +3 -1
- package/.docs/docs/evals/gates-and-verdicts.md +3 -1
- package/.docs/docs/evals/overview.md +1 -4
- package/.docs/docs/evals/quick-checks.md +3 -1
- package/.docs/docs/long-running-agents/background-tasks.md +1 -1
- package/.docs/docs/long-running-agents/durable-agents.md +5 -3
- package/.docs/docs/long-running-agents/goals.md +3 -1
- package/.docs/docs/long-running-agents/signal-providers.md +3 -1
- package/.docs/docs/long-running-agents/signals.md +22 -11
- package/.docs/docs/mastra-platform/observability.md +1 -5
- package/.docs/docs/mcp/mcp-apps.md +3 -3
- package/.docs/docs/mcp/overview.md +10 -6
- package/.docs/docs/memory/observational-memory.md +1 -2
- package/.docs/docs/memory/overview.md +4 -6
- package/.docs/docs/memory/semantic-recall.md +1 -1
- package/.docs/docs/memory/working-memory.md +3 -3
- package/.docs/docs/observability/integrations/exporters/mastra-platform.md +3 -1
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/tracing/overview.md +1 -1
- package/.docs/docs/server/auth/auth0.md +1 -1
- package/.docs/docs/server/auth/better-auth.md +2 -2
- package/.docs/docs/server/auth/clerk.md +1 -1
- package/.docs/docs/server/auth/firebase.md +1 -1
- package/.docs/docs/server/auth/google.md +2 -2
- package/.docs/docs/server/auth/jwt.md +2 -2
- package/.docs/docs/server/auth/okta.md +2 -2
- package/.docs/docs/server/auth/workos.md +1 -1
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/mastra-server.md +1 -1
- package/.docs/docs/server/pubsub.md +1 -1
- package/.docs/docs/server/request-context.md +4 -4
- package/.docs/docs/server/server-adapters.md +8 -8
- package/.docs/docs/studio/auth.md +3 -1
- package/.docs/docs/studio/overview.md +1 -1
- package/.docs/docs/workflows/agents-and-tools.md +5 -3
- package/.docs/docs/workflows/control-flow.md +3 -1
- package/.docs/docs/workflows/overview.md +7 -6
- package/.docs/docs/workspace/overview.md +1 -2
- package/.docs/docs/workspace/sandbox.md +0 -2
- package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
- package/.docs/guides/build-your-ui/copilotkit/overview.md +1 -1
- package/.docs/guides/concepts/streaming.md +3 -3
- package/.docs/guides/getting-started/quickstart.md +1 -3
- package/.docs/guides/guide/chef-michel.md +2 -0
- package/.docs/guides/guide/slack-assistant.md +2 -2
- package/.docs/guides/guide/stock-agent.md +2 -0
- package/.docs/models/environment-variables.md +0 -6
- package/.docs/models/gateways/netlify.md +1 -4
- package/.docs/models/gateways/openrouter.md +7 -8
- package/.docs/models/gateways/vercel.md +1 -6
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/abacus.md +14 -44
- package/.docs/models/providers/llmgateway.md +181 -185
- package/.docs/models/providers/nano-gpt.md +2 -2
- package/.docs/models/providers/neon.md +29 -40
- package/.docs/models/providers/nvidia.md +3 -1
- package/.docs/models/providers/openai.md +1 -6
- package/.docs/models/providers/opencode.md +2 -5
- package/.docs/models/providers/poolside.md +5 -6
- package/.docs/models/providers/routing-run.md +34 -23
- package/.docs/models/providers/the-grid-ai.md +3 -3
- package/.docs/models/providers.md +0 -6
- package/.docs/reference/agents/channels.md +2 -2
- package/.docs/reference/channels/channel-provider.md +1 -1
- package/.docs/reference/channels/slack-provider.md +2 -2
- package/.docs/reference/cli/mastra.md +10 -117
- package/.docs/reference/evals/create-scorer.md +0 -8
- package/.docs/reference/index.md +0 -15
- package/.docs/reference/memory/memory-class.md +1 -1
- package/.docs/reference/memory/serialized-memory-config.md +1 -1
- package/.docs/reference/project-structure.md +1 -1
- package/.docs/reference/pubsub/lease-provider.md +1 -1
- package/.docs/reference/server/express-adapter.md +3 -1
- package/.docs/reference/server/fastify-adapter.md +3 -1
- package/.docs/reference/server/hono-adapter.md +3 -1
- package/.docs/reference/server/koa-adapter.md +3 -1
- package/.docs/reference/server/nestjs-adapter.md +3 -1
- package/.docs/reference/storage/clickhouse.md +0 -32
- package/.docs/reference/storage/composite.md +1 -27
- package/.docs/reference/storage/retention.md +0 -11
- package/.docs/reference/tools/mcp-client.md +0 -22
- package/.docs/reference/tools/mcp-server.md +4 -161
- package/.docs/reference/workspace/agentcore-runtime-sandbox.md +3 -1
- package/.docs/reference/workspace/agentfs-filesystem.md +3 -1
- package/.docs/reference/workspace/apple-container-sandbox.md +3 -1
- package/.docs/reference/workspace/archil-filesystem.md +3 -1
- package/.docs/reference/workspace/azure-blob-filesystem.md +3 -1
- package/.docs/reference/workspace/blaxel-sandbox.md +3 -1
- package/.docs/reference/workspace/daytona-sandbox.md +3 -1
- package/.docs/reference/workspace/docker-sandbox.md +3 -1
- package/.docs/reference/workspace/e2b-sandbox.md +3 -1
- package/.docs/reference/workspace/files-sdk-filesystem.md +3 -1
- package/.docs/reference/workspace/gcs-filesystem.md +3 -1
- package/.docs/reference/workspace/google-drive-filesystem.md +3 -1
- package/.docs/reference/workspace/local-filesystem.md +3 -1
- package/.docs/reference/workspace/local-sandbox.md +3 -1
- package/.docs/reference/workspace/modal-sandbox.md +3 -1
- package/.docs/reference/workspace/railway-sandbox.md +3 -1
- package/.docs/reference/workspace/s3-filesystem.md +3 -1
- package/.docs/reference/workspace/vercel-sandbox.md +7 -5
- package/.docs/reference/workspace/vercel-serverless.md +3 -1
- package/CHANGELOG.md +0 -29
- package/package.json +4 -4
- package/.docs/docs/capabilities/channels/discord.md +0 -98
- package/.docs/docs/capabilities/channels/other-adapters.md +0 -68
- package/.docs/docs/capabilities/channels/overview.md +0 -255
- package/.docs/docs/capabilities/channels/slack.md +0 -225
- package/.docs/docs/capabilities/channels/teams.md +0 -100
- package/.docs/docs/capabilities/channels/telegram.md +0 -98
- package/.docs/docs/capabilities/channels/whatsapp.md +0 -99
- package/.docs/docs/getting-started/file-based-agents.md +0 -116
- package/.docs/models/providers/crossmodel.md +0 -109
- package/.docs/models/providers/empiriolabs.md +0 -106
- package/.docs/models/providers/meta.md +0 -101
- package/.docs/models/providers/model-oracle-ai.md +0 -87
- package/.docs/models/providers/pioneer.md +0 -148
- package/.docs/models/providers/unorouter.md +0 -95
- package/.docs/reference/file-based-agents/config.md +0 -97
- package/.docs/reference/file-based-agents/instructions.md +0 -54
- package/.docs/reference/file-based-agents/logger.md +0 -26
- package/.docs/reference/file-based-agents/memory.md +0 -58
- package/.docs/reference/file-based-agents/observability.md +0 -32
- package/.docs/reference/file-based-agents/processors.md +0 -56
- package/.docs/reference/file-based-agents/scorers.md +0 -54
- package/.docs/reference/file-based-agents/server.md +0 -37
- package/.docs/reference/file-based-agents/skills.md +0 -56
- package/.docs/reference/file-based-agents/storage.md +0 -30
- package/.docs/reference/file-based-agents/studio.md +0 -56
- package/.docs/reference/file-based-agents/subagents.md +0 -123
- package/.docs/reference/file-based-agents/tools.md +0 -63
- package/.docs/reference/file-based-agents/workflows.md +0 -52
- package/.docs/reference/file-based-agents/workspace.md +0 -74
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Meta
|
|
4
|
-
|
|
5
|
-
Access 1 Meta model through Mastra's model router. Authentication is handled automatically using the `META_MODEL_API_KEY` environment variable.
|
|
6
|
-
|
|
7
|
-
Learn more in the [Meta documentation](https://dev.meta.ai/docs).
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
META_MODEL_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: "meta/muse-spark-1.1"
|
|
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 [Meta documentation](https://dev.meta.ai/docs) for details.
|
|
34
|
-
|
|
35
|
-
## Models
|
|
36
|
-
|
|
37
|
-
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
-
| --------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
-
| `meta/muse-spark-1.1` | 1.0M | | | | | | $1 | $4 |
|
|
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://api.meta.ai/v1",
|
|
51
|
-
id: "meta/muse-spark-1.1",
|
|
52
|
-
apiKey: process.env.META_MODEL_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
|
-
? "meta/muse-spark-1.1"
|
|
70
|
-
: "meta/muse-spark-1.1";
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Direct provider installation
|
|
76
|
-
|
|
77
|
-
This provider can also be installed directly as a standalone package, which can be used instead of the Mastra model router string. View the [package documentation](https://www.npmjs.com/package/@ai-sdk/openai) for more details.
|
|
78
|
-
|
|
79
|
-
**npm**:
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
npm install @ai-sdk/openai
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**pnpm**:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
pnpm add @ai-sdk/openai
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
**Yarn**:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
yarn add @ai-sdk/openai
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
**Bun**:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
bun add @ai-sdk/openai
|
|
101
|
-
```
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Model Oracle AI
|
|
4
|
-
|
|
5
|
-
Access 15 Model Oracle AI models through Mastra's model router. Authentication is handled automatically using the `MODEL_ORACLE_API_KEY` environment variable.
|
|
6
|
-
|
|
7
|
-
Learn more in the [Model Oracle AI documentation](https://modeloracle.com/setup/).
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
MODEL_ORACLE_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: "model-oracle-ai/auto"
|
|
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 [Model Oracle AI documentation](https://modeloracle.com/setup/) for details.
|
|
34
|
-
|
|
35
|
-
## Models
|
|
36
|
-
|
|
37
|
-
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
-
| ---------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
-
| `model-oracle-ai/auto` | 1.0M | | | | | | — | — |
|
|
40
|
-
| `model-oracle-ai/claude-fable-5` | 1.0M | | | | | | — | — |
|
|
41
|
-
| `model-oracle-ai/claude-haiku-4.5` | 200K | | | | | | — | — |
|
|
42
|
-
| `model-oracle-ai/claude-opus-4.8` | 1.0M | | | | | | — | — |
|
|
43
|
-
| `model-oracle-ai/claude-sonnet-5` | 1.0M | | | | | | — | — |
|
|
44
|
-
| `model-oracle-ai/deepseek-v4-pro` | 1.0M | | | | | | — | — |
|
|
45
|
-
| `model-oracle-ai/glm-5.2` | 1.0M | | | | | | — | — |
|
|
46
|
-
| `model-oracle-ai/gpt-4.1` | 1.0M | | | | | | — | — |
|
|
47
|
-
| `model-oracle-ai/gpt-4.1-mini` | 1.0M | | | | | | — | — |
|
|
48
|
-
| `model-oracle-ai/gpt-5` | 400K | | | | | | — | — |
|
|
49
|
-
| `model-oracle-ai/gpt-5.4` | 1.1M | | | | | | — | — |
|
|
50
|
-
| `model-oracle-ai/gpt-5.4-mini` | 400K | | | | | | — | — |
|
|
51
|
-
| `model-oracle-ai/gpt-5.4-nano` | 400K | | | | | | — | — |
|
|
52
|
-
| `model-oracle-ai/gpt-5.5` | 1.1M | | | | | | — | — |
|
|
53
|
-
| `model-oracle-ai/o4-mini` | 200K | | | | | | — | — |
|
|
54
|
-
|
|
55
|
-
## Advanced configuration
|
|
56
|
-
|
|
57
|
-
### Custom headers
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
const agent = new Agent({
|
|
61
|
-
id: "custom-agent",
|
|
62
|
-
name: "custom-agent",
|
|
63
|
-
model: {
|
|
64
|
-
url: "https://api.modeloracle.com/api/v1",
|
|
65
|
-
id: "model-oracle-ai/auto",
|
|
66
|
-
apiKey: process.env.MODEL_ORACLE_API_KEY,
|
|
67
|
-
headers: {
|
|
68
|
-
"X-Custom-Header": "value"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Dynamic model selection
|
|
75
|
-
|
|
76
|
-
```typescript
|
|
77
|
-
const agent = new Agent({
|
|
78
|
-
id: "dynamic-agent",
|
|
79
|
-
name: "Dynamic Agent",
|
|
80
|
-
model: ({ requestContext }) => {
|
|
81
|
-
const useAdvanced = requestContext.task === "complex";
|
|
82
|
-
return useAdvanced
|
|
83
|
-
? "model-oracle-ai/o4-mini"
|
|
84
|
-
: "model-oracle-ai/auto";
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
```
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Pioneer
|
|
4
|
-
|
|
5
|
-
Access 76 Pioneer models through Mastra's model router. Authentication is handled automatically using the `PIONEER_API_KEY` environment variable.
|
|
6
|
-
|
|
7
|
-
Learn more in the [Pioneer documentation](https://agent.pioneer.ai/llms.txt).
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
PIONEER_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: "pioneer/HuggingFaceTB/SmolLM3-3B-Base"
|
|
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 [Pioneer documentation](https://agent.pioneer.ai/llms.txt) for details.
|
|
34
|
-
|
|
35
|
-
## Models
|
|
36
|
-
|
|
37
|
-
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
-
| ------------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
-
| `pioneer/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
|
|
40
|
-
| `pioneer/claude-opus-4-1` | 200K | | | | | | $15 | $75 |
|
|
41
|
-
| `pioneer/claude-opus-4-5` | 200K | | | | | | $5 | $25 |
|
|
42
|
-
| `pioneer/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 |
|
|
43
|
-
| `pioneer/claude-opus-4-7` | 1.0M | | | | | | $5 | $25 |
|
|
44
|
-
| `pioneer/claude-opus-4-8` | 1.0M | | | | | | $5 | $25 |
|
|
45
|
-
| `pioneer/claude-sonnet-4-5` | 1.0M | | | | | | $3 | $15 |
|
|
46
|
-
| `pioneer/claude-sonnet-4-6` | 1.0M | | | | | | $3 | $15 |
|
|
47
|
-
| `pioneer/deepseek-ai/DeepSeek-V4-Flash` | 1.0M | | | | | | $0.10 | $0.20 |
|
|
48
|
-
| `pioneer/deepseek-ai/DeepSeek-V4-Pro` | 1.0M | | | | | | $0.43 | $0.87 |
|
|
49
|
-
| `pioneer/fastino/gliguard-LLMGuardrails-300M` | 8K | | | | | | $0.15 | $0.15 |
|
|
50
|
-
| `pioneer/fastino/gliner2-base-v1` | 8K | | | | | | $0.15 | $0.15 |
|
|
51
|
-
| `pioneer/fastino/gliner2-large-v1` | 8K | | | | | | $0.15 | $0.15 |
|
|
52
|
-
| `pioneer/fastino/gliner2-multi-large-v1` | 8K | | | | | | $0.15 | $0.15 |
|
|
53
|
-
| `pioneer/fastino/gliner2-multi-v1` | 8K | | | | | | $0.15 | $0.15 |
|
|
54
|
-
| `pioneer/fastino/gliner2-privacy-filter-PII-multi` | 8K | | | | | | $0.15 | $0.15 |
|
|
55
|
-
| `pioneer/gemini-3-flash` | 1.0M | | | | | | $0.50 | $3 |
|
|
56
|
-
| `pioneer/gemini-3.1-pro` | 1.0M | | | | | | $2 | $12 |
|
|
57
|
-
| `pioneer/gemini-3.5-flash` | 1.0M | | | | | | $2 | $9 |
|
|
58
|
-
| `pioneer/google/diffusiongemma-26B-A4B-it` | 262K | | | | | | $0.50 | $0.50 |
|
|
59
|
-
| `pioneer/google/gemma-3-4b-pt` | 33K | | | | | | $0.15 | $0.15 |
|
|
60
|
-
| `pioneer/google/gemma-4-12B-it` | 33K | | | | | | $0.25 | $0.25 |
|
|
61
|
-
| `pioneer/google/gemma-4-31B-it` | 33K | | | | | | $0.50 | $0.50 |
|
|
62
|
-
| `pioneer/google/gemma-4-E2B-it` | 33K | | | | | | $0.10 | $0.10 |
|
|
63
|
-
| `pioneer/google/gemma-4-E4B-it` | 33K | | | | | | $0.20 | $0.20 |
|
|
64
|
-
| `pioneer/gpt-4.1` | 1.0M | | | | | | $2 | $8 |
|
|
65
|
-
| `pioneer/gpt-4.1-mini` | 1.0M | | | | | | $0.40 | $2 |
|
|
66
|
-
| `pioneer/gpt-4.1-nano` | 1.0M | | | | | | $0.10 | $0.40 |
|
|
67
|
-
| `pioneer/gpt-4o` | 128K | | | | | | $3 | $10 |
|
|
68
|
-
| `pioneer/gpt-4o-mini` | 128K | | | | | | $0.15 | $0.60 |
|
|
69
|
-
| `pioneer/gpt-5-mini` | 400K | | | | | | $0.25 | $2 |
|
|
70
|
-
| `pioneer/gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 |
|
|
71
|
-
| `pioneer/gpt-5.1` | 400K | | | | | | $1 | $10 |
|
|
72
|
-
| `pioneer/gpt-5.3-codex` | 400K | | | | | | $2 | $14 |
|
|
73
|
-
| `pioneer/gpt-5.4` | 1.1M | | | | | | $3 | $15 |
|
|
74
|
-
| `pioneer/gpt-5.4-mini` | 400K | | | | | | $0.75 | $5 |
|
|
75
|
-
| `pioneer/gpt-5.4-nano` | 1.0M | | | | | | $0.20 | $1 |
|
|
76
|
-
| `pioneer/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
|
|
77
|
-
| `pioneer/HuggingFaceTB/SmolLM3-3B-Base` | 33K | | | | | | $0.15 | $0.15 |
|
|
78
|
-
| `pioneer/LiquidAI/LFM2-24B-A2B` | 33K | | | | | | $0.03 | $0.12 |
|
|
79
|
-
| `pioneer/meta-llama/Llama-3.1-8B-Instruct` | 131K | | | | | | $0.20 | $0.20 |
|
|
80
|
-
| `pioneer/meta-llama/Llama-3.2-1B-Instruct` | 131K | | | | | | $0.10 | $0.20 |
|
|
81
|
-
| `pioneer/meta-llama/Llama-3.2-3B-Instruct` | 131K | | | | | | $0.10 | $0.34 |
|
|
82
|
-
| `pioneer/meta-llama/Llama-3.3-70B-Instruct` | 131K | | | | | | $0.90 | $0.90 |
|
|
83
|
-
| `pioneer/MiniMaxAI/MiniMax-M2.7` | 205K | | | | | | $0.28 | $1 |
|
|
84
|
-
| `pioneer/MiniMaxAI/MiniMax-M3` | 1.0M | | | | | | $0.30 | $1 |
|
|
85
|
-
| `pioneer/mistral-medium-3.5` | 262K | | | | | | $2 | $8 |
|
|
86
|
-
| `pioneer/mistralai/Mistral-7B-Instruct-v0.3` | 33K | | | | | | $0.20 | $0.20 |
|
|
87
|
-
| `pioneer/mistralai/Mistral-Nemo-Instruct-2407` | 131K | | | | | | $0.02 | $0.03 |
|
|
88
|
-
| `pioneer/mistralai/Mistral-Small-4-119B-2603` | 262K | | | | | | $0.15 | $0.60 |
|
|
89
|
-
| `pioneer/moonshotai/Kimi-K2.6` | 262K | | | | | | $0.95 | $4 |
|
|
90
|
-
| `pioneer/moonshotai/Kimi-K2.7-Code` | 262K | | | | | | $0.95 | $4 |
|
|
91
|
-
| `pioneer/nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16` | 262K | | | | | | $0.05 | $0.20 |
|
|
92
|
-
| `pioneer/nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-FP8` | 1.0M | | | | | | $0.09 | $0.45 |
|
|
93
|
-
| `pioneer/nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16` | 1.0M | | | | | | $0.50 | $3 |
|
|
94
|
-
| `pioneer/openai/gpt-oss-120b` | 131K | | | | | | $0.15 | $0.60 |
|
|
95
|
-
| `pioneer/openai/gpt-oss-20b` | 131K | | | | | | $0.07 | $0.30 |
|
|
96
|
-
| `pioneer/pioneer/auto` | 1.0M | | | | | | — | — |
|
|
97
|
-
| `pioneer/Qwen/Qwen3-1.7B-Base` | 33K | | | | | | $0.10 | $0.10 |
|
|
98
|
-
| `pioneer/Qwen/Qwen3-32B` | 131K | | | | | | $0.90 | $0.90 |
|
|
99
|
-
| `pioneer/Qwen/Qwen3-4B-Base` | 33K | | | | | | $0.15 | $0.15 |
|
|
100
|
-
| `pioneer/Qwen/Qwen3-4B-Instruct-2507` | 262K | | | | | | $0.20 | $0.20 |
|
|
101
|
-
| `pioneer/Qwen/Qwen3-8B` | 131K | | | | | | $0.20 | $0.20 |
|
|
102
|
-
| `pioneer/Qwen/Qwen3.5-9B` | 33K | | | | | | $0.30 | $0.30 |
|
|
103
|
-
| `pioneer/Qwen/Qwen3.6-27B` | 33K | | | | | | $0.60 | $0.60 |
|
|
104
|
-
| `pioneer/Qwen/Qwen3.6-35B-A3B` | 262K | | | | | | $0.14 | $1 |
|
|
105
|
-
| `pioneer/qwen3.6-flash` | 1.0M | | | | | | $0.19 | $1 |
|
|
106
|
-
| `pioneer/qwen3.6-max-preview` | 262K | | | | | | $1 | $6 |
|
|
107
|
-
| `pioneer/qwen3.6-plus` | 1.0M | | | | | | $0.33 | $2 |
|
|
108
|
-
| `pioneer/qwen3.7-max` | 1.0M | | | | | | $1 | $4 |
|
|
109
|
-
| `pioneer/qwen3.7-plus` | 1.0M | | | | | | $0.32 | $1 |
|
|
110
|
-
| `pioneer/sakana/fugu-ultra` | 1.0M | | | | | | $5 | $30 |
|
|
111
|
-
| `pioneer/XiaomiMiMo/MiMo-V2.5` | 1.1M | | | | | | $0.14 | $0.28 |
|
|
112
|
-
| `pioneer/XiaomiMiMo/MiMo-V2.5-Pro` | 1.1M | | | | | | $0.43 | $0.87 |
|
|
113
|
-
| `pioneer/zai-org/GLM-5.1` | 203K | | | | | | $0.98 | $3 |
|
|
114
|
-
| `pioneer/zai-org/GLM-5.2` | 1.0M | | | | | | $1 | $4 |
|
|
115
|
-
|
|
116
|
-
## Advanced configuration
|
|
117
|
-
|
|
118
|
-
### Custom headers
|
|
119
|
-
|
|
120
|
-
```typescript
|
|
121
|
-
const agent = new Agent({
|
|
122
|
-
id: "custom-agent",
|
|
123
|
-
name: "custom-agent",
|
|
124
|
-
model: {
|
|
125
|
-
url: "https://api.pioneer.ai/v1",
|
|
126
|
-
id: "pioneer/HuggingFaceTB/SmolLM3-3B-Base",
|
|
127
|
-
apiKey: process.env.PIONEER_API_KEY,
|
|
128
|
-
headers: {
|
|
129
|
-
"X-Custom-Header": "value"
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Dynamic model selection
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
138
|
-
const agent = new Agent({
|
|
139
|
-
id: "dynamic-agent",
|
|
140
|
-
name: "Dynamic Agent",
|
|
141
|
-
model: ({ requestContext }) => {
|
|
142
|
-
const useAdvanced = requestContext.task === "complex";
|
|
143
|
-
return useAdvanced
|
|
144
|
-
? "pioneer/zai-org/GLM-5.2"
|
|
145
|
-
: "pioneer/HuggingFaceTB/SmolLM3-3B-Base";
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
```
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# UnoRouter
|
|
4
|
-
|
|
5
|
-
Access 23 UnoRouter models through Mastra's model router. Authentication is handled automatically using the `UNOROUTER_API_KEY` environment variable.
|
|
6
|
-
|
|
7
|
-
Learn more in the [UnoRouter documentation](https://unorouter.com/models).
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
UNOROUTER_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: "unorouter/claude-haiku-4-5-20251001"
|
|
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 [UnoRouter documentation](https://unorouter.com/models) for details.
|
|
34
|
-
|
|
35
|
-
## Models
|
|
36
|
-
|
|
37
|
-
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
-
| ------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
-
| `unorouter/claude-haiku-4-5-20251001` | 200K | | | | | | $1 | $6 |
|
|
40
|
-
| `unorouter/claude-opus-4-8` | 1.0M | | | | | | $0.42 | $2 |
|
|
41
|
-
| `unorouter/claude-sonnet-5` | 1.0M | | | | | | $1 | $7 |
|
|
42
|
-
| `unorouter/deepseek-v4-flash` | 1.0M | | | | | | $0.06 | $0.13 |
|
|
43
|
-
| `unorouter/deepseek-v4-flash:free` | 1.0M | | | | | | — | — |
|
|
44
|
-
| `unorouter/deepseek-v4-pro` | 1.0M | | | | | | $0.90 | $2 |
|
|
45
|
-
| `unorouter/deepseek-v4-pro:free` | 1.0M | | | | | | — | — |
|
|
46
|
-
| `unorouter/gemini-3.5-flash` | 1.0M | | | | | | $0.19 | $1 |
|
|
47
|
-
| `unorouter/gemma-4-31b-it:free` | 262K | | | | | | — | — |
|
|
48
|
-
| `unorouter/glm-4.5-flash:free` | 131K | | | | | | — | — |
|
|
49
|
-
| `unorouter/glm-5.2` | 1.0M | | | | | | $2 | $5 |
|
|
50
|
-
| `unorouter/glm-5.2:free` | 1.0M | | | | | | — | — |
|
|
51
|
-
| `unorouter/gpt-5.2` | 400K | | | | | | $1 | $8 |
|
|
52
|
-
| `unorouter/gpt-5.4` | 1.1M | | | | | | $2 | $11 |
|
|
53
|
-
| `unorouter/gpt-5.4:free` | 1.1M | | | | | | — | — |
|
|
54
|
-
| `unorouter/gpt-5.5` | 1.1M | | | | | | $0.19 | $1 |
|
|
55
|
-
| `unorouter/gpt-5.5:free` | 1.1M | | | | | | — | — |
|
|
56
|
-
| `unorouter/kimi-k2.6` | 262K | | | | | | $1 | $5 |
|
|
57
|
-
| `unorouter/minimax-m2.7` | 205K | | | | | | $0.82 | $3 |
|
|
58
|
-
| `unorouter/minimax-m2.7:free` | 205K | | | | | | — | — |
|
|
59
|
-
| `unorouter/nemotron-3-ultra-550b-a55b:free` | 1.0M | | | | | | — | — |
|
|
60
|
-
| `unorouter/qwen3.5-397b-a17b:free` | 262K | | | | | | — | — |
|
|
61
|
-
| `unorouter/step-3.7-flash:free` | 256K | | | | | | — | — |
|
|
62
|
-
|
|
63
|
-
## Advanced configuration
|
|
64
|
-
|
|
65
|
-
### Custom headers
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
const agent = new Agent({
|
|
69
|
-
id: "custom-agent",
|
|
70
|
-
name: "custom-agent",
|
|
71
|
-
model: {
|
|
72
|
-
url: "https://api.unorouter.com/v1",
|
|
73
|
-
id: "unorouter/claude-haiku-4-5-20251001",
|
|
74
|
-
apiKey: process.env.UNOROUTER_API_KEY,
|
|
75
|
-
headers: {
|
|
76
|
-
"X-Custom-Header": "value"
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Dynamic model selection
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
const agent = new Agent({
|
|
86
|
-
id: "dynamic-agent",
|
|
87
|
-
name: "Dynamic Agent",
|
|
88
|
-
model: ({ requestContext }) => {
|
|
89
|
-
const useAdvanced = requestContext.task === "complex";
|
|
90
|
-
return useAdvanced
|
|
91
|
-
? "unorouter/step-3.7-flash:free"
|
|
92
|
-
: "unorouter/claude-haiku-4-5-20251001";
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
```
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# config.ts
|
|
4
|
-
|
|
5
|
-
An agent's `config.ts` sets its model and runtime options. Use it for options that belong to the [`Agent`](https://mastra.ai/reference/agents/agent) itself, while sibling files provide instructions, tools, skills, et cetera.
|
|
6
|
-
|
|
7
|
-
## What belongs in `config.ts`
|
|
8
|
-
|
|
9
|
-
`config.ts` is the required entry point for a file-based agent's model and runtime options. Put agent-level settings here when they don't need their own file, such as the model, description, default execution options, retry behavior, scorers, and display identity.
|
|
10
|
-
|
|
11
|
-
Keep adjacent concerns in sibling files when you want file-based routing to merge them into the agent. For example, use `instructions.md` for the always-on prompt and `tools/` for model-callable actions.
|
|
12
|
-
|
|
13
|
-
## Quickstart
|
|
14
|
-
|
|
15
|
-
The following `config.ts` plus an `instructions.md` file creates a working file-based agent:
|
|
16
|
-
|
|
17
|
-
```typescript
|
|
18
|
-
import { agentConfig } from '@mastra/core/agent'
|
|
19
|
-
|
|
20
|
-
export default agentConfig({
|
|
21
|
-
model: 'openai/gpt-5.5',
|
|
22
|
-
})
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
```markdown
|
|
26
|
-
You are a helpful weather assistant. Answer questions about current conditions and forecasts.
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Mastra uses the `weather` directory name as the default agent `id` and `name`. The sibling `instructions.md` supplies the required instructions.
|
|
30
|
-
|
|
31
|
-
## Set the model
|
|
32
|
-
|
|
33
|
-
The `model` field is the only required field in `agentConfig()`. The build fails when an agent directory doesn't provide a model. Other capabilities either come from sibling files or have defaults.
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
import { agentConfig } from '@mastra/core/agent'
|
|
37
|
-
|
|
38
|
-
export default agentConfig({
|
|
39
|
-
model: 'openai/gpt-5.5',
|
|
40
|
-
})
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Identity from the directory
|
|
44
|
-
|
|
45
|
-
A file-based agent's `id` and `name` default to the directory name. For `src/mastra/agents/weather/`, Mastra registers the agent as `weather` unless you override those fields.
|
|
46
|
-
|
|
47
|
-
Override `id` or `name` when the stable routing key and the display name should differ.
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
import { agentConfig } from '@mastra/core/agent'
|
|
51
|
-
|
|
52
|
-
export default agentConfig({
|
|
53
|
-
id: 'weather-assistant',
|
|
54
|
-
name: 'Weather Assistant',
|
|
55
|
-
model: 'openai/gpt-5.5',
|
|
56
|
-
})
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Set runtime options
|
|
60
|
-
|
|
61
|
-
`agentConfig()` accepts [`Agent` constructor options](https://mastra.ai/reference/agents/agent), except that `id`, `name`, and sibling-file fields can be supplied by the file-based convention. Use the Agent reference for the full option list.
|
|
62
|
-
|
|
63
|
-
Please note:
|
|
64
|
-
|
|
65
|
-
- File-based subagents require a non-empty `description` because the parent model uses it for delegation routing.
|
|
66
|
-
- `defaultOptions`, `maxRetries`, `scorers`, and other Agent options can live in `config.ts` when they don't need their own file.
|
|
67
|
-
|
|
68
|
-
## Where adjacent settings live
|
|
69
|
-
|
|
70
|
-
Keep `config.ts` focused on runtime options. Use sibling files for concerns that benefit from their own location.
|
|
71
|
-
|
|
72
|
-
| Setting | File or folder | Why it lives there |
|
|
73
|
-
| ------------ | ------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
74
|
-
| Instructions | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | Keeps the always-on prompt readable as markdown |
|
|
75
|
-
| Tools | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | Gives each callable action its own typed module |
|
|
76
|
-
| Skills | [`skills/`](https://mastra.ai/reference/file-based-agents/skills) | Keeps load-on-demand procedures separate from always-on instructions |
|
|
77
|
-
| Memory | [`memory.ts`](https://mastra.ai/reference/file-based-agents/memory) | Configures persistent memory without crowding runtime options |
|
|
78
|
-
| Workspace | [`workspace.ts`](https://mastra.ai/reference/file-based-agents/workspace) | Configures files and sandbox behavior separately from model settings |
|
|
79
|
-
| Processors | [`processors/`](https://mastra.ai/reference/file-based-agents/processors) | Separates input and output processing pipelines |
|
|
80
|
-
| Subagents | [`subagents/`](https://mastra.ai/reference/file-based-agents/subagents) | Gives each specialist child agent its own directory |
|
|
81
|
-
|
|
82
|
-
## Precedence
|
|
83
|
-
|
|
84
|
-
`config.ts` merges with the agent's other files according to these rules:
|
|
85
|
-
|
|
86
|
-
| Domain | Source A | Source B | Winner |
|
|
87
|
-
| ------------ | ----------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
|
88
|
-
| Instructions | Dynamic `config.instructions` | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | Dynamic `config.instructions` |
|
|
89
|
-
| Instructions | Static `config.instructions` | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | `instructions.md` |
|
|
90
|
-
| Tools | `config.tools` | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | Both merge; `config.tools` wins on key collisions |
|
|
91
|
-
| Tools | Function `config.tools` | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | Function `config.tools`; discovered tools are ignored |
|
|
92
|
-
| Skills | `config.skills` | [`skills/`](https://mastra.ai/reference/file-based-agents/skills) | Both merge; `config.skills` wins on name collisions |
|
|
93
|
-
| Skills | Function `config.skills` | [`skills/`](https://mastra.ai/reference/file-based-agents/skills) | Function `config.skills`; discovered skills are ignored |
|
|
94
|
-
| Memory | `config.memory` | [`memory.ts`](https://mastra.ai/reference/file-based-agents/memory) | `config.memory` |
|
|
95
|
-
| Workspace | `config.workspace` | [`workspace.ts`](https://mastra.ai/reference/file-based-agents/workspace) | `config.workspace` |
|
|
96
|
-
|
|
97
|
-
Missing both `instructions.md` and `config.instructions` fails the build. Missing both `config.memory` and `memory.ts` leaves the agent without memory.
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Instructions
|
|
4
|
-
|
|
5
|
-
An agent's `instructions.md` holds its always-on system prompt: the model reads it on every turn. Use it to define the agent's identity, tone, role, and standing rules.
|
|
6
|
-
|
|
7
|
-
Instructions are always in context, so keep them for stable behavior that applies to every request. Move anything conditional, large, or action-oriented out of `instructions.md` and into [`tools/`](https://mastra.ai/reference/file-based-agents/tools) or [`skills/`](https://mastra.ai/reference/file-based-agents/skills), which the model uses only when relevant.
|
|
8
|
-
|
|
9
|
-
## Quickstart
|
|
10
|
-
|
|
11
|
-
Add an `instructions.md` at the agent root. Whatever you write becomes the prompt, so the shortest version is a single sentence.
|
|
12
|
-
|
|
13
|
-
```markdown
|
|
14
|
-
You are a helpful weather assistant. Answer questions about current conditions and forecasts.
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## What goes in instructions
|
|
18
|
-
|
|
19
|
-
Effective instructions cover the parts of an agent's behavior that don't change between requests:
|
|
20
|
-
|
|
21
|
-
- Role and identity
|
|
22
|
-
- Tone and style
|
|
23
|
-
- Standing rules
|
|
24
|
-
- Output format
|
|
25
|
-
|
|
26
|
-
Move conditional, large, or action-oriented guidance into [`tools/`](https://mastra.ai/reference/file-based-agents/tools) or [`skills/`](https://mastra.ai/reference/file-based-agents/skills), which the model uses only when relevant.
|
|
27
|
-
|
|
28
|
-
## Dynamic instructions
|
|
29
|
-
|
|
30
|
-
When the prompt needs to change per request, for example based on the current user or runtime context, set a dynamic `instructions` function in [`config.ts`](https://mastra.ai/reference/file-based-agents/config) instead of using `instructions.md`. A function `instructions` wins over `instructions.md`, so the static file is ignored when both are present.
|
|
31
|
-
|
|
32
|
-
```typescript
|
|
33
|
-
import { agentConfig } from '@mastra/core/agent'
|
|
34
|
-
|
|
35
|
-
export default agentConfig({
|
|
36
|
-
model: 'openai/gpt-5.5',
|
|
37
|
-
instructions: ({ runtimeContext }) => {
|
|
38
|
-
const tier = runtimeContext.get('tier') ?? 'standard'
|
|
39
|
-
return `You are a support agent. Treat this as a ${tier}-tier customer.`
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Build-time behavior
|
|
45
|
-
|
|
46
|
-
Mastra reads `instructions.md` and inlines its contents into the generated code when the bundler builds your project. The deployed agent doesn't read the file at runtime, so changes to `instructions.md` take effect only after the next build.
|
|
47
|
-
|
|
48
|
-
## Precedence with config
|
|
49
|
-
|
|
50
|
-
Instructions can come from `instructions.md` or from the `instructions` field in [`config.ts`](https://mastra.ai/reference/file-based-agents/config):
|
|
51
|
-
|
|
52
|
-
- A dynamic (function) `instructions` in `config.ts` wins over `instructions.md`.
|
|
53
|
-
- Otherwise `instructions.md` wins over a static `instructions` string.
|
|
54
|
-
- If neither is present, the build fails and names the agent directory.
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Logger
|
|
4
|
-
|
|
5
|
-
Mastra sets the project's [logger](https://mastra.ai/docs/observability/logging) from a `logger.ts` file directly under `src/mastra/`. The file default-exports a logger, which replaces the built-in `ConsoleLogger` used across agents, workflows, and other components.
|
|
6
|
-
|
|
7
|
-
Use this page for the file-based convention. For log levels, transports, and provider details, see [logging](https://mastra.ai/docs/observability/logging).
|
|
8
|
-
|
|
9
|
-
## Quickstart
|
|
10
|
-
|
|
11
|
-
Create `src/mastra/logger.ts` and default-export a logger, such as [`PinoLogger`](https://mastra.ai/reference/logging/pino-logger):
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { PinoLogger } from '@mastra/loggers'
|
|
15
|
-
|
|
16
|
-
export default new PinoLogger({
|
|
17
|
-
name: 'Mastra',
|
|
18
|
-
level: 'info',
|
|
19
|
-
})
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Mastra registers the logger before storage, observability, and file-based agents, so those primitives log through this logger as they are wired up.
|
|
23
|
-
|
|
24
|
-
## Precedence with code
|
|
25
|
-
|
|
26
|
-
Code-registered logging wins over `logger.ts`. If you pass `logger` to `new Mastra({ logger })` in `src/mastra/index.ts` (or set `logger: false` to disable logging), `logger.ts` is ignored with a warning. Use `logger.ts` when one project-wide logger is enough; use code registration when setup depends on runtime wiring.
|