@mastra/mcp-docs-server 1.1.41 → 1.1.42-alpha.11
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/access-control.md +97 -0
- package/.docs/docs/agent-builder/browser.md +61 -0
- package/.docs/docs/agent-builder/channels.md +76 -0
- package/.docs/docs/agent-builder/configuration.md +147 -0
- package/.docs/docs/agent-builder/deploying.md +121 -0
- package/.docs/docs/agent-builder/memory.md +65 -0
- package/.docs/docs/agent-builder/model-policy.md +48 -0
- package/.docs/docs/agent-builder/overview.md +97 -0
- package/.docs/docs/agent-builder/skill-registries.md +31 -0
- package/.docs/docs/agent-builder/workspace.md +60 -0
- package/.docs/docs/agents/a2a.md +1 -1
- package/.docs/docs/agents/acp.md +4 -4
- package/.docs/docs/agents/adding-voice.md +37 -6
- package/.docs/docs/agents/agent-approval.md +15 -1
- package/.docs/docs/agents/background-tasks.md +2 -2
- package/.docs/docs/agents/channels.md +3 -1
- package/.docs/docs/agents/code-mode.md +163 -0
- package/.docs/docs/agents/guardrails.md +2 -2
- package/.docs/docs/agents/networks.md +1 -1
- package/.docs/docs/agents/overview.md +1 -1
- package/.docs/docs/agents/processors.md +3 -3
- package/.docs/docs/agents/response-caching.md +1 -1
- package/.docs/docs/agents/sdk-agents.md +261 -0
- package/.docs/docs/agents/signals.md +150 -73
- package/.docs/docs/agents/structured-output.md +5 -5
- package/.docs/docs/agents/supervisor-agents.md +2 -2
- package/.docs/docs/agents/using-tools.md +5 -5
- package/.docs/docs/browser/agent-browser.md +1 -1
- package/.docs/docs/browser/browser-viewer.md +1 -1
- package/.docs/docs/browser/overview.md +1 -1
- package/.docs/docs/browser/stagehand.md +5 -5
- package/.docs/docs/editor/overview.md +70 -8
- package/.docs/docs/evals/custom-scorers.md +1 -1
- package/.docs/docs/evals/datasets/running-experiments.md +1 -1
- package/.docs/docs/evals/overview.md +2 -2
- package/.docs/docs/getting-started/manual-install.md +1 -1
- package/.docs/docs/mcp/mcp-apps.md +3 -3
- package/.docs/docs/mcp/overview.md +1 -1
- package/.docs/docs/memory/memory-processors.md +6 -6
- package/.docs/docs/memory/multi-user-threads.md +1 -1
- package/.docs/docs/memory/observational-memory.md +19 -0
- package/.docs/docs/memory/semantic-recall.md +2 -2
- package/.docs/docs/memory/storage.md +2 -1
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/metrics/overview.md +1 -0
- package/.docs/docs/observability/metrics/querying.md +292 -0
- package/.docs/docs/observability/tracing/exporters/langfuse.md +1 -1
- package/.docs/docs/observability/tracing/exporters/langsmith.md +2 -2
- package/.docs/docs/rag/graph-rag.md +2 -2
- package/.docs/docs/rag/retrieval.md +12 -12
- package/.docs/docs/server/auth/fga.md +4 -0
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/request-context.md +3 -3
- package/.docs/docs/streaming/overview.md +1 -1
- package/.docs/docs/streaming/tool-streaming.md +1 -1
- package/.docs/docs/voice/overview.md +86 -24
- package/.docs/docs/voice/speech-to-speech.md +55 -4
- package/.docs/docs/voice/speech-to-text.md +1 -1
- package/.docs/docs/voice/text-to-speech.md +1 -1
- package/.docs/docs/workspace/filesystem.md +2 -2
- package/.docs/docs/workspace/overview.md +1 -1
- package/.docs/docs/workspace/sandbox.md +5 -3
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +1 -1
- package/.docs/guides/deployment/inngest.md +69 -0
- package/.docs/guides/guide/ai-recruiter.md +1 -1
- package/.docs/guides/guide/chef-michel.md +1 -1
- package/.docs/guides/guide/code-review-bot.md +1 -1
- package/.docs/guides/guide/dev-assistant.md +1 -1
- package/.docs/guides/guide/docs-manager.md +1 -1
- package/.docs/guides/guide/firecrawl.md +6 -6
- package/.docs/guides/guide/github-actions-pr-description.md +1 -1
- package/.docs/guides/guide/research-assistant.md +1 -1
- package/.docs/guides/guide/research-coordinator.md +2 -2
- package/.docs/guides/guide/slack-assistant.md +1 -1
- package/.docs/guides/guide/stock-agent.md +2 -2
- package/.docs/guides/guide/whatsapp-chat-bot.md +2 -2
- package/.docs/guides/migrations/agentnetwork.md +4 -4
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +1 -1
- package/.docs/guides/migrations/vnext-to-standard-apis.md +2 -2
- package/.docs/models/embeddings.md +2 -2
- package/.docs/reference/agents/agent.md +60 -21
- package/.docs/reference/agents/channels.md +48 -6
- package/.docs/reference/agents/generateLegacy.md +1 -1
- package/.docs/reference/agents/getLLM.md +2 -2
- package/.docs/reference/agents/getMetadata.md +2 -2
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/browser/agent-browser.md +1 -1
- package/.docs/reference/browser/browser-viewer.md +1 -1
- package/.docs/reference/browser/mastra-browser.md +1 -1
- package/.docs/reference/browser/stagehand-browser.md +5 -5
- package/.docs/reference/client-js/agent-builder.md +161 -0
- package/.docs/reference/client-js/agents.md +19 -2
- package/.docs/reference/client-js/mastra-client.md +4 -0
- package/.docs/reference/configuration.md +1 -1
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +74 -0
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +77 -0
- package/.docs/reference/editor/agent-builder/builder-models.md +64 -0
- package/.docs/reference/editor/blob-store-provider.md +59 -0
- package/.docs/reference/editor/browser-provider.md +75 -0
- package/.docs/reference/editor/filesystem-provider.md +62 -0
- package/.docs/reference/editor/mastra-editor.md +61 -1
- package/.docs/reference/editor/processor-provider.md +64 -0
- package/.docs/reference/editor/sandbox-provider.md +61 -0
- package/.docs/reference/editor/storage-browser-ref.md +80 -0
- package/.docs/reference/editor/storage-workspace-ref.md +93 -0
- package/.docs/reference/evals/answer-relevancy.md +1 -1
- package/.docs/reference/evals/answer-similarity.md +1 -1
- package/.docs/reference/evals/bias.md +1 -1
- package/.docs/reference/evals/context-precision.md +3 -3
- package/.docs/reference/evals/context-relevance.md +11 -11
- package/.docs/reference/evals/create-scorer.md +2 -0
- package/.docs/reference/evals/faithfulness.md +1 -1
- package/.docs/reference/evals/hallucination.md +5 -5
- package/.docs/reference/evals/noise-sensitivity.md +11 -11
- package/.docs/reference/evals/prompt-alignment.md +15 -15
- package/.docs/reference/evals/tool-call-accuracy.md +3 -3
- package/.docs/reference/evals/toxicity.md +1 -1
- package/.docs/reference/index.md +15 -0
- package/.docs/reference/memory/memory-class.md +3 -3
- package/.docs/reference/memory/observational-memory.md +6 -4
- package/.docs/reference/memory/serialized-memory-config.md +72 -0
- package/.docs/reference/observability/metrics/automatic-metrics.md +7 -1
- package/.docs/reference/observability/tracing/exporters/langfuse.md +1 -1
- package/.docs/reference/processors/batch-parts-processor.md +1 -1
- package/.docs/reference/processors/cost-guard-processor.md +1 -1
- package/.docs/reference/processors/language-detector.md +1 -1
- package/.docs/reference/processors/message-history-processor.md +1 -1
- package/.docs/reference/processors/moderation-processor.md +2 -2
- package/.docs/reference/processors/pii-detector.md +2 -2
- package/.docs/reference/processors/prefill-error-handler.md +2 -2
- package/.docs/reference/processors/processor-interface.md +2 -2
- package/.docs/reference/processors/prompt-injection-detector.md +1 -1
- package/.docs/reference/processors/regex-filter-processor.md +1 -1
- package/.docs/reference/processors/semantic-recall-processor.md +1 -1
- package/.docs/reference/processors/skill-search-processor.md +1 -1
- package/.docs/reference/processors/system-prompt-scrubber.md +1 -1
- package/.docs/reference/processors/token-limiter-processor.md +3 -3
- package/.docs/reference/processors/tool-call-filter.md +2 -2
- package/.docs/reference/processors/tool-search-processor.md +33 -2
- package/.docs/reference/processors/unicode-normalizer.md +1 -1
- package/.docs/reference/processors/working-memory-processor.md +1 -1
- package/.docs/reference/rag/rerank.md +1 -1
- package/.docs/reference/server/nestjs-adapter.md +1 -1
- package/.docs/reference/server/routes.md +108 -9
- package/.docs/reference/storage/dsql.md +1 -1
- package/.docs/reference/storage/mongodb.md +1 -1
- package/.docs/reference/storage/postgresql.md +1 -1
- package/.docs/reference/storage/redis.md +1 -1
- package/.docs/reference/storage/spanner.md +5 -0
- package/.docs/reference/storage/upstash.md +1 -1
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/templates/overview.md +3 -3
- package/.docs/reference/tools/mcp-client.md +53 -2
- package/.docs/reference/tools/mcp-server.md +33 -1
- package/.docs/reference/tools/vector-query-tool.md +1 -1
- package/.docs/reference/vectors/libsql.md +1 -1
- package/.docs/reference/vectors/mongodb.md +1 -1
- package/.docs/reference/vectors/pg.md +3 -1
- package/.docs/reference/vectors/upstash.md +1 -1
- package/.docs/reference/voice/google-gemini-live.md +15 -2
- package/.docs/reference/voice/inworld-realtime.md +353 -0
- package/.docs/reference/voice/inworld.md +2 -0
- package/.docs/reference/voice/voice.addInstructions.md +1 -1
- package/.docs/reference/workspace/agentcore-runtime-sandbox.md +202 -0
- package/.docs/reference/workspace/agentfs-filesystem.md +1 -1
- package/.docs/reference/workspace/azure-blob-filesystem.md +1 -1
- package/.docs/reference/workspace/blaxel-sandbox.md +3 -0
- package/.docs/reference/workspace/docker-sandbox.md +4 -2
- package/.docs/reference/workspace/e2b-sandbox.md +9 -5
- package/.docs/reference/workspace/files-sdk-filesystem.md +1 -1
- package/.docs/reference/workspace/gcs-filesystem.md +1 -1
- package/.docs/reference/workspace/google-drive-filesystem.md +1 -1
- package/.docs/reference/workspace/local-filesystem.md +1 -1
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/modal-sandbox.md +1 -1
- package/.docs/reference/workspace/s3-filesystem.md +1 -1
- package/.docs/reference/workspace/vercel-microvm-sandbox.md +199 -0
- package/.docs/reference/workspace/vercel.md +2 -0
- package/CHANGELOG.md +72 -0
- package/package.json +8 -6
|
@@ -81,7 +81,7 @@ import { TokenLimiterProcessor } from '@mastra/core/processors'
|
|
|
81
81
|
export const agent = new Agent({
|
|
82
82
|
name: 'context-limited-agent',
|
|
83
83
|
instructions: 'You are a helpful assistant',
|
|
84
|
-
model: 'openai/gpt-5.
|
|
84
|
+
model: 'openai/gpt-5.5',
|
|
85
85
|
memory: new Memory({
|
|
86
86
|
/* ... */
|
|
87
87
|
}),
|
|
@@ -102,7 +102,7 @@ import { TokenLimiterProcessor } from '@mastra/core/processors'
|
|
|
102
102
|
export const agent = new Agent({
|
|
103
103
|
name: 'multi-step-agent',
|
|
104
104
|
instructions: 'You are a helpful research assistant with access to tools',
|
|
105
|
-
model: 'openai/gpt-5.
|
|
105
|
+
model: 'openai/gpt-5.5',
|
|
106
106
|
inputProcessors: [
|
|
107
107
|
new TokenLimiterProcessor({ limit: 8000 }), // Applied at every step
|
|
108
108
|
],
|
|
@@ -125,7 +125,7 @@ import { TokenLimiterProcessor } from '@mastra/core/processors'
|
|
|
125
125
|
export const agent = new Agent({
|
|
126
126
|
name: 'response-limited-agent',
|
|
127
127
|
instructions: 'You are a helpful assistant',
|
|
128
|
-
model: 'openai/gpt-5.
|
|
128
|
+
model: 'openai/gpt-5.5',
|
|
129
129
|
outputProcessors: [
|
|
130
130
|
new TokenLimiterProcessor({
|
|
131
131
|
limit: 1000,
|
|
@@ -90,7 +90,7 @@ import { ToolCallFilter } from '@mastra/core/processors'
|
|
|
90
90
|
export const agent = new Agent({
|
|
91
91
|
name: 'filtered-agent',
|
|
92
92
|
instructions: 'You are a helpful assistant',
|
|
93
|
-
model: 'openai/gpt-5.
|
|
93
|
+
model: 'openai/gpt-5.5',
|
|
94
94
|
tools: {
|
|
95
95
|
searchDatabase,
|
|
96
96
|
sendEmail,
|
|
@@ -115,7 +115,7 @@ import { ToolCallFilter } from '@mastra/core/processors'
|
|
|
115
115
|
export const agent = new Agent({
|
|
116
116
|
name: 'no-tools-context-agent',
|
|
117
117
|
instructions: 'You are a helpful assistant',
|
|
118
|
-
model: 'openai/gpt-5.
|
|
118
|
+
model: 'openai/gpt-5.5',
|
|
119
119
|
tools: {
|
|
120
120
|
searchDatabase,
|
|
121
121
|
sendEmail,
|
|
@@ -35,6 +35,8 @@ const toolSearch = new ToolSearchProcessor({
|
|
|
35
35
|
|
|
36
36
|
**options.ttl** (`number`): Time-to-live for thread state in milliseconds. After this duration of inactivity, thread state will be cleaned up. Set to 0 to disable cleanup.
|
|
37
37
|
|
|
38
|
+
**options.filter** (`(args: ToolSearchFilterArgs) => boolean | Promise<boolean>`): Optional request-aware hook for hiding tools from search results, blocking tool loading, or hiding already-loaded tools for the current request.
|
|
39
|
+
|
|
38
40
|
## Returns
|
|
39
41
|
|
|
40
42
|
**id** (`string`): Processor identifier set to 'tool-search'
|
|
@@ -43,6 +45,35 @@ const toolSearch = new ToolSearchProcessor({
|
|
|
43
45
|
|
|
44
46
|
**processInputStep** (`(args: ProcessInputStepArgs) => Promise<ProcessInputStepResult>`): Processes each step to inject search/load meta-tools and any previously loaded tools into the agent's tool set.
|
|
45
47
|
|
|
48
|
+
## Request-aware filtering
|
|
49
|
+
|
|
50
|
+
Use `filter` to apply request-specific policy to dynamic tools. The hook receives the resolved tool ID as `toolName`, the tool, request context, and phase. `toolName` is the ID returned by `search_tools`, which may differ from the key used in the `tools` object.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { ToolSearchProcessor } from '@mastra/core/processors'
|
|
54
|
+
|
|
55
|
+
const toolSearch = new ToolSearchProcessor({
|
|
56
|
+
tools: allTools,
|
|
57
|
+
filter: ({ toolName, requestContext, phase }) => {
|
|
58
|
+
const plan = requestContext?.get('plan')
|
|
59
|
+
|
|
60
|
+
if (phase === 'search') {
|
|
61
|
+
return true
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return plan === 'pro' || !toolName.startsWith('premium_')
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The `phase` value describes where the filter is being applied:
|
|
70
|
+
|
|
71
|
+
- `search`: Filters results returned by `search_tools`.
|
|
72
|
+
- `load`: Blocks `load_tool` from loading disallowed tools.
|
|
73
|
+
- `active`: Hides already-loaded tools from the current request if they are no longer allowed.
|
|
74
|
+
|
|
75
|
+
If the hook throws or rejects, `ToolSearchProcessor` treats the tool as disallowed for that request. The hook may run for every matching search candidate, so keep async policy checks cheap or cached. The meta-tools `search_tools` and `load_tool` are always available. Tools passed directly through the agent or `processInputStep` remain available unless you filter them outside `ToolSearchProcessor`.
|
|
76
|
+
|
|
46
77
|
## Extended usage example
|
|
47
78
|
|
|
48
79
|
```typescript
|
|
@@ -70,7 +101,7 @@ const agent = new Agent({
|
|
|
70
101
|
name: 'dynamic-tools-agent',
|
|
71
102
|
instructions:
|
|
72
103
|
'You are a helpful assistant with access to many tools. Use search_tools to find relevant tools, then load_tool to make them available.',
|
|
73
|
-
model: 'openai/gpt-5.
|
|
104
|
+
model: 'openai/gpt-5.5',
|
|
74
105
|
inputProcessors: [toolSearch],
|
|
75
106
|
})
|
|
76
107
|
```
|
|
@@ -91,7 +122,7 @@ import { ToolSearchProcessor, TokenLimiter } from '@mastra/core/processors'
|
|
|
91
122
|
|
|
92
123
|
const agent = new Agent({
|
|
93
124
|
name: 'my-agent',
|
|
94
|
-
model: 'openai/gpt-5.
|
|
125
|
+
model: 'openai/gpt-5.5',
|
|
95
126
|
inputProcessors: [
|
|
96
127
|
new ToolSearchProcessor({
|
|
97
128
|
tools: allTools,
|
|
@@ -43,7 +43,7 @@ export const agent = new Agent({
|
|
|
43
43
|
id: 'normalized-agent',
|
|
44
44
|
name: 'normalized-agent',
|
|
45
45
|
instructions: 'You are a helpful assistant',
|
|
46
|
-
model: 'openai/gpt-5.
|
|
46
|
+
model: 'openai/gpt-5.5',
|
|
47
47
|
inputProcessors: [
|
|
48
48
|
new UnicodeNormalizer({
|
|
49
49
|
stripControlChars: true,
|
|
@@ -67,7 +67,7 @@ const storage = new PostgresStorage({
|
|
|
67
67
|
export const agent = new Agent({
|
|
68
68
|
name: 'personalized-agent',
|
|
69
69
|
instructions: 'You are a helpful assistant that remembers user preferences',
|
|
70
|
-
model: 'openai/gpt-5.
|
|
70
|
+
model: 'openai/gpt-5.5',
|
|
71
71
|
inputProcessors: [
|
|
72
72
|
new WorkingMemory({
|
|
73
73
|
storage,
|
|
@@ -16,7 +16,7 @@ function rerank(
|
|
|
16
16
|
```typescript
|
|
17
17
|
import { rerank } from '@mastra/rag'
|
|
18
18
|
|
|
19
|
-
const model = 'openai/gpt-5.
|
|
19
|
+
const model = 'openai/gpt-5.5'
|
|
20
20
|
|
|
21
21
|
const rerankedResults = await rerank(vectorSearchResults, 'How do I deploy to production?', model, {
|
|
22
22
|
weights: {
|
|
@@ -114,7 +114,7 @@ import { Mastra } from '@mastra/core/mastra'
|
|
|
114
114
|
greeter: {
|
|
115
115
|
name: 'greeter',
|
|
116
116
|
description: 'Greets the user',
|
|
117
|
-
model: config.get('MASTRA_MODEL', '
|
|
117
|
+
model: config.get('MASTRA_MODEL', 'openai/gpt-5-mini'),
|
|
118
118
|
},
|
|
119
119
|
},
|
|
120
120
|
}),
|
|
@@ -4,15 +4,20 @@ Server adapters register these routes when you call `server.init()`. All routes
|
|
|
4
4
|
|
|
5
5
|
## Agents
|
|
6
6
|
|
|
7
|
-
| Method | Path | Description
|
|
8
|
-
| ------ | -------------------------------------------- |
|
|
9
|
-
| `GET` | `/api/agents` | List all agents
|
|
10
|
-
| `GET` | `/api/agents/:agentId` | Get agent by ID (supports version query params)
|
|
11
|
-
| `POST` | `/api/agents/:agentId/generate` | Generate agent response
|
|
12
|
-
| `POST` | `/api/agents/:agentId/stream` | Stream agent response
|
|
13
|
-
| `POST` | `/api/agents/:agentId/
|
|
14
|
-
| `
|
|
15
|
-
| `POST` | `/api/agents/:agentId/
|
|
7
|
+
| Method | Path | Description |
|
|
8
|
+
| ------ | -------------------------------------------- | ----------------------------------------------------------------------- |
|
|
9
|
+
| `GET` | `/api/agents` | List all agents |
|
|
10
|
+
| `GET` | `/api/agents/:agentId` | Get agent by ID (supports version query params) |
|
|
11
|
+
| `POST` | `/api/agents/:agentId/generate` | Generate agent response |
|
|
12
|
+
| `POST` | `/api/agents/:agentId/stream` | Stream agent response |
|
|
13
|
+
| `POST` | `/api/agents/:agentId/send-message` | Send a user message to an active or idle thread |
|
|
14
|
+
| `POST` | `/api/agents/:agentId/queue-message` | Queue a user message for the next thread turn |
|
|
15
|
+
| `POST` | `/api/agents/:agentId/signals` | Send a lower-level signal to an active or idle thread |
|
|
16
|
+
| `POST` | `/api/agents/:agentId/threads/subscribe` | Subscribe to a thread stream |
|
|
17
|
+
| `POST` | `/api/agents/:agentId/send-tool-approval` | Approve or decline a tool call and resume through a thread subscription |
|
|
18
|
+
| `POST` | `/api/agents/:agentId/resume-stream` | Resume a suspended agent stream with custom data |
|
|
19
|
+
| `GET` | `/api/agents/:agentId/tools` | List agent tools |
|
|
20
|
+
| `POST` | `/api/agents/:agentId/tools/:toolId/execute` | Execute agent tool |
|
|
16
21
|
|
|
17
22
|
### Get agent query parameters
|
|
18
23
|
|
|
@@ -68,6 +73,100 @@ GET /api/agents/my-agent?versionId=abc123
|
|
|
68
73
|
}
|
|
69
74
|
```
|
|
70
75
|
|
|
76
|
+
### Agent message routes
|
|
77
|
+
|
|
78
|
+
Use `POST /api/agents/:agentId/send-message` to send a user message to the active agent loop or wake an idle thread. Use `POST /api/agents/:agentId/queue-message` when the active run should finish before Mastra starts a follow-up run.
|
|
79
|
+
|
|
80
|
+
Both routes accept the same request body:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
{
|
|
84
|
+
message: string | Array<TextPart | FilePart> | {
|
|
85
|
+
contents: string | Array<TextPart | FilePart>;
|
|
86
|
+
attributes?: Record<string, JSONValue>;
|
|
87
|
+
metadata?: Record<string, unknown>;
|
|
88
|
+
providerOptions?: ProviderMetadata;
|
|
89
|
+
};
|
|
90
|
+
runId?: string;
|
|
91
|
+
resourceId?: string;
|
|
92
|
+
threadId?: string;
|
|
93
|
+
ifActive?: {
|
|
94
|
+
behavior?: 'deliver' | 'persist' | 'discard';
|
|
95
|
+
attributes?: Record<string, string | number | boolean>;
|
|
96
|
+
};
|
|
97
|
+
ifIdle?: {
|
|
98
|
+
behavior?: 'wake' | 'persist' | 'discard';
|
|
99
|
+
streamOptions?: Omit<AgentExecutionOptions, 'messages'>;
|
|
100
|
+
attributes?: Record<string, string | number | boolean>;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
When `runId` is omitted, `resourceId` and `threadId` are required. `ifIdle` only applies to thread-targeted requests, not run-targeted requests.
|
|
106
|
+
|
|
107
|
+
#### Send a message
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
curl -X POST http://localhost:4111/api/agents/supportAgent/send-message \
|
|
111
|
+
-H 'Content-Type: application/json' \
|
|
112
|
+
-d '{
|
|
113
|
+
"message": {
|
|
114
|
+
"contents": "Show the shorter version.",
|
|
115
|
+
"attributes": { "sentFrom": "web" }
|
|
116
|
+
},
|
|
117
|
+
"resourceId": "user_123",
|
|
118
|
+
"threadId": "thread_456"
|
|
119
|
+
}'
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### Queue a message
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
curl -X POST http://localhost:4111/api/agents/supportAgent/queue-message \
|
|
126
|
+
-H 'Content-Type: application/json' \
|
|
127
|
+
-d '{
|
|
128
|
+
"message": "Also check whether the tests need updates.",
|
|
129
|
+
"resourceId": "user_123",
|
|
130
|
+
"threadId": "thread_456"
|
|
131
|
+
}'
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Both routes return:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
{
|
|
138
|
+
accepted: true;
|
|
139
|
+
runId: string;
|
|
140
|
+
signal?: CreatedAgentSignal;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Subscription tool approval routes
|
|
145
|
+
|
|
146
|
+
Use `POST /api/agents/:agentId/send-tool-approval` when the client already has an active thread subscription. The route resumes the run and returns a JSON acknowledgement. Resumed stream chunks are delivered through `POST /api/agents/:agentId/threads/subscribe`.
|
|
147
|
+
|
|
148
|
+
The route accepts this request body:
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
{
|
|
152
|
+
resourceId: string;
|
|
153
|
+
threadId: string;
|
|
154
|
+
toolCallId: string;
|
|
155
|
+
approved: boolean;
|
|
156
|
+
requestContext?: Record<string, unknown>;
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The route returns:
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
{
|
|
164
|
+
accepted: true;
|
|
165
|
+
runId: string;
|
|
166
|
+
toolCallId?: string;
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
71
170
|
## Workflows
|
|
72
171
|
|
|
73
172
|
| Method | Path | Description |
|
|
@@ -241,7 +241,7 @@ export const dsqlAgent = new Agent({
|
|
|
241
241
|
name: 'DSQL Agent',
|
|
242
242
|
instructions:
|
|
243
243
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
244
|
-
model: 'openai/gpt-5.
|
|
244
|
+
model: 'openai/gpt-5.5',
|
|
245
245
|
memory: new Memory({
|
|
246
246
|
storage: new DSQLStore({
|
|
247
247
|
id: 'dsql-agent-storage',
|
|
@@ -206,7 +206,7 @@ export const mongodbAgent = new Agent({
|
|
|
206
206
|
name: 'mongodb-agent',
|
|
207
207
|
instructions:
|
|
208
208
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
209
|
-
model: 'openai/gpt-5.
|
|
209
|
+
model: 'openai/gpt-5.5',
|
|
210
210
|
memory: new Memory({
|
|
211
211
|
storage: new MongoDBStore({
|
|
212
212
|
uri: process.env.MONGODB_URI!,
|
|
@@ -332,7 +332,7 @@ export const pgAgent = new Agent({
|
|
|
332
332
|
name: 'PG Agent',
|
|
333
333
|
instructions:
|
|
334
334
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
335
|
-
model: 'openai/gpt-5.
|
|
335
|
+
model: 'openai/gpt-5.5',
|
|
336
336
|
memory: new Memory({
|
|
337
337
|
storage: new PostgresStore({
|
|
338
338
|
id: 'pg-agent-storage',
|
|
@@ -181,7 +181,7 @@ export const redisAgent = new Agent({
|
|
|
181
181
|
name: 'Redis Agent',
|
|
182
182
|
instructions:
|
|
183
183
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
184
|
-
model: 'openai/gpt-5.
|
|
184
|
+
model: 'openai/gpt-5.5',
|
|
185
185
|
memory: new Memory({
|
|
186
186
|
storage: new RedisStore({
|
|
187
187
|
id: 'redis-agent-storage',
|
|
@@ -122,6 +122,11 @@ The storage adapter creates the following tables, all using the GoogleSQL dialec
|
|
|
122
122
|
- `mastra_prompt_blocks` / `mastra_prompt_block_versions`: prompt block records and versioned content snapshots (template content, rules, request-context schema)
|
|
123
123
|
- `mastra_scorer_definitions` / `mastra_scorer_definition_versions`: scorer definition records and versioned config snapshots (judge instructions, model, score range, preset config, default sampling)
|
|
124
124
|
- `mastra_schedules` / `mastra_schedule_triggers`: cron-driven workflow schedules and trigger history, consumed by Mastra's built-in `WorkflowScheduler`
|
|
125
|
+
- `mastra_workspaces` / `mastra_workspace_versions`: workspace records and versioned configuration snapshots (filesystem, sandbox, mounts, search, skills, tools)
|
|
126
|
+
- `mastra_datasets` / `mastra_dataset_items` / `mastra_dataset_versions`: evaluation datasets, SCD-2 versioned items, and version snapshots
|
|
127
|
+
- `mastra_experiments` / `mastra_experiment_results`: experiment runs and their per-item results
|
|
128
|
+
- `mastra_favorites`: per-user favorites for agents and skills, with denormalized `favoriteCount` maintained on the parent record
|
|
129
|
+
- `mastra_channel_installations` / `mastra_channel_config`: multi-platform channel installations and per-platform configuration
|
|
125
130
|
- `mastra_ai_spans`: AI tracing spans for observability (per-trace and per-span records, used to power the Studio traces UI)
|
|
126
131
|
|
|
127
132
|
Tables are created with `STRING(MAX)` for text and JSON payloads, `INT64`, `FLOAT64`, `BOOL`, and `TIMESTAMP`.
|
|
@@ -103,7 +103,7 @@ export const upstashAgent = new Agent({
|
|
|
103
103
|
name: 'Upstash Agent',
|
|
104
104
|
instructions:
|
|
105
105
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
106
|
-
model: 'openai/gpt-5.
|
|
106
|
+
model: 'openai/gpt-5.5',
|
|
107
107
|
memory: new Memory({
|
|
108
108
|
storage: new UpstashStore({
|
|
109
109
|
id: 'upstash-agent-storage',
|
|
@@ -322,7 +322,7 @@ await agent.stream('message for agent', {
|
|
|
322
322
|
sentiment: z.enum(['positive', 'negative', 'neutral']),
|
|
323
323
|
confidence: z.number(),
|
|
324
324
|
}),
|
|
325
|
-
model: 'openai/gpt-5.
|
|
325
|
+
model: 'openai/gpt-5.5',
|
|
326
326
|
errorStrategy: 'warn',
|
|
327
327
|
},
|
|
328
328
|
// Output processors for streaming response validation
|
|
@@ -175,7 +175,7 @@ Include a `.env.example` file with all required environment variables:
|
|
|
175
175
|
# LLM provider API keys (choose one or more)
|
|
176
176
|
OPENAI_API_KEY=your_openai_api_key_here
|
|
177
177
|
ANTHROPIC_API_KEY=your_anthropic_api_key_here
|
|
178
|
-
|
|
178
|
+
GOOGLE_API_KEY=your_google_api_key_here
|
|
179
179
|
|
|
180
180
|
# Other service API keys as needed
|
|
181
181
|
OTHER_SERVICE_API_KEY=your_api_key_here
|
|
@@ -192,7 +192,7 @@ import { Agent } from '@mastra/core/agent'
|
|
|
192
192
|
|
|
193
193
|
const agent = new Agent({
|
|
194
194
|
name: 'example-agent',
|
|
195
|
-
model: 'openai/gpt-5.
|
|
195
|
+
model: 'openai/gpt-5.5', // or other provider strings
|
|
196
196
|
instructions: 'Your agent instructions here',
|
|
197
197
|
})
|
|
198
198
|
```
|
|
@@ -233,7 +233,7 @@ Detailed explanation of the template's functionality and use case.
|
|
|
233
233
|
|
|
234
234
|
- `OPENAI_API_KEY`: Your OpenAI API key. Get one at [OpenAI Platform](https://platform.openai.com/api-keys)
|
|
235
235
|
- `ANTHROPIC_API_KEY`: Your Anthropic API key. Get one at [Anthropic Console](https://console.anthropic.com/settings/keys)
|
|
236
|
-
- `
|
|
236
|
+
- `GOOGLE_API_KEY`: Your Google AI API key. Get one at [Google AI Studio](https://makersuite.google.com/app/apikey)
|
|
237
237
|
- `OTHER_API_KEY`: Description of what this key is for
|
|
238
238
|
|
|
239
239
|
## Usage
|
|
@@ -53,6 +53,10 @@ Each server in the `servers` map is configured using the `MastraMCPServerDefinit
|
|
|
53
53
|
|
|
54
54
|
**enableServerLogs** (`boolean`): Whether to enable logging for this server. (Default: `true`)
|
|
55
55
|
|
|
56
|
+
**forwardInstructions** (`boolean`): Whether to append instructions advertised by this MCP server to an agent's system prompt when the agent uses this server's tools. Disabled by default; enable it only for servers you trust, since the instructions are injected into the agent's system prompt. (Default: `false`)
|
|
57
|
+
|
|
58
|
+
**instructionsMaxLength** (`number`): Maximum number of server instruction characters to append to an agent's system prompt. (Default: `512`)
|
|
59
|
+
|
|
56
60
|
**requireToolApproval** (`boolean | (params: RequireToolApprovalContext) => boolean | Promise<boolean>`): Require human approval before executing tools from this server. When set to \`true\`, all tools require approval. When set to a function, the function is called with the tool name, arguments, request context, and any tool annotations advertised by the server to dynamically decide whether approval is needed.
|
|
57
61
|
|
|
58
62
|
## Tool approval
|
|
@@ -123,6 +127,36 @@ Per the MCP specification, **clients MUST consider tool annotations to be untrus
|
|
|
123
127
|
|
|
124
128
|
The same annotations are also exposed on the tools returned by `listTools()` and `listToolsets()` under `tool.mcp.annotations`, so you can inspect them when wiring tools into an agent.
|
|
125
129
|
|
|
130
|
+
## Server instructions
|
|
131
|
+
|
|
132
|
+
When an MCP server advertises instructions during initialization, `MCPClient` stores them for that server. Forwarding those instructions into an agent's system prompt is **opt-in**: set `forwardInstructions: true` on a server to have agents that use its tools (via `listTools()` or `listToolsets()`) receive its instructions automatically.
|
|
133
|
+
|
|
134
|
+
The guidance is grouped by server name and truncated to `instructionsMaxLength` characters per server.
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
const mcp = new MCPClient({
|
|
138
|
+
servers: {
|
|
139
|
+
db: {
|
|
140
|
+
url: new URL('http://localhost:3000/mcp'),
|
|
141
|
+
forwardInstructions: true,
|
|
142
|
+
instructionsMaxLength: 512,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
const agent = new Agent({
|
|
148
|
+
id: 'db-agent',
|
|
149
|
+
name: 'DB Agent',
|
|
150
|
+
instructions: 'Help with database changes.',
|
|
151
|
+
model,
|
|
152
|
+
tools: await mcp.listTools(),
|
|
153
|
+
})
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
When `forwardInstructions` is omitted (the default), instructions are still cached and can be inspected via [`getServerInstructions()`](#getserverinstructions), but are not added to any agent's system prompt.
|
|
157
|
+
|
|
158
|
+
> **Security note:** server instructions are forwarded verbatim (subject only to length truncation) into the agent's system prompt. A malicious or compromised MCP server can use them to inject instructions the agent will treat as trusted system guidance. Only enable `forwardInstructions` for servers you trust, and prefer reviewing instructions with `getServerInstructions()` before forwarding instructions from third-party servers.
|
|
159
|
+
|
|
126
160
|
## Methods
|
|
127
161
|
|
|
128
162
|
### `listTools()`
|
|
@@ -143,6 +177,23 @@ const res = await agent.stream(prompt, {
|
|
|
143
177
|
})
|
|
144
178
|
```
|
|
145
179
|
|
|
180
|
+
### `getServerInstructions()`
|
|
181
|
+
|
|
182
|
+
Returns the instructions currently known for each configured MCP server. Servers that have not connected yet, or do not advertise instructions, return `undefined`.
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
getServerInstructions(): Record<string, string | undefined>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Example:
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
await mcp.listTools()
|
|
192
|
+
|
|
193
|
+
const instructionsByServer = mcp.getServerInstructions()
|
|
194
|
+
console.log(instructionsByServer.db)
|
|
195
|
+
```
|
|
196
|
+
|
|
146
197
|
### `disconnect()`
|
|
147
198
|
|
|
148
199
|
Disconnects from all MCP servers and cleans up resources.
|
|
@@ -839,7 +890,7 @@ const agent = new Agent({
|
|
|
839
890
|
id: 'multi-tool-agent',
|
|
840
891
|
name: 'Multi-tool Agent',
|
|
841
892
|
instructions: 'You have access to multiple tool servers.',
|
|
842
|
-
model: 'openai/gpt-5.
|
|
893
|
+
model: 'openai/gpt-5.5',
|
|
843
894
|
tools: await mcp.listTools(),
|
|
844
895
|
})
|
|
845
896
|
|
|
@@ -890,7 +941,7 @@ const agent = new Agent({
|
|
|
890
941
|
id: 'multi-tool-agent',
|
|
891
942
|
name: 'Multi-tool Agent',
|
|
892
943
|
instructions: 'You help users check stocks and weather.',
|
|
893
|
-
model: 'openai/gpt-5.
|
|
944
|
+
model: 'openai/gpt-5.5',
|
|
894
945
|
})
|
|
895
946
|
|
|
896
947
|
// Later, configure MCP with user-specific settings
|
|
@@ -22,7 +22,7 @@ const myAgent = new Agent({
|
|
|
22
22
|
name: 'MyExampleAgent',
|
|
23
23
|
description: 'A generalist to help with basic questions.',
|
|
24
24
|
instructions: 'You are a helpful assistant.',
|
|
25
|
-
model: 'openai/gpt-5.
|
|
25
|
+
model: 'openai/gpt-5.5',
|
|
26
26
|
})
|
|
27
27
|
|
|
28
28
|
const weatherTool = createTool({
|
|
@@ -67,6 +67,8 @@ The constructor accepts an `MCPServerConfig` object with the following propertie
|
|
|
67
67
|
|
|
68
68
|
**instructions** (`string`): Optional instructions describing how to use the server and its features.
|
|
69
69
|
|
|
70
|
+
**mapAuthInfoToUser** (`({ authInfo, extra, requestContext }) => unknown | null | undefined | Promise<unknown | null | undefined>`): Maps MCP transport auth data from \`extra.authInfo\` into the \`user\` value used by Mastra FGA checks. Use this when an OAuth-protected MCP server is registered on a Mastra instance with an FGA provider.
|
|
71
|
+
|
|
70
72
|
**repository** (`Repository`): Optional repository information for the server's source code.
|
|
71
73
|
|
|
72
74
|
**releaseDate** (`string`): Optional release date of this server version (ISO 8601 string). Defaults to the time of instantiation if not provided.
|
|
@@ -1097,6 +1099,36 @@ Whatever you set on `req.auth` in your HTTP middleware becomes available as `con
|
|
|
1097
1099
|
req.auth = { ... } → context?.mcp?.extra?.authInfo.extra = { ... }
|
|
1098
1100
|
```
|
|
1099
1101
|
|
|
1102
|
+
### Map auth data for FGA
|
|
1103
|
+
|
|
1104
|
+
When an `MCPServer` is registered on a Mastra instance with a fine-grained authorization (FGA) provider, Mastra checks `requestContext.get('user')` before listing or calling tools. HTTP MCP transports pass authenticated data as `extra.authInfo`, so use `mapAuthInfoToUser` to set the user shape expected by your FGA provider.
|
|
1105
|
+
|
|
1106
|
+
```typescript
|
|
1107
|
+
const server = new MCPServer({
|
|
1108
|
+
id: 'my-server',
|
|
1109
|
+
name: 'My Server',
|
|
1110
|
+
version: '1.0.0',
|
|
1111
|
+
tools: { getUserData },
|
|
1112
|
+
mapAuthInfoToUser: ({ authInfo }) => {
|
|
1113
|
+
const user = authInfo as {
|
|
1114
|
+
extra?: {
|
|
1115
|
+
userId?: string
|
|
1116
|
+
organizationMembershipId?: string
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
if (!user.extra?.userId) {
|
|
1121
|
+
return null
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
return {
|
|
1125
|
+
id: user.extra.userId,
|
|
1126
|
+
organizationMembershipId: user.extra.organizationMembershipId,
|
|
1127
|
+
}
|
|
1128
|
+
},
|
|
1129
|
+
})
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1100
1132
|
### Setting Up Authentication Middleware
|
|
1101
1133
|
|
|
1102
1134
|
To pass data to your tools, populate `req.auth` on the Node.js request object in your HTTP server middleware before calling `server.startHTTP()`.
|
|
@@ -142,7 +142,7 @@ const queryTool = createVectorQueryTool({
|
|
|
142
142
|
indexName: 'documentation',
|
|
143
143
|
model: new ModelRouterEmbeddingModel('openai/text-embedding-3-small'),
|
|
144
144
|
reranker: {
|
|
145
|
-
model: 'openai/gpt-5.
|
|
145
|
+
model: 'openai/gpt-5.5',
|
|
146
146
|
options: {
|
|
147
147
|
weights: {
|
|
148
148
|
semantic: 0.5, // Semantic relevance weight
|
|
@@ -277,7 +277,7 @@ export const libsqlAgent = new Agent({
|
|
|
277
277
|
name: 'libSQL Agent',
|
|
278
278
|
instructions:
|
|
279
279
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
280
|
-
model: 'openai/gpt-5.
|
|
280
|
+
model: 'openai/gpt-5.5',
|
|
281
281
|
memory: new Memory({
|
|
282
282
|
storage: new LibSQLStore({
|
|
283
283
|
id: 'libsql-agent-storage',
|
|
@@ -263,7 +263,7 @@ export const mongodbAgent = new Agent({
|
|
|
263
263
|
name: 'mongodb-agent',
|
|
264
264
|
instructions:
|
|
265
265
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
266
|
-
model: 'openai/gpt-5.
|
|
266
|
+
model: 'openai/gpt-5.5',
|
|
267
267
|
memory: new Memory({
|
|
268
268
|
storage: new MongoDBStore({
|
|
269
269
|
id: 'mongodb-storage',
|
|
@@ -26,6 +26,8 @@ The PgVector class provides vector search using [PostgreSQL](https://www.postgre
|
|
|
26
26
|
|
|
27
27
|
**pgPoolOptions** (`PoolConfig`): Additional pg pool configuration options
|
|
28
28
|
|
|
29
|
+
**disableInit** (`boolean`): When true, automatic DDL (schema, extension, table, and index creation) inside \`createIndex\` is skipped. Useful for CI/CD pipelines where schema and indexes are managed separately and the runtime database role lacks DDL privileges. Can also be enabled with the \`MASTRA\_DISABLE\_STORAGE\_INIT\` environment variable. (Default: `false`)
|
|
30
|
+
|
|
29
31
|
## Constructor examples
|
|
30
32
|
|
|
31
33
|
### Connection String
|
|
@@ -399,7 +401,7 @@ export const pgAgent = new Agent({
|
|
|
399
401
|
name: 'PG Agent',
|
|
400
402
|
instructions:
|
|
401
403
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
402
|
-
model: 'openai/gpt-5.
|
|
404
|
+
model: 'openai/gpt-5.5',
|
|
403
405
|
memory: new Memory({
|
|
404
406
|
storage: new PostgresStore({
|
|
405
407
|
id: 'pg-agent-storage',
|
|
@@ -265,7 +265,7 @@ export const upstashAgent = new Agent({
|
|
|
265
265
|
name: 'Upstash Agent',
|
|
266
266
|
instructions:
|
|
267
267
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
268
|
-
model: 'openai/gpt-5.
|
|
268
|
+
model: 'openai/gpt-5.5',
|
|
269
269
|
memory: new Memory({
|
|
270
270
|
storage: new UpstashStore({
|
|
271
271
|
id: 'upstash-agent-storage',
|
|
@@ -242,7 +242,9 @@ The GeminiLiveVoice class emits the following events:
|
|
|
242
242
|
|
|
243
243
|
**speaking** (`event`): Emitted with audio metadata. Callback receives { audioData?: Int16Array, sampleRate?: number }.
|
|
244
244
|
|
|
245
|
-
**writing** (`event`): Emitted when transcribed text is available. Callback receives { text: string, role: 'assistant' | 'user' }.
|
|
245
|
+
**writing** (`event`): Emitted when transcribed text is available. Callback receives { text: string, role: 'assistant' | 'user' }. On native-audio models the assistant transcript is driven by the server's \`output\_audio\_transcription\` channel rather than \`modelTurn.parts.text\`.
|
|
246
|
+
|
|
247
|
+
**thinking** (`event`): Emitted on native-audio models with the model's chain-of-thought / reasoning text from \`modelTurn.parts.text\`. Callback receives { text: string }. Does not fire on non-native-audio models, where \`modelTurn.parts.text\` is the spoken response and is emitted as \`writing\` instead.
|
|
246
248
|
|
|
247
249
|
**session** (`event`): Emitted on session state changes. Callback receives { state: 'connecting' | 'connected' | 'disconnected' | 'disconnecting' | 'updated', config?: object }.
|
|
248
250
|
|
|
@@ -254,7 +256,18 @@ The GeminiLiveVoice class emits the following events:
|
|
|
254
256
|
|
|
255
257
|
**error** (`event`): Emitted when an error occurs. Callback receives { message: string, code?: string, details?: unknown }.
|
|
256
258
|
|
|
257
|
-
**interrupt** (`event`):
|
|
259
|
+
**interrupt** (`event`): Emitted on barge-in when the user starts speaking over an in-flight model response. The server cancels any further audio for the current turn. Callback receives { type: 'user', timestamp: number }.
|
|
260
|
+
|
|
261
|
+
## Native-audio behavior
|
|
262
|
+
|
|
263
|
+
Native-audio Gemini Live models — any model whose ID contains `native-audio`, such as `gemini-2.5-flash-native-audio-preview-12-2025` — split text output across two channels:
|
|
264
|
+
|
|
265
|
+
- The model's spoken reply is delivered as audio plus an `output_audio_transcription` transcript and surfaced as `writing` with `role: 'assistant'`.
|
|
266
|
+
- The model's internal reasoning is delivered as `modelTurn.parts.text` and surfaced as `thinking`.
|
|
267
|
+
|
|
268
|
+
On non-native-audio models there is no `output_audio_transcription` channel, so `modelTurn.parts.text` is the spoken response itself and is emitted as `writing`; the `thinking` event does not fire.
|
|
269
|
+
|
|
270
|
+
Input transcription, output transcription, and barge-in detection (`realtime_input_config.activity_handling = 'START_OF_ACTIVITY_INTERRUPTS'`) are enabled automatically in the setup payload — no extra configuration is required.
|
|
258
271
|
|
|
259
272
|
## Available models
|
|
260
273
|
|