# exa-search-cli

> A command-line integration with Exa for repeatable research: web search, readable page-text retrieval, and external research tasks with structured output.

## Contribution and scope

Built with AI coding agents as part of Nolan Vale's independent product and workflow-automation work. Nolan defines requirements, directs implementation, checks results, and iterates. Exa provides the underlying search and research services; this repository supplies a CLI integration, not a new search engine or AI model.

## Install

```bash
uv tool install exa-search-cli
```

Alternatively, use pip install exa-search-cli in a suitable Python environment.

Set EXA_API_KEY to an authorized Exa API key. Do not commit or expose the key.

## Commands

- `exa-search <query>`: search. Flags: --json, --compact, --num-results, --type, --category, --start-date, --end-date, --include-domain, --exclude-domain, --similar, --text, --max-chars, --objective, --max-age-hours.
- `exa-crawl <url>`: request readable page text or focused excerpts. Flags: --json, --compact, --max-chars, --query, --max-age-hours.
- `exa-research <topic>`: create a research task on Exa. Flags: --json, --model.
- `exa-research-status <research-id>`: check a task and retrieve its result. Flags: --json.

Source access, categories, models, and result availability depend on the provider.

## Workflow examples

```bash
exa-search "document review workflow" --json
exa-crawl https://example.com -c 8000
exa-research "document processing approaches" --json
exa-research-status <research-id> --json
```

## Output reference

- Search: results[]{title, url, published_date, author, highlights[], text}.
- Crawl: results[]{url, title, text}.
- Research/status: {research_id, model, instructions, status, output.content, error}.
- Result iterator for object or array responses: (if type=="array" then . else (.results // []) end)[].

Consult README.md and docs/USAGE.md for examples and installed-command help for supported options.

## Data and review

Requests are sent to Exa. Research commands create external tasks, so the integration is not entirely read-only or offline. Protect credentials and review generated research against source material before using it in decisions.

## Key files

- README.md: purpose, contribution, setup, and limitations.
- AGENTS.md: contributor instructions.
- docs/USAGE.md: usage reference.
- pyproject.toml: dependencies and entry points.

## Links

- Repository: https://github.com/nolan-vale/exa-search-cli
- Product-builder portfolio: https://github.com/nolan-vale
- PyPI: https://pypi.org/project/exa-search-cli/
- Provider documentation: https://docs.exa.ai

## Research workflow (0.1.6)

- `--category publication`: scholarly sources; paper/research paper map to publication.
- Current types include auto, lite, fast, instant, deep-lite, deep, deep-reasoning; legacy keyword/neural remain accepted.
- `exa-search QUERY --text --max-chars 8000 --json`: bounded text per result; text and highlights are not requested together.
- `exa-crawl URL1 URL2 -c 12000 --json`: batch up to 100 URLs in one request; terminal output honors -c.
- All commands: --timeout SECONDS (default 60), --version. No automatic retries.
- Invalid arguments exit 2 before network calls; API failures exit nonzero with stderr diagnostics and redacted keys.
- Crawl JSON preserves per-URL statuses; partial failures warn on stderr, all failures exit 1.
- Search is discovery, not bibliographic verification; confirm metadata at the primary source. Crawl extracts text, not original PDF files.

## Focused retrieval

- `exa-search QUERY --objective "Prefer original pricing pages, not directories" --compact`: supplies the broader research goal. Objective is 1–4096 characters, not blank, and incompatible with --similar. Preferences do not replace hard filters or source validation.
- `exa-crawl URL --query "specific question" -c 2500 --compact`: extracts relevant passages from across a long page, with full text explicitly disabled. Do not assume excerpts contain all qualifications.
- Search and crawl support `--max-age-hours`: omitted = API defaults; -1 = cache only; 0 = fresh fetch; 1–720 = maximum cache age. This controls content age, not publication date. Search type lite does not support the flag.
- Search and crawl support `--compact`: implies JSON; one line; removes empty/decorative fields and duplicate URL IDs, while retaining evidence, substantive extended fields, costs, warnings and statuses. Ordinary --json remains unchanged.
- Bounded full text reaching its cap warns on stderr that content may be incomplete. No automatic paid refetch or implicit state is added.
