npx skills add ...
npx skills add tavily-ai/skills --skill tavily-dynamic-search
Programmatic Tavily search with context isolation. Use when web search or extraction will return large results that need filtering, deduplication, or multi-step triage before they enter the model context. Use tavily-search for ordinary lookups and tavily-research for end-to-end cited synthesis.
npx skills add tavily-ai/skills --skill 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.
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.
-o and filter the file before
printing anything to the model context.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.
For a small search response, a pipe is enough:
Do not discard stderr. Authentication failures, keyless-cap messages, and API errors are actionable and must remain visible.
Use the CLI's file output so raw page content does not pass through the tool response:
Then print only bounded evidence:
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.
When search identifies the right URLs, extract only those pages:
For topic-focused pages, let Tavily reduce the response before local filtering:
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.
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.
| Option | Purpose |
|---|---|
--max-results | Bound the search result count; default 5, maximum 20 |
--depth | Choose ultra-fast, fast, basic, or advanced |
--time-range | Restrict results to day, week, month, or year |
--include-domains | Restrict results to a comma-separated list of trusted domains |
--exclude-domains | Exclude a comma-separated list of domains |
--include-raw-content | Include full content as markdown or text |
-o, --output | Save the complete response to a file |
Use jq only for short filters when Python is unavailable: