October 12, 2026

How We Improved Web Search Recall And Efficiency Using Agentic Code Execution

Letting agents write and run code over collected web data raised recall from 59% to 95% across 50 tasks.

clock
8
min read
Copied!

Yuval Bertocchi

linkedin
Director of Engineering
Koren Gershoni

Koren Gershoni

Data Scientist

How We Improved Web Search Recall And Efficiency Using Agentic Code Execution
October 12, 2026

How We Improved Web Search Recall And Efficiency Using Agentic Code Execution

Letting agents write and run code over collected web data raised recall from 59% to 95% across 50 tasks.

clock
8
min read
Copied!

Yuval Bertocchi

linkedin
Director of Engineering
Koren Gershoni

Koren Gershoni

Data Scientist

How We Improved Web Search Recall And Efficiency Using Agentic Code Execution

By letting Web Search Agents write and execute code over collected web data, we increased recall from 59% to 95% while cutting cost per correct answer by 2.8×.

At Nimble, we build Web Search Agents to search and retrieve data across the live web. Early versions worked well when an answer could be assembled from a manageable set of pages. They struggled when the task required completeness across an entire site or dataset.

The problem was not retrieval capacity, but retrieval efficiency. In one early test, the agent returned three qualifying companies where another system returned 13. The missing companies were already present in pages our agent had collected. It simply ran out of turns before it could process them.

Before, our agents read through hundreds of collected pages through the LLM one by one. Now, our agents can write a parser or transformation once and run it across the full dataset inside an isolated sandbox.

In a 50-task benchmark (100 runs, each task run with and without code execution), that increased recall from 59% to 95% while reducing cost per correct answer by 2.8×. The savings come from running one small piece of code instead of generating a long sequence of agentic tool calls one by one, each of which costs tokens to produce.

59% → 95% recall
$0.0040 → $0.0014 cost per correct answer

The Problem: Efficiently Scaling Web Search + Retrieval

Before code execution, exhaustive web tasks had two expensive loops: the model read each page, then wrote each output row.

Read operations were bounded, and every output row required another model-driven tool call. As the number of pages or records grew, the agent could hit its turn, time, or context limits even when it had already found the right sources.

We tested several ways to extend that architecture:

ApproachLimitationOutcome
More turns and larger readsMoved the limit, but the model still processed pages individuallyFound 5 companies instead of 3
RAG / vector searchReturns the best matches, while a complete-list task needs every matchNot built
Cheaper LLM for page processingStill one model call per page, so cost and latency scale with the listFound 13 companies instead of 3
Code over collected pagesOne procedure can process the complete datasetAdopted

Adding a Code Execution Sandbox

Nimble’s fetching tools still handle browser use. Code execution operates over the data they collect.

Before:

Search and fetch
↓
Model reads page
↓
Model writes rows
↓
Repeat
↓
Output

Now:

Search and fetch
↓
Collected pages / files
↓
Agent writes task-specific code
↓
Code execution sandbox: parse, filter, dedupe, compute
↓
Structured output / files

Code can also inspect what has been collected and determine which URLs should be fetched next, handing that work back to the browser layer. The sandbox itself has no direct internet access or credentials, and executed scripts are retained, both for audit and for reuse. Once a script works, later runs can reuse it instead of generating and debugging it again, which makes the agent more repeatable.

This gives the agent two execution modes. The model handles decisions that require interpretation, such as what constitutes a valid product or which fields matter. Once those decisions become explicit rules, code can apply them consistently across hundreds or thousands of records.

Code execution in production

The strongest use cases are tasks where the agent must apply a known operation across a large body of web data.

Production workload exampleWhat code didResult
Full store locator for a national chainParsed location indexes and paginated store data, then merged the resultsThousands of locations
Whole ecommerce catalogParsed listings, removed widget noise, cleaned names and grouped productsHundreds of products across ~20 categories
JavaScript-heavy industrial catalogsProcessed the listing data requests behind the siteComplete product lists, consistently across repeated runs

The same model applies to filtering, joins, exact calculations, schema transformations, and large file outputs. Intermediate CSV or JSON data can remain in files rather than repeatedly entering model context.

This is already a common execution path in production. Over two weeks, Web Search Agents made 41,181 run_code calls across 5,234 runs, and roughly 54% of sampled research-agent runs used the sandbox.

