@mastra/core 1.26.0-alpha.11 → 1.26.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/agent/agent.d.ts.map +1 -1
  3. package/dist/agent/index.cjs +8 -8
  4. package/dist/agent/index.js +1 -1
  5. package/dist/agent/types.d.ts +7 -1
  6. package/dist/agent/types.d.ts.map +1 -1
  7. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  8. package/dist/agent/workflows/prepare-stream/schema.d.ts +1 -0
  9. package/dist/agent/workflows/prepare-stream/schema.d.ts.map +1 -1
  10. package/dist/browser/index.cjs +2 -2
  11. package/dist/browser/index.js +1 -1
  12. package/dist/channels/index.cjs +4 -4
  13. package/dist/channels/index.js +1 -1
  14. package/dist/{chunk-CXIQCUHL.js → chunk-24FTWXDR.js} +3 -3
  15. package/dist/{chunk-CXIQCUHL.js.map → chunk-24FTWXDR.js.map} +1 -1
  16. package/dist/{chunk-RSFZN7OV.cjs → chunk-2NQ2TF5F.cjs} +389 -316
  17. package/dist/chunk-2NQ2TF5F.cjs.map +1 -0
  18. package/dist/{chunk-ECT5553H.cjs → chunk-34M2QMAZ.cjs} +292 -292
  19. package/dist/{chunk-ECT5553H.cjs.map → chunk-34M2QMAZ.cjs.map} +1 -1
  20. package/dist/{chunk-BJCPVJJV.js → chunk-37OQ7B3U.js} +3 -3
  21. package/dist/{chunk-BJCPVJJV.js.map → chunk-37OQ7B3U.js.map} +1 -1
  22. package/dist/{chunk-TER3JXU5.cjs → chunk-4MLJKGJI.cjs} +52 -22
  23. package/dist/chunk-4MLJKGJI.cjs.map +1 -0
  24. package/dist/{chunk-WBPTY4Y7.cjs → chunk-7IMHDDED.cjs} +57 -57
  25. package/dist/{chunk-WBPTY4Y7.cjs.map → chunk-7IMHDDED.cjs.map} +1 -1
  26. package/dist/{chunk-2QPYXXQP.js → chunk-DHKEEJPE.js} +3 -3
  27. package/dist/{chunk-2QPYXXQP.js.map → chunk-DHKEEJPE.js.map} +1 -1
  28. package/dist/{chunk-72TFCXLB.js → chunk-DLDGEMBE.js} +381 -308
  29. package/dist/chunk-DLDGEMBE.js.map +1 -0
  30. package/dist/{chunk-IFMX323P.cjs → chunk-ER7WPKHP.cjs} +7 -7
  31. package/dist/{chunk-IFMX323P.cjs.map → chunk-ER7WPKHP.cjs.map} +1 -1
  32. package/dist/{chunk-5EU2N7AI.js → chunk-FE3JBPGZ.js} +9 -9
  33. package/dist/{chunk-5EU2N7AI.js.map → chunk-FE3JBPGZ.js.map} +1 -1
  34. package/dist/{chunk-TJ4FSWVQ.js → chunk-GDUBYVBH.js} +4 -4
  35. package/dist/{chunk-TJ4FSWVQ.js.map → chunk-GDUBYVBH.js.map} +1 -1
  36. package/dist/{chunk-6SZ4HY7N.cjs → chunk-GSJT6X23.cjs} +10 -9
  37. package/dist/chunk-GSJT6X23.cjs.map +1 -0
  38. package/dist/{chunk-HGZ5C3XG.cjs → chunk-KEXLOZNA.cjs} +17 -17
  39. package/dist/{chunk-HGZ5C3XG.cjs.map → chunk-KEXLOZNA.cjs.map} +1 -1
  40. package/dist/{chunk-MT2NFL3T.js → chunk-NTGYHDWA.js} +40 -10
  41. package/dist/chunk-NTGYHDWA.js.map +1 -0
  42. package/dist/{chunk-KSTYF5BD.js → chunk-SQAGQFGX.js} +3 -3
  43. package/dist/{chunk-KSTYF5BD.js.map → chunk-SQAGQFGX.js.map} +1 -1
  44. package/dist/{chunk-BQN6OA5U.js → chunk-T5WE2PEP.js} +6 -6
  45. package/dist/{chunk-BQN6OA5U.js.map → chunk-T5WE2PEP.js.map} +1 -1
  46. package/dist/{chunk-SLO7BNJL.cjs → chunk-TITDW65H.cjs} +9 -9
  47. package/dist/{chunk-SLO7BNJL.cjs.map → chunk-TITDW65H.cjs.map} +1 -1
  48. package/dist/{chunk-M7NIAKE6.cjs → chunk-WBZ5SRGR.cjs} +3 -3
  49. package/dist/{chunk-M7NIAKE6.cjs.map → chunk-WBZ5SRGR.cjs.map} +1 -1
  50. package/dist/{chunk-B3A3OLBO.cjs → chunk-WDJZB44P.cjs} +224 -224
  51. package/dist/{chunk-B3A3OLBO.cjs.map → chunk-WDJZB44P.cjs.map} +1 -1
  52. package/dist/{chunk-HTSHN5E4.js → chunk-WSVLXQT6.js} +8 -7
  53. package/dist/chunk-WSVLXQT6.js.map +1 -0
  54. package/dist/{chunk-DELWJ5NK.js → chunk-WYPOS74A.js} +3 -3
  55. package/dist/{chunk-DELWJ5NK.js.map → chunk-WYPOS74A.js.map} +1 -1
  56. package/dist/{chunk-5IIRXFH2.cjs → chunk-YQ5QJC3S.cjs} +5 -5
  57. package/dist/{chunk-5IIRXFH2.cjs.map → chunk-YQ5QJC3S.cjs.map} +1 -1
  58. package/dist/datasets/experiment/index.d.ts.map +1 -1
  59. package/dist/datasets/index.cjs +11 -11
  60. package/dist/datasets/index.js +1 -1
  61. package/dist/docs/SKILL.md +3 -1
  62. package/dist/docs/assets/SOURCE_MAP.json +191 -191
  63. package/dist/docs/references/docs-agents-structured-output.md +22 -0
  64. package/dist/docs/references/docs-memory-storage.md +1 -0
  65. package/dist/docs/references/reference-storage-redis.md +266 -0
  66. package/dist/docs/references/reference-tools-tavily.md +307 -0
  67. package/dist/docs/references/reference.md +2 -0
  68. package/dist/evals/index.cjs +5 -5
  69. package/dist/evals/index.js +2 -2
  70. package/dist/evals/scoreTraces/index.cjs +3 -3
  71. package/dist/evals/scoreTraces/index.js +1 -1
  72. package/dist/harness/index.cjs +7 -7
  73. package/dist/harness/index.js +5 -5
  74. package/dist/index.cjs +2 -2
  75. package/dist/index.js +1 -1
  76. package/dist/llm/index.cjs +20 -20
  77. package/dist/llm/index.js +5 -5
  78. package/dist/llm/model/provider-types.generated.d.ts +15 -0
  79. package/dist/loop/index.cjs +14 -14
  80. package/dist/loop/index.js +1 -1
  81. package/dist/loop/workflows/agentic-execution/build-messages-from-chunks.d.ts +32 -0
  82. package/dist/loop/workflows/agentic-execution/build-messages-from-chunks.d.ts.map +1 -0
  83. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  84. package/dist/loop/workflows/run-state.d.ts +0 -9
  85. package/dist/loop/workflows/run-state.d.ts.map +1 -1
  86. package/dist/mastra/index.cjs +2 -2
  87. package/dist/mastra/index.js +1 -1
  88. package/dist/mastra-47JQIPP2.cjs +12 -0
  89. package/dist/{mastra-UBXRRSVL.cjs.map → mastra-47JQIPP2.cjs.map} +1 -1
  90. package/dist/mastra-MEZUGGZZ.js +3 -0
  91. package/dist/{mastra-YR56DXR7.js.map → mastra-MEZUGGZZ.js.map} +1 -1
  92. package/dist/memory/index.cjs +19 -19
  93. package/dist/memory/index.js +1 -1
  94. package/dist/models-dev-BUQGQZCQ.js +3 -0
  95. package/dist/{models-dev-B24Y4NYV.js.map → models-dev-BUQGQZCQ.js.map} +1 -1
  96. package/dist/models-dev-INA3VBAK.cjs +12 -0
  97. package/dist/{models-dev-EMLWCDMI.cjs.map → models-dev-INA3VBAK.cjs.map} +1 -1
  98. package/dist/netlify-BW7IYASM.cjs +12 -0
  99. package/dist/{netlify-BFZBVACL.cjs.map → netlify-BW7IYASM.cjs.map} +1 -1
  100. package/dist/netlify-EQPVEYNW.js +3 -0
  101. package/dist/{netlify-W7DGKAGR.js.map → netlify-EQPVEYNW.js.map} +1 -1
  102. package/dist/processor-provider/index.cjs +10 -10
  103. package/dist/processor-provider/index.js +1 -1
  104. package/dist/processors/index.cjs +45 -45
  105. package/dist/processors/index.js +1 -1
  106. package/dist/processors/processors/structured-output.d.ts +13 -12
  107. package/dist/processors/processors/structured-output.d.ts.map +1 -1
  108. package/dist/provider-registry-4FV6CXQI.cjs +44 -0
  109. package/dist/{provider-registry-OLA6QVLP.cjs.map → provider-registry-4FV6CXQI.cjs.map} +1 -1
  110. package/dist/provider-registry-EAKPPU44.js +3 -0
  111. package/dist/{provider-registry-LGHC4U7P.js.map → provider-registry-EAKPPU44.js.map} +1 -1
  112. package/dist/provider-registry.json +32 -2
  113. package/dist/relevance/index.cjs +3 -3
  114. package/dist/relevance/index.js +1 -1
  115. package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
  116. package/dist/stream/base/output.d.ts.map +1 -1
  117. package/dist/stream/index.cjs +8 -8
  118. package/dist/stream/index.js +1 -1
  119. package/dist/tool-loop-agent/index.cjs +4 -4
  120. package/dist/tool-loop-agent/index.js +1 -1
  121. package/dist/workflows/evented/index.cjs +10 -10
  122. package/dist/workflows/evented/index.js +1 -1
  123. package/dist/workflows/index.cjs +24 -24
  124. package/dist/workflows/index.js +1 -1
  125. package/package.json +2 -2
  126. package/src/llm/model/provider-types.generated.d.ts +15 -0
  127. package/dist/chunk-6SZ4HY7N.cjs.map +0 -1
  128. package/dist/chunk-72TFCXLB.js.map +0 -1
  129. package/dist/chunk-HTSHN5E4.js.map +0 -1
  130. package/dist/chunk-MT2NFL3T.js.map +0 -1
  131. package/dist/chunk-RSFZN7OV.cjs.map +0 -1
  132. package/dist/chunk-TER3JXU5.cjs.map +0 -1
  133. package/dist/mastra-UBXRRSVL.cjs +0 -12
  134. package/dist/mastra-YR56DXR7.js +0 -3
  135. package/dist/models-dev-B24Y4NYV.js +0 -3
  136. package/dist/models-dev-EMLWCDMI.cjs +0 -12
  137. package/dist/netlify-BFZBVACL.cjs +0 -12
  138. package/dist/netlify-W7DGKAGR.js +0 -3
  139. package/dist/provider-registry-LGHC4U7P.js +0 -3
  140. package/dist/provider-registry-OLA6QVLP.cjs +0 -44
