Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.portkey.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Tavily provides a search API purpose-built for AI agents. Portkey’s Tavily guardrail injects relevant web search results into the request before it reaches the LLM, so the model can answer with current online information.

Get Started with Tavily

Requires Backend v1.16.0+.

Using Tavily with Portkey

1. Add Tavily Credentials to Portkey

  • Click on the Admin Settings button on Sidebar
  • Navigate to Plugins tab 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 Guardrails page and click the Create button
  • Search for “Tavily Online Search” and click Add
  • Configure the search behaviour (all parameters are optional):
ParameterTypeDescriptionDefault
prefixstringText inserted before the Tavily search context in the prompt\n<web_search_context>
suffixstringText inserted after the Tavily search context in the prompt\n</web_search_context>
maxResultsnumberMaximum number of Tavily search results to return5
searchDepthenumLatency vs. relevance tradeoff: advanced, basic, fast, ultra-fast
chunksPerSourcenumberMaximum number of chunks returned per source (advanced/fast depths)3
topicenumCategory of results: general, news, finance
timeRangeenumFilter by recency: day / week / month / year (or d / w / m / y)
startDatestringReturn results after this date (YYYY-MM-DD)
endDatestringReturn results before this date (YYYY-MM-DD)
includeAnswerboolean | basic | advancedInclude a Tavily-generated answer in the responsefalse
includeRawContentboolean | markdown | textInclude cleaned, parsed HTML content for each resultfalse
includeImagesbooleanInclude query-related images and per-result imagesfalse
includeImageDescriptionsbooleanInclude descriptive text for each imagefalse
includeFaviconbooleanInclude the favicon URL for each resultfalse
includeDomainsstring[]Restrict results to the listed domains
excludeDomainsstring[]Exclude results from the listed domains
countrystringBoost results from a specific country (only when topic = general)
autoParametersbooleanLet Tavily automatically configure search parameters from the queryfalse
exactMatchbooleanReturn only results matching exact quoted phrasesfalse
includeUsagebooleanInclude Tavily credit usage information in the response metadatafalse
safeSearchbooleanEnterprise-only. Filters adult or unsafe content. Not supported for fast/ultra-fast depths.false
timeoutnumberMaximum time to wait for the Tavily request (ms)30000
  • Set any actions you 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 NameDescriptionSupported Hooks
Tavily Online SearchAdds relevant Tavily web results to the prompt so the model can answer with current online informationbeforeRequestHook

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_guardrails param 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.
{
  "input_guardrails": ["guardrails-id-xxx"]
}
const portkey = new Portkey({
    apiKey: "PORTKEY_API_KEY",
    config: "pc-***"
});
For more, refer to the Config documentation.

Get Support

If you face any issues with the Tavily integration, join the Portkey community forum for assistance.
Last modified on May 27, 2026