Most of those calls were practical data-processing work: 41.6% parsed pages into rows, 25.3% wrote output rows, and 24.3% inspected files.

Benchmarks With and Without Code Execution

We tested 50 structured web tasks across eight kinds of work, running each one twice with the same agent, model, and effort level: once with code execution available and once without it, for 100 runs in total. Every task asked for a complete, checkable set of rows, so each answer could be compared row by row against a known reference set. For results on public benchmarks, see How Nimble Ranks On Public And Vertical Web Search Benchmarks.

Recall increased from 59% to 95%

Across the 50 tasks, the reference data contained 3,313 right answers.

The agent found:

  • 1,960 with code disabled
  • 3,149 with code enabled

Aggregate recall increased from 59% to 95%. The average task score rose from 79% to 97%, and the agent returned a fully correct answer on 39 tasks with code versus 30 without it. Code execution won 17 tasks, tied 32, and lost 1.

Kind of work (tasks)Code offCode on
Whole list from one site (8)51%94%
Per-row lookups across many pages (6)67%99%
List + filter (7)78%94%
Count across a large set (7)81%95%
Dates and time windows (6)87%99%
Combine across sources (7)89%99%
Calculations (7)100%100%
Single-fact controls (2)100%100%

The biggest gains appeared where the task required exhaustively processing a large source. On the 13 tasks with 75 or more right answers, the average score rose from 58% to 96%. Without code, the agent returned 153 of 375 final Python PEPs and 24 of 248 Y Combinator Winter 2024 companies; with code, it returned all 375 and 214. Per-row lookups across many pages showed the next-largest gain: the agent found the latest version of all 30 top PyPI packages with code, versus 11 without it.

Cost per correct answer fell by 2.8×

Across the 50-task benchmark, cost per correct answer fell from $0.0040 to $0.0014. Total model spend across all 50 tasks fell from $7.78 to $4.52, a 42% reduction, and code cost less in six of the eight kinds of work.

The saving comes from the shape of the work. Without code, the agent generates a long chain of tool calls, and every call costs tokens to produce. With code, it writes one short script that processes everything at once. Code cost slightly more, by a few cents per task, only on list-and-filter tasks and the two single-fact controls.

Code can also make an already-correct result much more efficient. Both configurations returned all 59 requested Python PEP titles and statuses, but the code-enabled run cost $0.02, compared with $0.24 without code.

Small computations showed little benefit

The seven calculation tasks and two single-fact controls fit inside the model’s context, and both configurations produced fully correct outputs. Code still made the calculations cheaper, but it did not change accuracy. Generated code can need a round of debugging before it works, but that cost is paid once: the working script can then be reused in future runs.

Code execution also does not eliminate the need for validation. The code-enabled agent lost one task, a stadium-capacity lookup where it used outdated or rounded figures, merged two categories on one counting task, and returned extra records on two list tasks.

Reference answers were frozen from primary sources on the day of each run (the site’s own API or feed where one exists, public reference tables otherwise) and built by script rather than by an LLM. Every result was scored with the same matching script, and a row counted only if its values were also correct. Each task ran once per configuration, so individual per-task results can vary from run to run; the aggregate gap across 50 tasks is the more reliable measurement.

From Generated Code to Learned Tools

Generating code solves a task once. Retaining a successful procedure lets the agent start from what it has already learned the next time it encounters the same problem.

New problem
    ↓
Generate procedure
    ↓
Execute
    ↓
Validate
    ↓
Retain learned tool
    ↓
Reuse on similar task
    ↓
Execute and validate
       ↳ failure → repair → retain improvement

This matters because web-specific procedures are not static. A site may change its markup, pagination, fields, or underlying data structure. A learned tool can be reused while it continues to validate, then revised when an assumption breaks.

The agent already repairs generated code inside an individual run: 86% of sandbox calls succeed on the first attempt, and when a script fails, the model can inspect the error and correct its code on the next call.

The longer-term mechanism extends that principle across tasks. The useful artifact is a validated procedure for solving a recurring web-data problem.

When Code Execution Is Worth It

Code execution pays off when the amount of deterministic processing is large relative to the amount of reasoning required: exhaustive lists, large datasets, repeated parsing, filtering, joins, aggregation, exact calculations, and structured file generation.