@@ -210,6 +210,28 @@ const response = await testAgent.generate('Tell me about TypeScript.', {
210
210
  })
211
211
  ```
212
212
 
213
+ If you want that structuring model to also see the current conversation history, set `useAgent: true` alongside `model`. Mastra will reuse the parent agent with the separate structuring model and attach read-only memory context when a thread is available.
214
+
215
+ ```typescript
216
+ const response = await testAgent.generate('Return my profile as structured data.', {
217
+ memory: {
218
+ thread: 'thread-123',
219
+ resource: 'user-123',
220
+ },
221
+ structuredOutput: {
222
+ schema: z.object({
223
+ favoriteColor: z.string(),
224
+ hometown: z.string(),
225
+ petName: z.string(),
226
+ }),
227
+ model: 'openai/gpt-5.4',
228
+ useAgent: true,
229
+ },
230
+ })
231
+ ```
232
+
233
+ Leave `useAgent` unset if you want the separate structuring model to work only from the current response and not inherit prior conversation memory.
234
+
213
235
  ### Multi-step approach with `prepareStep`
214
236
 
215
237
  For models that don't support tools and structured outputs together, you can use `prepareStep` to handle them in separate steps.
@@ -34,6 +34,7 @@ Each provider page includes installation instructions, configuration parameters,
34
34
  - [PostgreSQL](https://mastra.ai/reference/storage/postgresql)
35
35
  - [MongoDB](https://mastra.ai/reference/storage/mongodb)
36
36
  - [Upstash](https://mastra.ai/reference/storage/upstash)
37
+ - [Redis](https://mastra.ai/reference/storage/redis)
37
38
  - [Cloudflare D1](https://mastra.ai/reference/storage/cloudflare-d1)
38
39
  - [Cloudflare KV & Durable Objects](https://mastra.ai/reference/storage/cloudflare)
39
40
  - [Convex](https://mastra.ai/reference/storage/convex)
@@ -0,0 +1,266 @@
1
+ # Redis Storage
2
+
3
+ The Redis storage implementation provides a high-performance storage solution using direct Redis connections via [node-redis](https://github.com/redis/node-redis) (the official Redis client for Node.js). It supports standalone Redis, and through custom client configuration, Redis Sentinel and Cluster deployments.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @mastra/redis
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Using Connection String
14
+
15
+ ```typescript
16
+ import { RedisStore } from '@mastra/redis'
17
+
18
+ const storage = new RedisStore({
19
+ id: 'redis-storage',
20
+ connectionString: 'redis://localhost:6379',
21
+ })
22
+
23
+ await storage.init()
24
+ ```
25
+
26
+ ### Using Host/Port Configuration
27
+
28
+ ```typescript
29
+ import { RedisStore } from '@mastra/redis'
30
+
31
+ const storage = new RedisStore({
32
+ id: 'redis-storage',
33
+ host: 'localhost',
34
+ port: 6379,
35
+ password: 'your-password',
36
+ db: 0,
37
+ })
38
+
39
+ await storage.init()
40
+ ```
41
+
42
+ ### Using Pre-configured Client
43
+
44
+ For advanced configurations like Sentinel or Cluster, you can pass a pre-configured redis client:
45
+
46
+ ```typescript
47
+ import { RedisStore } from '@mastra/redis'
48
+ import { createClient } from 'redis'
49
+
50
+ const client = createClient({
51
+ url: 'redis://localhost:6379',
52
+ socket: {
53
+ reconnectStrategy: retries => Math.min(retries * 50, 2000),
54
+ },
55
+ })
56
+
57
+ // Connect the client before passing to RedisStore
58
+ await client.connect()
59
+
60
+ const storage = new RedisStore({
61
+ id: 'redis-storage',
62
+ client,
63
+ })
64
+ ```
65
+
66
+ ## Parameters
67
+
68
+ **id** (`string`): Unique identifier for the storage instance
69
+
70
+ **connectionString** (`string`): Redis connection URL (e.g., \`redis\://localhost:6379\` or \`redis\://:password\@localhost:6379\`)
71
+
72
+ **host** (`string`): Redis host address
73
+
74
+ **port** (`number`): Redis port number (Default: `6379`)
75
+
76
+ **password** (`string`): Redis password for authentication
77
+
78
+ **db** (`number`): Redis database number (Default: `0`)
79
+
80
+ **client** (`RedisClient`): Pre-configured redis client (from the \`redis\` package) for advanced setups
81
+
82
+ > **Note:** You must provide either `connectionString`, `host`, or `client`. These options are mutually exclusive.
83
+
84
+ ## Additional Notes
85
+
86
+ ### Key Structure
87
+
88
+ The Redis storage implementation uses the following key patterns:
89
+
90
+ - Threads: `mastra_threads:id:{threadId}`
91
+ - Messages: `mastra_messages:threadId:{threadId}:id:{messageId}`
92
+ - Message index: `msg-idx:{messageId}` (for fast lookups)
93
+ - Thread messages sorted set: `thread:{threadId}:messages`
94
+ - Workflow snapshots: `mastra_workflow_snapshot:namespace:{ns}:workflow_name:{name}:run_id:{id}`
95
+ - Scores: `mastra_scorers:id:{scoreId}`
96
+ - Resources: `mastra_resources:{resourceId}`
97
+
98
+ ### Redis Sentinel
99
+
100
+ For high-availability deployments using Redis Sentinel, create a custom client:
101
+
102
+ ```typescript
103
+ import { RedisStore } from '@mastra/redis'
104
+ import { createClient } from 'redis'
105
+
106
+ const client = createClient({
107
+ url: 'redis://sentinel-host:26379',
108
+ // Configure sentinel options as needed for your setup
109
+ })
110
+
111
+ await client.connect()
112
+
113
+ const storage = new RedisStore({
114
+ id: 'redis-sentinel-storage',
115
+ client,
116
+ })
117
+ ```
118
+
119
+ ### Redis Cluster
120
+
121
+ For Redis Cluster deployments, use the cluster client:
122
+
123
+ ```typescript
124
+ import { RedisStore } from '@mastra/redis'
125
+ import { createCluster } from 'redis'
126
+
127
+ const cluster = createCluster({
128
+ rootNodes: [
129
+ { url: 'redis://node-1:6379' },
130
+ { url: 'redis://node-2:6379' },
131
+ { url: 'redis://node-3:6379' },
132
+ ],
133
+ })
134
+
135
+ await cluster.connect()
136
+
137
+ const storage = new RedisStore({
138
+ id: 'redis-cluster-storage',
139
+ client: cluster,
140
+ })
141
+ ```
142
+
143
+ ### Accessing the Underlying Client
144
+
145
+ You can access the underlying redis client for custom operations:
146
+
147
+ ```typescript
148
+ const storage = new RedisStore({
149
+ id: 'redis-storage',
150
+ connectionString: 'redis://localhost:6379',
151
+ })
152
+
153
+ await storage.init()
154
+
155
+ const client = storage.getClient()
156
+
157
+ // Custom Redis operations
158
+ await client.set('custom-key', 'value')
159
+ const value = await client.get('custom-key')
160
+ ```
161
+
162
+ ### Closing Connections
163
+
164
+ When shutting down your application, close the Redis connection:
165
+
166
+ ```typescript
167
+ await storage.close()
168
+ ```
169
+
170
+ ## Usage Example
171
+
172
+ ### Adding memory to an agent
173
+
174
+ ```typescript
175
+ import { Memory } from '@mastra/memory'
176
+ import { Agent } from '@mastra/core/agent'
177
+ import { RedisStore } from '@mastra/redis'
178
+
179
+ export const redisAgent = new Agent({
180
+ id: 'redis-agent',
181
+ name: 'Redis Agent',
182
+ instructions:
183
+ 'You are an AI agent with the ability to automatically recall memories from previous interactions.',
184
+ model: 'openai/gpt-4o',
185
+ memory: new Memory({
186
+ storage: new RedisStore({
187
+ id: 'redis-agent-storage',
188
+ connectionString: process.env.REDIS_URL!,
189
+ }),
190
+ options: {
191
+ lastMessages: 10,
192
+ },
193
+ }),
194
+ })
195
+ ```
196
+
197
+ ### Using the agent
198
+
199
+ ```typescript
200
+ import 'dotenv/config'
201
+
202
+ import { mastra } from './mastra'
203
+
204
+ const threadId = '123'
205
+ const resourceId = 'user-456'
206
+
207
+ const agent = mastra.getAgent('redisAgent')
208
+
209
+ const message = await agent.stream('My name is Mastra', {
210
+ memory: {
211
+ thread: threadId,
212
+ resource: resourceId,
213
+ },
214
+ })
215
+
216
+ await message.textStream.pipeTo(new WritableStream())
217
+
218
+ const stream = await agent.stream("What's my name?", {
219
+ memory: {
220
+ thread: threadId,
221
+ resource: resourceId,
222
+ },
223
+ memoryOptions: {
224
+ lastMessages: 5,
225
+ },
226
+ })
227
+
228
+ for await (const chunk of stream.textStream) {
229
+ process.stdout.write(chunk)
230
+ }
231
+ ```
232
+
233
+ ### Using with Mastra instance
234
+
235
+ ```typescript
236
+ import { Mastra } from '@mastra/core'
237
+ import { RedisStore } from '@mastra/redis'
238
+
239
+ const storage = new RedisStore({
240
+ id: 'mastra-storage',
241
+ host: 'localhost',
242
+ port: 6379,
243
+ })
244
+
245
+ const mastra = new Mastra({
246
+ storage, // init() called automatically
247
+ })
248
+ ```
249
+
250
+ If using storage directly without Mastra, call `init()` explicitly:
251
+
252
+ ```typescript
253
+ import { RedisStore } from '@mastra/redis'
254
+
255
+ const storage = new RedisStore({
256
+ id: 'redis-storage',
257
+ host: 'localhost',
258
+ port: 6379,
259
+ })
260
+
261
+ await storage.init()
262
+
263
+ // Access domain-specific stores via getStore()
264
+ const memoryStore = await storage.getStore('memory')
265
+ const thread = await memoryStore?.getThreadById({ threadId: '...' })
266
+ ```
@@ -0,0 +1,307 @@
1
+ # Tavily tools
2
+
3
+ **Added in:** `@mastra/tavily@0.1.0-alpha.0`
4
+
5
+ The `@mastra/tavily` package wraps the [Tavily](https://app.tavily.com) API as Mastra-compatible tools. It exposes factory functions for search, extract, crawl, and map — each returning a tool created with [`createTool()`](https://mastra.ai/reference/tools/create-tool) that includes full Zod input/output schemas.
6
+
7
+ ## Installation
8
+
9
+ **npm**:
10
+
11
+ ```sh
12
+ npm install @mastra/tavily @tavily/core zod
13
+ ```
14
+
15
+ **pnpm**:
16
+
17
+ ```sh
18
+ pnpm add @mastra/tavily @tavily/core zod
19
+ ```
20
+
21
+ **Yarn**:
22
+
23
+ ```sh
24
+ yarn add @mastra/tavily @tavily/core zod
25
+ ```
26
+
27
+ **Bun**:
28
+
29
+ ```sh
30
+ bun add @mastra/tavily @tavily/core zod
31
+ ```
32
+
33
+ ## Quick start
34
+
35
+ Use `createTavilyTools()` to get all four tools with shared configuration:
36
+
37
+ ```typescript
38
+ import { createTavilyTools } from '@mastra/tavily'
39
+
40
+ const tools = createTavilyTools()
41
+ // Or pass an explicit API key:
42
+ // const tools = createTavilyTools({ apiKey: 'tvly-...' })
43
+ ```
44
+
45
+ Each tool can also be created individually:
46
+
47
+ ```typescript
48
+ import { createTavilySearchTool, createTavilyExtractTool } from '@mastra/tavily'
49
+
50
+ const searchTool = createTavilySearchTool()
51
+ const extractTool = createTavilyExtractTool({ apiKey: 'tvly-...' })
52
+ ```
53
+
54
+ By default, all tools read `TAVILY_API_KEY` from the environment. You can pass `{ apiKey }` explicitly to override.
55
+
56
+ ## Configuration
57
+
58
+ All factory functions accept `TavilyClientOptions` from `@tavily/core`:
59
+
60
+ **apiKey** (`string`): Tavily API key. Falls back to the \`TAVILY\_API\_KEY\` environment variable.
61
+
62
+ **clientSource** (`string`): Attribution string sent with each request. (Default: `'mastra'`)
63
+
64
+ **apiBaseURL** (`string`): Base URL for the Tavily API.
65
+
66
+ **proxies** (`object`): Proxy configuration passed to the underlying HTTP client.
67
+
68
+ **projectId** (`string`): Tavily project ID for request scoping.
69
+
70
+ ## `createTavilyTools()`
71
+
72
+ Returns an object containing all four tools with a shared configuration.
73
+
74
+ ```typescript
75
+ import { createTavilyTools } from '@mastra/tavily'
76
+
77
+ const tools = createTavilyTools({ apiKey: 'tvly-...' })
78
+ // tools.tavilySearch, tools.tavilyExtract, tools.tavilyCrawl, tools.tavilyMap
79
+ ```
80
+
81
+ **Returns:** `{ tavilySearch, tavilyExtract, tavilyCrawl, tavilyMap }`
82
+
83
+ ## `createTavilySearchTool()`
84
+
85
+ Creates a tool that searches the web using Tavily. Returns relevant results with content snippets, optional AI-generated answers, and images.
86
+
87
+ **Tool ID:** `tavily-search`
88
+
89
+ ```typescript
90
+ import { createTavilySearchTool } from '@mastra/tavily'
91
+
92
+ const searchTool = createTavilySearchTool()
93
+ ```
94
+
95
+ ### Input
96
+
97
+ **query** (`string`): The search query.
98
+
99
+ **searchDepth** (`'basic' | 'advanced' | 'fast' | 'ultra-fast'`): Search depth. Use 'basic' for standard results, 'advanced' for more thorough results, or 'fast'/'ultra-fast' for low latency.
100
+
101
+ **maxResults** (`number`): Maximum number of results to return (1-20).
102
+
103
+ **includeAnswer** (`boolean | 'basic' | 'advanced'`): Include an AI-generated answer summary.
104
+
105
+ **includeImages** (`boolean`): Include query-related images in the response.
106
+
107
+ **includeImageDescriptions** (`boolean`): Include descriptions for returned images.
108
+
109
+ **includeRawContent** (`false | 'markdown' | 'text'`): Include cleaned HTML content of each result. Pass false to disable, or 'markdown'/'text' for format.
110
+
111
+ **includeDomains** (`string[]`): Restrict results to these domains.
112
+
113
+ **excludeDomains** (`string[]`): Exclude results from these domains.
114
+
115
+ **timeRange** (`'day' | 'week' | 'month' | 'year'`): Filter results by recency.
116
+
117
+ ### Output
118
+
119
+ **query** (`string`): The original search query.
120
+
121
+ **answer** (`string`): AI-generated answer summary.
122
+
123
+ **images** (`{ url: string; description?: string }[]`): Related images.
124
+
125
+ **results** (`SearchResult[]`): Array of search results.
126
+
127
+ **results.title** (`string`): Result title.
128
+
129
+ **results.url** (`string`): Result URL.
130
+
131
+ **results.content** (`string`): Content snippet.
132
+
133
+ **results.score** (`number`): Relevance score.
134
+
135
+ **results.rawContent** (`string`): Full-page content (when requested).
136
+
137
+ **responseTime** (`number`): Server response time in seconds.
138
+
139
+ ## `createTavilyExtractTool()`
140
+
141
+ Creates a tool that extracts content from one or more URLs. Returns raw page content in markdown or text format with up to 20 URLs per request.
142
+
143
+ **Tool ID:** `tavily-extract`
144
+
145
+ ```typescript
146
+ import { createTavilyExtractTool } from '@mastra/tavily'
147
+
148
+ const extractTool = createTavilyExtractTool()
149
+ ```
150
+
151
+ ### Input
152
+
153
+ **urls** (`string[]`): URLs to extract content from (1-20).
154
+
155
+ **extractDepth** (`'basic' | 'advanced'`): Extraction depth. Use 'advanced' to retrieve tables and embedded content.
156
+
157
+ **query** (`string`): User intent for reranking extracted content chunks by relevance.
158
+
159
+ **includeImages** (`boolean`): Include images extracted from the pages.
160
+
161
+ **format** (`'markdown' | 'text'`): Output format for extracted content. (Default: `'markdown'`)
162
+
163
+ ### Output
164
+
165
+ **results** (`ExtractResult[]`): Successfully extracted pages.
166
+
167
+ **results.url** (`string`): Page URL.
168
+
169
+ **results.rawContent** (`string`): Extracted page content.
170
+
171
+ **results.images** (`string[]`): Extracted image URLs.
172
+
173
+ **failedResults** (`FailedResult[]`): URLs that failed extraction.
174
+
175
+ **failedResults.url** (`string`): Failed URL.
176
+
177
+ **failedResults.error** (`string`): Error message.
178
+
179
+ **responseTime** (`number`): Server response time in seconds.
180
+
181
+ ## `createTavilyCrawlTool()`
182
+
183
+ Creates a tool that crawls a website starting from a URL. Extracts content from discovered pages with configurable depth, breadth, and domain constraints.
184
+
185
+ **Tool ID:** `tavily-crawl`
186
+
187
+ ```typescript
188
+ import { createTavilyCrawlTool } from '@mastra/tavily'
189
+
190
+ const crawlTool = createTavilyCrawlTool()
191
+ ```
192
+
193
+ ### Input
194
+
195
+ **url** (`string`): The root URL to begin the crawl.
196
+
197
+ **maxDepth** (`number`): Maximum depth of the crawl from the base URL.
198
+
199
+ **maxBreadth** (`number`): Maximum number of links to follow per page.
200
+
201
+ **limit** (`number`): Total number of pages the crawler processes before stopping.
202
+
203
+ **instructions** (`string`): Natural language instructions for the crawler.
204
+
205
+ **selectPaths** (`string[]`): Regex patterns to select specific URL paths.
206
+
207
+ **selectDomains** (`string[]`): Regex patterns to restrict to specific domains.
208
+
209
+ **excludePaths** (`string[]`): Regex patterns to exclude specific URL paths.
210
+
211
+ **excludeDomains** (`string[]`): Regex patterns to exclude specific domains.
212
+
213
+ **allowExternal** (`boolean`): Whether to follow links to external domains.
214
+
215
+ **extractDepth** (`'basic' | 'advanced'`): Extraction depth. Use 'advanced' to retrieve tables and embedded content.
216
+
217
+ **includeImages** (`boolean`): Include images from crawled pages.
218
+
219
+ **format** (`'markdown' | 'text'`): Output format for extracted content. (Default: `'markdown'`)
220
+
221
+ ### Output
222
+
223
+ **baseUrl** (`string`): The root URL that was crawled.
224
+
225
+ **results** (`CrawlResult[]`): Content extracted from discovered pages.
226
+
227
+ **results.url** (`string`): Page URL.
228
+
229
+ **results.rawContent** (`string`): Extracted page content.
230
+
231
+ **results.images** (`string[]`): Image URLs found on the page.
232
+
233
+ **responseTime** (`number`): Server response time in seconds.
234
+
235
+ ## `createTavilyMapTool()`
236
+
237
+ Creates a tool that maps a website's structure starting from a URL. Discovers and returns a list of URLs without extracting page content. Use this to understand site structure before targeted extraction.
238
+
239
+ **Tool ID:** `tavily-map`
240
+
241
+ ```typescript
242
+ import { createTavilyMapTool } from '@mastra/tavily'
243
+
244
+ const mapTool = createTavilyMapTool()
245
+ ```
246
+
247
+ ### Input
248
+
249
+ **url** (`string`): The root URL to begin mapping.
250
+
251
+ **maxDepth** (`number`): Maximum depth of the mapping from the base URL.
252
+
253
+ **maxBreadth** (`number`): Maximum number of links to follow per page.
254
+
255
+ **limit** (`number`): Total number of links the mapper processes before stopping.
256
+
257
+ **instructions** (`string`): Natural language instructions for the mapper.
258
+
259
+ **selectPaths** (`string[]`): Regex patterns to select specific URL paths.
260
+
261
+ **selectDomains** (`string[]`): Regex patterns to restrict to specific domains.
262
+
263
+ **excludePaths** (`string[]`): Regex patterns to exclude specific URL paths.
264
+
265
+ **excludeDomains** (`string[]`): Regex patterns to exclude specific domains.
266
+
267
+ **allowExternal** (`boolean`): Whether to include external domain links.
268
+
269
+ ### Output
270
+
271
+ **baseUrl** (`string`): The root URL that was mapped.
272
+
273
+ **results** (`string[]`): Discovered URLs.
274
+
275
+ **responseTime** (`number`): Server response time in seconds.
276
+
277
+ ## Agent example
278
+
279
+ The following example demonstrates a research agent that combines search and extract:
280
+
281
+ ```typescript
282
+ import { Agent } from '@mastra/core/agent'
283
+ import { createTavilySearchTool, createTavilyExtractTool } from '@mastra/tavily'
284
+
285
+ const agent = new Agent({
286
+ id: 'web-search-agent',
287
+ name: 'Web Search Agent',
288
+ model: 'anthropic/claude-sonnet-4-6',
289
+ instructions:
290
+ 'You are a web search assistant. Use search tool to find relevant pages, then use extract tool to get full content from the best results.',
291
+ tools: {
292
+ search: createTavilySearchTool(),
293
+ extract: createTavilyExtractTool(),
294
+ },
295
+ })
296
+ ```
297
+
298
+ ## Environment variables
299
+
300
+ | Variable | Description |
301
+ | ---------------- | ------------------------------------------------------------------------------------------- |
302
+ | `TAVILY_API_KEY` | Your Tavily API key. Used as the default when `apiKey` is not passed to a factory function. |
303
+
304
+ ## Related
305
+
306
+ - [`createTool()`](https://mastra.ai/reference/tools/create-tool)
307
+ - [Tavily API documentation](https://docs.tavily.com)
@@ -201,6 +201,7 @@ The Reference section provides documentation of Mastra's API, including paramete
201
201
  - [MongoDB Storage](https://mastra.ai/reference/storage/mongodb)
202
202
  - [MSSQL Storage](https://mastra.ai/reference/storage/mssql)
203
203
  - [PostgreSQL Storage](https://mastra.ai/reference/storage/postgresql)
204
+ - [Redis Storage](https://mastra.ai/reference/storage/redis)
204
205
  - [Upstash Storage](https://mastra.ai/reference/storage/upstash)
205
206
  - [ChunkType](https://mastra.ai/reference/streaming/ChunkType)
206
207
  - [MastraModelOutput](https://mastra.ai/reference/streaming/agents/MastraModelOutput)
@@ -217,6 +218,7 @@ The Reference section provides documentation of Mastra's API, including paramete
217
218
  - [createVectorQueryTool()](https://mastra.ai/reference/tools/vector-query-tool)
218
219
  - [MCPClient](https://mastra.ai/reference/tools/mcp-client)
219
220
  - [MCPServer](https://mastra.ai/reference/tools/mcp-server)
221
+ - [Tavily Tools](https://mastra.ai/reference/tools/tavily)
220
222
  - [Amazon S3 Vector Store](https://mastra.ai/reference/vectors/s3vectors)
221
223
  - [Astra Vector Store](https://mastra.ai/reference/vectors/astra)
222
224
  - [Chroma Vector Store](https://mastra.ai/reference/vectors/chroma)
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var chunk5IIRXFH2_cjs = require('../chunk-5IIRXFH2.cjs');
4
- var chunkRSFZN7OV_cjs = require('../chunk-RSFZN7OV.cjs');
3
+ var chunkYQ5QJC3S_cjs = require('../chunk-YQ5QJC3S.cjs');
4
+ var chunk2NQ2TF5F_cjs = require('../chunk-2NQ2TF5F.cjs');
5
5
  var chunkSBWFQ2CA_cjs = require('../chunk-SBWFQ2CA.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "runEvals", {
10
10
  enumerable: true,
11
- get: function () { return chunk5IIRXFH2_cjs.runEvals; }
11
+ get: function () { return chunkYQ5QJC3S_cjs.runEvals; }
12
12
  });
13
13
  Object.defineProperty(exports, "MastraScorer", {
14
14
  enumerable: true,
15
- get: function () { return chunkRSFZN7OV_cjs.MastraScorer; }
15
+ get: function () { return chunk2NQ2TF5F_cjs.MastraScorer; }
16
16
  });
17
17
  Object.defineProperty(exports, "createScorer", {
18
18
  enumerable: true,
19
- get: function () { return chunkRSFZN7OV_cjs.createScorer; }
19
+ get: function () { return chunk2NQ2TF5F_cjs.createScorer; }
20
20
  });
21
21
  Object.defineProperty(exports, "extractTrajectory", {
22
22
  enumerable: true,
@@ -1,5 +1,5 @@
1
- export { runEvals } from '../chunk-KSTYF5BD.js';
2
- export { MastraScorer, createScorer } from '../chunk-72TFCXLB.js';
1
+ export { runEvals } from '../chunk-SQAGQFGX.js';
2
+ export { MastraScorer, createScorer } from '../chunk-DLDGEMBE.js';
3
3
  export { extractTrajectory, extractTrajectoryFromTrace, extractWorkflowTrajectory, listScoresResponseSchema, saveScorePayloadSchema, scoreResultSchema, scoreRowDataSchema, scoringEntityTypeSchema, scoringExtractStepResultSchema, scoringHookInputSchema, scoringInputSchema, scoringInputWithExtractStepResultAndAnalyzeStepResultSchema, scoringInputWithExtractStepResultAndScoreAndReasonSchema, scoringInputWithExtractStepResultSchema, scoringPromptsSchema, scoringSourceSchema, scoringValueSchema } from '../chunk-XV2GQXYR.js';
4
4
  //# sourceMappingURL=index.js.map
5
5
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkWBPTY4Y7_cjs = require('../../chunk-WBPTY4Y7.cjs');
3
+ var chunk7IMHDDED_cjs = require('../../chunk-7IMHDDED.cjs');
4
4
  var chunkSBWFQ2CA_cjs = require('../../chunk-SBWFQ2CA.cjs');
5
5
  var chunk2NAHFM32_cjs = require('../../chunk-2NAHFM32.cjs');
6
6
  var chunk4U7ZLI36_cjs = require('../../chunk-4U7ZLI36.cjs');
@@ -234,7 +234,7 @@ function transformTraceToScorerInputAndOutput(trace) {
234
234
  }
235
235
 
236
236
  // src/evals/scoreTraces/scoreTracesWorkflow.ts
237
- var getTraceStep = chunkWBPTY4Y7_cjs.createStep({
237
+ var getTraceStep = chunk7IMHDDED_cjs.createStep({
238
238
  id: "__process-trace-scoring",
239
239
  inputSchema: v4.z.object({
240
240
  targets: v4.z.array(
@@ -429,7 +429,7 @@ async function attachScoreToSpan({
429
429
  } catch {
430
430
  }
431
431
  }
432
- var scoreTracesWorkflow = chunkWBPTY4Y7_cjs.createWorkflow({
432
+ var scoreTracesWorkflow = chunk7IMHDDED_cjs.createWorkflow({
433
433
  id: "__batch-scoring-traces",
434
434
  inputSchema: v4.z.object({
435
435
  targets: v4.z.array(
@@ -1,4 +1,4 @@
1
- import { createStep, createWorkflow } from '../../chunk-DELWJ5NK.js';
1
+ import { createStep, createWorkflow } from '../../chunk-WYPOS74A.js';
2
2
  import { saveScorePayloadSchema } from '../../chunk-XV2GQXYR.js';
3
3
  import { getEntityTypeForSpan } from '../../chunk-YK76RFQG.js';
4
4
  import { MastraError } from '../../chunk-FJEVLHJT.js';