@mastra/mcp-docs-server 1.1.14-alpha.2 → 1.1.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.
Files changed (124) hide show
  1. package/.docs/course/01-first-agent/07-creating-your-agent.md +1 -1
  2. package/.docs/course/01-first-agent/12-connecting-tool-to-agent.md +1 -1
  3. package/.docs/course/01-first-agent/16-adding-memory-to-agent.md +1 -1
  4. package/.docs/course/02-agent-tools-mcp/05-updating-your-agent.md +1 -1
  5. package/.docs/course/02-agent-tools-mcp/10-updating-agent-instructions-zapier.md +1 -1
  6. package/.docs/course/02-agent-tools-mcp/16-updating-agent-instructions-github.md +1 -1
  7. package/.docs/course/02-agent-tools-mcp/21-updating-agent-instructions-hackernews.md +1 -1
  8. package/.docs/course/02-agent-tools-mcp/27-updating-agent-instructions-filesystem.md +1 -1
  9. package/.docs/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +1 -1
  10. package/.docs/course/03-agent-memory/04-creating-basic-memory-agent.md +1 -1
  11. package/.docs/course/03-agent-memory/08-configuring-conversation-history.md +1 -1
  12. package/.docs/course/03-agent-memory/16-configuring-semantic-recall.md +1 -1
  13. package/.docs/course/03-agent-memory/21-configuring-working-memory.md +1 -1
  14. package/.docs/course/03-agent-memory/22-custom-working-memory-templates.md +1 -1
  15. package/.docs/course/03-agent-memory/27-creating-learning-assistant.md +1 -1
  16. package/.docs/course/04-workflows/11-creating-an-ai-agent.md +2 -2
  17. package/.docs/docs/agents/adding-voice.md +6 -6
  18. package/.docs/docs/agents/agent-approval.md +4 -4
  19. package/.docs/docs/agents/guardrails.md +1 -1
  20. package/.docs/docs/agents/network-approval.md +1 -1
  21. package/.docs/docs/agents/networks.md +1 -1
  22. package/.docs/docs/agents/overview.md +2 -2
  23. package/.docs/docs/agents/processors.md +11 -11
  24. package/.docs/docs/agents/structured-output.md +4 -4
  25. package/.docs/docs/agents/supervisor-agents.md +3 -3
  26. package/.docs/docs/agents/using-tools.md +4 -4
  27. package/.docs/docs/evals/custom-scorers.md +4 -4
  28. package/.docs/docs/evals/overview.md +2 -2
  29. package/.docs/docs/mcp/overview.md +1 -1
  30. package/.docs/docs/memory/memory-processors.md +6 -6
  31. package/.docs/docs/memory/semantic-recall.md +1 -1
  32. package/.docs/docs/memory/storage.md +1 -1
  33. package/.docs/docs/memory/working-memory.md +2 -2
  34. package/.docs/docs/observability/datasets/running-experiments.md +1 -1
  35. package/.docs/docs/observability/tracing/exporters/langfuse.md +1 -1
  36. package/.docs/docs/observability/tracing/exporters/langsmith.md +2 -2
  37. package/.docs/docs/rag/graph-rag.md +2 -2
  38. package/.docs/docs/rag/retrieval.md +12 -12
  39. package/.docs/docs/server/mastra-client.md +1 -1
  40. package/.docs/docs/server/request-context.md +3 -3
  41. package/.docs/docs/streaming/tool-streaming.md +1 -1
  42. package/.docs/docs/voice/overview.md +21 -21
  43. package/.docs/docs/voice/speech-to-speech.md +2 -2
  44. package/.docs/docs/voice/speech-to-text.md +1 -1
  45. package/.docs/docs/voice/text-to-speech.md +1 -1
  46. package/.docs/docs/workspace/filesystem.md +1 -1
  47. package/.docs/docs/workspace/overview.md +1 -1
  48. package/.docs/docs/workspace/sandbox.md +1 -1
  49. package/.docs/guides/build-your-ui/ai-sdk-ui.md +1 -1
  50. package/.docs/guides/guide/ai-recruiter.md +1 -1
  51. package/.docs/guides/guide/chef-michel.md +1 -1
  52. package/.docs/guides/guide/code-review-bot.md +1 -1
  53. package/.docs/guides/guide/dev-assistant.md +1 -1
  54. package/.docs/guides/guide/docs-manager.md +1 -1
  55. package/.docs/guides/guide/github-actions-pr-description.md +1 -1
  56. package/.docs/guides/guide/research-assistant.md +3 -3
  57. package/.docs/guides/guide/research-coordinator.md +2 -2
  58. package/.docs/guides/guide/stock-agent.md +2 -2
  59. package/.docs/guides/guide/web-search.md +5 -5
  60. package/.docs/guides/guide/whatsapp-chat-bot.md +2 -2
  61. package/.docs/guides/migrations/agentnetwork.md +4 -4
  62. package/.docs/guides/migrations/upgrade-to-v1/agent.md +1 -1
  63. package/.docs/guides/migrations/vnext-to-standard-apis.md +2 -2
  64. package/.docs/models/gateways/netlify.md +5 -1
  65. package/.docs/models/gateways/vercel.md +5 -2
  66. package/.docs/models/index.md +2 -2
  67. package/.docs/models/providers/alibaba-cn.md +4 -4
  68. package/.docs/models/providers/dinference.md +73 -0
  69. package/.docs/models/providers/openai.md +3 -1
  70. package/.docs/models/providers/opencode.md +1 -5
  71. package/.docs/models/providers/scaleway.md +4 -2
  72. package/.docs/models/providers/tencent-coding-plan.md +78 -0
  73. package/.docs/models/providers.md +2 -0
  74. package/.docs/reference/agents/agent.md +5 -5
  75. package/.docs/reference/agents/generateLegacy.md +2 -2
  76. package/.docs/reference/agents/getLLM.md +1 -1
  77. package/.docs/reference/agents/network.md +1 -1
  78. package/.docs/reference/configuration.md +3 -3
  79. package/.docs/reference/evals/answer-relevancy.md +1 -1
  80. package/.docs/reference/evals/answer-similarity.md +1 -1
  81. package/.docs/reference/evals/bias.md +1 -1
  82. package/.docs/reference/evals/context-precision.md +3 -3
  83. package/.docs/reference/evals/context-relevance.md +11 -11
  84. package/.docs/reference/evals/faithfulness.md +1 -1
  85. package/.docs/reference/evals/hallucination.md +5 -5
  86. package/.docs/reference/evals/noise-sensitivity.md +11 -11
  87. package/.docs/reference/evals/prompt-alignment.md +15 -15
  88. package/.docs/reference/evals/tool-call-accuracy.md +3 -3
  89. package/.docs/reference/evals/toxicity.md +1 -1
  90. package/.docs/reference/harness/harness-class.md +4 -4
  91. package/.docs/reference/memory/memory-class.md +3 -3
  92. package/.docs/reference/memory/observational-memory.md +5 -5
  93. package/.docs/reference/observability/tracing/exporters/langfuse.md +1 -1
  94. package/.docs/reference/processors/batch-parts-processor.md +1 -1
  95. package/.docs/reference/processors/language-detector.md +1 -1
  96. package/.docs/reference/processors/moderation-processor.md +2 -2
  97. package/.docs/reference/processors/pii-detector.md +2 -2
  98. package/.docs/reference/processors/processor-interface.md +3 -3
  99. package/.docs/reference/processors/prompt-injection-detector.md +1 -1
  100. package/.docs/reference/processors/system-prompt-scrubber.md +1 -1
  101. package/.docs/reference/processors/token-limiter-processor.md +3 -3
  102. package/.docs/reference/processors/tool-search-processor.md +2 -2
  103. package/.docs/reference/processors/unicode-normalizer.md +1 -1
  104. package/.docs/reference/rag/rerank.md +1 -1
  105. package/.docs/reference/storage/mongodb.md +1 -1
  106. package/.docs/reference/storage/postgresql.md +1 -1
  107. package/.docs/reference/storage/upstash.md +1 -1
  108. package/.docs/reference/streaming/agents/stream.md +1 -1
  109. package/.docs/reference/templates/overview.md +1 -1
  110. package/.docs/reference/tools/mcp-client.md +2 -2
  111. package/.docs/reference/tools/mcp-server.md +1 -1
  112. package/.docs/reference/tools/vector-query-tool.md +1 -1
  113. package/.docs/reference/vectors/libsql.md +1 -1
  114. package/.docs/reference/vectors/mongodb.md +1 -1
  115. package/.docs/reference/vectors/pg.md +1 -1
  116. package/.docs/reference/vectors/upstash.md +1 -1
  117. package/.docs/reference/voice/voice.addInstructions.md +1 -1
  118. package/.docs/reference/workspace/e2b-sandbox.md +1 -1
  119. package/.docs/reference/workspace/gcs-filesystem.md +1 -1
  120. package/.docs/reference/workspace/local-filesystem.md +1 -1
  121. package/.docs/reference/workspace/local-sandbox.md +1 -1
  122. package/.docs/reference/workspace/s3-filesystem.md +1 -1
  123. package/CHANGELOG.md +15 -0
  124. package/package.json +5 -5
