Skip to content

Commit 99ffca1

Browse files
guy-hartsteinvercel[bot]nicoalbanese
authored andcommitted
Feat/add tavily tools (#10567)
<!-- Welcome to contributing to AI SDK! We're excited to see your changes. We suggest you read the following contributing guide we've created before submitting: https://github.com/vercel/ai/blob/main/CONTRIBUTING.md --> ## Background Tavily provides a suite of web-access tools trusted by over 800K developers worldwide. We're excited to announce our new Vercel AI SDK integration package (https://www.npmjs.com/package/@tavily/ai-sdk) which will allow developers to build Tavily-powered agents on Vercel AI SDK v5. <!-- Why was this change necessary? --> ## Summary This PR adds Tavily tools to the new Vercel agent registry and tool-calling documentation. <!-- What did you change? --> ## Checklist <!-- Do not edit this list. Leave items unchecked that don't apply. If you need to track subtasks, create a new "## Tasks" section Please check if the PR fulfills the following requirements: --> - [ ] Tests have been added / updated (for bug fixes / features) - [x] Documentation has been added / updated (for bug fixes / features) - [ ] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [ ] I have reviewed this pull request (self-review) --------- Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by: nicoalbanese <[email protected]>
1 parent 1299708 commit 99ffca1

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

content/cookbook/05-node/56-web-search-agent.mdx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,39 @@ const { text } = await generateText({
161161
console.log(text);
162162
```
163163

164+
#### Tavily
165+
166+
<Note>
167+
Get your API key from the [Tavily Dashboard](https://app.tavily.com).
168+
</Note>
169+
170+
First, install the `tavilySearch` tool:
171+
172+
```bash
173+
pnpm install @tavily/ai-sdk
174+
```
175+
176+
Then, you can import and pass it into `generateText`, `streamText`, or your agent:
177+
178+
```ts
179+
import { generateText, stepCountIs } from 'ai';
180+
import { tavilySearch, tavilyExtract } from '@tavily/ai-sdk';
181+
182+
const { text } = await generateText({
183+
model: 'anthropic/claude-sonnet-4.5',
184+
prompt: 'When was the latest update to the AI SDK?',
185+
tools: {
186+
webSearch: tavilySearch(),
187+
webExtract: tavilyExtract(),
188+
},
189+
stopWhen: stepCountIs(3),
190+
});
191+
192+
console.log(text);
193+
```
194+
195+
For more customization options over your agent's web-access functionality, visit the [Tavily AI SDK Documentation](https://docs.tavily.com/documentation/integrations/vercel).
196+
164197
### Build and use custom tools
165198

166199
For more control over your web search functionality, you can build custom tools using web scraping and crawling APIs. This approach allows you to customize search parameters, handle specific data formats, and integrate with specialized search services.

content/docs/02-foundations/04-tools.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ These packages provide pre-built tools you can install and use immediately:
150150

151151
- **[@exalabs/ai-sdk](https://www.npmjs.com/package/@exalabs/ai-sdk)** - Web search tool that lets AI search the web and get real-time information.
152152
- **[@parallel-web/ai-sdk-tools](https://www.npmjs.com/package/@parallel-web/ai-sdk-tools)** - Web search and extract tools powered by Parallel Web API for real-time information and content extraction.
153+
- **[@tavily/ai-sdk](https://www.npmjs.com/package/@tavily/ai-sdk)** - Search, extract, crawl, and map tools for enterprise-grade agents to explore the web in real-time.
153154
- **[Stripe agent tools](https://docs.stripe.com/agents?framework=vercel)** - Tools for interacting with Stripe.
154155
- **[StackOne ToolSet](https://docs.stackone.com/agents/typescript/frameworks/vercel-ai-sdk)** - Agentic integrations for hundreds of [enterprise SaaS](https://www.stackone.com/integrations) platforms.
155156
- **[agentic](https://docs.agentic.so/marketplace/ts-sdks/ai-sdk)** - A collection of 20+ tools that connect to external APIs such as [Exa](https://exa.ai/) or [E2B](https://e2b.dev/).

content/tools-registry/registry.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,38 @@ console.log(text);`,
118118
websiteUrl: 'https://parallel.ai',
119119
npmUrl: 'https://www.npmjs.com/package/@parallel-web/ai-sdk-tools',
120120
},
121+
{
122+
slug: 'tavily',
123+
name: 'Tavily',
124+
description:
125+
'Tavily is a web intelligence platform offering real-time web search optimized for AI applications. Tavily provides comprehensive web research capabilities including search, content extraction, website crawling, and site mapping to power AI agents with current information.',
126+
packageName: '@tavily/ai-sdk',
127+
tags: ['search', 'extract', 'crawl'],
128+
apiKeyEnvName: 'TAVILY_API_KEY',
129+
installCommand: {
130+
pnpm: 'pnpm install @tavily/ai-sdk',
131+
npm: 'npm install @tavily/ai-sdk',
132+
yarn: 'yarn add @tavily/ai-sdk',
133+
bun: 'bun add @tavily/ai-sdk',
134+
},
135+
codeExample: `import { generateText, gateway, stepCountIs } from 'ai';
136+
import { tavilySearch } from '@tavily/ai-sdk';
137+
138+
const { text } = await generateText({
139+
model: gateway('google/gemini-3-pro-preview'),
140+
prompt: 'What are the latest developments in agentic search?',
141+
tools: {
142+
webSearch: tavilySearch,
143+
},
144+
stopWhen: stepCountIs(3),
145+
});
146+
147+
console.log(text);`,
148+
docsUrl: 'https://docs.tavily.com/documentation/integrations/vercel',
149+
apiKeyUrl: 'https://app.tavily.com/home',
150+
websiteUrl: 'https://tavily.com',
151+
npmUrl: 'https://www.npmjs.com/package/@tavily/ai-sdk',
152+
},
121153
{
122154
slug: 'firecrawl',
123155
name: 'Firecrawl',

0 commit comments

Comments
 (0)