Get API Key
Sign up at tavily.com
Introduction
Convex is a backend platform for building full-stack apps with a reactive database, server functions, and real-time sync. Components let you add isolated, reusable backend capabilities to your app. The@tavily/convex-tavily component installs Tavily as an isolated Convex component. Your application actions call a typed TavilyClient, which delegates to component actions and keeps TAVILY_API_KEY in typed Convex environment configuration.
What the Tavily component adds
The component is stateless and owns no database tables.
Requirements
- A Convex project with Node.js and npm
- A Tavily API key
Setup
Step 1: Install the component
Step 1: Install the component
Add the package to your Convex app:
Step 2: Register the component
Step 2: Register the component
Add the component to
convex/convex.config.ts:Step 3: Set your API key
Step 3: Set your API key
Store your Tavily API key in your Convex environment:
Step 4: Call Tavily from an application action
Step 4: Call Tavily from an application action
Create an application-owned action that wraps the component. Keeping this wrapper in your app gives you a place to add authentication, authorization, and rate limiting:
Step 5: Verify the component is working
Step 5: Verify the component is working
Call your action from your app client with a current-events query, for example:The request flows from your client through your application action,
TavilyClient, and the component to https://api.tavily.com/search, and returns grounded results with sources.Extract content from known pages
Usetavily.extract to pull clean markdown from specific URLs: