@mastra/tavily 1.1.2-alpha.0 → 1.1.2

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 (2) hide show
  1. package/README.md +20 -108
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,122 +1,26 @@
1
1
  # @mastra/tavily
2
2
 
3
- Tavily web search, extract, crawl, and map tools for [Mastra](https://mastra.ai) agents.
4
-
3
+ Add Tavily search, extract, crawl, and map tools to Mastra agents with shared configuration, typed Zod schemas, and structured web results.
5
4
  ## Installation
6
5
 
7
6
  ```bash
8
- npm install @mastra/tavily @tavily/core zod
9
- ```
10
-
11
- ## Quick Start
12
-
13
- Use `createTavilyTools()` to get all four tools with a shared configuration:
14
-
15
- ```typescript
16
- import { Agent } from '@mastra/core/agent';
17
- import { createTavilyTools } from '@mastra/tavily';
18
-
19
- const tools = createTavilyTools();
20
- // Or pass an explicit API key:
21
- // const tools = createTavilyTools({ apiKey: 'tvly-...' });
22
-
23
- const agent = new Agent({
24
- id: 'realtime-information-agent',
25
- name: 'Realtime Information Agent',
26
- instructions:
27
- 'You are a realtime information agent that can search the web for the latest information and provide it to the user.',
28
- model: 'anthropic/claude-sonnet-4-6',
29
- tools,
30
- });
31
- ```
32
-
33
- By default, the tools read `TAVILY_API_KEY` from your environment. You can also pass `{ apiKey }` explicitly.
34
-
35
- ## Individual Tools
36
-
37
- Each tool can be created independently:
38
-
39
- ```typescript
40
- import { createTavilySearchTool, createTavilyExtractTool } from '@mastra/tavily';
41
-
42
- const searchTool = createTavilySearchTool({ apiKey: 'tvly-...' });
43
- const extractTool = createTavilyExtractTool(); // uses TAVILY_API_KEY env var
7
+ npm install @mastra/tavily
44
8
  ```
45
9
 
46
- ### Search
47
-
48
- ```typescript
49
- import { createTavilySearchTool } from '@mastra/tavily';
50
-
51
- const searchTool = createTavilySearchTool();
10
+ ## Usage
52
11
 
53
- // When called by an agent, accepts:
54
- // - query (required)
55
- // - searchDepth: 'basic' | 'advanced'
56
- // - maxResults: 1-20
57
- // - includeAnswer: boolean | 'basic' | 'advanced'
58
- // - includeImages, includeImageDescriptions, includeRawContent
59
- // - includeDomains, excludeDomains
60
- // - timeRange: 'day' | 'week' | 'month' | 'year'
61
- ```
62
12
 
63
- ### Extract
64
-
65
- ```typescript
66
- import { createTavilyExtractTool } from '@mastra/tavily';
67
-
68
- const extractTool = createTavilyExtractTool();
69
-
70
- // Accepts: urls (1-20), extractDepth, includeImages, format ('markdown' | 'text')
71
- // Returns: results[] + failedResults[]
72
- ```
73
-
74
- ### Crawl
75
-
76
- ```typescript
77
- import { createTavilyCrawlTool } from '@mastra/tavily';
78
-
79
- const crawlTool = createTavilyCrawlTool();
80
-
81
- // Accepts: url, maxDepth, maxBreadth, limit, instructions,
82
- // selectPaths, selectDomains, excludePaths, excludeDomains,
83
- // allowExternal, extractDepth, includeImages, format
84
- // Returns: baseUrl + results[]
85
- ```
86
-
87
- ### Map
88
-
89
- ```typescript
90
- import { createTavilyMapTool } from '@mastra/tavily';
91
-
92
- const mapTool = createTavilyMapTool();
93
-
94
- // Accepts: url, maxDepth, maxBreadth, limit, instructions,
95
- // selectPaths, selectDomains, excludePaths, excludeDomains, allowExternal
96
- // Returns: baseUrl + discovered URL strings
97
- ```
98
-
99
- ## Configuration
100
-
101
- | Option | Type | Default | Description |
102
- | -------- | -------- | ---------------------------- | ------------------- |
103
- | `apiKey` | `string` | `process.env.TAVILY_API_KEY` | Your Tavily API key |
104
-
105
- All tools accept `TavilyClientOptions` from `@tavily/core` (includes `apiKey`, `proxies`, `apiBaseURL`, `clientName`, `projectId`). If no API key is found, the tool throws a clear error at execution time. `clientName` defaults to `'mastra'` and is sent in the `X-Client-Name` header.
106
-
107
- ## RAG Pairing Example
108
-
109
- Combine search and extract for retrieval-augmented generation:
13
+ Set `TAVILY_API_KEY` before creating the tools.
110
14
 
111
15
  ```typescript
112
16
  import { Agent } from '@mastra/core/agent';
113
- import { createTavilySearchTool, createTavilyExtractTool } from '@mastra/tavily';
17
+ import { createTavilyExtractTool, createTavilySearchTool } from '@mastra/tavily';
114
18
 
115
- const agent = new Agent({
116
- id: 'rag-agent',
117
- name: 'Research Assistant',
118
- model: 'anthropic/claude-sonnet-4-6',
119
- instructions: `You are a research assistant. Use tavily-search to find relevant pages, then use tavily-extract to get full content from the best results.`,
19
+ export const researchAgent = new Agent({
20
+ id: 'research-agent',
21
+ name: 'Research Agent',
22
+ model: 'openai/gpt-5.6-sol',
23
+ instructions: 'Search for relevant pages, then extract the best sources before answering.',
120
24
  tools: {
121
25
  search: createTavilySearchTool(),
122
26
  extract: createTavilyExtractTool(),
@@ -124,6 +28,14 @@ const agent = new Agent({
124
28
  });
125
29
  ```
126
30
 
127
- ## License
31
+ ## Documentation
32
+
33
+ - [Tavily](https://mastra.ai/integrations/tools/tavily)
34
+
35
+ ## Changelog
36
+
37
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/integrations/tavily/CHANGELOG.md) for version history and release notes.
38
+
39
+ ## Support
128
40
 
129
- Apache-2.0
41
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/tavily",
3
- "version": "1.1.2-alpha.0",
3
+ "version": "1.1.2",
4
4
  "description": "Tavily web search, extract, crawl, and map tools for Mastra agents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -53,9 +53,9 @@
53
53
  "typescript": "^7.0.2",
54
54
  "vitest": "4.1.10",
55
55
  "zod": "^4.4.3",
56
- "@internal/lint": "0.0.129",
57
- "@internal/types-builder": "0.0.104",
58
- "@mastra/core": "1.64.0-alpha.2"
56
+ "@internal/lint": "0.0.130",
57
+ "@internal/types-builder": "0.0.105",
58
+ "@mastra/core": "1.64.0"
59
59
  },
60
60
  "scripts": {
61
61
  "build:lib": "tsdown --silent --config tsdown.config.ts",