@mastra/mcp-docs-server 1.2.7-alpha.10 → 1.2.7-alpha.3
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/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 +3 -1
- 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/voice/livekit.md +3 -100
- 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 -3
- package/.docs/models/gateways/netlify.md +1 -4
- package/.docs/models/gateways/openrouter.md +6 -10
- package/.docs/models/gateways/vercel.md +1 -7
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/google.md +1 -2
- package/.docs/models/providers/llmgateway.md +181 -184
- package/.docs/models/providers/nano-gpt.md +2 -2
- package/.docs/models/providers/neon.md +29 -40
- package/.docs/models/providers/openai.md +1 -5
- package/.docs/models/providers/opencode.md +1 -2
- package/.docs/models/providers/poolside.md +5 -6
- package/.docs/models/providers/routing-run.md +34 -20
- package/.docs/models/providers/the-grid-ai.md +3 -3
- package/.docs/models/providers/wandb.md +14 -21
- package/.docs/models/providers/xai.md +1 -2
- package/.docs/models/providers.md +0 -3
- 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/voice/livekit.md +8 -272
- 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 -22
- package/package.json +5 -5
- 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 -114
- package/.docs/models/providers/crossmodel.md +0 -109
- package/.docs/models/providers/meta.md +0 -101
- package/.docs/models/providers/zenifra.md +0 -73
- 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/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/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
- package/.docs/reference/memory/summarizeConversation.md +0 -99
- package/.docs/reference/memory/summarizeThread.md +0 -93
|
@@ -62,7 +62,7 @@ export const testMcpClient = new MCPClient({
|
|
|
62
62
|
})
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
Visit [MCPClient](https://mastra.ai/reference/tools/mcp-client) for a full list of configuration options.
|
|
65
|
+
> **Info:** Visit [MCPClient](https://mastra.ai/reference/tools/mcp-client) for a full list of configuration options.
|
|
66
66
|
|
|
67
67
|
> **Authentication:** For connecting to OAuth-protected MCP servers, see the [OAuth Authentication](https://mastra.ai/reference/tools/mcp-client) section.
|
|
68
68
|
|
|
@@ -89,7 +89,7 @@ export const testAgent = new Agent({
|
|
|
89
89
|
})
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
Visit [Agent Class](https://mastra.ai/reference/agents/agent) for a full list of configuration options.
|
|
92
|
+
> **Info:** Visit [Agent Class](https://mastra.ai/reference/agents/agent) for a full list of configuration options.
|
|
93
93
|
|
|
94
94
|
## Tool approval
|
|
95
95
|
|
|
@@ -129,7 +129,7 @@ export const testMcpServer = new MCPServer({
|
|
|
129
129
|
})
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
Visit [MCPServer](https://mastra.ai/reference/tools/mcp-server) for a full list of configuration options.
|
|
132
|
+
> **Info:** Visit [MCPServer](https://mastra.ai/reference/tools/mcp-server) for a full list of configuration options.
|
|
133
133
|
|
|
134
134
|
> **Authentication:** To protect your MCP server with OAuth, see the [OAuth Protection](https://mastra.ai/reference/tools/mcp-server) section.
|
|
135
135
|
|
|
@@ -160,7 +160,9 @@ export const mastra = new Mastra({
|
|
|
160
160
|
|
|
161
161
|
### Static tools
|
|
162
162
|
|
|
163
|
-
Use the `.listTools()` method to fetch tools from all configured MCP servers. This is suitable when configuration (such as API keys) is static and consistent across users or requests. Call it once and pass the result to the `tools` property when defining your agent.
|
|
163
|
+
Use the `.listTools()` method to fetch tools from all configured MCP servers. This is suitable when configuration (such as API keys) is static and consistent across users or requests. Call it once and pass the result to the `tools` property when defining your agent.
|
|
164
|
+
|
|
165
|
+
> **Info:** Visit [listTools()](https://mastra.ai/reference/tools/mcp-client) for more information.
|
|
164
166
|
|
|
165
167
|
```typescript
|
|
166
168
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -209,7 +211,7 @@ async function handleRequest(userPrompt: string, userApiKey: string) {
|
|
|
209
211
|
}
|
|
210
212
|
```
|
|
211
213
|
|
|
212
|
-
Visit [listToolsets()](https://mastra.ai/reference/tools/mcp-client) for more information.
|
|
214
|
+
> **Info:** Visit [listToolsets()](https://mastra.ai/reference/tools/mcp-client) for more information.
|
|
213
215
|
|
|
214
216
|
## Connecting to an MCP registry
|
|
215
217
|
|
|
@@ -410,7 +412,9 @@ As an alternative to MCP, Ampersand's AI SDK also has an adapter for Mastra, so
|
|
|
410
412
|
|
|
411
413
|
## MCP Apps
|
|
412
414
|
|
|
413
|
-
MCP servers can serve interactive HTML UIs via the MCP Apps extension. Tools with associated `ui://` resources render sandboxed iframes in Studio — both on tool detail pages and inline in agent chat. The app iframe can call server tools and inject messages into the conversation.
|
|
415
|
+
MCP servers can serve interactive HTML UIs via the MCP Apps extension. Tools with associated `ui://` resources render sandboxed iframes in Studio — both on tool detail pages and inline in agent chat. The app iframe can call server tools and inject messages into the conversation.
|
|
416
|
+
|
|
417
|
+
> **Note:** Visit [MCP Apps](https://mastra.ai/docs/mcp/mcp-apps) for setup instructions and the app bridge API.
|
|
414
418
|
|
|
415
419
|
## Related
|
|
416
420
|
|
|
@@ -714,5 +714,4 @@ In practical terms, OM replaces both working memory and message history, and has
|
|
|
714
714
|
- [Memory Overview](https://mastra.ai/docs/memory/overview)
|
|
715
715
|
- [Message History](https://mastra.ai/docs/memory/message-history)
|
|
716
716
|
- [Memory Processors](https://mastra.ai/docs/memory/memory-processors)
|
|
717
|
-
- [Mastra Code](https://code.mastra.ai/): A coding agent using Observational Memory
|
|
718
|
-
- 📹 [Mastra processors and Observational Memory workshop](https://www.youtube.com/watch?v=4Vpp7xQYvl0)
|
|
717
|
+
- [Mastra Code](https://code.mastra.ai/): A coding agent using Observational Memory
|
|
@@ -15,8 +15,6 @@ If the combined memory exceeds the model's context limit, [memory processors](ht
|
|
|
15
15
|
|
|
16
16
|
Memory results will be stored in one or more of your configured [storage providers](https://mastra.ai/docs/storage/overview).
|
|
17
17
|
|
|
18
|
-
> **📹 Watch:** Watch [Mastra memory concepts](https://www.youtube.com/watch?v=18iIHQtIPmc) for a conceptual overview of the memory layers agents can use.
|
|
19
|
-
|
|
20
18
|
## When to use memory
|
|
21
19
|
|
|
22
20
|
Use memory when your agent needs to maintain multi-turn conversations that reference prior exchanges, recall user preferences or facts from earlier in a session, or build context over time within a conversation thread. Skip memory for single-turn requests where each interaction is independent.
|
|
@@ -77,7 +75,7 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
|
|
|
77
75
|
bun add @mastra/libsql@latest
|
|
78
76
|
```
|
|
79
77
|
|
|
80
|
-
For more details on available providers and how storage works in Mastra, visit the [storage](https://mastra.ai/docs/storage/overview) documentation.
|
|
78
|
+
> **Note:** For more details on available providers and how storage works in Mastra, visit the [storage](https://mastra.ai/docs/storage/overview) documentation.
|
|
81
79
|
|
|
82
80
|
3. Add the storage provider to your main Mastra instance to enable memory across all configured agents.
|
|
83
81
|
|
|
@@ -110,7 +108,7 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
|
|
|
110
108
|
})
|
|
111
109
|
```
|
|
112
110
|
|
|
113
|
-
Visit [Memory Class](https://mastra.ai/reference/memory/memory-class) for a full list of configuration options.
|
|
111
|
+
> **Note:** Visit [Memory Class](https://mastra.ai/reference/memory/memory-class) for a full list of configuration options.
|
|
114
112
|
|
|
115
113
|
5. Call your agent, for example in [Studio](https://mastra.ai/docs/studio/overview). Inside Studio, start a new chat with your agent and take a look at the right sidebar. It'll now display various memory-related information.
|
|
116
114
|
|
|
@@ -166,7 +164,7 @@ export const memoryAgent = new Agent({
|
|
|
166
164
|
})
|
|
167
165
|
```
|
|
168
166
|
|
|
169
|
-
See [Observational Memory](https://mastra.ai/docs/memory/observational-memory) for details on how observations and reflections work, and [the reference](https://mastra.ai/reference/memory/observational-memory) for all configuration options.
|
|
167
|
+
> **Note:** See [Observational Memory](https://mastra.ai/docs/memory/observational-memory) for details on how observations and reflections work, and [the reference](https://mastra.ai/reference/memory/observational-memory) for all configuration options.
|
|
170
168
|
|
|
171
169
|
## Memory in multi-agent systems
|
|
172
170
|
|
|
@@ -238,7 +236,7 @@ export const memoryAgent = new Agent({
|
|
|
238
236
|
})
|
|
239
237
|
```
|
|
240
238
|
|
|
241
|
-
Visit [Request Context](https://mastra.ai/docs/server/request-context) for more information.
|
|
239
|
+
> **Note:** Visit [Request Context](https://mastra.ai/docs/server/request-context) for more information.
|
|
242
240
|
|
|
243
241
|
## Related
|
|
244
242
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
If you ask your friend what they did last weekend, they will search in their memory for events associated with "last weekend" and then tell you what they did. That's sort of like how semantic recall works in Mastra.
|
|
6
6
|
|
|
7
|
-
>
|
|
7
|
+
> **Watch 📹:** What semantic recall is, how it works, and how to configure it in Mastra → [YouTube (5 minutes)](https://youtu.be/UVZtK8cK8xQ)
|
|
8
8
|
|
|
9
9
|
## How semantic recall works
|
|
10
10
|
|
|
@@ -10,8 +10,6 @@ This is useful for maintaining ongoing state that's always relevant and should a
|
|
|
10
10
|
|
|
11
11
|
If you use [Observational Memory](https://mastra.ai/docs/memory/observational-memory), `observationalMemory.observation.manageWorkingMemory` lets OM update working memory for the agent.
|
|
12
12
|
|
|
13
|
-
> **📹 Watch:** Watch [Mastra working memory](https://www.youtube.com/watch?v=UMy_JHLf1n8\&pp=ygUVbWFzdHJhIHdvcmtpbmcgbWVtb3J5) to see how agents keep persistent user context available across interactions.
|
|
14
|
-
|
|
15
13
|
Working memory can persist at two different scopes:
|
|
16
14
|
|
|
17
15
|
- **Resource-scoped** (default): Memory persists across all conversation threads for the same user
|
|
@@ -45,7 +43,9 @@ const agent = new Agent({
|
|
|
45
43
|
|
|
46
44
|
## How it works
|
|
47
45
|
|
|
48
|
-
Working memory is a block of Markdown text that the agent is able to update over time to store continuously relevant information
|
|
46
|
+
Working memory is a block of Markdown text that the agent is able to update over time to store continuously relevant information:
|
|
47
|
+
|
|
48
|
+
[YouTube video player](https://www.youtube-nocookie.com/embed/UMy_JHLf1n8)
|
|
49
49
|
|
|
50
50
|
## Memory persistence scopes
|
|
51
51
|
|
|
@@ -126,7 +126,9 @@ If you prefer, rely entirely on environment variables:
|
|
|
126
126
|
new MastraPlatformExporter()
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
With `MASTRA_PLATFORM_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` set, `MastraPlatformExporter` sends data to the Mastra platform project you configured. If you also set `MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT`, it sends data to that collector instead.
|
|
129
|
+
With `MASTRA_PLATFORM_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` set, `MastraPlatformExporter` sends data to the Mastra platform project you configured. If you also set `MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT`, it sends data to that collector instead.
|
|
130
|
+
|
|
131
|
+
> **Note:** Visit [MastraPlatformExporter reference](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for the full list of configuration options.
|
|
130
132
|
|
|
131
133
|
## Recommended configuration
|
|
132
134
|
|
|
@@ -22,7 +22,7 @@ export const mastra = new Mastra({
|
|
|
22
22
|
})
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Visit [PinoLogger](https://mastra.ai/reference/logging/pino-logger) for all available configuration options.
|
|
25
|
+
> **Info:** Visit [PinoLogger](https://mastra.ai/reference/logging/pino-logger) for all available configuration options.
|
|
26
26
|
|
|
27
27
|
## Logging to observability storage
|
|
28
28
|
|
|
@@ -325,7 +325,7 @@ const result = await agent.generate([{ role: 'user', content: 'Sensitive operati
|
|
|
325
325
|
})
|
|
326
326
|
```
|
|
327
327
|
|
|
328
|
-
For more granular control over sensitive data, consider using the [Sensitive Data Filter](https://mastra.ai/docs/observability/integrations/processors/sensitive-data-filter) processor, which can redact specific fields (like passwords, tokens, and keys) while preserving the rest of the input/output.
|
|
328
|
+
> **Tip:** For more granular control over sensitive data, consider using the [Sensitive Data Filter](https://mastra.ai/docs/observability/integrations/processors/sensitive-data-filter) processor, which can redact specific fields (like passwords, tokens, and keys) while preserving the rest of the input/output.
|
|
329
329
|
|
|
330
330
|
#### Child spans and metadata extraction
|
|
331
331
|
|
|
@@ -105,7 +105,7 @@ const auth0Provider = new MastraAuthAuth0({
|
|
|
105
105
|
})
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
Visit [MastraAuthAuth0](https://mastra.ai/reference/auth/auth0) for all available configuration options.
|
|
108
|
+
> **Info:** Visit [MastraAuthAuth0](https://mastra.ai/reference/auth/auth0) for all available configuration options.
|
|
109
109
|
|
|
110
110
|
## Client-side setup
|
|
111
111
|
|
|
@@ -87,7 +87,7 @@ export const mastra = new Mastra({
|
|
|
87
87
|
})
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
Visit [MastraAuthBetterAuth](https://mastra.ai/reference/auth/better-auth) for all available configuration options.
|
|
90
|
+
> **Info:** Visit [MastraAuthBetterAuth](https://mastra.ai/reference/auth/better-auth) for all available configuration options.
|
|
91
91
|
|
|
92
92
|
## Custom authorization
|
|
93
93
|
|
|
@@ -180,7 +180,7 @@ export const mastraClient = new MastraClient({
|
|
|
180
180
|
})
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
-
Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
183
|
+
> **Info:** Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
184
184
|
|
|
185
185
|
### Making authenticated requests
|
|
186
186
|
|
|
@@ -88,7 +88,7 @@ export const useClerkAuth = () => {
|
|
|
88
88
|
}
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
Refer to the [Clerk documentation](https://clerk.com/docs) for more information.
|
|
91
|
+
> **Info:** Refer to the [Clerk documentation](https://clerk.com/docs) for more information.
|
|
92
92
|
|
|
93
93
|
## Configuring `MastraClient`
|
|
94
94
|
|
|
@@ -118,7 +118,7 @@ const firebaseAuth = new MastraAuthFirebase({
|
|
|
118
118
|
})
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
Visit [MastraAuthFirebase](https://mastra.ai/reference/auth/firebase) for all available configuration options.
|
|
121
|
+
> **Info:** Visit [MastraAuthFirebase](https://mastra.ai/reference/auth/firebase) for all available configuration options.
|
|
122
122
|
|
|
123
123
|
## Client-side setup
|
|
124
124
|
|
|
@@ -168,7 +168,7 @@ export const mastra = new Mastra({
|
|
|
168
168
|
})
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
Visit [MastraAuthGoogle](https://mastra.ai/reference/auth/google) for all available configuration options.
|
|
171
|
+
> **Info:** Visit [MastraAuthGoogle](https://mastra.ai/reference/auth/google) for all available configuration options.
|
|
172
172
|
|
|
173
173
|
## Role mapping
|
|
174
174
|
|
|
@@ -242,7 +242,7 @@ export const createMastraClient = (idToken: string) => {
|
|
|
242
242
|
}
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
-
Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
245
|
+
> **Info:** Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
246
246
|
|
|
247
247
|
### Making authenticated requests
|
|
248
248
|
|
|
@@ -61,7 +61,7 @@ export const mastra = new Mastra({
|
|
|
61
61
|
})
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
Visit [MastraJwtAuth](https://mastra.ai/reference/auth/jwt) for all available configuration options.
|
|
64
|
+
> **Info:** Visit [MastraJwtAuth](https://mastra.ai/reference/auth/jwt) for all available configuration options.
|
|
65
65
|
|
|
66
66
|
Inside [Studio](https://mastra.ai/docs/studio/overview), go to **Settings** and under **Headers** select the **"Add Header"** button. Enter `Authorization` as the header name and `Bearer <your-jwt>` as the value.
|
|
67
67
|
|
|
@@ -80,7 +80,7 @@ export const mastraClient = new MastraClient({
|
|
|
80
80
|
})
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
83
|
+
> **Info:** Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
84
84
|
|
|
85
85
|
### Making authenticated requests
|
|
86
86
|
|
|
@@ -120,7 +120,7 @@ export const mastra = new Mastra({
|
|
|
120
120
|
|
|
121
121
|
> **Note:** To link users between providers, store the Okta user ID in the other provider's user metadata. Mastra uses this ID to fetch groups from Okta.
|
|
122
122
|
|
|
123
|
-
Visit [MastraAuthOkta](https://mastra.ai/reference/auth/okta) for all available configuration options.
|
|
123
|
+
> **Info:** Visit [MastraAuthOkta](https://mastra.ai/reference/auth/okta) for all available configuration options.
|
|
124
124
|
|
|
125
125
|
## Role mapping
|
|
126
126
|
|
|
@@ -194,7 +194,7 @@ export const createMastraClient = (accessToken: string) => {
|
|
|
194
194
|
}
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
-
Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
197
|
+
> **Info:** Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
198
198
|
|
|
199
199
|
### Making authenticated requests
|
|
200
200
|
|
|
@@ -149,7 +149,7 @@ const workosAuth = new AdminOnlyWorkosAuth({
|
|
|
149
149
|
})
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
Visit [MastraAuthWorkos](https://mastra.ai/reference/auth/workos) for all available configuration options.
|
|
152
|
+
> **Info:** Visit [MastraAuthWorkos](https://mastra.ai/reference/auth/workos) for all available configuration options.
|
|
153
153
|
|
|
154
154
|
## Client-side setup
|
|
155
155
|
|
|
@@ -134,7 +134,7 @@ export const mastraClient = new MastraClient({
|
|
|
134
134
|
})
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
Visit [MastraClient](https://mastra.ai/reference/client-js/mastra-client) for more configuration options.
|
|
137
|
+
> **Info:** Visit [MastraClient](https://mastra.ai/reference/client-js/mastra-client) for more configuration options.
|
|
138
138
|
|
|
139
139
|
## Credentials and session cookies
|
|
140
140
|
|
|
@@ -32,7 +32,7 @@ export const mastra = new Mastra({
|
|
|
32
32
|
})
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Visit the [configuration reference](https://mastra.ai/reference/configuration) for a full list of available server options.
|
|
35
|
+
> **Info:** Visit the [configuration reference](https://mastra.ai/reference/configuration) for a full list of available server options.
|
|
36
36
|
|
|
37
37
|
## Deploy your server
|
|
38
38
|
|
|
@@ -116,7 +116,7 @@ export const mastra = new Mastra({
|
|
|
116
116
|
})
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
Visit the [PubSub reference](https://mastra.ai/reference/pubsub/base) for the full delivery contract and the configuration options for each backend.
|
|
119
|
+
> **Note:** Visit the [PubSub reference](https://mastra.ai/reference/pubsub/base) for the full delivery contract and the configuration options for each backend.
|
|
120
120
|
|
|
121
121
|
## Related
|
|
122
122
|
|
|
@@ -82,7 +82,7 @@ export const mastra = new Mastra({
|
|
|
82
82
|
})
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
Visit [Middleware](https://mastra.ai/docs/server/middleware) for how to use server middleware.
|
|
85
|
+
> **Info:** Visit [Middleware](https://mastra.ai/docs/server/middleware) for how to use server middleware.
|
|
86
86
|
|
|
87
87
|
## Studio
|
|
88
88
|
|
|
@@ -188,7 +188,7 @@ export const registryAgent = new Agent({
|
|
|
188
188
|
})
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
-
Visit [Agent](https://mastra.ai/reference/agents/agent) for a full list of configuration options.
|
|
191
|
+
> **Info:** Visit [Agent](https://mastra.ai/reference/agents/agent) for a full list of configuration options.
|
|
192
192
|
|
|
193
193
|
## Accessing values from workflow steps
|
|
194
194
|
|
|
@@ -210,7 +210,7 @@ const stepOne = createStep({
|
|
|
210
210
|
})
|
|
211
211
|
```
|
|
212
212
|
|
|
213
|
-
Visit [createStep()](https://mastra.ai/reference/workflows/step) for a full list of configuration options.
|
|
213
|
+
> **Info:** Visit [createStep()](https://mastra.ai/reference/workflows/step) for a full list of configuration options.
|
|
214
214
|
|
|
215
215
|
## Accessing values with tools
|
|
216
216
|
|
|
@@ -232,7 +232,7 @@ export const weatherTool = createTool({
|
|
|
232
232
|
})
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
Visit [createTool()](https://mastra.ai/reference/tools/create-tool) for a full list of configuration options.
|
|
235
|
+
> **Info:** Visit [createTool()](https://mastra.ai/reference/tools/create-tool) for a full list of configuration options.
|
|
236
236
|
|
|
237
237
|
## Reserved keys
|
|
238
238
|
|
|
@@ -303,7 +303,7 @@ app.listen(4111, () => {
|
|
|
303
303
|
})
|
|
304
304
|
```
|
|
305
305
|
|
|
306
|
-
See the [Express Adapter](https://mastra.ai/reference/server/express-adapter) documentation for full configuration options.
|
|
306
|
+
> **Info:** See the [Express Adapter](https://mastra.ai/reference/server/express-adapter) documentation for full configuration options.
|
|
307
307
|
|
|
308
308
|
**Hono**:
|
|
309
309
|
|
|
@@ -324,7 +324,7 @@ serve({ fetch: app.fetch, port: 4111 }, () => {
|
|
|
324
324
|
})
|
|
325
325
|
```
|
|
326
326
|
|
|
327
|
-
See the [Hono Adapter](https://mastra.ai/reference/server/hono-adapter) documentation for full configuration options.
|
|
327
|
+
> **Info:** See the [Hono Adapter](https://mastra.ai/reference/server/hono-adapter) documentation for full configuration options.
|
|
328
328
|
|
|
329
329
|
**Fastify**:
|
|
330
330
|
|
|
@@ -352,7 +352,7 @@ app.listen({ port }, () => {
|
|
|
352
352
|
})
|
|
353
353
|
```
|
|
354
354
|
|
|
355
|
-
See the [Fastify Adapter](https://mastra.ai/reference/server/fastify-adapter) documentation for full configuration options.
|
|
355
|
+
> **Info:** See the [Fastify Adapter](https://mastra.ai/reference/server/fastify-adapter) documentation for full configuration options.
|
|
356
356
|
|
|
357
357
|
**Koa**:
|
|
358
358
|
|
|
@@ -387,7 +387,7 @@ app.listen(port, () => {
|
|
|
387
387
|
})
|
|
388
388
|
```
|
|
389
389
|
|
|
390
|
-
See the [Koa Adapter](https://mastra.ai/reference/server/koa-adapter) documentation for full configuration options.
|
|
390
|
+
> **Info:** See the [Koa Adapter](https://mastra.ai/reference/server/koa-adapter) documentation for full configuration options.
|
|
391
391
|
|
|
392
392
|
**NestJS**:
|
|
393
393
|
|
|
@@ -418,7 +418,7 @@ async function bootstrap() {
|
|
|
418
418
|
bootstrap()
|
|
419
419
|
```
|
|
420
420
|
|
|
421
|
-
See the [NestJS Adapter](https://mastra.ai/reference/server/nestjs-adapter) documentation for full configuration options.
|
|
421
|
+
> **Info:** See the [NestJS Adapter](https://mastra.ai/reference/server/nestjs-adapter) documentation for full configuration options.
|
|
422
422
|
|
|
423
423
|
## Initialization flow
|
|
424
424
|
|
|
@@ -460,7 +460,7 @@ You can add your own routes to the app alongside Mastra's routes.
|
|
|
460
460
|
- When you want Mastra-managed auth and route metadata such as `requiresAuth`, prefer `registerApiRoute()`.
|
|
461
461
|
- When you mount routes directly on the framework app, use the adapter's exported `createAuthMiddleware()` helper if those routes need Mastra auth.
|
|
462
462
|
|
|
463
|
-
Visit "Adding custom routes" for [Express](https://mastra.ai/reference/server/express-adapter) and [Hono](https://mastra.ai/reference/server/hono-adapter) for more information.
|
|
463
|
+
> **Info:** Visit "Adding custom routes" for [Express](https://mastra.ai/reference/server/express-adapter) and [Hono](https://mastra.ai/reference/server/hono-adapter) for more information.
|
|
464
464
|
|
|
465
465
|
## Route prefixes
|
|
466
466
|
|
|
@@ -513,7 +513,7 @@ const server = new MastraServer({
|
|
|
513
513
|
})
|
|
514
514
|
```
|
|
515
515
|
|
|
516
|
-
See [MastraServer](https://mastra.ai/reference/server/mastra-server) for full configuration options.
|
|
516
|
+
> **Info:** See [MastraServer](https://mastra.ai/reference/server/mastra-server) for full configuration options.
|
|
517
517
|
|
|
518
518
|
## Per-route auth overrides
|
|
519
519
|
|
|
@@ -540,7 +540,7 @@ const server = new MastraServer({
|
|
|
540
540
|
})
|
|
541
541
|
```
|
|
542
542
|
|
|
543
|
-
See [MastraServer](https://mastra.ai/reference/server/mastra-server) for full configuration options.
|
|
543
|
+
> **Info:** See [MastraServer](https://mastra.ai/reference/server/mastra-server) for full configuration options.
|
|
544
544
|
|
|
545
545
|
## Accessing the app
|
|
546
546
|
|
|
@@ -35,7 +35,9 @@ export const mastra = new Mastra({
|
|
|
35
35
|
})
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Once configured, Studio shows a login screen and requires authentication for all API requests.
|
|
38
|
+
Once configured, Studio shows a login screen and requires authentication for all API requests.
|
|
39
|
+
|
|
40
|
+
> **Note:** Visit the [Auth docs](https://mastra.ai/docs/server/auth) for a full list of supported providers.
|
|
39
41
|
|
|
40
42
|
## How it works
|
|
41
43
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Studio provides an interactive UI for building, testing, and managing your agents, workflows, and tools. Run it locally during development, add [authentication](https://mastra.ai/docs/studio/auth), or [deploy it](https://mastra.ai/docs/studio/deployment) to production so your team can manage agents, monitor performance, and gain insights through built-in observability.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[YouTube video player](https://www.youtube-nocookie.com/embed/ojGu6Bi4wYk)
|
|
8
8
|
|
|
9
9
|
## Start Studio
|
|
10
10
|
|
|
@@ -162,45 +162,6 @@ export default createLiveKitWorker({
|
|
|
162
162
|
|
|
163
163
|
See the [LiveKit turn detection docs](https://docs.livekit.io/agents/logic/turns/) for all options.
|
|
164
164
|
|
|
165
|
-
## Per-call voices and transcription
|
|
166
|
-
|
|
167
|
-
The top-level `stt` and `tts` options apply to every call. To pick them per call — one voice or language per tenant — set the `configuration.stt` and `configuration.tts` resolvers instead. Each resolver runs once per call with the dispatch metadata, request context, room name, and job context, and returns anything the matching top-level option accepts: a plugin instance or an inference model string. Return `undefined` to fall back to the top-level option.
|
|
168
|
-
|
|
169
|
-
The following example gives each tenant its own text-to-speech voice, keyed off the `tenant` entry in the dispatch metadata:
|
|
170
|
-
|
|
171
|
-
```typescript
|
|
172
|
-
import * as cartesia from '@livekit/agents-plugin-cartesia'
|
|
173
|
-
|
|
174
|
-
// One voice id per tenant, resolved from the dispatch metadata on each call.
|
|
175
|
-
const tenantVoices: Record<string, string> = {
|
|
176
|
-
meridian: 'your-cartesia-voice-id-1',
|
|
177
|
-
coastal: 'your-cartesia-voice-id-2',
|
|
178
|
-
}
|
|
179
|
-
// The resolver runs during call setup, so cache plugin instances across calls.
|
|
180
|
-
const ttsByVoice = new Map<string, cartesia.TTS>()
|
|
181
|
-
|
|
182
|
-
export default createLiveKitWorker({
|
|
183
|
-
mastra,
|
|
184
|
-
agent: 'support',
|
|
185
|
-
stt: 'deepgram/nova-3',
|
|
186
|
-
tts: 'cartesia/sonic-3',
|
|
187
|
-
configuration: {
|
|
188
|
-
tts: ({ requestContext }) => {
|
|
189
|
-
const voice = tenantVoices[requestContext?.tenant as string]
|
|
190
|
-
if (!voice) return undefined // fall back to the top-level `tts`
|
|
191
|
-
let tts = ttsByVoice.get(voice)
|
|
192
|
-
if (!tts) {
|
|
193
|
-
tts = new cartesia.TTS({ voice })
|
|
194
|
-
ttsByVoice.set(voice, tts)
|
|
195
|
-
}
|
|
196
|
-
return tts
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
})
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
`configuration.stt` works the same way for per-call transcription, for example a different transcription model or language per tenant. The greeting has a matching per-call form: `configuration.greeting.text` accepts a resolver with the same call context, so one worker can open with each tenant's own phrasing.
|
|
203
|
-
|
|
204
165
|
## Memory and threads
|
|
205
166
|
|
|
206
167
|
When the resolved Mastra agent has memory configured, each call becomes one memory thread:
|
|
@@ -211,7 +172,7 @@ When the resolved Mastra agent has memory configured, each call becomes one memo
|
|
|
211
172
|
|
|
212
173
|
Each turn sends only the new user input; Mastra Memory supplies history, semantic recall, and working memory. Pin a session to an existing thread by passing `threadId` in the connection request body, which is useful for continuing a text conversation by voice. In Studio, starting a call from an open chat binds the call to that thread, and the transcript fills into the chat after each exchange.
|
|
213
174
|
|
|
214
|
-
|
|
175
|
+
One caveat: when a user interrupts the agent, Mastra Memory stores the full generated reply even though the user only heard part of it. LiveKit's own transcript is truncated to what was spoken.
|
|
215
176
|
|
|
216
177
|
## Speak while tools run
|
|
217
178
|
|
|
@@ -228,13 +189,13 @@ export default createLiveKitWorker({
|
|
|
228
189
|
})
|
|
229
190
|
```
|
|
230
191
|
|
|
231
|
-
The phrase is spoken as part of the reply and
|
|
192
|
+
The phrase is spoken as part of the reply and shown in the transcript.
|
|
232
193
|
|
|
233
194
|
## Generate replies with a workflow
|
|
234
195
|
|
|
235
196
|
By default the worker generates each reply with a Mastra agent. To run multi-step logic per turn (for example classify intent, route, call tools in sequence, then compose a reply), generate replies with a Mastra [workflow](https://mastra.ai/docs/workflows/overview) instead. Set `workflow` in place of `agent`.
|
|
236
197
|
|
|
237
|
-
LiveKit still owns the audio loop and calls into Mastra once per turn, so the workflow runs to completion each turn.
|
|
198
|
+
LiveKit still owns the audio loop and calls into Mastra once per turn, so the workflow runs to completion each turn. Suspend and resume aren't available, and conversation state isn't carried between turns. Pass the transcript in through `workflowInput` so the workflow stays stateless:
|
|
238
199
|
|
|
239
200
|
```typescript
|
|
240
201
|
import { createLiveKitWorker, chatContextToMessages } from '@mastra/livekit/worker'
|
|
@@ -272,64 +233,6 @@ const generateResponse = createStep({
|
|
|
272
233
|
|
|
273
234
|
With a workflow, the worker doesn't persist turns automatically the way an agent's `stream()` does. Persist conversation history inside the workflow, or keep the LiveKit transcript as the source of truth and pass it in each turn.
|
|
274
235
|
|
|
275
|
-
## Use Mastra as the LLM component
|
|
276
|
-
|
|
277
|
-
`createLiveKitWorker()` owns the LiveKit session for you. To own the session yourself, use [`MastraLLM`](https://mastra.ai/reference/voice/livekit) instead: a standard LiveKit LLM plugin that puts a Mastra agent in the `llm` slot of your own `voice.AgentSession`. The Mastra app — agent loop, tools, memory, observability — runs on your Mastra server, and the worker reaches it over HTTP. The worker process needs no Mastra app, database, or model provider keys.
|
|
278
|
-
|
|
279
|
-
```typescript
|
|
280
|
-
import { fileURLToPath } from 'node:url'
|
|
281
|
-
import { defineAgent, voice } from '@livekit/agents'
|
|
282
|
-
import * as silero from '@livekit/agents-plugin-silero'
|
|
283
|
-
import { MastraLLM } from '@mastra/livekit/plugin'
|
|
284
|
-
import { runLiveKitWorker } from '@mastra/livekit/worker'
|
|
285
|
-
|
|
286
|
-
export default defineAgent({
|
|
287
|
-
entry: async ctx => {
|
|
288
|
-
await ctx.connect()
|
|
289
|
-
|
|
290
|
-
const session = new voice.AgentSession({
|
|
291
|
-
llm: new MastraLLM({
|
|
292
|
-
remote: { baseUrl: process.env.MASTRA_URL!, agentId: 'support' },
|
|
293
|
-
memory: { thread: ctx.room.name!, resource: 'user-7' },
|
|
294
|
-
}),
|
|
295
|
-
stt: 'deepgram/nova-3',
|
|
296
|
-
tts: 'cartesia/sonic-3',
|
|
297
|
-
vad: await silero.VAD.load(),
|
|
298
|
-
// Required with `memory`: LiveKit enables preemptive generation by default.
|
|
299
|
-
turnHandling: { preemptiveGeneration: { enabled: false } },
|
|
300
|
-
})
|
|
301
|
-
|
|
302
|
-
await session.start({
|
|
303
|
-
// These instructions never reach the Mastra agent; its own instructions apply.
|
|
304
|
-
agent: new voice.Agent({ instructions: 'Replies come from the Mastra agent.' }),
|
|
305
|
-
room: ctx.room,
|
|
306
|
-
})
|
|
307
|
-
|
|
308
|
-
session.say('Hi! How can I help you today?')
|
|
309
|
-
},
|
|
310
|
-
})
|
|
311
|
-
|
|
312
|
-
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
313
|
-
runLiveKitWorker({ entry: import.meta.url, agentName: 'mastra-voice' })
|
|
314
|
-
}
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
Both paths share the same reply pipeline underneath; choose by who should own the session:
|
|
318
|
-
|
|
319
|
-
| | `createLiveKitWorker()` | `MastraLLM` |
|
|
320
|
-
| ------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- |
|
|
321
|
-
| Session ownership | The worker helper builds and manages the `AgentSession` | Your code builds the session; every LiveKit option and hook is yours |
|
|
322
|
-
| Where the Mastra app runs | In the worker process | On your Mastra server, reached over HTTP (or in-process via `agent`) |
|
|
323
|
-
| Worker process needs | Your Mastra app, storage, and model provider keys | Only the LiveKit SDK and network access to your server |
|
|
324
|
-
| Built-in conveniences | Greeting, consent gating, agent-initiated hang-up, thread bootstrap, observability roll-up | Rebuild what you need with the [session helpers](https://mastra.ai/reference/voice/livekit) |
|
|
325
|
-
| Best for | Fastest path to a working voice agent; Studio voice mode | Existing LiveKit apps and full control over the session |
|
|
326
|
-
|
|
327
|
-
Tools stay on the Mastra agent and execute on the server; LiveKit-side tools passed to the session are ignored. Tool activity reaches the worker through `toolFeedback` (spoken filler), `onToolCall` (fires as each tool call starts), and `onTurnComplete` (fires after each reply with the text, tool calls, and token usage). Agent-initiated hang-up takes a few lines: pair `onToolCall` with [`runEndCall()`](https://mastra.ai/reference/voice/livekit).
|
|
328
|
-
|
|
329
|
-
> **Warning:** Don't combine the `memory` option with LiveKit's `preemptiveGeneration`, which LiveKit enables by default in sessions you build yourself. A speculative turn that completes before LiveKit discards it persists a user message and a never-spoken reply to the thread. Set `turnHandling: { preemptiveGeneration: { enabled: false } }` as shown above, or run without `memory` and pass the full transcript each turn.
|
|
330
|
-
|
|
331
|
-
`MastraLLM` also accepts an in-process Mastra `agent` instance — session ownership without a second deployment — or a custom `generate` function. The remote transport is available standalone as [`createRemoteAgentReplyGenerator()`](https://mastra.ai/reference/voice/livekit), which also plugs into `createLiveKitWorker`'s `generate` option to run the batteries-included worker against a remote server.
|
|
332
|
-
|
|
333
236
|
## Server-initiated sessions
|
|
334
237
|
|
|
335
238
|
Use `dispatchVoiceSession()` to add a voice agent to a room from your own code, for example to join an existing room or to drive an outbound [SIP call](https://docs.livekit.io/sip/):
|
|
@@ -57,7 +57,7 @@ export const testWorkflow = createWorkflow({})
|
|
|
57
57
|
.commit()
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
Visit [Input Data Mapping](https://mastra.ai/docs/workflows/control-flow) for more information.
|
|
60
|
+
> **Info:** Visit [Input Data Mapping](https://mastra.ai/docs/workflows/control-flow) for more information.
|
|
61
61
|
|
|
62
62
|
When no `structuredOutput` option is provided, Mastra agents use a default schema that expects a `prompt` string as input and returns a `text` string as output:
|
|
63
63
|
|
|
@@ -106,7 +106,9 @@ export const testWorkflow = createWorkflow({})
|
|
|
106
106
|
.commit()
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
The `structuredOutput.schema` option accepts any Standard JSON Schema. The agent will generate output conforming to this schema, and the step's `outputSchema` will be automatically set to match.
|
|
109
|
+
The `structuredOutput.schema` option accepts any Standard JSON Schema. The agent will generate output conforming to this schema, and the step's `outputSchema` will be automatically set to match.
|
|
110
|
+
|
|
111
|
+
> **Info:** Visit [Structured Output](https://mastra.ai/docs/agents/structured-output) for more options like error handling strategies and streaming with structured output.
|
|
110
112
|
|
|
111
113
|
## Using tools in workflows
|
|
112
114
|
|
|
@@ -155,7 +157,7 @@ export const testWorkflow = createWorkflow({})
|
|
|
155
157
|
.commit()
|
|
156
158
|
```
|
|
157
159
|
|
|
158
|
-
Visit [Input Data Mapping](https://mastra.ai/docs/workflows/control-flow) for more information.
|
|
160
|
+
> **Info:** Visit [Input Data Mapping](https://mastra.ai/docs/workflows/control-flow) for more information.
|
|
159
161
|
|
|
160
162
|
## Related
|
|
161
163
|
|
|
@@ -101,6 +101,8 @@ export const testWorkflow = createWorkflow({
|
|
|
101
101
|
.commit()
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
> **📹 Watch:** How to run steps in parallel and optimize your Mastra workflow → [YouTube (3 minutes)](https://youtu.be/GQJxve5Hki4)
|
|
105
|
+
|
|
104
106
|
### Output structure
|
|
105
107
|
|
|
106
108
|
When steps run in parallel, the output is an object where each key is the step's `id` and the value is that step's output. This allows you to access each parallel step's result independently.
|
|
@@ -208,7 +210,7 @@ const writerStep = createStep({
|
|
|
208
210
|
})
|
|
209
211
|
```
|
|
210
212
|
|
|
211
|
-
Visit [Choosing the right pattern](#choosing-the-right-pattern) to understand when to use `.parallel()` vs `.foreach()`.
|
|
213
|
+
> **Info:** Visit [Choosing the right pattern](#choosing-the-right-pattern) to understand when to use `.parallel()` vs `.foreach()`.
|
|
212
214
|
|
|
213
215
|
## Conditional logic with `.branch()`
|
|
214
216
|
|