feat: add Exa AI-powered search tool - #1
Open
tgonzalezc5 wants to merge 1 commit into
Open
Conversation
Adds a `web_search` tool that complements `web_fetch`: where the existing tool reads a known URL, the new one discovers URLs and returns ranked results from Exa with optional inline highlights, summaries, or full text. Exposes neural / fast / instant / deep search modes, the six Exa categories, domain and text filters, date ranges, and user-location biasing. Registered eagerly in the dry-run and CLI catalogs and lazily inside `create_claw_agent` so the SDK is only imported when first used. The Exa Python SDK (`exa-py`) is an optional dependency under the new `exa` extra; `EXA_API_KEY` joins the sensitive-env strip list so sandboxed exec calls cannot leak it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
web_searchtool that uses Exa for AI-powered web search, complementing the existingweb_fetch(which reads a known URL).company,research paper,news,personal site,financial report,people), domain include/exclude lists, text include/exclude phrases, date ranges, anduser_locationbiasing.highlights,summary, and fulltextcan be requested simultaneously, and the result snippet falls back through them.create_claw_agentso the SDK is only imported on first use.exa-pyis an optional dependency under a newexaextra;EXA_API_KEYis added to the sensitive-env strip list inLocalBackendso sandboxed exec cannot leak it.Usage
Set
EXA_API_KEYin the environment (see.env.example) and install withpip install 'clawagents[exa]'.Files changed
src/clawagents/tools/exa_search.py— new tool, typedExaSearchResultdataclass, parsing + formatting helperssrc/clawagents/agent.py— lazy_LazyExaSearchregistration alongside_LazyWebFetchsrc/clawagents/__main__.py,src/clawagents/dry_run.py— eager catalog registrationsrc/clawagents/sandbox/local.py— addEXA_API_KEYto_SENSITIVE_ENV_KEYSpyproject.toml— newexaoptional extra, also bundled intoall.env.example— documentedEXA_API_KEYblocktests/test_exa_search.py— 20 unit tests covering parsing, snippet fallback, validation, kwargs forwarding, and tracking-header injectionTest plan
pytest tests/test_exa_search.py— 20 tests passing locally (parsing, fallback, validation, mock-target accuracy, header injection)pytest tests/test_web_fetch_ssrf.py tests/test_tools_comprehensive.py— 49 adjacent tests still greenmypy src/clawagents/tools/exa_search.py— clean_tool_catalog()includesweb_searchwith all 16 parameters