It adds less value when the dataset is small enough for the model to handle directly. The benchmark reflects that distinction: the largest gains came from wide list tasks and per-row lookups across many pages, while small computation tasks were already tractable without the sandbox.

That is the architectural shift.

Nimble Web Search Agents no longer need to read and rewrite every piece of web data through the LLM. The model can decide what needs to happen, generate the procedure, and validate the result while code performs the repetitive processing at scale.

The web stops being a sequence of pages the model has to read one at a time and becomes data the agent can operate on.

To try it, start with the Web Search Agent docs.

Appendix: Benchmark Data

This appendix gives the full results behind the benchmark section. Each of the 50 tasks ran once with code execution available and once without it, using the same agent, model, and effort level.

How the benchmark was run

  • Tasks: 50 tasks across eight kinds of work. Each task asked for structured rows with a fixed set of fields, so every answer could be checked line by line.
  • Reference answers: frozen from the primary source on the day of each run. We used the site's own API or feed where one exists (job boards, PyPI, GitHub, USGS, nobelprize.org, FRED, World Bank) and Wikipedia tables otherwise. Every reference answer was built by script, never by an LLM.
  • Runs: each task ran twice at high effort with the same agent, model, and code version: once with the code tool removed ("off") and once with it available ("on"). 10 tasks ran on September 30, 2026 and 40 on October 7, 2026.
  • Scoring: one script matched returned rows to the reference by a stable key (catalog number, ticker, job ID, slug, or name). A row counted only if its values were also correct, for example a party, a capacity within 3 to 5%, or an exact count. Task score is correct rows divided by total right answers; counting tasks score exact buckets.
  • Cost: LLM cost per run from our tracing. Sandbox time costs about $0.00003 per second, so it barely registers.

Results by kind of work

Kind of workTasksScore, code offScore, code onCost, code off ($)Cost, code on ($)
Whole list from one site851%94%2.281.11
Per-row lookups across many pages667%99%1.190.36
List + filter778%94%0.510.58
Count across a large set781%95%1.110.58
Dates and time windows687%99%0.920.61
Combine across sources789%99%1.180.92
Calculations7100%100%0.570.32
Single-fact controls2100%100%0.030.04
All 50 tasks5079%97%7.784.52

All 50 tasks

Counts are correct rows (or exact buckets for counting tasks). Bold marks the better side where the two configurations differ.

