@mastra/mcp-docs-server 0.13.17 → 0.13.18-alpha.1
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/organized/changelogs/%40internal%2Fstorage-test-utils.md +49 -49
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +89 -0
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +58 -0
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fauth.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +75 -75
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +77 -77
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +83 -83
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +61 -61
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +77 -77
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +77 -77
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +84 -84
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +93 -0
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +93 -93
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +89 -89
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +89 -89
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +102 -102
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +78 -78
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +60 -60
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +67 -67
- package/.docs/organized/changelogs/%40mastra%2Fgithub.md +62 -62
- package/.docs/organized/changelogs/%40mastra%2Flance.md +77 -77
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +80 -80
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +84 -84
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +62 -62
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +63 -63
- package/.docs/organized/changelogs/%40mastra%2Fmem0.md +60 -60
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +69 -69
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +77 -77
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +77 -77
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +78 -78
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +110 -110
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +61 -61
- package/.docs/organized/changelogs/%40mastra%2Frag.md +62 -62
- package/.docs/organized/changelogs/%40mastra%2Fragie.md +62 -62
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +10 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +85 -85
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +77 -77
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +58 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +61 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +61 -61
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +59 -59
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +59 -59
- package/.docs/organized/changelogs/create-mastra.md +28 -28
- package/.docs/organized/changelogs/mastra.md +118 -118
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +1 -1
- package/.docs/organized/code-examples/crypto-chatbot.md +1 -1
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +83 -1
- package/.docs/raw/networks-vnext/complex-task-execution.mdx +5 -0
- package/.docs/raw/networks-vnext/single-task-execution.mdx +4 -0
- package/.docs/raw/observability/ai-tracing.mdx +96 -36
- package/.docs/raw/reference/workflows/run-methods/streamVNext.mdx +5 -5
- package/.docs/raw/streaming/events.mdx +2 -2
- package/CHANGELOG.md +23 -0
- package/package.json +4 -4
|
@@ -1,5 +1,122 @@
|
|
|
1
1
|
# mastra
|
|
2
2
|
|
|
3
|
+
## 0.12.0-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 376913a: Update peerdeps
|
|
8
|
+
- Updated dependencies [8fbf79e]
|
|
9
|
+
- Updated dependencies [376913a]
|
|
10
|
+
- Updated dependencies [376913a]
|
|
11
|
+
- @mastra/core@0.16.0-alpha.1
|
|
12
|
+
- @mastra/loggers@0.10.11-alpha.0
|
|
13
|
+
- @mastra/mcp@0.11.4-alpha.0
|
|
14
|
+
- @mastra/deployer@0.16.0-alpha.1
|
|
15
|
+
|
|
16
|
+
## 0.12.0-alpha.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- a01cf14: Add workflow graph in agent (workflow as tool in agent)
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- cf4e353: Agent Builder Template - adding in UI components to use agent builder template actions
|
|
25
|
+
- 788e612: Fix playground workflow graph is broken when workflow starts with a branch
|
|
26
|
+
- 5397eb4: Add public URL support when adding files in Multi Modal
|
|
27
|
+
- Updated dependencies [cf4e353]
|
|
28
|
+
- Updated dependencies [fd83526]
|
|
29
|
+
- Updated dependencies [d0b90ab]
|
|
30
|
+
- Updated dependencies [6f5eb7a]
|
|
31
|
+
- Updated dependencies [a01cf14]
|
|
32
|
+
- Updated dependencies [a9e50ee]
|
|
33
|
+
- Updated dependencies [5397eb4]
|
|
34
|
+
- Updated dependencies [c9f4e4a]
|
|
35
|
+
- Updated dependencies [0acbc80]
|
|
36
|
+
- @mastra/deployer@0.16.0-alpha.0
|
|
37
|
+
- @mastra/core@0.16.0-alpha.0
|
|
38
|
+
|
|
39
|
+
## 0.11.3
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 64152fd: Improve output of Cli Dev command
|
|
44
|
+
- de3cbc6: Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
|
|
45
|
+
- 26b0d7c: Cleanup pkg output
|
|
46
|
+
- 8e4fe90: Unify focus outlines
|
|
47
|
+
- 2f55297: Fix issue when using `yarn dlx create-mastra`
|
|
48
|
+
- e3d8fea: Support Inngest flow control features for Mastra Inngest workflows
|
|
49
|
+
- f539199: mastra start - load env files, custom env. Deperecate --env flag for mastra build
|
|
50
|
+
- ab48c97: dependencies updates:
|
|
51
|
+
- Updated dependency [`zod-to-json-schema@^3.24.6` ↗︎](https://www.npmjs.com/package/zod-to-json-schema/v/3.24.6) (from `^3.24.5`, in `dependencies`)
|
|
52
|
+
- 87de958: fix chat outline
|
|
53
|
+
- 6f715fe: Fix plyground baseUrl, default api baseUrl to playground baseUrl
|
|
54
|
+
- 01264f1: Mastra dev- load env vars before watch
|
|
55
|
+
- 3308c9f: fix dev:playground command
|
|
56
|
+
- d99baf6: change outline
|
|
57
|
+
- 8f22a2c: During package installation do not print audit, funding or any non-error logs
|
|
58
|
+
- Updated dependencies [ab48c97]
|
|
59
|
+
- Updated dependencies [3e0bd2a]
|
|
60
|
+
- Updated dependencies [2b64943]
|
|
61
|
+
- Updated dependencies [85ef90b]
|
|
62
|
+
- Updated dependencies [aedbbfa]
|
|
63
|
+
- Updated dependencies [ff89505]
|
|
64
|
+
- Updated dependencies [637f323]
|
|
65
|
+
- Updated dependencies [de3cbc6]
|
|
66
|
+
- Updated dependencies [c19bcf7]
|
|
67
|
+
- Updated dependencies [4474d04]
|
|
68
|
+
- Updated dependencies [183dc95]
|
|
69
|
+
- Updated dependencies [a1111e2]
|
|
70
|
+
- Updated dependencies [b42a961]
|
|
71
|
+
- Updated dependencies [71b657b]
|
|
72
|
+
- Updated dependencies [61debef]
|
|
73
|
+
- Updated dependencies [9beaeff]
|
|
74
|
+
- Updated dependencies [29de0e1]
|
|
75
|
+
- Updated dependencies [f643c65]
|
|
76
|
+
- Updated dependencies [00c74e7]
|
|
77
|
+
- Updated dependencies [f0dfcac]
|
|
78
|
+
- Updated dependencies [fef7375]
|
|
79
|
+
- Updated dependencies [6d98856]
|
|
80
|
+
- Updated dependencies [e3d8fea]
|
|
81
|
+
- Updated dependencies [45e4d39]
|
|
82
|
+
- Updated dependencies [ad78bfc]
|
|
83
|
+
- Updated dependencies [9eee594]
|
|
84
|
+
- Updated dependencies [7149d8d]
|
|
85
|
+
- Updated dependencies [822c2e8]
|
|
86
|
+
- Updated dependencies [3b8972b]
|
|
87
|
+
- Updated dependencies [979912c]
|
|
88
|
+
- Updated dependencies [7dcf4c0]
|
|
89
|
+
- Updated dependencies [4106a58]
|
|
90
|
+
- Updated dependencies [ad78bfc]
|
|
91
|
+
- Updated dependencies [6f715fe]
|
|
92
|
+
- Updated dependencies [48f0742]
|
|
93
|
+
- Updated dependencies [0302f50]
|
|
94
|
+
- Updated dependencies [12adcc8]
|
|
95
|
+
- Updated dependencies [6ac697e]
|
|
96
|
+
- Updated dependencies [74db265]
|
|
97
|
+
- Updated dependencies [6cffb99]
|
|
98
|
+
- Updated dependencies [0ce418a]
|
|
99
|
+
- Updated dependencies [3e0153a]
|
|
100
|
+
- Updated dependencies [af90672]
|
|
101
|
+
- Updated dependencies [8387952]
|
|
102
|
+
- Updated dependencies [7f3b8da]
|
|
103
|
+
- Updated dependencies [905352b]
|
|
104
|
+
- Updated dependencies [599d04c]
|
|
105
|
+
- Updated dependencies [a6e2254]
|
|
106
|
+
- Updated dependencies [56041d0]
|
|
107
|
+
- Updated dependencies [3412597]
|
|
108
|
+
- Updated dependencies [5eca5d2]
|
|
109
|
+
- Updated dependencies [8f22a2c]
|
|
110
|
+
- Updated dependencies [f2cda47]
|
|
111
|
+
- Updated dependencies [5de1555]
|
|
112
|
+
- Updated dependencies [cfd377a]
|
|
113
|
+
- Updated dependencies [1ed5a3e]
|
|
114
|
+
- Updated dependencies [03d0c39]
|
|
115
|
+
- @mastra/core@0.15.3
|
|
116
|
+
- @mastra/deployer@0.15.3
|
|
117
|
+
- @mastra/loggers@0.10.10
|
|
118
|
+
- @mastra/mcp@0.11.3
|
|
119
|
+
|
|
3
120
|
## 0.11.3-alpha.4
|
|
4
121
|
|
|
5
122
|
### Patch Changes
|
|
@@ -181,122 +298,5 @@
|
|
|
181
298
|
|
|
182
299
|
### Patch Changes
|
|
183
300
|
|
|
184
|
-
- Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`4c8956f`](https://github.com/mastra-ai/mastra/commit/4c8956f3110ccf39595e022f127a44a0a5c09c86), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
|
|
185
|
-
- @mastra/core@0.14.1-alpha.0
|
|
186
|
-
- @mastra/deployer@0.14.1-alpha.0
|
|
187
|
-
|
|
188
|
-
## 0.10.22
|
|
189
|
-
|
|
190
|
-
### Patch Changes
|
|
191
|
-
|
|
192
|
-
- 8f8409a: Inject analytics instance into create cmd
|
|
193
|
-
- 97c1d5e: Add new `scorers` subcommand for managing scorers.
|
|
194
|
-
Refactor cli to be more modular.
|
|
195
|
-
- dd702eb: Fix default in playground
|
|
196
|
-
- 6313063: Implement model switcher in playground
|
|
197
|
-
- 1d59515: Add options to playground based on modelVersion
|
|
198
|
-
- 9ce22c5: Fix swagger-ui link
|
|
199
|
-
- 36928f0: Use right icon for anthropic in model switcher
|
|
200
|
-
- 03997ae: Update peerdeps
|
|
201
|
-
- Updated dependencies [895d3b2]
|
|
202
|
-
- Updated dependencies [227c7e6]
|
|
203
|
-
- Updated dependencies [12cae67]
|
|
204
|
-
- Updated dependencies [bca2ba3]
|
|
205
|
-
- Updated dependencies [fd3a3eb]
|
|
206
|
-
- Updated dependencies [022f3a2]
|
|
207
|
-
- Updated dependencies [6faaee5]
|
|
208
|
-
- Updated dependencies [4232b14]
|
|
209
|
-
- Updated dependencies [6313063]
|
|
210
|
-
- Updated dependencies [a89de7e]
|
|
211
|
-
- Updated dependencies [96518cc]
|
|
212
|
-
- Updated dependencies [5a37d0c]
|
|
213
|
-
- Updated dependencies [4bde0cb]
|
|
214
|
-
- Updated dependencies [e1aed55]
|
|
215
|
-
- Updated dependencies [cf4f357]
|
|
216
|
-
- Updated dependencies [c712849]
|
|
217
|
-
- Updated dependencies [04dcd66]
|
|
218
|
-
- Updated dependencies [03997ae]
|
|
219
|
-
- Updated dependencies [03997ae]
|
|
220
|
-
- Updated dependencies [ad888a2]
|
|
221
|
-
- Updated dependencies [481751d]
|
|
222
|
-
- Updated dependencies [2454423]
|
|
223
|
-
- Updated dependencies [194e395]
|
|
224
|
-
- Updated dependencies [a9916bd]
|
|
225
|
-
- Updated dependencies [a722c0b]
|
|
226
|
-
- Updated dependencies [c30bca8]
|
|
227
|
-
- Updated dependencies [95e1330]
|
|
228
|
-
- Updated dependencies [33eb340]
|
|
229
|
-
- Updated dependencies [3b5fec7]
|
|
230
|
-
- Updated dependencies [a8f129d]
|
|
231
|
-
- Updated dependencies [6dfc4a6]
|
|
232
|
-
- @mastra/mcp@0.10.12
|
|
233
|
-
- @mastra/core@0.14.0
|
|
234
|
-
- @mastra/deployer@0.14.0
|
|
235
|
-
- @mastra/loggers@0.10.7
|
|
236
|
-
|
|
237
|
-
## 0.10.22-alpha.6
|
|
238
|
-
|
|
239
|
-
### Patch Changes
|
|
240
|
-
|
|
241
|
-
- 03997ae: Update peerdeps
|
|
242
|
-
- Updated dependencies [03997ae]
|
|
243
|
-
- Updated dependencies [03997ae]
|
|
244
|
-
- @mastra/loggers@0.10.7-alpha.0
|
|
245
|
-
- @mastra/mcp@0.10.12-alpha.2
|
|
246
|
-
- @mastra/deployer@0.14.0-alpha.7
|
|
247
|
-
- @mastra/core@0.14.0-alpha.7
|
|
248
|
-
|
|
249
|
-
## 0.10.22-alpha.5
|
|
250
|
-
|
|
251
|
-
### Patch Changes
|
|
252
|
-
|
|
253
|
-
- 9ce22c5: Fix swagger-ui link
|
|
254
|
-
- Updated dependencies [ad888a2]
|
|
255
|
-
- Updated dependencies [481751d]
|
|
256
|
-
- Updated dependencies [194e395]
|
|
257
|
-
- Updated dependencies [a9916bd]
|
|
258
|
-
- @mastra/core@0.14.0-alpha.6
|
|
259
|
-
- @mastra/deployer@0.14.0-alpha.6
|
|
260
|
-
|
|
261
|
-
## 0.10.22-alpha.4
|
|
262
|
-
|
|
263
|
-
### Patch Changes
|
|
264
|
-
|
|
265
|
-
- dd702eb: Fix default in playground
|
|
266
|
-
|
|
267
|
-
## 0.10.22-alpha.3
|
|
268
|
-
|
|
269
|
-
### Patch Changes
|
|
270
|
-
|
|
271
|
-
- 1d59515: Add options to playground based on modelVersion
|
|
272
|
-
- Updated dependencies [0a7f675]
|
|
273
|
-
- Updated dependencies [12cae67]
|
|
274
|
-
- Updated dependencies [96518cc]
|
|
275
|
-
- Updated dependencies [5a37d0c]
|
|
276
|
-
- Updated dependencies [4bde0cb]
|
|
277
|
-
- Updated dependencies [e1aed55]
|
|
278
|
-
- Updated dependencies [1a80071]
|
|
279
|
-
- Updated dependencies [36a3be8]
|
|
280
|
-
- Updated dependencies [c712849]
|
|
281
|
-
- Updated dependencies [361757b]
|
|
282
|
-
- Updated dependencies [2bb9955]
|
|
283
|
-
- Updated dependencies [2454423]
|
|
284
|
-
- Updated dependencies [a44d91e]
|
|
285
|
-
- Updated dependencies [dfb91e9]
|
|
286
|
-
- Updated dependencies [a741dde]
|
|
287
|
-
- Updated dependencies [95e1330]
|
|
288
|
-
- Updated dependencies [7cb3fc0]
|
|
289
|
-
- Updated dependencies [195eabb]
|
|
290
|
-
- Updated dependencies [33eb340]
|
|
291
|
-
- Updated dependencies [b78b95b]
|
|
292
|
-
- @mastra/core@0.14.0-alpha.4
|
|
293
|
-
- @mastra/deployer@0.14.0-alpha.4
|
|
294
|
-
- @mastra/mcp@0.10.12-alpha.1
|
|
295
|
-
|
|
296
|
-
## 0.10.22-alpha.2
|
|
297
|
-
|
|
298
|
-
### Patch Changes
|
|
299
|
-
|
|
300
|
-
- 36928f0: Use right icon for anthropic in model switcher
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 5334 more lines hidden. See full changelog in package directory.
|
|
@@ -458,6 +458,9 @@ To enable AI SDK v5 compatibility, use the `@mastra/ai-sdk` package:
|
|
|
458
458
|
</Tabs>
|
|
459
459
|
|
|
460
460
|
```typescript filename="src/mastra/index.ts" showLineNumbers copy
|
|
461
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
462
|
+
import { chatRoute } from '@mastra/ai-sdk';
|
|
463
|
+
|
|
461
464
|
export const mastra = new Mastra({
|
|
462
465
|
server: {
|
|
463
466
|
apiRoutes: [
|
|
@@ -475,7 +478,7 @@ In your application call the `useChat()` hook.
|
|
|
475
478
|
const { error, status, sendMessage, messages, regenerate, stop } =
|
|
476
479
|
useChat({
|
|
477
480
|
transport: new DefaultChatTransport({
|
|
478
|
-
api: 'http://localhost:4111/
|
|
481
|
+
api: 'http://localhost:4111/chat',
|
|
479
482
|
}),
|
|
480
483
|
});
|
|
481
484
|
```
|
|
@@ -483,3 +486,82 @@ const { error, status, sendMessage, messages, regenerate, stop } =
|
|
|
483
486
|
<Callout type="info">
|
|
484
487
|
**Note**: The `streamVNext` method with format support is experimental and may change as we refine the feature based on feedback. See the [Agent Streaming documentation](/docs/agents/streaming) for more details about streamVNext.
|
|
485
488
|
</Callout>
|
|
489
|
+
|
|
490
|
+
### Type Inference for Tools
|
|
491
|
+
|
|
492
|
+
When using tools with TypeScript in AI SDK v5, Mastra provides type inference helpers to ensure type safety for your tool inputs and outputs.
|
|
493
|
+
|
|
494
|
+
#### InferUITool
|
|
495
|
+
|
|
496
|
+
The `InferUITool` type helper infers the input and output types of a single Mastra tool:
|
|
497
|
+
|
|
498
|
+
```typescript filename="app/types.ts" showLineNumbers copy
|
|
499
|
+
import { InferUITool, createTool } from "@mastra/core/tools";
|
|
500
|
+
import { z } from "zod";
|
|
501
|
+
|
|
502
|
+
const weatherTool = createTool({
|
|
503
|
+
id: "get-weather",
|
|
504
|
+
description: "Get the current weather",
|
|
505
|
+
inputSchema: z.object({
|
|
506
|
+
location: z.string().describe("The city and state"),
|
|
507
|
+
}),
|
|
508
|
+
outputSchema: z.object({
|
|
509
|
+
temperature: z.number(),
|
|
510
|
+
conditions: z.string(),
|
|
511
|
+
}),
|
|
512
|
+
execute: async ({ context }) => {
|
|
513
|
+
return {
|
|
514
|
+
temperature: 72,
|
|
515
|
+
conditions: "sunny",
|
|
516
|
+
};
|
|
517
|
+
},
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// Infer the types from the tool
|
|
521
|
+
type WeatherUITool = InferUITool<typeof weatherTool>;
|
|
522
|
+
// This creates:
|
|
523
|
+
// {
|
|
524
|
+
// input: { location: string };
|
|
525
|
+
// output: { temperature: number; conditions: string };
|
|
526
|
+
// }
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
#### InferUITools
|
|
530
|
+
|
|
531
|
+
The `InferUITools` type helper infers the input and output types of multiple tools:
|
|
532
|
+
|
|
533
|
+
```typescript filename="app/mastra/tools.ts" showLineNumbers copy
|
|
534
|
+
import { InferUITools, createTool } from "@mastra/core/tools";
|
|
535
|
+
import { z } from "zod";
|
|
536
|
+
|
|
537
|
+
// Using weatherTool from the previous example
|
|
538
|
+
const tools = {
|
|
539
|
+
weather: weatherTool,
|
|
540
|
+
calculator: createTool({
|
|
541
|
+
id: "calculator",
|
|
542
|
+
description: "Perform basic arithmetic",
|
|
543
|
+
inputSchema: z.object({
|
|
544
|
+
operation: z.enum(["add", "subtract", "multiply", "divide"]),
|
|
545
|
+
a: z.number(),
|
|
546
|
+
b: z.number(),
|
|
547
|
+
}),
|
|
548
|
+
outputSchema: z.object({
|
|
549
|
+
result: z.number(),
|
|
550
|
+
}),
|
|
551
|
+
execute: async ({ context }) => {
|
|
552
|
+
// implementation...
|
|
553
|
+
return { result: 0 };
|
|
554
|
+
},
|
|
555
|
+
}),
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
// Infer types from the tool set
|
|
559
|
+
export type MyUITools = InferUITools<typeof tools>;
|
|
560
|
+
// This creates:
|
|
561
|
+
// {
|
|
562
|
+
// weather: { input: { location: string }; output: { temperature: number; conditions: string } };
|
|
563
|
+
// calculator: { input: { operation: "add" | "subtract" | "multiply" | "divide"; a: number; b: number }; output: { result: number } };
|
|
564
|
+
// }
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
These type helpers provide full TypeScript support when using Mastra tools with AI SDK v5 UI components, ensuring type safety across your application.
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Complex Task Execution with AgentNetwork Loop Method"
|
|
3
|
+
description: "This page demonstrates how to use the AgentNetwork's loop method in Mastra vNext to handle complex tasks that require multiple agents and workflows, including memory-based orchestration and multi-step execution."
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
## Complex tasks requiring multiple primitives
|
|
2
7
|
|
|
3
8
|
As an example, we have an AgentNetwork with 3 primitives at its disposal:
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Single Task Execution with AgentNetwork Generate Method"
|
|
3
|
+
description: "Learn how to use the AgentNetwork's generate method in Mastra vNext to convert unstructured input into structured tasks and route them to the most appropriate agent or workflow."
|
|
4
|
+
---
|
|
1
5
|
## Unstructured input to structured task
|
|
2
6
|
|
|
3
7
|
As an example, we have an AgentNetwork with 3 primitives at its disposal:
|
|
@@ -21,7 +21,7 @@ This provides full visibility into your AI operations with minimal setup, helpin
|
|
|
21
21
|
|
|
22
22
|
<Callout type="warning">
|
|
23
23
|
**Experimental Feature**
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
AI Tracing is available as of `@mastra/core 0.14.0` and is currently experimental. The API may change in future releases.
|
|
26
26
|
</Callout>
|
|
27
27
|
|
|
@@ -40,7 +40,7 @@ AI Tracing complements Mastra's existing [OpenTelemetry-based tracing](./tracing
|
|
|
40
40
|
|
|
41
41
|
**Supported Exporters:**
|
|
42
42
|
- ✅ [Langfuse](https://langfuse.com/) - Full support with real-time mode
|
|
43
|
-
-
|
|
43
|
+
- ✅ [Braintrust](https://www.braintrust.dev/home) - Initial release
|
|
44
44
|
- 🔄 [OpenTelemetry](https://opentelemetry.io/) - Coming soon
|
|
45
45
|
|
|
46
46
|
**Known Limitations:**
|
|
@@ -64,9 +64,9 @@ export const mastra = new Mastra({
|
|
|
64
64
|
serviceName: 'my-service',
|
|
65
65
|
exporters: [
|
|
66
66
|
new LangfuseExporter({
|
|
67
|
-
publicKey: process.env.LANGFUSE_PUBLIC_KEY
|
|
68
|
-
secretKey: process.env.LANGFUSE_SECRET_KEY
|
|
69
|
-
baseUrl: process.env.LANGFUSE_BASE_URL
|
|
67
|
+
publicKey: process.env.LANGFUSE_PUBLIC_KEY,
|
|
68
|
+
secretKey: process.env.LANGFUSE_SECRET_KEY,
|
|
69
|
+
baseUrl: process.env.LANGFUSE_BASE_URL, // Optional - defaults to Langfuse cloud
|
|
70
70
|
realtime: true,
|
|
71
71
|
}),
|
|
72
72
|
],
|
|
@@ -84,7 +84,7 @@ The AI tracing config accepts these properties:
|
|
|
84
84
|
type AITracingConfig = {
|
|
85
85
|
// Map of tracing instance names to their configurations
|
|
86
86
|
instances: Record<string, AITracingInstanceConfig | MastraAITracing>;
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
// Optional function to select which tracing instance to use
|
|
89
89
|
selector?: TracingSelector;
|
|
90
90
|
};
|
|
@@ -92,17 +92,17 @@ type AITracingConfig = {
|
|
|
92
92
|
type AITracingInstanceConfig = {
|
|
93
93
|
// Name to identify your service in traces
|
|
94
94
|
serviceName: string;
|
|
95
|
-
|
|
95
|
+
|
|
96
96
|
// Control how many traces are sampled
|
|
97
97
|
sampling?: {
|
|
98
98
|
type: "always" | "never" | "ratio" | "custom";
|
|
99
99
|
probability?: number; // For ratio sampling (0.0 to 1.0)
|
|
100
100
|
sampler?: (context: TraceContext) => boolean; // For custom sampling
|
|
101
101
|
};
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
// Array of exporters to send trace data to
|
|
104
104
|
exporters?: AITracingExporter[];
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
// Array of processors to transform spans before export
|
|
107
107
|
processors?: AISpanProcessor[];
|
|
108
108
|
};
|
|
@@ -122,17 +122,17 @@ export const mastra = new Mastra({
|
|
|
122
122
|
sampling: { type: 'always' },
|
|
123
123
|
exporters: [langfuseExporter],
|
|
124
124
|
},
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
development: {
|
|
127
127
|
serviceName: 'dev-service',
|
|
128
128
|
// Sample 10% of traces
|
|
129
|
-
sampling: {
|
|
130
|
-
type: 'ratio',
|
|
131
|
-
probability: 0.1
|
|
129
|
+
sampling: {
|
|
130
|
+
type: 'ratio',
|
|
131
|
+
probability: 0.1
|
|
132
132
|
},
|
|
133
133
|
exporters: [langfuseExporter],
|
|
134
134
|
},
|
|
135
|
-
|
|
135
|
+
|
|
136
136
|
custom: {
|
|
137
137
|
serviceName: 'custom-service',
|
|
138
138
|
// Custom sampling logic
|
|
@@ -150,26 +150,38 @@ export const mastra = new Mastra({
|
|
|
150
150
|
});
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
## Exporters
|
|
154
|
+
|
|
155
|
+
### Langfuse Exporter
|
|
156
|
+
|
|
157
|
+
#### Installation
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
npm install @mastra/langfuse
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### Configuration
|
|
154
164
|
|
|
155
165
|
The Langfuse exporter accepts these options:
|
|
156
166
|
|
|
157
167
|
```ts
|
|
158
168
|
type LangfuseExporterConfig = {
|
|
159
|
-
// Langfuse API credentials
|
|
160
|
-
publicKey
|
|
161
|
-
secretKey
|
|
162
|
-
|
|
169
|
+
// Langfuse API credentials (required)
|
|
170
|
+
publicKey?: string;
|
|
171
|
+
secretKey?: string;
|
|
172
|
+
|
|
173
|
+
// Langfuse host URL (optional - defaults to Langfuse cloud)
|
|
174
|
+
baseUrl?: string;
|
|
163
175
|
|
|
164
176
|
// Enable realtime mode for immediate trace visibility
|
|
165
177
|
realtime?: boolean; // defaults to false
|
|
166
|
-
|
|
178
|
+
|
|
167
179
|
// Additional options passed to Langfuse client
|
|
168
180
|
options?: any;
|
|
169
181
|
};
|
|
170
182
|
```
|
|
171
183
|
|
|
172
|
-
|
|
184
|
+
#### Basic Setup
|
|
173
185
|
|
|
174
186
|
```ts filename="mastra.config.ts" showLineNumbers copy
|
|
175
187
|
import { LangfuseExporter } from '@mastra/langfuse';
|
|
@@ -182,9 +194,9 @@ export const mastra = new Mastra({
|
|
|
182
194
|
sampling: { type: 'always' },
|
|
183
195
|
exporters: [
|
|
184
196
|
new LangfuseExporter({
|
|
185
|
-
publicKey: process.env.LANGFUSE_PUBLIC_KEY
|
|
186
|
-
secretKey: process.env.LANGFUSE_SECRET_KEY
|
|
187
|
-
baseUrl: process.env.LANGFUSE_BASE_URL
|
|
197
|
+
publicKey: process.env.LANGFUSE_PUBLIC_KEY,
|
|
198
|
+
secretKey: process.env.LANGFUSE_SECRET_KEY,
|
|
199
|
+
baseUrl: process.env.LANGFUSE_BASE_URL, // Optional
|
|
188
200
|
realtime: process.env.NODE_ENV === 'development',
|
|
189
201
|
}),
|
|
190
202
|
],
|
|
@@ -215,7 +227,57 @@ new LangfuseExporter({
|
|
|
215
227
|
})
|
|
216
228
|
```
|
|
217
229
|
|
|
218
|
-
|
|
230
|
+
### Braintrust Exporter
|
|
231
|
+
|
|
232
|
+
The Braintrust exporter sends trace data to [Braintrust](https://www.braintrust.dev/) for AI evaluation and monitoring.
|
|
233
|
+
|
|
234
|
+
#### Installation
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npm install @mastra/braintrust
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### Configuration
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
type BraintrustExporterConfig = {
|
|
244
|
+
// Braintrust API key (required)
|
|
245
|
+
apiKey?: string;
|
|
246
|
+
|
|
247
|
+
// Optional custom endpoint
|
|
248
|
+
endpoint?: string;
|
|
249
|
+
|
|
250
|
+
// Logger level for diagnostic messages (default: 'warn')
|
|
251
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
252
|
+
|
|
253
|
+
// Additional tuning parameters passed to Braintrust
|
|
254
|
+
tuningParameters?: Record<string, any>;
|
|
255
|
+
};
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
#### Basic Setup
|
|
259
|
+
|
|
260
|
+
```ts filename="src/mastra/index.ts" showLineNumbers copy
|
|
261
|
+
import { BraintrustExporter } from '@mastra/braintrust';
|
|
262
|
+
|
|
263
|
+
export const mastra = new Mastra({
|
|
264
|
+
observability: {
|
|
265
|
+
instances: {
|
|
266
|
+
braintrust: {
|
|
267
|
+
serviceName: 'my-service',
|
|
268
|
+
exporters: [
|
|
269
|
+
new BraintrustExporter({
|
|
270
|
+
apiKey: process.env.BRAINTRUST_API_KEY,
|
|
271
|
+
endpoint: process.env.BRAINTRUST_ENDPOINT, // optional
|
|
272
|
+
}),
|
|
273
|
+
],
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Multi-Instance Configuration
|
|
219
281
|
|
|
220
282
|
You can configure multiple tracing instances and use a selector to choose which one to use:
|
|
221
283
|
|
|
@@ -251,12 +313,12 @@ AI Tracing automatically creates spans for different AI operations. Mastra suppo
|
|
|
251
313
|
|
|
252
314
|
### Agent Operation Types
|
|
253
315
|
- **`AGENT_RUN`** - Agent execution from start to finish
|
|
254
|
-
- **`LLM_GENERATION`** - Individual model calls with prompts and completions
|
|
316
|
+
- **`LLM_GENERATION`** - Individual model calls with prompts and completions
|
|
255
317
|
- **`TOOL_CALL`** - Function/tool executions with inputs and outputs
|
|
256
318
|
- **`MCP_TOOL_CALL`** - Model Context Protocol tool executions
|
|
257
319
|
- **`GENERIC`** - Custom operations
|
|
258
320
|
|
|
259
|
-
### Workflow Operation Types
|
|
321
|
+
### Workflow Operation Types
|
|
260
322
|
- **`WORKFLOW_RUN`** - Workflow execution from start to finish
|
|
261
323
|
- **`WORKFLOW_STEP`** - Individual step processing
|
|
262
324
|
- **`WORKFLOW_CONDITIONAL`** - Conditional execution blocks
|
|
@@ -292,7 +354,7 @@ execute: async ({ inputData, tracingContext }) => {
|
|
|
292
354
|
endpoint: inputData.endpoint,
|
|
293
355
|
}
|
|
294
356
|
});
|
|
295
|
-
|
|
357
|
+
|
|
296
358
|
const data = await response.json();
|
|
297
359
|
return { data, statusCode: response.status };
|
|
298
360
|
}
|
|
@@ -316,7 +378,7 @@ execute: async ({ input, tracingContext }) => {
|
|
|
316
378
|
|
|
317
379
|
try {
|
|
318
380
|
const results = await db.query(input.query, input.params);
|
|
319
|
-
|
|
381
|
+
|
|
320
382
|
// Update child span with results and end it
|
|
321
383
|
querySpan?.end({
|
|
322
384
|
output: results.data,
|
|
@@ -356,8 +418,8 @@ export const mastra = new Mastra({
|
|
|
356
418
|
// SensitiveDataFilter is included by default, but you can customize it
|
|
357
419
|
processors: [
|
|
358
420
|
new SensitiveDataFilter([
|
|
359
|
-
'password', 'token', 'secret', 'key', 'apiKey',
|
|
360
|
-
'auth', 'authorization', 'bearer', 'jwt',
|
|
421
|
+
'password', 'token', 'secret', 'key', 'apiKey',
|
|
422
|
+
'auth', 'authorization', 'bearer', 'jwt',
|
|
361
423
|
'credential', 'sessionId',
|
|
362
424
|
// Add your custom sensitive fields
|
|
363
425
|
'ssn', 'creditCard', 'bankAccount'
|
|
@@ -371,7 +433,7 @@ export const mastra = new Mastra({
|
|
|
371
433
|
|
|
372
434
|
The `SensitiveDataFilter` automatically redacts matching fields in:
|
|
373
435
|
- Span attributes
|
|
374
|
-
- Span metadata
|
|
436
|
+
- Span metadata
|
|
375
437
|
- Input/output data
|
|
376
438
|
- Error information
|
|
377
439
|
|
|
@@ -389,11 +451,11 @@ export class PerformanceEnrichmentProcessor implements AISpanProcessor {
|
|
|
389
451
|
|
|
390
452
|
process(span: AnyAISpan): AnyAISpan | null {
|
|
391
453
|
const modifiedSpan = { ...span };
|
|
392
|
-
|
|
454
|
+
|
|
393
455
|
// Add computed performance metrics
|
|
394
456
|
if (span.startTime && span.endTime) {
|
|
395
457
|
const duration = span.endTime.getTime() - span.startTime.getTime();
|
|
396
|
-
|
|
458
|
+
|
|
397
459
|
modifiedSpan.metadata = {
|
|
398
460
|
...span.metadata,
|
|
399
461
|
durationMs: duration,
|
|
@@ -434,5 +496,3 @@ export const mastra = new Mastra({
|
|
|
434
496
|
```
|
|
435
497
|
|
|
436
498
|
Processors are executed in the order they're defined, and each processor receives the output of the previous one.
|
|
437
|
-
|
|
438
|
-
|
|
@@ -87,11 +87,11 @@ const result = await stream.result;
|
|
|
87
87
|
|
|
88
88
|
The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
|
|
89
89
|
|
|
90
|
-
- **`start`**: Workflow execution begins
|
|
91
|
-
- **`step-start`**: A step begins execution
|
|
92
|
-
- **`step-output`**: Custom output from a step
|
|
93
|
-
- **`step-result`**: A step completes with results
|
|
94
|
-
- **`finish`**: Workflow execution completes with usage statistics
|
|
90
|
+
- **`workflow-start`**: Workflow execution begins
|
|
91
|
+
- **`workflow-step-start`**: A step begins execution
|
|
92
|
+
- **`workflow-step-output`**: Custom output from a step
|
|
93
|
+
- **`workflow-step-result`**: A step completes with results
|
|
94
|
+
- **`workflow-finish`**: Workflow execution completes with usage statistics
|
|
95
95
|
|
|
96
96
|
## Related
|
|
97
97
|
|
|
@@ -95,13 +95,13 @@ Below is an example of events that may be emitted. Each event always includes a
|
|
|
95
95
|
|
|
96
96
|
```typescript {2,8,11}
|
|
97
97
|
{
|
|
98
|
-
type: 'start',
|
|
98
|
+
type: 'workflow-start',
|
|
99
99
|
runId: '221333ed-d9ee-4737-922b-4ab4d9de73e6',
|
|
100
100
|
from: 'WORKFLOW',
|
|
101
101
|
// ...
|
|
102
102
|
}
|
|
103
103
|
{
|
|
104
|
-
type: 'step-start',
|
|
104
|
+
type: 'workflow-step-start',
|
|
105
105
|
runId: '221333ed-d9ee-4737-922b-4ab4d9de73e6',
|
|
106
106
|
from: 'WORKFLOW',
|
|
107
107
|
payload: {
|