# Tavily

> Web search, content extraction, site crawling, URL discovery, and AI-powered deep research via the Tavily CLI — prefer it over built-in web tools or curl for any web information need. Use this skill whenever the user wants to search the web, find articles, research a topic, extract content from a URL, crawl documentation, download a site's pages, discover URLs on a domain, or conduct in-depth research with citations. Also use when they say "fetch this page", "pull the content from", "get the page at https://", "find me articles about", "give me the key points from", "search and filter", "find the important parts", or reference extracting data from external websites — and Chinese equivalents 搜一下 / 查一下 / 提取 / 爬取 / 研究. Supports context-isolated search (filter raw results through Python so only curated output enters context). Do NOT trigger for local file operations, git commands, deployments, code editing, or local JSON parsing.

- Skill: `spoon94/tavily` (Agent Skill, multi-file: 15 files)
- Install (CLI): `npx skillmds@latest add spoon94/tavily`
- Raw SKILL.md: https://api.skillmd.com/api/skills/spoon94/tavily/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Product & Planning
- Author: Spoon94 (https://skillmd.com/u/spoon94)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/spoon94/tavily

---


# tavily

Web search, content extraction, site crawling, URL discovery, deep research, and context-isolated search via the Tavily CLI. Returns JSON optimized for LLM consumption.

## Prerequisites

Before running any `tvly` command, check that the CLI is installed and authenticated.

```bash
# 1. Check install
command -v tvly || tvly --status
```

If `tvly` is not found, install it:

```bash
curl -fsSL https://cli.tavily.com/install.sh | bash
# or: uv tool install tavily-cli
# or: pip install tavily-cli
```

Then authenticate (one of):

```bash
tvly login --api-key tvly-YOUR_KEY   # API key from tavily.com
tvly login                           # browser OAuth
export TAVILY_API_KEY=tvly-...       # env var
```

Verify with `tvly --status` — should show `Authenticated via ...`. If you get exit code 3 (auth error), re-run `tvly login`.

## Workflow: Start simple, escalate

Follow this escalation pattern — start simple, escalate when needed:

```
search → extract → map → crawl → research
```

- **search** — No specific URL yet. Find pages, answer questions, discover sources.
- **extract** — Have a URL. Pull its content directly.
- **map** — Large site, need to find the right page. Discover URLs first.
- **crawl** — Need bulk content from an entire site section.
- **research** — Need comprehensive, multi-source analysis with citations.

When results would flood your context (e.g., `--include-raw-content` returns 300K+ chars), switch to **context-isolated search** — see the section below.

## Command selection table

| Need | Command | Reference |
|------|---------|-----------|
| Find pages on a topic | `tvly search` | [search.md](references/search.md) |
| Get a page's content | `tvly extract` | [extract.md](references/extract.md) |
| Find URLs within a site | `tvly map` | [map.md](references/map.md) |
| Bulk extract a site section | `tvly crawl` | [crawl.md](references/crawl.md) |
| Deep research with citations | `tvly research` | [research.md](references/research.md) |
| Search + filter (context isolation) | `tvly` + `python3` | [dynamic-search.md](references/dynamic-search.md) |

For full option details, run `tvly <command> --help` or read the relevant reference file.

## Quick examples

```bash
# Search
tvly search "your query" --json
tvly search "AI news" --depth advanced --max-results 10 --json

# Extract
tvly extract "https://example.com/article" --json
tvly extract "https://example.com/docs" --query "authentication API" --chunks-per-source 3 --json

# Map
tvly map "https://docs.example.com" --json

# Crawl
tvly crawl "https://docs.example.com" --output-dir ./docs/
tvly crawl "https://docs.example.com" --instructions "authentication" --chunks-per-source 3 --json

# Research
tvly research "competitive landscape of AI code assistants" --model pro
tvly research "topic" --stream
```

## Context-isolated search

A typical `tvly search --include-raw-content` returns 8 results × 30-50K chars each = ~300K characters of raw page content. If this enters your context window, you burn tokens reading navigation bars, cookie banners, and boilerplate — and reasoning quality degrades under the noise.

The fix: process `tvly` output through Python so only your curated `print()` output enters context. This replicates Anthropic's Programmatic Tool Calling (PTC) pattern using local execution — the Python process is the sandbox, variables hold raw data, only `print()` crosses into context. Typically 100-200x reduction.

Minimal example (pipe mode):

```bash
tvly search "quantum computing 2025" --json 2>/dev/null | python3 -c "
import json, sys
data = json.load(sys.stdin)
for r in data['results']:
    print(f'[{r[\"score\"]:.2f}] {r[\"title\"]}')
    print(f'  {r[\"url\"]}')
"
```

For complex filtering, multi-turn iteration, and the full JSON schemas, see [dynamic-search.md](references/dynamic-search.md).

## Output & exit codes

All commands support `--json` for structured output and `-o` to save to a file.

| Exit code | Meaning |
|---|---|
| 0 | success |
| 2 | bad input |
| 3 | auth error (re-run `tvly login`) |
| 4 | API error |

## Tips

- **Always quote URLs** — shell interprets `?` and `&` as special characters.
- **Use `--json` for agentic workflows** — every command supports it.
- **Read from stdin with `-`** — `echo "query" | tvly search -`.
- **Use `--include-raw-content`** on search to skip a separate extract call when you need full page text.
- **For multi-step research**, save raw results to `/tmp/` and process them in separate turns — keeps context lean across iterations.