#TaskKindRight answersCode offCode onCost off → on ($)
1Industrial manufacturer: cable spool catalog numbersWhole list7724770.30 → 0.13
2YC Winter 2024 companiesWhole list248242140.33 → 0.31
3Coffee chain: stores in one US stateWhole list1581161280.22 → 0.17
4Figma open jobsWhole list1631631630.36 → 0.07
5Credit-card benefits lobby entriesWhole list6362620.06 → 0.07
6US Apple StoresWhole list269302690.20 → 0.15
7Final Python PEPsWhole list3751533750.41 → 0.02
8Lex Fridman podcast episodesWhole list5032244430.40 → 0.19
9OpenAI remote job postingsList + filter588330.27 → 0.26
10Colorado peaks above 14,215 ftList + filter1717170.02 → 0.01
11California S&P 500 companies added 2011+List + filter4614460.04 → 0.14
12M6.5+ earthquakes in 2024List + filter2828280.05 → 0.02
13French 3-star Michelin restaurantsList + filter3030300.03 → 0.02
14meta-llama models, 100k+ monthly downloadsList + filter1717170.06 → 0.06
15US national parks over 1M acresList + filter1212120.04 → 0.07
16In both S&P 500 and Nasdaq-100Combine sources8585850.21 → 0.34
17Governor's party vs 2024 winner, 50 statesCombine sources5050500.06 → 0.04
18Premier League 2024-25: position + capacityCombine sources2020180.06 → 0.03
19awesome-python projects with 20k+ starsCombine sources104781040.26 → 0.12
20YC W24 companies hiring nowCombine sources8940890.08 → 0.16
21Top-100 PyPI packages without Python 3.13Combine sources1717170.16 → 0.09
22Nobel Physics 2000-2025 + institution countryCombine sources7171710.35 → 0.13
23YC W24 companies per industryCount large set8280.33 → 0.09
24PEPs per statusCount large set9770.15 → 0.06
25Apple Stores per stateCount large set4545450.10 → 0.02
26S&P 500 companies per HQ stateCount large set4026360.31 → 0.20
27M5+ earthquakes per month, 2024Count large set1212120.05 → 0.05
28Nobel Physics laureates per decadeCount large set1212120.12 → 0.14
29S&P 500 companies per sectorCount large set1111110.05 → 0.03
30Nimble blog posts from 2025Dates7532710.29 → 0.29
31SpaceX launches in 2023Dates9898980.22 → 0.09
32Fed rate changes since Dec 2015Dates3232320.03 → 0.13
33Python releases in 2024Dates2121210.02 → 0.03
34FastAPI releases, last 12 monthsDates9270920.32 → 0.03
35Notable deaths aged 100+, Jan 2025Dates2828280.03 → 0.04
36Top-50 US cities per state*Calculation2828280.06 → 0.11
37Figma open jobs per departmentCalculation1313130.04 → 0.02
38G20 GDP per person, 2023Calculation1919190.04 → 0.02
39G7 GDP-per-person growth, 2019 to 2023Calculation7770.02 → 0.01
40Python 3.8 to 3.14 support lifetime (days)Calculation7770.10 → 0.05
41Population density per stateCalculation5050500.03 → 0.02
4210 fastest-growing big US citiesCalculation1010100.27 → 0.08
43NBA arenas + capacityPer-row lookup3029290.02 → 0.01
44EU members: year joined + euroPer-row lookup2727270.03 → 0.02
45Top-30 PyPI packages: latest versionPer-row lookup3011300.29 → 0.04
46Top-30 awesome-python repos: language + licensePer-row lookup3016290.28 → 0.05
47PEPs 700 to 760: title + statusPer-row lookup5959590.24 → 0.02
48YC W24 fintech companies: foundersPer-row lookup183180.33 → 0.21
49Current Fed funds target rangeControl1110.01 → 0.02
50Latest stable PythonControl1110.01 → 0.02

*Task 36's code-on result is a re-run. The first attempt timed out at 23 of 28 states ($0.04).

Limits

  • One run per configuration. A single task can swing from run to run. The overall gap is large, but per-task numbers should be read as indicative, not exact.
  • We chose the tasks and built the reference answers ourselves. Public benchmarks such as WideSearch (paper), 200 table-filling tasks of the same shape with published scores for other agents, are the next step for a direct comparison.
  • Live data drifts. Reference answers for jobs, hiring flags, downloads, and GitHub stars were frozen within an hour of the runs, so a handful of edge items may have moved.
  • Two scoring rules to note: the "fully remote" OpenAI jobs task used the site's own rule (any location marked Remote), and the Premier League task accepted stadium capacities within 5%.

Reference-answer sources

Fetched on the day of each run.

FAQ

Answers to frequently asked questions

What is agentic code execution in a web search agent?
plusminus

Agentic code execution lets a Web Search Agent write a short script and run it in an isolated sandbox over the pages it has already collected. The model decides what to extract and which rules apply, and the code applies those rules to every page or record. This replaces long chains of model-driven tool calls for parsing, filtering, deduplicating, and counting.

How much does agentic code execution improve recall?
plusminus

In Nimble's 50-task benchmark, each task ran once with code execution and once without it. Recall rose from 59% to 95% (3,149 of 3,313 right answers, versus 1,960), and the average task score rose from 79% to 97%. The largest gains came on whole-list tasks and per-row lookups across many pages.

Does code execution make web search agents cheaper to run?
plusminus

For data-heavy tasks, yes. In the benchmark, cost per correct answer fell from $0.0040 to $0.0014, and total model spend across the 50 tasks fell 42%. The saving comes from writing one script instead of generating a long sequence of tool calls, each of which costs tokens.

Can the code execution sandbox access the internet?
plusminus

No. The sandbox has no direct internet access or credentials. Nimble's fetching tools handle browsing, and code runs over the data they collect. Code can decide which URLs to fetch next, but it hands that work back to the browser layer.

When is agentic code execution not worth using?
plusminus

When the data is small enough for the model to handle directly. In the benchmark, calculation tasks over tables of 7 to 50 rows were fully correct with or without code. Code still lowered cost on those tasks, but it did not change accuracy.