Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions content/cookbook/05-node/56-web-search-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,39 @@ const { text } = await generateText({
console.log(text);
```

#### Tavily

<Note>
Get your API key from the [Tavily Dashboard](https://app.tavily.com).
</Note>

First, install the `tavilySearch` tool:

```bash
pnpm install @tavily/ai-sdk
```

Then, you can import and pass it into `generateText`, `streamText`, or your agent:

```ts
import { generateText, stepCountIs } from 'ai';
import { tavilySearch, tavilyExtract } from '@tavily/ai-sdk';

const { text } = await generateText({
model: 'anthropic/claude-sonnet-4.5',
prompt: 'When was the latest update to the AI SDK?',
tools: {
webSearch: tavilySearch(),
webExtract: tavilyExtract(),
},
stopWhen: stepCountIs(3),
});

console.log(text);
```

For more customization options over your agent's web-access functionality, visit the [Tavily AI SDK Documentation](https://docs.tavily.com/documentation/integrations/vercel).

### Build and use custom tools

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.
Expand Down
1 change: 1 addition & 0 deletions content/docs/02-foundations/04-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ These packages provide pre-built tools you can install and use immediately:

- **[@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.
- **[@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.
- **[@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.
- **[Stripe agent tools](https://docs.stripe.com/agents?framework=vercel)** - Tools for interacting with Stripe.
- **[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.
- **[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/).
Expand Down
32 changes: 32 additions & 0 deletions content/tools-registry/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,38 @@ console.log(text);`,
websiteUrl: 'https://parallel.ai',
npmUrl: 'https://www.npmjs.com/package/@parallel-web/ai-sdk-tools',
},
{
slug: 'tavily',
name: 'Tavily',
description:
'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.',
packageName: '@tavily/ai-sdk',
tags: ['search', 'extract', 'crawl'],
apiKeyEnvName: 'TAVILY_API_KEY',
installCommand: {
pnpm: 'pnpm install @tavily/ai-sdk',
npm: 'npm install @tavily/ai-sdk',
yarn: 'yarn add @tavily/ai-sdk',
bun: 'bun add @tavily/ai-sdk',
},
codeExample: `import { generateText, gateway, stepCountIs } from 'ai';
import { tavilySearch } from '@tavily/ai-sdk';

const { text } = await generateText({
model: gateway('google/gemini-3-pro-preview'),
prompt: 'What are the latest developments in agentic search?',
tools: {
webSearch: tavilySearch,
},
stopWhen: stepCountIs(3),
});

console.log(text);`,
docsUrl: 'https://docs.tavily.com/documentation/integrations/vercel',
apiKeyUrl: 'https://app.tavily.com/home',
websiteUrl: 'https://tavily.com',
npmUrl: 'https://www.npmjs.com/package/@tavily/ai-sdk',
},
{
slug: 'firecrawl',
name: 'Firecrawl',
Expand Down
Loading