@@ -42,7 +42,7 @@ SUCCESS CRITERIA
42
42
  - Deliver accurate and helpful analysis of transaction data.
43
43
  - Achieve high user satisfaction through clear and helpful responses.
44
44
  - Maintain user trust by ensuring data privacy and security.`,
45
- model: 'openai/gpt-4.1-mini',
45
+ model: 'openai/gpt-5.4',
46
46
  tools: {}, // We'll add tools in a later step
47
47
  })
48
48
  ```
@@ -19,7 +19,7 @@ export const financialAgent = new Agent({
19
19
  TOOLS
20
20
  - Use the getTransactions tool to fetch financial transaction data.
21
21
  - Analyze the transaction data to answer user questions about their spending.`,
22
- model: 'openai/gpt-4.1-mini',
22
+ model: 'openai/gpt-5.4',
23
23
  tools: { getTransactionsTool }, // Add our tool here
24
24
  })
25
25
  ```
@@ -19,7 +19,7 @@ export const financialAgent = new Agent({
19
19
  instructions: `ROLE DEFINITION
20
20
  // ... existing instructions ...
21
21
  `,
22
- model: 'openai/gpt-4.1-mini',
22
+ model: 'openai/gpt-5.4',
23
23
  tools: { getTransactionsTool },
24
24
  memory: new Memory({
25
25
  storage: new LibSQLStore({
@@ -10,7 +10,7 @@ export const personalAssistantAgent = new Agent({
10
10
 
11
11
  Keep your responses concise and friendly.
12
12
  `,
13
- model: 'openai/gpt-4.1-mini',
13
+ model: 'openai/gpt-5.4',
14
14
  tools: { ...mcpTools }, // Add MCP tools to your agent
15
15
  })
16
16
  ```
@@ -18,7 +18,7 @@ export const personalAssistantAgent = new Agent({
18
18
 
19
19
  Keep your responses concise and friendly.
20
20
  `,
21
- model: 'openai/gpt-4.1-mini',
21
+ model: 'openai/gpt-5.4',
22
22
  tools: { ...mcpTools },
23
23
  memory,
24
24
  })
@@ -22,7 +22,7 @@ export const personalAssistantAgent = new Agent({
22
22
 
23
23
  Keep your responses concise and friendly.
24
24
  `,
25
- model: 'openai/gpt-4.1-mini',
25
+ model: 'openai/gpt-5.4',
26
26
  tools: { ...mcpTools },
27
27
  memory,
28
28
  })
@@ -27,7 +27,7 @@ export const personalAssistantAgent = new Agent({
27
27
 
28
28
  Keep your responses concise and friendly.
29
29
  `,
30
- model: 'openai/gpt-4.1-mini',
30
+ model: 'openai/gpt-5.4',
31
31
  tools: { ...mcpTools },
32
32
  memory,
33
33
  })
@@ -34,7 +34,7 @@ export const personalAssistantAgent = new Agent({
34
34
 
35
35
  Keep your responses concise and friendly.
36
36
  `,
37
- model: 'openai/gpt-4.1-mini',
37
+ model: 'openai/gpt-5.4',
38
38
  tools: { ...mcpTools },
39
39
  memory,
40
40
  })
@@ -61,7 +61,7 @@ export const personalAssistantAgent = new Agent({
61
61
  Always maintain a helpful and professional tone.
62
62
  Use the stored information to provide more personalized responses.
63
63
  `,
64
- model: 'openai/gpt-4.1-mini',
64
+ model: 'openai/gpt-5.4',
65
65
  tools: { ...mcpTools },
66
66
  memory,
67
67
  })
@@ -26,7 +26,7 @@ export const memoryAgent = new Agent({
26
26
  When a user shares information about themselves, acknowledge it and remember it for future reference.
27
27
  If asked about something mentioned earlier in the conversation, recall it accurately.
28
28
  `,
29
- model: 'openai/gpt-4.1-mini',
29
+ model: 'openai/gpt-5.4',
30
30
  memory: memory,
31
31
  })
32
32
  ```
@@ -26,7 +26,7 @@ export const memoryAgent = new Agent({
26
26
  When a user shares information about themselves, acknowledge it and remember it for future reference.
27
27
  If asked about something mentioned earlier in the conversation, recall it accurately.
28
28
  `,
29
- model: 'openai/gpt-4.1-mini',
29
+ model: 'openai/gpt-5.4',
30
30
  memory: memory,
31
31
  })
32
32
  ```
@@ -34,7 +34,7 @@ export const memoryAgent = new Agent({
34
34
  If asked about something mentioned earlier in the conversation, recall it accurately.
35
35
  You can also recall relevant information from older conversations when appropriate.
36
36
  `,
37
- model: 'openai/gpt-4.1-mini',
37
+ model: 'openai/gpt-5.4',
38
38
  memory: memory,
39
39
  })
40
40
  ```
@@ -51,7 +51,7 @@ export const memoryAgent = new Agent({
51
51
  Always refer to your working memory before asking for information the user has already provided.
52
52
  Use the information in your working memory to provide personalized responses.
53
53
  `,
54
- model: 'openai/gpt-4.1-mini',
54
+ model: 'openai/gpt-5.4',
55
55
  memory: memory,
56
56
  })
57
57
  ```
@@ -73,7 +73,7 @@ export const memoryAgent = new Agent({
73
73
  When the user shares personal information such as their name, location, or preferences,
74
74
  acknowledge it and update your working memory accordingly.
75
75
  `,
76
- model: 'openai/gpt-4.1-mini',
76
+ model: 'openai/gpt-5.4',
77
77
  memory: memory,
78
78
  })
79
79
  ```
@@ -87,7 +87,7 @@ export const learningAssistantAgent = new Agent({
87
87
  Always be encouraging and supportive. Focus on building the user's confidence
88
88
  and celebrating their progress.
89
89
  `,
90
- model: 'openai/gpt-4.1-mini',
90
+ model: 'openai/gpt-5.4',
91
91
  memory: learningMemory,
92
92
  })
