tavily-dynamic-search

bởi tavily-ai

Tìm kiếm trên web, lọc kết quả và trích xuất nội dung để dữ liệu tìm kiếm thô không bao giờ lọt vào cửa sổ ngữ cảnh của bạn. Chỉ đầu ra print() đã được chọn lọc mới được trả về.

npx skills add https://github.com/tavily-ai/skills --skill tavily-dynamic-search

Tavily Dynamic Search

Keep large raw web payloads on disk and return only the evidence needed for the task. This is useful when using --include-raw-content, combining several queries, or extracting multiple long pages. Do not use this workflow for a simple lookup that a normal tvly search --json can answer directly.

Before running

Search and extract support capped keyless access. Run them directly when tvly is available. If tvly is missing, follow the tavily-cli setup. Do not look for an API key or authenticate before the first request. If the keyless cap is reached in an interactive session, run tvly login to open browser OAuth, then retry the blocked request once. In an unattended environment, report the cap and authentication options instead of starting an interactive flow.

Workflow

  1. Search broadly without raw content and inspect titles, URLs, scores, and snippets.
  2. Fetch full content only for the best sources.
  3. When raw output could be large, save it with -o and filter the file before printing anything to the model context.
  4. Preserve source URLs beside every extracted fact.

When the user restricts evidence to official or named domains, validate the hostname of every selected URL during local filtering. --include-domains narrows the search but is not proof that every returned result belongs to an allowed host. If full-page extraction is unavailable, label conclusions as search-snippet evidence instead of implying that the page body was verified.

Keep the process in one turn when the relevant sources and filters are already known. Use another turn only when the first search changes what should be extracted.

Create a unique temporary task directory before saving evidence so concurrent agents do not overwrite one another. Python's tempfile.mkdtemp() is available when mktemp is not permitted. Reuse that directory for all raw and filtered artifacts from the task.

Small result: filter a direct JSON response

For a small search response, a pipe is enough:

tvly search "query" --max-results 5 --json | python3 -c '
import json, sys
data = json.load(sys.stdin)
for result in data.get("results", []):
    score = result.get("score") or 0
    title = result.get("title") or ""
    print(f"[{score:.2f}] {title}")
    print(result.get("url", ""))
    print(result.get("content", "")[:300])
'

Do not discard stderr. Authentication failures, keyless-cap messages, and API errors are actionable and must remain visible.

Large result: save first, then filter

Use the CLI's file output so raw page content does not pass through the tool response:

tvly search "query" \
  --include-raw-content markdown \
  --max-results 8 \
  --json \
  -o /tmp/tavily-search-results.json

Then print only bounded evidence:

python3 -c '
import json
from pathlib import Path

data = json.loads(Path("/tmp/tavily-search-results.json").read_text())
for result in data.get("results", []):
    title = result.get("title") or ""
    url = result.get("url") or ""
    print(f"## {title}")
    print(f"URL: {url}")
    print((result.get("raw_content") or result.get("content") or "")[:1200])
    print()
'

Adjust the filtering logic to the question. Prefer relevant paragraphs or fields over fixed character slices when the target information is known. Aim for roughly 150-600 tokens per source unless a table or code block genuinely requires more.

Targeted extraction

When search identifies the right URLs, extract only those pages:

tvly extract "https://example.com/article" \
  --json \
  -o /tmp/tavily-extract-results.json

For topic-focused pages, let Tavily reduce the response before local filtering:

tvly extract "https://example.com/docs" \
  --query "authentication API" \
  --chunks-per-source 3 \
  --json \
  -o /tmp/tavily-extract-results.json

Multiple queries

For multi-angle research, run a small set of focused searches, deduplicate by URL, and rank before extracting. Use subprocess.run(..., capture_output=True, text=True) when orchestrating commands in Python. Check returncode; if a command fails, surface its stderr and stop or retry deliberately. Never use a blanket except Exception: continue that hides missing evidence.

Response shapes

tvly search --json returns query, optional answer, results, and response_time. Each result commonly contains url, title, content, score, and optional raw_content.

tvly extract --json returns results, failed_results, and response_time. Each successful result commonly contains url, raw_content, and optional images.

Treat fields as optional and use .get() while filtering. Inspect failed_results instead of assuming every requested URL succeeded.

Useful options

OptionPurpose
--max-resultsBound the search result count; default 5, maximum 20
--depthChoose ultra-fast, fast, basic, or advanced
--time-rangeRestrict results to day, week, month, or year
--include-domainsRestrict results to a comma-separated list of trusted domains
--exclude-domainsExclude a comma-separated list of domains
--include-raw-contentInclude full content as markdown or text
-o, --outputSave the complete response to a file

Use jq only for short filters when Python is unavailable:

tvly search "query" --json | jq '[.results[] | {title, url, score, content}]'

Thêm skills từ tavily-ai

