通过 Tavily API 进行网络搜索和数据检索。适用于网页搜索、新闻获取、问题回答及来源查找。支持5种模式:通用搜索、新闻搜索、图片搜索、视频搜索和文档搜索。
Tavily is a search API optimized for AI applications — returns structured results with relevance scores and optional AI-generated summaries.
bash
# Standard search (default, 5 results, ~brave format)
python3 {baseDir}/scripts/tavily_search.py --query "..." --format md
# Include AI short answer
python3 {baseDir}/scripts/tavily_search.py --query "..." --include-answer
# Advanced search (higher quality, slower)
python3 {baseDir}/scripts/tavily_search.py --query "..." --search-depth advanced
FormatDescriptionBest For--format mdHuman-readable MarkdownDirect user display--format bravetitle/url/snippet JSONStructured processing (default)--format rawFull JSON with all fieldsDebugging / advanced use
--mode search (default)#General web search. Good for research, finding links, fact-checking.
text
python3 {baseDir}/scripts/tavily_search.py --query "OpenAI GPT-5 release" --mode search
--mode news#Fresh news headlines (past N days). Good for current events, breaking news.
text
python3 {baseDir}/scripts/tavily_search.py --query "US Iran war" --mode news --days 7
--mode qna#Direct Q&A — asks Tavily to answer a specific question from web sources.
text
python3 {baseDir}/scripts/tavily_search.py --query "What happened at Nvidia GTC 2026?" --mode qna
--mode images#Image search results.
text
python3 {baseDir}/scripts/tavily_search.py --query "Tesla Cybertruck" --mode images
--mode context#Research-oriented — includes related topics, better for deep dives.
text
python3 {baseDir}/scripts/tavily_search.py --query "Claude AI agent architecture" --mode context
FlagDefaultDescription--max-results N5Number of results (max 10)--include-answeroffAdd AI-generated short answer--search-depthbasicbasic (fast) or advanced (better quality)--days N3Freshness for news mode (1-7)--domainsnoneRestrict to domain(s), e.g. --domains reuters.com bbc.com
VariableDescriptionTAVILY_API_KEYAPI key (from tavily.io)TAVILY_SEARCH_DEPTHDefault: basic or advanced
text
# Quick fact-check
python3 {baseDir}/scripts/tavily_search.py --query "Charlie Kirk death September 2025" --include-answer
# Latest news on a topic
python3 {baseDir}/scripts/tavily_search.py --query "AI agents March 2026" --mode news --days 7 --format md
# Deep research with related topics
python3 {baseDir}/scripts/tavily_search.py --query "Claude Opus 4.6 capabilities" --mode context --search-depth advanced
# Domain-restricted search
python3 {baseDir}/scripts/tavily_search.py --query "China EV market 2026" --domains reuters.com bloomberg.com
--max-results small (3–5) by default to reduce token/reading load--format md when displaying results directly to users--include-answer for quick summaries without reading all results