93
93
 
@@ -22,7 +22,7 @@ export const contentAgent = new Agent({
22
22
 
23
23
  Always provide constructive, actionable feedback.
24
24
  `,
25
- model: 'openai/gpt-4.1-mini',
25
+ model: 'openai/gpt-5.4',
26
26
  })
27
27
  ```
28
28
 
@@ -31,7 +31,7 @@ export const contentAgent = new Agent({
31
31
  - **Name**: Unique identifier for the agent
32
32
  - **Description**: What the agent does
33
33
  - **Instructions**: Detailed prompts that guide the AI's behavior
34
- - **Model**: Which AI model to use (GPT-4.1-mini is fast and cost-effective)
34
+ - **Model**: Which AI model to use
35
35
 
36
36
  ## Registering and Testing Your Agent
37
37
 
@@ -20,7 +20,7 @@ export const agent = new Agent({
20
20
  id: 'voice-agent',
21
21
  name: 'Voice Agent',
22
22
  instructions: `You are a helpful assistant with both STT and TTS capabilities.`,
23
- model: 'openai/gpt-5.1',
23
+ model: 'openai/gpt-5.4',
24
24
  voice,
25
25
  })
26
26
 
@@ -109,7 +109,7 @@ export const agent = new Agent({
109
109
  id: 'speech-to-speech-agent',
110
110
  name: 'Speech-to-Speech Agent',
111
111
  instructions: `You are a helpful assistant with speech-to-speech capabilities.`,
112
- model: 'openai/gpt-5.1',
112
+ model: 'openai/gpt-5.4',
113
113
  tools: {
114
114
  // Tools configured on Agent are passed to voice provider
115
115
  search,
@@ -209,7 +209,7 @@ export const convertToText = async (input: string | NodeJS.ReadableStream): Prom
209
209
  export const hybridVoiceAgent = new Agent({
210
210
  id: 'hybrid-voice-agent',
211
211
  name: 'Hybrid Voice Agent',
212
- model: 'openai/gpt-5.1',
212
+ model: 'openai/gpt-5.4',
213
213
  instructions: 'You can speak and listen using different providers.',
214
214
  voice: new CompositeVoice({
215
215
  input: new OpenAIVoice(),
@@ -221,7 +221,7 @@ export const unifiedVoiceAgent = new Agent({
221
221
  id: 'unified-voice-agent',
222
222
  name: 'Unified Voice Agent',
223
223
  instructions: 'You are an agent with both STT and TTS capabilities.',
224
- model: 'openai/gpt-5.1',
224
+ model: 'openai/gpt-5.4',
225
225
  voice: new OpenAIVoice(),
226
226
  })
227
227
 
@@ -263,7 +263,7 @@ export const agent = new Agent({
263
263
  id: 'voice-agent',
264
264
  name: 'Voice Agent',
265
265
  instructions: `You are a helpful assistant with both STT and TTS capabilities.`,
266
- model: 'openai/gpt-5.1',
266
+ model: 'openai/gpt-5.4',
267
267
 
268
268
  // Create a composite voice using OpenAI for listening and PlayAI for speaking
269
269
  voice: new CompositeVoice({
@@ -288,7 +288,7 @@ export const agent = new Agent({
288
288
  id: 'aisdk-voice-agent',
289
289
  name: 'AI SDK Voice Agent',
290
290
  instructions: `You are a helpful assistant with voice capabilities.`,
291
- model: 'openai/gpt-5.1',
291
+ model: 'openai/gpt-5.4',
292
292
 
293
293
  // Pass AI SDK models directly to CompositeVoice
294
294
  voice: new CompositeVoice({
@@ -278,7 +278,7 @@ const agent = new Agent({
278
278
  id: 'my-agent',
279
279
  name: 'My Agent',
280
280
  instructions: 'You are a helpful assistant',
281
- model: 'openai/gpt-4o-mini',
281
+ model: 'openai/gpt-5-mini',
282
282
  tools: { weatherTool },
283
283
  memory: new Memory(),
284
284
  defaultOptions: {
@@ -343,7 +343,7 @@ const agent = new Agent({
343
343
  id: 'my-agent',
344
344
  name: 'My Agent',
345
345
  instructions: 'You are a helpful assistant',
346
- model: 'openai/gpt-4o-mini',
346
+ model: 'openai/gpt-5-mini',
347
347
  tools: { weatherTool },
348
348
  memory: new Memory(),
349
349
  defaultOptions: {
@@ -445,7 +445,7 @@ const dataAgent = new Agent({
445
445
  id: 'data-agent',
446
446
  name: 'Data Agent',
447
447
  description: 'Handles database queries and user data retrieval',
448
- model: 'openai/gpt-4o-mini',
448
+ model: 'openai/gpt-5-mini',
449
449
  tools: { findUserTool },
450
450
  })
451
451
 
@@ -454,7 +454,7 @@ const supervisorAgent = new Agent({
454
454
  name: 'Supervisor Agent',
455
455
  instructions: `You coordinate data retrieval tasks.
456
456
  Delegate to data-agent for user lookups.`,
457
- model: 'openai/gpt-5.1',
457
+ model: 'openai/gpt-5.4',
458
458
  agents: { dataAgent },
459
459
  memory: new Memory(),
460
460
  })
@@ -25,7 +25,7 @@ export const moderatedAgent = new Agent({
25
25
  id: 'moderated-agent',
26
26
  name: 'Moderated Agent',
27
27
  instructions: 'You are a helpful assistant',
28
- model: 'openai/gpt-5.1',
28
+ model: 'openai/gpt-5.4',
29
29
  inputProcessors: [
30
30
  new ModerationProcessor({
31
31
  model: 'openrouter/openai/gpt-oss-safeguard-20b',
@@ -176,7 +176,7 @@ const routingAgent = new Agent({
176
176
  id: 'routing-agent',
177
177
  name: 'Routing Agent',
178
178
  instructions: 'You coordinate tasks across multiple agents',
179
- model: 'openai/gpt-4o-mini',
179
+ model: 'openai/gpt-5-mini',
180
180
  tools: { confirmationTool },
181
181
  memory: new Memory(),
182
182
  defaultNetworkOptions: {
@@ -48,7 +48,7 @@ export const routingAgent = new Agent({
48
48
  Always respond with a complete report—no bullet points.
49
49
  Write in full paragraphs, like a blog post.
50
50
  Do not answer with incomplete or uncertain information.`,
51
- model: 'openai/gpt-5.1',
51
+ model: 'openai/gpt-5.4',
52
52
  agents: {
53
53
  researchAgent,
54
54
  writingAgent,
@@ -53,7 +53,7 @@ Agents use LLMs and tools to solve open-ended tasks. They reason about goals, de
53
53
  id: 'test-agent',
54
54
  name: 'Test Agent',
55
55
  instructions: 'You are a helpful assistant.',
56
- model: 'openai/gpt-5.1',
56
+ model: 'openai/gpt-5.4',
57
57
  })
58
58
  ```
59
59
 
@@ -283,7 +283,7 @@ export const testAgent = new Agent({
283
283
  model: ({ requestContext }) => {
284
284
  const userTier = requestContext.get('user-tier') as UserTier['user-tier']
285
285
 
286
- return userTier === 'enterprise' ? 'openai/gpt-5' : 'openai/gpt-4.1-nano'
286
+ return userTier === 'enterprise' ? 'openai/gpt-5.4' : 'openai/gpt-5-mini'
287
287
  },
288
288
  })
289
289
  ```
@@ -37,10 +37,10 @@ import { ModerationProcessor } from '@mastra/core/processors'
37
37
  export const moderatedAgent = new Agent({
38
38
  name: 'moderated-agent',
39
39
  instructions: 'You are a helpful assistant',
40
- model: 'openai/gpt-4o-mini',
40
+ model: 'openai/gpt-5-mini',
41
41
  inputProcessors: [
42
42
  new ModerationProcessor({
43
- model: 'openai/gpt-4.1-nano',
43
+ model: 'openai/gpt-5-mini',
44
44
  categories: ['hate', 'harassment', 'violence'],
45
45
  threshold: 0.7,
46
46
  strategy: 'block',
@@ -178,7 +178,7 @@ export class DynamicModelProcessor implements Processor {
178
178
  }: ProcessInputStepArgs): Promise<ProcessInputStepResult> {
179
179
  // Use a fast model for initial response
180
180
  if (stepNumber === 0) {
181
- return { model: 'openai/gpt-4o-mini' }
181
+ return { model: 'openai/gpt-5-mini' }
182
182
  }
183
183
 
184
184
  // Disable tools after 5 steps to force completion
@@ -270,7 +270,7 @@ const MAX_STEPS = 5
270
270
  const agent = new Agent({
271
271
  id: 'bounded-agent',
272
272
  name: 'Bounded Agent',
273
- model: 'openai/gpt-4o-mini',
273
+ model: 'openai/gpt-5-mini',
274
274
  tools: {
275
275
  /* your tools */
276
276
  },
@@ -291,7 +291,7 @@ For simpler per-step logic, you can use the `prepareStep` callback on `generate(
291
291
  await agent.generate('Complex task', {
292
292
  prepareStep: async ({ stepNumber, model }) => {
293
293
  if (stepNumber === 0) {
294
- return { model: 'openai/gpt-4o-mini' }
294
+ return { model: 'openai/gpt-5-mini' }
295
295
  }
296
296
  if (stepNumber > 5) {
297
297
  return { toolChoice: 'none' }
@@ -482,7 +482,7 @@ import { TokenLimiter } from '@mastra/core/processors'
482
482
 
483
483
  const agent = new Agent({
484
484
  name: 'my-agent',
485
- model: 'openai/gpt-4o',
485
+ model: 'openai/gpt-5.4',
486
486
  inputProcessors: [
487
487
  // Ensure the total tokens don't exceed ~127k
488
488
  new TokenLimiter(127000),
@@ -490,7 +490,7 @@ const agent = new Agent({
490
490
  })
491
491
  ```
492
492
 
493
- The `TokenLimiter` uses the `o200k_base` encoding by default (suitable for GPT-4o). You can specify other encodings for different models:
493
+ The `TokenLimiter` uses the `o200k_base` encoding by default. You can specify other encodings for different models:
494
494
 
495
495
  ```typescript
496
496
  import cl100k_base from 'js-tiktoken/ranks/cl100k_base'
@@ -516,7 +516,7 @@ import { ToolCallFilter, TokenLimiter } from '@mastra/core/processors'
516
516
 
517
517
  const agent = new Agent({
518
518
  name: 'my-agent',
519
- model: 'openai/gpt-4o',
519
+ model: 'openai/gpt-5.4',
520
520
  inputProcessors: [
521
521
  // Example 1: Remove all tool calls/results
522
522
  new ToolCallFilter(),
@@ -542,7 +542,7 @@ import { ToolSearchProcessor } from '@mastra/core/processors'
542
542
 
543
543
  const agent = new Agent({
544
544
  name: 'my-agent',
545
- model: 'openai/gpt-4o',
545
+ model: 'openai/gpt-5.4',
546
546
  inputProcessors: [
547
547
  new ToolSearchProcessor({
548
548
  tools: {
@@ -584,7 +584,7 @@ const moderationWorkflow = createWorkflow({
584
584
  const agent = new Agent({
585
585
  id: 'moderated-agent',
586
586
  name: 'Moderated Agent',
587
- model: 'openai/gpt-4o',
587
+ model: 'openai/gpt-5.4',
588
588
  inputProcessors: [moderationWorkflow],
589
589
  })
590
590
  ```
@@ -619,7 +619,7 @@ export class QualityChecker implements Processor {
619
619
  const agent = new Agent({
620
620
  id: 'quality-agent',
621
621
  name: 'Quality Agent',
622
- model: 'openai/gpt-4o',
622
+ model: 'openai/gpt-5.4',
623
623
  outputProcessors: [new QualityChecker()],
624
624
  maxProcessorRetries: 3, // Maximum retry attempts (default: 3)
625
625
  })
@@ -137,7 +137,7 @@ const response = await testAgent.generate('Analyze the TypeScript programming la
137
137
  differentiators: z.array(z.string()),
138
138
  }),
139
139
  }),
140
- model: 'openai/gpt-4o',
140
+ model: 'openai/gpt-5.4',
141
141
  },
142
142
  })
143
143
 
@@ -207,7 +207,7 @@ When `model` is provided to the `structuredOutput` property, Mastra uses a separ
207
207
  const response = await testAgent.generate("Tell me about TypeScript.", {
208
208
  structuredOutput: {
209
209
  schema: yourSchema
210
- model: 'openai/gpt-4o'
210
+ model: 'openai/gpt-5.4'
211
211
  }
212
212
  });
213
213
  ```
@@ -221,7 +221,7 @@ const result = await agent.stream('weather in vancouver?', {
221
221
  prepareStep: async ({ stepNumber }) => {
222
222
  if (stepNumber === 0) {
223
223
  return {
224
- model: 'anthropic/claude-sonnet-4-20250514',
224
+ model: 'openai/gpt-5.4',
225
225
  tools: {
226
226
  weatherTool,
227
227
  },
@@ -229,7 +229,7 @@ const result = await agent.stream('weather in vancouver?', {
229
229
  }
230
230
  }
231
231
  return {
232
- model: 'anthropic/claude-sonnet-4-20250514',
232
+ model: 'openai/gpt-5.4',
233
233
  tools: undefined,
234
234
  structuredOutput: {
235
235
  schema: z.object({
@@ -24,20 +24,20 @@ import { LibSQLStore } from '@mastra/libsql'
24
24
  const researchAgent = new Agent({
25
25
  id: 'research-agent',
26
26
  description: 'Gathers factual information and returns bullet-point summaries.',
27
- model: 'openai/gpt-4o-mini',
27
+ model: 'openai/gpt-5-mini',
28
28
  })
29
29
 
30
30
  const writingAgent = new Agent({
31
31
  id: 'writing-agent',
32
32
  description: 'Transforms research into well-structured articles.',
33
- model: 'openai/gpt-4o-mini',
33
+ model: 'openai/gpt-5-mini',
34
34
  })
35
35
 
36
36
  const supervisor = new Agent({
37
37
  id: 'supervisor',
38
38
  instructions: `You coordinate research and writing using specialized agents.
39
39
  Delegate to research-agent for facts, then writing-agent for content.`,
40
- model: 'openai/gpt-5.1',
40
+ model: 'openai/gpt-5.4',
41
41
  agents: { researchAgent, writingAgent },
42
42
  memory: new Memory({
43
43
  storage: new LibSQLStore({ id: 'storage', url: 'file:mastra.db' }),
@@ -86,7 +86,7 @@ export const weatherAgent = new Agent({
86
86
  instructions: `
87
87
  You are a helpful weather assistant.
88
88
  Use the weatherTool to fetch current weather data.`,
89
- model: 'openai/gpt-5.1',
89
+ model: 'openai/gpt-5.4',
90
90
  tools: { weatherTool },
91
91
  })
92
92
  ```
@@ -118,7 +118,7 @@ export const parentAgent = new Agent({
118
118
  name: 'Parent Agent',
119
119
  description: 'Take care in writing a good description here',
120
120
  instructions: `Instructions`,
121
- model: 'openai/gpt-5.1',
121
+ model: 'openai/gpt-5.4',
122
122
  agents: {
123
123
  subAgent,
124
124
  },
@@ -129,7 +129,7 @@ const subAgent = new Agent({
129
129
  name: 'Sub Agent',
130
130
  description: 'Take care in writing a good description here',
131
131
  instructions: `Instructions`,
132
- model: 'openai/gpt-5.1',
132
+ model: 'openai/gpt-5.4',
133
133
  })
134
134
  ```
135
135
 
@@ -149,7 +149,7 @@ export const researchAgent = new Agent({
149
149
  instructions: `
150
150
  You are a research assistant.
151
151
  Use the research workflow to gather and compile information on topics.`,
152
- model: 'openai/gpt-5.1',
152
+ model: 'openai/gpt-5.4',
153
153
  tools: {
154
154
  weatherTool,
155
155
  },
@@ -44,7 +44,7 @@ const glutenCheckerScorer = createScorer({
44
44
  id: 'gluten-checker',
45
45
  description: 'Check if recipes contain gluten ingredients',
46
46
  judge: { // Optional: for prompt object steps
47
- model: 'openai/gpt-5.1',
47
+ model: 'openai/gpt-5.4',
48
48
  instructions: 'You are a Chef that identifies if recipes contain gluten.'
49
49
  }
50
50
  })
@@ -71,7 +71,7 @@ const quoteSourcesScorer = createScorer({
71
71
  id: 'quote-sources',
72
72
  description: 'Check if the response includes sources',
73
73
  judge: {
74
- model: 'openai/gpt-4.1-nano',
74
+ model: 'openai/gpt-5-mini',
75
75
  instructions: 'You are a strict evaluator.',
76
76
  },
77
77
  })
@@ -341,7 +341,7 @@ export const glutenCheckerScorer = createScorer({
341
341
  id: 'gluten-checker',
342
342
  description: 'Check if the output contains any gluten',
343
343
  judge: {
344
- model: 'openai/gpt-4.1-nano',
344
+ model: 'openai/gpt-5-mini',
345
345
  instructions: GLUTEN_INSTRUCTIONS,
346
346
  },
347
347
  })
@@ -376,7 +376,7 @@ Sets up the LLM model and defines its role as a domain expert.
376
376
 
377
377
  ```typescript
378
378
  judge: {
379
- model: 'openai/gpt-4.1-nano',
379
+ model: 'openai/gpt-5-mini',
380
380
  instructions: GLUTEN_INSTRUCTIONS,
381
381
  }
382
382
  ```
@@ -57,11 +57,11 @@ import { createAnswerRelevancyScorer, createToxicityScorer } from '@mastra/evals
57
57
  export const evaluatedAgent = new Agent({
58
58
  scorers: {
59
59
  relevancy: {
60
- scorer: createAnswerRelevancyScorer({ model: 'openai/gpt-4.1-nano' }),
60
+ scorer: createAnswerRelevancyScorer({ model: 'openai/gpt-5-mini' }),
61
61
  sampling: { type: 'ratio', rate: 0.5 },
62
62
  },
63
63
  safety: {
64
- scorer: createToxicityScorer({ model: 'openai/gpt-4.1-nano' }),
64
+ scorer: createToxicityScorer({ model: 'openai/gpt-5-mini' }),
65
65
  sampling: { type: 'ratio', rate: 1 },
66
66
  },
67
67
  },
@@ -82,7 +82,7 @@ export const testAgent = new Agent({
82
82
  - US National Weather Service
83
83
 
84
84
  Answer questions using the information you find using the MCP Servers.`,
85
- model: 'openai/gpt-5.1',
85
+ model: 'openai/gpt-5.4',
86
86
  tools: await testMcpClient.listTools(),
87
87
  })
88
88
  ```
@@ -45,7 +45,7 @@ const agent = new Agent({
45
45
  id: 'test-agent',
46
46
  name: 'Test Agent',
47
47
  instructions: 'You are a helpful assistant',
48
- model: 'openai/gpt-4o',
48
+ model: 'openai/gpt-5.4',
49
49
  memory: new Memory({
50
50
  storage: new LibSQLStore({
51
51
  id: 'memory-store',
@@ -95,7 +95,7 @@ import { openai } from '@ai-sdk/openai'
95
95
  const agent = new Agent({
96
96
  name: 'semantic-agent',
97
97
  instructions: 'You are a helpful assistant with semantic memory',
98
- model: 'openai/gpt-4o',
98
+ model: 'openai/gpt-5.4',
99
99
  memory: new Memory({
100
100
  storage: new LibSQLStore({
101
101
  id: 'memory-store',
@@ -148,7 +148,7 @@ import { openai } from '@ai-sdk/openai'
148
148
  const agent = new Agent({
149
149
  name: 'working-memory-agent',
150
150
  instructions: 'You are an assistant with working memory',
151
- model: 'openai/gpt-4o',
151
+ model: 'openai/gpt-5.4',
152
152
  memory: new Memory({
153
153
  storage: new LibSQLStore({
154
154
  id: 'memory-store',
@@ -180,7 +180,7 @@ const customMessageHistory = new MessageHistory({
180
180
  const agent = new Agent({
181
181
  name: 'custom-memory-agent',
182
182
  instructions: 'You are a helpful assistant',
183
- model: 'openai/gpt-4o',
183
+ model: 'openai/gpt-5.4',
184
184
  memory: new Memory({
185
185
  storage: new LibSQLStore({ id: 'memory-store', url: 'file:memory.db' }),
186
186
  lastMessages: 10, // This would normally add MessageHistory(10)
@@ -250,7 +250,7 @@ const contentBlocker = {
250
250
  const agent = new Agent({
251
251
  name: 'safe-agent',
252
252
  instructions: 'You are a helpful assistant',
253
- model: 'openai/gpt-4o',
253
+ model: 'openai/gpt-5.4',
254
254
  memory: new Memory({ lastMessages: 10 }),
255
255
  // Your guardrail runs BEFORE memory saves
256
256
  outputProcessors: [contentBlocker],
@@ -289,7 +289,7 @@ const inputValidator = {
289
289
  const agent = new Agent({
290
290
  name: 'validated-agent',
291
291
  instructions: 'You are a helpful assistant',
292
- model: 'openai/gpt-4o',
292
+ model: 'openai/gpt-5.4',
293
293
  memory: new Memory({ lastMessages: 10 }),
294
294
  // Your guardrail runs AFTER memory loads history
295
295
  inputProcessors: [inputValidator],
@@ -28,7 +28,7 @@ const agent = new Agent({
28
28
  id: 'support-agent',
29
29
  name: 'SupportAgent',
30
30
  instructions: 'You are a helpful support agent.',
31
- model: 'openai/gpt-5.1',
31
+ model: 'openai/gpt-5.4',
32
32
  memory: new Memory(),
33
33
  })
34
34
  ```
@@ -180,7 +180,7 @@ export const agent = new Agent({
180
180
  memory: new Memory({
181
181
  options: {
182
182
  generateTitle: {
183
- model: 'openai/gpt-4o-mini',
183
+ model: 'openai/gpt-5-mini',
184
184
  instructions: 'Generate a 1 word title',
185
185
  },
186
186
  },
@@ -26,7 +26,7 @@ const agent = new Agent({
26
26
  id: 'personal-assistant',
27
27
  name: 'PersonalAssistant',
28
28
  instructions: 'You are a helpful personal assistant.',
29
- model: 'openai/gpt-5.1',
29
+ model: 'openai/gpt-5.4',
30
30
  memory: new Memory({
31
31
  options: {
32
32
  workingMemory: {
@@ -268,7 +268,7 @@ Schema-based working memory uses **merge semantics**, meaning the agent only nee
268
268
  ## Choosing between template and schema
269
269
 
270
270
  - Use a **template** (Markdown) if you want the agent to maintain memory as a free-form text block, such as a user profile or scratchpad. Templates use **replace semantics** — the agent must provide the complete memory content on each update.
271
- - Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. Schemas use **merge semantics** — the agent only provides fields to update, and existing fields are preserved.
271
+ - Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. The `workingMemory.schema` field accepts any `PublicSchema`-compatible schema (including Zod v3, Zod v4, JSON Schema, or already-standard schemas). Schemas use **merge semantics** — the agent only provides fields to update, and existing fields are preserved.
272
272
  - Only one mode can be active at a time: setting both `template` and `schema` isn't supported.
273
273
 
274
274
  ## Example: Multi-step retention