Tavily
Empower your agents with real-time web knowledge using Tavily, the search engine built specifically for AI.
💡 Core Concepts
To effectively use Tavily, you should understand how it interacts with your agent.
1. What is Tavily?
Tavily is a search API optimized for LLMs. Unlike traditional search engines, it returns concise answers.
2. Configuration Parameters
You can customize the search behavior in the config block:
max_results: Limit the number of search results returned (e.g.,5).include_answer: Set toTrueto get a short, synthesized answer to the query.include_raw_content: Set toTrueif you need the full text of the scraped pages.search_depth: Choose betweenbasic(faster) oradvanced(deeper search).
⚙️ Configuration Steps
Follow these steps to enable web search capabilities for your agents.
Get your API Key
- Sign up at tavily.com.
- Create a new API Key in your dashboard.
- Copy the key (it starts with
tvly-).
Set up Key Vault (Recommended)
Hardcoding keys is risky. We recommend using the Key Vault.
- Navigate to the Key Vault section in SVAHNAR Platform.
- Add a new secret named
TAVILY_API_KEY. - Paste your Tavily API Key as the value.
This allows you to reference the key in your YAML as ${TAVILY_API_KEY}.
Configure the Tool
Add the tool to your agent's configuration. You must ensure the agent has a clear instruction to use it.
Minimal Configuration:
tools:
tool_assigned:
- name: Tavily
config:
API_key: ${TAVILY_API_KEY}
📚 Practical Recipes
Recipe 1: Standard Web Search Agent
Use Case: An agent that performs broad searches to answer general questions.
create_agent_network:
agent-1:
agent_name: "web_search_agent"
LLM_config:
params:
model: "gpt-5-mini"
tools:
tool_assigned:
- name: Tavily
config:
API_key: ${TAVILY_API_KEY}
max_results: 5
agent_function:
- "Search the web for authoritative resources about the user's query."
Recipe 2: Advanced RAG Fetcher
Use Case: An agent capable of deep research that needs direct answers and raw content for analysis.
tools:
tool_assigned:
- name: Tavily
config:
API_key: ${TAVILY_API_KEY}
max_results: 3
include_answer: True
include_raw_content: True
search_depth: "advanced"
🚑 Troubleshooting
-
API_key must be provided
- The tool cannot find the API key. Ensure you have either passed it directly in the
configor referenced a valid Key Vault variable (e.g.,${TAVILY_API_KEY}).
- The tool cannot find the API key. Ensure you have either passed it directly in the
-
Other Errors
- Check with the Tavily service or Rate Limits.
- Check your billing status on the Tavily dashboard.
- Ensure you aren't exceeding the
max_resultslimit for your plan.