Get Started with Tavily
Requires Backend
v1.16.0+.Using Tavily with Portkey
1. Add Tavily Credentials to Portkey
- Click on the
Admin Settingsbutton on Sidebar - Navigate to
Pluginstab under Organisation Settings - Click on the edit button for the Tavily integration
- Add your Tavily API Key (obtain this from your Tavily account)
2. Add Tavily’s Guardrail Check
- Navigate to the
Guardrailspage and click theCreatebutton - Search for “Tavily Online Search” and click
Add - Configure the search behaviour (all parameters are optional):
| Parameter | Type | Description | Default |
|---|---|---|---|
prefix | string | Text inserted before the Tavily search context in the prompt | \n<web_search_context> |
suffix | string | Text inserted after the Tavily search context in the prompt | \n</web_search_context> |
maxResults | number | Maximum number of Tavily search results to return | 5 |
searchDepth | enum | Latency vs. relevance tradeoff: advanced, basic, fast, ultra-fast | — |
chunksPerSource | number | Maximum number of chunks returned per source (advanced/fast depths) | 3 |
topic | enum | Category of results: general, news, finance | — |
timeRange | enum | Filter by recency: day / week / month / year (or d / w / m / y) | — |
startDate | string | Return results after this date (YYYY-MM-DD) | — |
endDate | string | Return results before this date (YYYY-MM-DD) | — |
includeAnswer | boolean | basic | advanced | Include a Tavily-generated answer in the response | false |
includeRawContent | boolean | markdown | text | Include cleaned, parsed HTML content for each result | false |
includeImages | boolean | Include query-related images and per-result images | false |
includeImageDescriptions | boolean | Include descriptive text for each image | false |
includeFavicon | boolean | Include the favicon URL for each result | false |
includeDomains | string[] | Restrict results to the listed domains | — |
excludeDomains | string[] | Exclude results from the listed domains | — |
country | string | Boost results from a specific country (only when topic = general) | — |
autoParameters | boolean | Let Tavily automatically configure search parameters from the query | false |
exactMatch | boolean | Return only results matching exact quoted phrases | false |
includeUsage | boolean | Include Tavily credit usage information in the response metadata | false |
safeSearch | boolean | Enterprise-only. Filters adult or unsafe content. Not supported for fast/ultra-fast depths. | false |
timeout | number | Maximum time to wait for the Tavily request (ms) | 30000 |
- Set any
actionsyou want on your check, and create the Guardrail!
Guardrail Actions allow you to orchestrate your guardrails logic. You can learn more about them here
| Check Name | Description | Supported Hooks |
|---|---|---|
| Tavily Online Search | Adds relevant Tavily web results to the prompt so the model can answer with current online information | beforeRequestHook |
3. Add Guardrail ID to a Config and Make Your Request
- When you save a Guardrail, you’ll get an associated Guardrail ID — add this ID to the
input_guardrailsparam in your Portkey Config - Create these Configs in Portkey UI, save them, and get an associated Config ID to attach to your requests. More here.
- NodeJS
- Python
- cURL

