Skip to content

feat(tavily_search): add Exa as a search provider and move the DeepSearchQA and WideSearch session harnesses onto it - #5827

Draft
yaoyu-33 wants to merge 10 commits into
mainfrom
yuya/exa-search-tool-server
Draft

yaoyu-33 wants to merge 10 commits into
mainfrom
yuya/exa-search-tool-server

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What and why

DeepSearchQA and WideSearch run every harness through harness_exa_search. That legacy agent starts the harness and its own Exa integration inside a sandbox, behind legacy_agent, and calls /verify from its own /run. Each harness wires Exa differently there: exa-mcp-server through npx, a Pi extension, or Hermes' built-in web search. Most of these harnesses now serve sandbox sessions, and #5551 lets an Environment Server grant a tool server's MCP tools to a session agent; HLE's search configs already grant tavily_search tools over MCP to session harnesses under single_agent_turn_legacy. This PR gives tavily_search an Exa provider and moves the copies that can move onto it:

  1. Exa as a tavily_search provider. search_provider: exa (the default stays tavily) plus exa_api_key serves the same three tools from Exa:

    • web_search posts to Exa's /search and returns its query-matched highlights as each result's summary.
    • find_in_page posts to /contents with the query and returns the matching passages, or the page text when Exa returns none.
    • scroll_page reads the page text from /contents.

    The requests go through the existing aiohttp adapter, TavilySearchAIOHTTPClient. It now takes the key's header name and value prefix and the provider name used in errors (x-api-key, no prefix, Exa). Everything else works as it does for Tavily:

    • the exclusion policy (the provider-side subset is sent as excludeDomains);
    • the page cache and output limits;
    • the key pool and the bounded retries, with failover to the next key on a 401 or on Exa's 402 (credits or budget exhausted);
    • errors that carry no provider body.

    tavily_api_key is now optional in the config and required at startup only when the provider is Tavily. Tavily configs see no change beyond the fixes for both providers below.

  2. Config moves. The Codex, Pi, Hermes, OpenCode, OpenClaw and Kilo Code copies of both benchmarks (12 files and their manifests) now run under single_agent_turn_legacy, with an exa_search tool server (tavily_search with search_provider: exa) in tool_servers. Each episode seeds the stateless verifier and an exa_search session, grants the three tools to the agent over MCP, closes the agent, verifies, then closes both sessions.

    • The agent creates its own sandbox, with the same image, ttl_s and memory as before.
    • The harness settings carry over: version pins, timeouts, context and output limits, thinking, and Hermes's turn limit, plus a 2-hour runner timeout. OpenCode's setup_timeout becomes sandbox_install_timeout_seconds.
    • The prompts name the exa_search server's web_search, find_in_page and scroll_page tools and say the tool list may show them with that server's prefix. Most harnesses prefix granted MCP tools (Pi and Hermes mcp__exa_search__web_search, Kilo Code and OpenCode exa_search_web_search, OpenClaw exa_search__web_search; Codex shows web_search). With a prompt that named only web_search, Hermes called web_search twice and got "Tool 'web_search' does not exist" before it found the prefixed tool.
    • Each benchmark gets a search_exclusions.json that blocks huggingface.co and hf.co, where its dataset is published. DeepSearchQA's also blocks its Kaggle benchmark page and any URL containing deepsearchqa, deep-search-qa or deep_search_qa (Kaggle hosts the dataset and leaderboard, and copies such as the Harbor hub's carry the name). tavily_search requires a policy, and the benchmark's own host is the one every answer key sits on. HLE's policy also lists both hosts. The policy covers the three tools only: the sandbox's shell and a harness's own fetch tool still have open network access.
    • Review fixes: OpenClaw's setup_timeout (read only on its host CLI path) becomes sandbox_install_timeout_seconds; OpenCode, OpenClaw and Kilo Code get a 300 s per-call MCP timeout, above one search's ~183 s worst case, and Hermes (whose 120 s limit has no knob) gets http_timeout_s: 30 on its exa_search; Kilo Code sizes its own sandbox ttl_s; Hermes disables its own web toolset, which registers a web_search of its own when a search key is in the sandbox environment.
    • Also in tavily_search, for both providers: a 200 reply whose body is not a JSON object raises a provider-named error (aiohttp's decode-error repr carries the request headers, key included), and scroll_page no longer caches an empty page, which is usually a failed fetch (Exa reports a failed crawl inside a 200).
    • Second review round, in tavily_search: scroll_page answers an empty page with No content found., as find_in_page already did, instead of a header showing words 0-0 of 0; closing a session drops its call metrics unless dump_session_id_to_metrics_on_exit is set (a tool-server session is never verified there, so they stayed for the server's lifetime); and with caching on, Exa's /contents asks for at most max_cached_page_chars of page text when that is set (Exa's own default is several million characters, which the cache truncated anyway).
  3. Deprecate harness_exa_search. As in chore(agent): deprecate the legacy /run path of *_sandboxed_agent harnesses #5222: one startup warning per process and a README banner.

An earlier revision of this PR added a separate resources_servers/exa_search server. It is gone: a resources server that grades nothing cannot ship the example data and rollouts that CI requires of every resources server. Squash-merging leaves no trace of it.

Issue: none public; this PR is self-contained.

Merge with main and version pins (2026-11-20)

  • Merged origin/main (f57d175397); no rebase. The only conflict was the nemo_gym.utils import in responses_api_agents/harness_exa_search/app.py: it now imports both main's is_nemo_gym_fastapi_entrypoint (multi-worker entrypoint guard) and this branch's is_nemo_gym_fastapi_worker (once-per-process deprecation warning), as hermes_sandboxed_agent does on main.
  • The moved copies run main's agent adapter on the host and install only the harness CLI in the sandbox, so each pin must equal main's agent default at merge time. Today they do: Codex 0.144.4, Kilo Code 7.4.15, OpenClaw 2026.6.11, OpenCode 1.17.11, Pi 0.80.2. Hermes takes hermes_agent's own pin.
  • Pi: pi_version: 0.80.2 is main's pi_agent pin (responses_api_agents/pi_agent/configs/pi_agent.yaml). It moves to 1.5.2 with feat(pi): upgrade the coding agent to 1.5.2 #6454, which is still open. feat(pi): upgrade the coding agent to 1.5.2 #6454 also edits deepsearchqa_pi.yaml and widesearch_pi.yaml, keeping them on harness_exa_search at 0.80.2 because that path runs the pinned Gym commit's adapter in the sandbox. Whichever PR merges second keeps this PR's session version of both files with pi_version: 1.5.2 and drops feat(pi): upgrade the coding agent to 1.5.2 #6454's comment.
  • Likewise, if the OpenCode (feat(opencode): upgrade opencode_agent to OpenCode 1.19.6 and 2.3.2 #6456) or OpenClaw (feat(openclaw): upgrade the agent to 2026.11.5 and retain session transcripts #6457) upgrade merges first, the matching pins here follow main.
  • Follow-up commits: the WideSearch README no longer tells readers to set exa_api_key in the config after the OpenCode example (the session copies read EXA_API_KEY), and the prompt change above.

Behavior changes to review

  • The sandbox must reach the Gym host. A session harness calls the model server and exa_search from its sandbox, so the moved copies set use_absolute_ip: true. harness_exa_search instead relayed model calls out of the sandbox itself. Where sandboxes cannot reach the Gym node (for example remote sandboxes on a cluster), the moved copies cannot run as they are; the legacy copies keep working there.
  • The search tools are now the same for every harness. Before, each harness had its own Exa wrapper, with different tools, result formats and no domain exclusions. The moved copies use the three tavily_search tools and block the dataset's Hugging Face pages. Their scores are therefore not directly comparable with earlier harness_exa_search runs of the same harness.
  • Parallelism. Each session agent's concurrency is set to 32. harness_exa_search had no limit.
  • tavily_search for every user, Tavily included: scroll_page on a page that could not be fetched now returns No content found. with total_words: 0, not a header with an empty body. The HLE search configs see this text change only for failed fetches. Closing a session now frees its metrics; with dump_session_id_to_metrics_on_exit set, they are kept for the dump as before.

Known limitations, not changed here

  • Explicit Environment Server routing. The moved copies declare their dataset on the agent, as main's other single_agent_turn_legacy configs do. A run that routes rows to the Environment Server explicitly fails before dispatch: core's pairing check compares the row's task_source (the agent) with the server's resources server. Main's configs fail the same way (reproduced with aime24), so the fix belongs in core, not in these configs.
  • Sandbox egress. The copies keep network_access: inherit. model_and_tools would block the harness runtime's own install in the generic image, and Kilo Code has no such setting, so restricting egress needs prebuilt harness images first.

Still on harness_exa_search

  • The Claude Code copy, including the benchmark default config.yaml: Claude Code refuses required MCP tool grants in a session.
  • Cline, Prime Agent, Simple Strands and NeMo Fabric DeepAgents: these agents serve no sessions yet.
  • responses_api_agents/harness_exa_search/configs/harness_exa_search_claude_code.yaml, and the deepsearchqa and widesearch resources-server configs, which bind the Claude Code agent.

So neither harness_exa_search nor harness_agent (whose registry it imports) can be removed yet.

Why harness_agent and harness_exa_search are being retired rather than extended is in the "Why retire it instead of extending it" section of #5821.

Validation

Run on the final head ac8a646385 (the merge with main plus two follow-up commits), on a Linux workstation, Python 3.13.14, one venv with nemo-gym[dev,sandbox] and each server's extra dependencies:

  • Server tests, pytest <server>/tests:
    • resources_servers/tavily_search: 122 passed (main's tests plus the 22 in test_exa_provider.py);
    • responses_api_agents/harness_exa_search: 9 passed;
    • resources_servers/deepsearchqa: 3 passed;
    • resources_servers/widesearch: 6 passed;
    • environment_servers/single_agent_turn_legacy: 54 passed.
  • Core suites, pytest tests/unit_tests/{environment,data,eval,benchmarks} tests/unit_tests/test_public_api.py: 6485 passed, 37 failed, 32 errors. The same 69 tests fail on a pristine origin/main tree with the same venv and host (compared by test ID). Their causes are the host: tests that shell out to the system Python 3.8, and Harbor fetch tests that need a newer Git.
  • pre-commit run --all-files: all hooks pass and change no file. pre-commit 4.0.1 was used because the newest release needs a newer Git than the host has.
  • gym env validate --config <copy> ++default_host=<docker bridge> for the 12 moved copies: all valid.
  • gym env validate --manifest benchmarks/<b>/configs/<b>_<harness>/manifest.yaml for the 12 moved manifests, with the datasets prepared by prepare.py: all valid. Each resolves agent_server to its session agent and loads 900 DeepSearchQA or 200 WideSearch rows.
  • CI on ac8a646385: 52 checks pass, 15 skipped. The only failure is the non-blocking Environment Server compliance probe of responses_api_agents/harness_exa_search, which runs because this PR touches its app.py. It reports A1 (the agent defines run()) and A2 (no agent sessions). Both describe the deprecated agent this PR starts retiring; the PR adds only its deprecation warning.

Rollout evidence

Real-model smokes of all 12 moved configs against a stub Exa backend. No run made a real Exa call. No Exa API key was available, so exa_base_url pointed every run's exa_search server at a local stub. The stub serves:

  • /search: two placeholder results, https://stub.example/page0 and page1. Each highlight only echoes the query.
  • /contents: for each requested URL, one placeholder sentence repeated 20 times as the page text. When highlights is requested it adds one placeholder passage that echoes the query.

The stub logs each request it receives: path, body, and whether the key header was present.

Everything else ran as shipped:

  • gym env start --config benchmarks/<b>/configs/<b>_<harness>.yaml with vllm_model and the Docker sandbox provider, then gym eval run --no-serve --agent <agent> --input <row> --limit 1;
  • policy and judge model: nvidia/nemotron-3.5-super-vl-120b-a12b on a hosted endpoint;
  • rows: DeepSearchQA example row 0 (single answer, "New Zealand") and WideSearch ws_en_005, with task_source removed so --agent routes them;
  • all 12 runs on the final head's prompts.
Benchmark Harness Reward Granted tools the harness called Requests to the stub
DeepSearchQA Codex 1.0 web_search ×2, find_in_page ×1 /search 2, /contents 1
DeepSearchQA Hermes 1.0 mcp__exa_search__web_search ×2 /search 2
DeepSearchQA Kilo Code 1.0 exa_search_web_search ×5 /search 5
DeepSearchQA OpenClaw 1.0 exa_search__web_search ×44, exa_search__find_in_page ×3, exa_search__scroll_page ×5 /search 44, /contents 8
DeepSearchQA OpenCode 1.0 exa_search_web_search ×7 /search 7
DeepSearchQA Pi 0.0 (answered Luxembourg) mcp__exa_search__web_search ×2, mcp__exa_search__find_in_page ×2 /search 2, /contents 2
WideSearch Codex 0.0 (item F1 0.84) web_search ×8, find_in_page ×7 /search 8, /contents 7
WideSearch Hermes 0.0 (item F1 0.75) mcp__exa_search__web_search ×8, mcp__exa_search__find_in_page ×4 /search 8, /contents 4
WideSearch Kilo Code 0.0 (item F1 0.59) exa_search_web_search ×7, exa_search_find_in_page ×4 /search 7, /contents 4
WideSearch OpenClaw 0.0 (item F1 0.84) exa_search__web_search ×42, exa_search__find_in_page ×28 /search 42, /contents 28
WideSearch OpenCode 0.0 (item F1 0.75) exa_search_web_search ×12, exa_search_find_in_page ×4, exa_search_scroll_page ×2 /search 12, /contents 6
WideSearch Pi 0.0 (item F1 0.75) mcp__exa_search__web_search ×10, mcp__exa_search__find_in_page ×4, mcp__exa_search__scroll_page ×1 /search 10, /contents 5

In every run:

  • the episode completed with mask_sample: false, and the benchmark's judge graded the answer;
  • every request to the stub carried the x-api-key header, and every /search sent excludeDomains: ["huggingface.co", "hf.co"];
  • find_in_page sent highlights: {query}, and scroll_page asked for page text only;
  • the harness's sandbox was gone after the run, and the servers were stopped.

Pi's DeepSearchQA 0.0 is a wrong final answer: the judge saw "Luxembourg", although New Zealand was in Pi's own table. The same config with the first prompt wording answered New Zealand (1.0). WideSearch's reward is the strict whole-table score, so a stub-backed run scores 0, and item F1 shows the table was graded.

Before the prompt fix, all six DeepSearchQA copies also ran on the first prompt wording, all with reward 1.0. In that round Hermes called bare web_search twice and got "Tool 'web_search' does not exist" before it found mcp__exa_search__web_search. That run motivated the prompt change.

Placeholder pages cannot answer the questions. The DeepSearchQA answers came from the harnesses' own shell and fetch tools, which keep open network access (see "Sandbox egress" above). These runs prove the wiring for each harness:

  • the exa_search session is seeded;
  • the MCP grant reaches the harness under its prefixed name;
  • tool results reach the model;
  • verify runs.

They say nothing about Exa's result quality. Exa's request and response shapes are covered only by the unit tests in test_exa_provider.py.

Not run: real Exa. No Exa API key was available, so no run in this PR sent a request to Exa.

🤖 Generated with Claude Code

yaoyu-33 and others added 3 commits November 8, 2026 09:48
resources_servers/exa_search serves one tool, exa_search, that posts to Exa's
/search through Gym's aiohttp client and returns each result's title, URL,
date, author and page text. An Environment Server grants it to a session
agent over MCP by listing the server in tool_servers (#5551), so any
MCP-capable harness can search with Exa without an Exa integration of its
own. The server keeps no session state and grades nothing. Retryable statuses
and transport failures are retried; a failed search reaches the agent as the
tool's result with the status only, never Exa's error body.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…e exa_search tool server

The Codex, Pi, Hermes, OpenCode, OpenClaw and Kilo Code config copies of both
benchmarks drop harness_exa_search behind legacy_agent. Under
single_agent_turn_legacy each agent creates its own sandbox and gets Exa search
as the exa_search MCP tool through tool_servers; the stateless verifier
grades the answer as before. The harness settings carry over (version pins,
timeouts, context and output limits, thinking, Hermes's turn limit, image,
sandbox ttl and memory), the prompts name the exa_search tool, and the
sandbox reaches the model server and exa_search on the Gym host
(use_absolute_ip). The manifests name the session agents. The Claude Code,
Cline, Prime Agent, Simple Strands and NeMo Fabric DeepAgents copies stay on
harness_exa_search.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
harness_exa_search runs each episode through its own legacy /run path. The
session harnesses now get Exa search from the exa_search tool server, so the
agent logs one DEPRECATED warning per process at startup (not in uvicorn
workers) and its README opens with a deprecation banner, as #5222 did for the
sandboxed agents. Five harness copies still use it. No behavior change beyond
the log line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 8, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yaoyu-33

yaoyu-33 commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 82bdf5e

@svcnvidia-nemo-ci svcnvidia-nemo-ci added feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers labels Nov 8, 2026
yaoyu-33 and others added 2 commits November 8, 2026 16:46
…arch server

tavily_search takes search_provider: exa (default tavily) with exa_api_key, and serves web_search,
find_in_page and scroll_page from Exa's /search and /contents through the same aiohttp client,
exclusion policy, page cache, output limits, key pool and bounded retries. The DeepSearchQA and
WideSearch session configs now run it as their exa_search tool server, with an exclusion policy
that keeps each dataset's Hugging Face pages out of results. The separate exa_search resources
server is removed: a server that grades nothing cannot ship the example data and rollouts every
resources server must have.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test e3cfeca

@yaoyu-33 yaoyu-33 changed the title feat(exa_search): add an Exa search tool server and move the DeepSearchQA and WideSearch session harnesses onto it feat(tavily_search): add Exa as a search provider and move the DeepSearchQA and WideSearch session harnesses onto it Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

…moved search configs

Review fixes for the Exa provider and the twelve DeepSearchQA and WideSearch
session copies:

- Exa answers a key whose credits or budget ran out with 402; the key pool now
  tries the next key on it, as it does for Tavily's 432/433. The rejected-key
  statuses are a client field, unchanged for Tavily.
- A 200 reply whose body is not a JSON object raises a provider-named error.
  aiohttp's decode error repr carries the request headers, key included, and
  a validation error quoted the body.
- scroll_page no longer caches an empty page. Exa reports a failed crawl
  inside a 200, and the cached empty page hid that URL from every later
  session on the server.
- OpenClaw copies: setup_timeout is read only on the host CLI path, so the
  900 s install budget moves to sandbox_install_timeout_seconds.
- OpenCode, OpenClaw and Kilo copies raise the per-call MCP timeout to 300 s,
  above the ~183 s worst case of one search; Hermes, whose 120 s limit has no
  knob, gets http_timeout_s: 30 on its exa_search instead.
- Kilo copies leave ttl_s to Kilo, which sizes it from setup and run budgets.
- Hermes copies disable Hermes's own web toolset, which registers a
  web_search of its own when a search key is in the sandbox environment.
- READMEs: the exclusion policy covers the three tools only, scores are not
  comparable with the harness_exa_search versions, WideSearch's legacy copies
  need exa_api_key set in the copy, and which settings are Tavily-only.

Signed-off-by: yaoyu-33 <[email protected]>

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test b757c39

… flag empty pages

- Closing a session drops its call metrics unless dump_session_id_to_metrics_on_exit is set; a tool-server
  session is never verified here, so they stayed for the server's lifetime.
- With caching on, Exa /contents asks for at most max_cached_page_chars of page text instead of Exa's
  multi-million-character default that the cache truncated anyway.
- scroll_page answers a page that could not be fetched with "No content found.", as find_in_page does.
- DeepSearchQA's exclusion policy also blocks its Kaggle benchmark page and URLs naming the benchmark.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 408000e

yaoyu-33 and others added 3 commits November 20, 2026 13:56
Resolve the one conflict in responses_api_agents/harness_exa_search/app.py by importing both
is_nemo_gym_fastapi_entrypoint (main's multi-worker entrypoint guard) and
is_nemo_gym_fastapi_worker (this branch's once-per-process deprecation warning).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…ger need

The README told readers to set exa_api_key in the selected config right after the
OpenCode example, but the session copies read EXA_API_KEY; the paragraph above already
says the harness_exa_search copies need the key set in the copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
… in the session prompts

The session copies told the model to call web_search, find_in_page and scroll_page, but most
harnesses list granted MCP tools under a server prefix: Pi and Hermes show
mcp__exa_search__web_search, Kilo Code and OpenCode exa_search_web_search, OpenClaw
exa_search__web_search; only Codex shows web_search. In a smoke run Hermes called web_search
twice and got "Tool 'web_search' does not exist" before finding the prefixed tool. The prompts
now name the exa_search server and say the tools may carry its prefix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test ac8a646

This branch was previously deployed

1 inactive (outdated) deployment
public — 408000ef Deployed Nov 9, 2026 by copy-pr-bot[bot] via release / finalize / notify #10955
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work risk:high Autobot PR risk: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants