Skip to main content

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

Add the package to your Convex app:
Add the component to convex/convex.config.ts:
Store your Tavily API key in your Convex environment:
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:
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

Use tavily.extract to pull clean markdown from specific URLs:

Learn more