research
tavily-ai
Nghiên cứu toàn diện về bất kỳ chủ đề nào với khả năng tự động thu thập nguồn, phân tích và trích dẫn. Thực hiện nghiên cứu web đa nguồn với trích dẫn rõ ràng, lý tưởng cho so sánh, sự kiện hiện tại, phân tích thị trường và báo cáo chi tiết. Cung cấp ba tùy chọn mô hình: mini cho nghiên cứu chủ đề đơn lẻ có mục tiêu (~30 giây), pro cho phân tích đa góc độ toàn diện (~60-120 giây) và auto để phát hiện độ phức tạp dựa trên API. Xác thực qua OAuth thông qua máy chủ Tavily MCP với tính năng đăng nhập tự động dựa trên trình duyệt trên...
search
tavily-ai
Tìm kiếm web với kết quả tối ưu hóa cho LLM, chấm điểm mức độ liên quan và bộ lọc linh hoạt. Hỗ trợ bốn chế độ tìm kiếm theo độ sâu (siêu nhanh, nhanh, cơ bản, nâng cao) với khả năng tùy chỉnh độ trễ và mức độ liên quan. Bao gồm lọc theo tên miền, giới hạn khung thời gian, phạm vi ngày tháng, ưu tiên quốc gia và trích xuất nội dung thô. Trả về kết quả với tiêu đề, URL, đoạn trích nội dung và điểm liên quan; tùy chọn kết quả hình ảnh và biểu tượng trang web. Xác thực OAuth tự động qua máy chủ Tavily MCP ho
tavily-best-practices
tavily-ai
API tìm kiếm web dành cho LLM với truy cập dữ liệu thời gian thực, trích xuất nội dung, thu thập dữ liệu trang web và nghiên cứu hỗ trợ AI. Năm phương thức cốt lõi: search() cho kết quả web, extract() cho nội dung URL, crawl() cho trích xuất toàn bộ trang web, map() cho khám phá URL và research() cho tổng hợp AI đầu cuối. Hỗ trợ SDK Python và JavaScript với các client bất đồng bộ cho truy vấn song song và độ sâu tìm kiếm có thể cấu hình (siêu nhanh/nhanh/cơ bản/nâng cao). Phương thức Crawl chấp nhận hướng dẫn ngữ nghĩa để tập trung trích xuất vào...
tavily-cli
tavily-ai
Tìm kiếm web, trích xuất nội dung, thu thập dữ liệu trang web và nghiên cứu chuyên sâu qua Tavily CLI. Năm chế độ lệnh bao gồm tìm kiếm, trích xuất, khám phá URL, thu thập dữ liệu hàng loạt và nghiên cứu đa nguồn có trích dẫn. Tất cả lệnh đều hỗ trợ đầu ra JSON và lưu tệp cho các quy trình làm việc có cấu trúc, tự động. Mô hình leo thang hướng dẫn bạn từ tìm kiếm đơn giản qua trích xuất, lập bản đồ, thu thập dữ liệu đến nghiên cứu toàn diện dựa trên nhu cầu của bạn. Yêu cầu cài đặt tavily-cli và xác thực kh
tavily-crawl
tavily-ai
Trình thu thập trang web nhiều trang với bộ lọc ngữ nghĩa và xuất định dạng markdown. Thu thập toàn bộ các phần của trang web với kiểm soát độ sâu và độ rộng; lọc theo biểu thức chính quy đường dẫn, tên miền hoặc hướng dẫn ngôn ngữ tự nhiên để tập trung kết quả. Lưu mỗi trang dưới dạng tệp markdown cục bộ qua --output-dir, hoặc trả về JSON có cấu trúc để xử lý theo tác nhân. Sử dụng hướng dẫn ngữ nghĩa với trích xuất khối để tránh phình to ngữ cảnh khi đưa kết quả vào LLM; sử dụng trích xuất toàn trang để tải tài liệu ngoại tuyến. Hỗ trợ...
tavily-extract
tavily-ai
Trích xuất markdown hoặc văn bản sạch từ tối đa 20 URL, hỗ trợ kết xuất JavaScript và phân đoạn theo truy vấn. Xử lý các trang được kết xuất JavaScript với độ sâu trích xuất có thể cấu hình (cơ bản cho trang đơn giản, nâng cao cho SPA động và bảng). Hỗ trợ trích xuất theo truy vấn để chỉ trả về các đoạn nội dung liên quan thay vì toàn bộ trang. Trả về markdown tối ưu cho LLM theo mặc định, với các tùy chọn định dạng văn bản thuần và đầu ra JSON có cấu trúc. Xử lý tối đa 20 URL trong một lần gọi;...
tavily-research
tavily-ai
Nghiên cứu toàn diện với AI, tổng hợp đa nguồn và trích dẫn. Tạo báo cáo có cấu trúc dựa trên nguồn web, mất 30-120 giây tùy theo lựa chọn mô hình (mini cho truy vấn mục tiêu, pro cho so sánh phức tạp). Hỗ trợ nhiều định dạng đầu ra: báo cáo markdown, JSON với lược đồ tùy chỉnh và kiểu trích dẫn có thể cấu hình (đánh số, MLA, APA, Chicago). Bao gồm quy trình làm việc bất đồng bộ cho nghiên cứu chạy dài qua các lệnh --no-wait, status và poll, cùng với thời gian thực...
tavily-search
tavily-ai
Tìm kiếm web với kết quả tối ưu hóa cho LLM, đoạn trích nội dung và điểm liên quan. Hỗ trợ bốn độ sâu tìm kiếm (siêu nhanh, nhanh, cơ bản, nâng cao) với số lượng kết quả có thể cấu hình lên đến 20, cùng bộ lọc miền và ràng buộc thời gian. Trả về đầu ra JSON có cấu trúc với đoạn trích nội dung, điểm liên quan và siêu dữ liệu được tối ưu hóa cho việc tiêu thụ của LLM. Bao gồm các chế độ tìm kiếm chuyên biệt cho chủ đề tin tức và tài chính, với tùy chọn câu trả lời do AI tạo và trích xuất toàn bộ nội dung trang. Tích