Est.
Deep ResearchLong read

Long-Horizon Task Execution with Search-Augmented Agents

Agents fail on long tasks because they lose track of what's actually true in the world.

Senior Writer · · 14 min read
Cover illustration for “Long-Horizon Task Execution with Search-Augmented Agents”
Deep Research · August 20, 2026 · 14 min read · 3,226 words

Long-horizon task execution breaks down for a simple reason: agents lose track of what's actually true in the world while they're busy acting on it, even when the model underneath is reasoning just fine. This piece works through why that happens and what fixes it. Better reasoning alone doesn't solve it. What closes the gap is an architecture that keeps pulling the agent back to current, checkable information at every step, not just once at the starting line.

Picture a long-horizon task as one where a big goal splits into a chain of sub-tasks, where the agent has to hold state across all of them, and where a decision made in step two doesn't show its consequences until step nine. Automated software engineering is the obvious case: find a bug buried in a few hundred thousand lines of code, patch it, confirm the patch doesn't quietly break three other things downstream. Multi-step research synthesis works the same way; a literature review feeds a gap analysis, which feeds a drafted argument, and each stage is only as solid as the one under it. Business process automation follows the same pattern too: procurement, compliance checks, approval routing, all stitched into one flow, where a bad assumption early on doesn't show itself until much later.

The world keeps moving while the agent is still working. A codebase gets edited mid-task. A regulation gets amended. A database record updates without asking permission. Every action the agent takes produces a new state, and it has to read that state correctly before the next action makes any sense; that's the part that actually breaks. Frontier models in 2025 already beat human experts on plenty of coding, math, and science benchmarks, so raw intelligence isn't the bottleneck here. Systems design is. That's the reframing the rest of this piece works through.

What benchmark data actually shows about current agent reliability over extended sequences

METR's Time Horizon 1.1 result is the clearest anchor here. Claude Opus 4.6 hits roughly a 50% success rate on tasks that would take a skilled human close to twelve hours to finish. Sit with that for a second: the best model available right now fails about half the time on work that's structured and well-scoped, nothing open-ended or vague about it. That's not a rounding error.

One clarification matters before anyone reads too much into that number. METR's time horizon metric measures task difficulty, calibrated against how long a human needs, not a clock limit on how long you can leave an agent running unsupervised. Opus 4.6 landing at 50% around the twelve-hour mark tells you where the reliability curve starts bending. It doesn't tell you how long a leash is safe.

SWE-Bench Pro sharpens the picture for software specifically. Leading models resolve only around two-fifths of issues on the public dataset, and performance probably drops further on harder, commercial-grade variants that haven't leaked into anyone's training data yet. Enterprise tool-use benchmarks put leading models at roughly 70% accuracy on individual tool calls, which sounds fine until an agent starts chaining twenty tool calls and compounding twenty of those decisions in a row. The real operational risk lives in the chain, not in any single call.

The HORIZON framework backs this up with breadth instead of one clean test. Across more than 700 tasks, four separate environments, and thousands of trajectories checked against strong human-annotator agreement, the failure rates hold steady across domains. That consistency is worth noting: this isn't a quirk of one benchmark's design. It's a real property of how current agents behave once a sequence runs long.

So what does a builder actually do with these numbers? Current performance supports supervised workflows with a human in the loop, and it supports lower-stakes automation reasonably well. Fully autonomous execution in high-consequence domains isn't there yet. And the failures don't scatter randomly through a task; they pile up at the exact points where the agent has to reconcile what it believes about the world with what's actually true out there, information it has no direct way to check on its own. Search grounding earns its place in the architecture right there, at that pile-up point.

The three failure modes that accumulate as action sequences lengthen

Diagram: How Accuracy Compounds Across Sequential Steps. Visualizes: Visualize the mathematical collapse of agent reliability as sequential steps accumulate.

Three distinct failure modes show up as sequences stretch out, and they feed each other rather than staying in their own lanes.

Stale context comes first. The agent reasons from information that was true when the task started but has since shifted underneath it: a regulation got updated, a price moved, a dependency got patched by some other process entirely. The agent has no idea any of that happened, so it keeps building on ground that's already eroded.

Error compounding comes second, and the math here is unforgiving. An agent running at 90% accuracy on any single step lands around 35% accurate across ten sequential steps if nothing corrects the drift along the way. Each sub-task inherits whatever uncertainty the one before it was carrying, and without some correction mechanism in place, that uncertainty doesn't average out. It stacks.

Unverifiable intermediate outputs round out the third. The agent produces something, a summary, a recommendation, a drafted clause, and every step after that treats it as settled fact. Nowhere in the process is there a checkpoint where that output gets checked against an outside source before it moves on.

These three don't stay separate. Stale context produces the first errors. Those errors compound because nothing catches them early enough. And because the intermediate outputs can't be verified, the agent has no way to even notice the pileup until walking it back has gotten expensive, sometimes prohibitively so. For compliance work or anything customer-facing, that silent compounding is the real risk, more than any single wrong answer. What these three failure modes point toward, together, is a specific architectural need: some mechanism that re-anchors the agent to real-world state at every planning step, not once at the start of the run and then never again.

How search-augmented retrieval fits into the agent planning loop

Search works best as a recurring operation embedded inside the planning loop itself, firing whenever the agent's grip on world state needs refreshing, rather than as a one-time prefetch before the agent starts working.

The loop runs something like this: plan a sub-task, figure out what real-world state that sub-task actually depends on, search and retrieve that state, fold it into working context, execute, repeat. Retrieval fires on any step that touches an external fact, and in most long-horizon tasks, that's more steps than developers tend to assume going in.

This structure hits all three failure modes at once. Stale context gets fixed because each retrieval call pulls current information and swaps out whatever cached assumption the agent was carrying. Error compounding gets interrupted because a verified intermediate output breaks the chain: a downstream step starting from a cited, retrieved fact can't silently inherit an upstream hallucination the way it would if everything got generated internally with no outside check. And unverifiable outputs turn verifiable, because citations attached to retrieved content give both the agent and any human reviewer a path back to the source. The claim can actually be traced now, not just trusted.

Retrieval-augmented generation is the mechanism underneath this, but the agentic version changes what happens and how often. The agent reads its own intent at each step, pulls relevant current content from the web, and builds a grounded response before moving forward, repeatedly, as needed, rather than doing that work once at session start and coasting on it.

The Plan-and-Act architecture presented at ICML 2025 gives this a concrete shape. By splitting high-level planning from low-level execution, it opens up natural insertion points for retrieval: the planning layer can check world state before committing to an execution path, instead of discovering mid-execution that the world changed, at the exact moment course-correcting is most expensive. HiAgent and related memory-augmented architectures, described in ACL 2025 and ICLR 2026 work, stack hierarchical working memory on top of this, so retrieval results get managed, compressed, and selectively kept rather than piling up until the agent's context overflows or starts degrading. Anthropic's 2025 context engineering guidance matters here too: discard, compress, and select strategies decide whether retrieved content stays useful across a long sequence or slowly poisons the agent's reasoning with irrelevant buildup.

That leaves an open, practical question for anyone actually building one of these systems. Where in the loop does retrieval fire, and on what trigger? Every step? Only when the agent flags its own uncertainty? Only on domain-specific signals? That question carries straight into the sections ahead.

What to look for in a search API when the agent, not a human, is the caller

A human running a web search can tolerate a few irrelevant results without much cost. They skim, discard, move on, barely notice. An agent doesn't get that luxury. Whatever the API hands back gets folded directly into the reasoning chain, so retrieval quality stops being a nice-to-have and becomes a direct input into decision quality.

Four things matter most for agentic workloads. Freshness comes first: data that's hours stale is a real liability when the task touches prices, filings, regulatory status, or technical documentation that shifts on short cycles. Answer quality and citation integrity come second; an API that hands the agent ten raw links is asking it to do a second reasoning pass it shouldn't need, while an API that returns synthesized content with sources attached lets the agent act on the response directly and still trace it back if something needs checking later. Latency is third, and it's easy to underweight until it bites: every retrieval call sits on the critical path of a multi-step sequence, so a slow call doesn't cost you once. It costs you at every step where retrieval fires, and that multiplies fast across a full task horizon. Precision and recall round it out, and in finance, compliance, or medicine, low recall means the agent missed a filing or a ruling that actually mattered, not just that it returned a slightly worse result than ideal.

Teams evaluating an API for a specific workload are better off building an actual test harness than trusting a vendor's marketing page. Define the test domains that match your agent's real task types. Build an evaluation set with gold-standard answers you already know are right. Automate the testing so precision, recall, and freshness get measured separately instead of blending into one mushy "accuracy" number. Then set your accuracy bar based on what the domain genuinely demands: compliance work needs a much higher bar than summarizing blog posts for an internal digest.

Cost structure deserves its own look, apart from raw quality. A per-query pricing model behaves very differently at high volume than a flat subscription does, so model your expected query rates across a full agent run rather than eyeballing per-call cost off a demo. Twenty retrieval calls per task, times a few thousand tasks a day, adds up fast in ways a sales deck never shows you. And infrastructure fit matters more than it looks at first glance: MCP compatibility, SDK availability, zero-data-retention guarantees, these often decide whether legal and security sign off on the integration at all.

How the main search API options compare on the criteria that matter for agentic use

Table: Search API Options for Agentic Workloads. Compares Primary Approach, Best Fit, Benchmark Standing, Enterprise Readiness, and 1 more by You.com, Tavily, Firecrawl and Perplexity Sonar.

Microsoft retiring the Bing Search API in August 2025 reshaped this whole landscape, and it's worth starting there. Teams that had built retrieval pipelines on top of Bing suddenly needed somewhere else to go, and that pushed a wave of developers toward APIs built specifically for AI workflows rather than for human search boxes. The comparison below reflects that newer landscape, organized around the same four criteria from the last section: freshness, answer quality with citations, latency, and the precision-recall balance.

You.com's Research and Web Search APIs currently sit at the top of the DeepSearchQA benchmark and rank first on FinSearchComp, which makes them the option here with publicly verifiable benchmark leadership in both general research and financial retrieval specifically. The APIs return cited, synthesized answers built for an agent to consume directly, rather than a raw list of links needing another parsing pass on top. The Finance Research API is purpose-built for source-reconciled financial intelligence, which matters if your agent is operating anywhere near compliance or investment decisions. On the infrastructure side, zero data retention and SOC2 certification handle enterprise requirements at the platform level instead of pushing that work onto the integrating team, and the API is MCP-compatible, with clients that include DuckDuckGo, Alibaba, and Amazon.

Tavily was built specifically with AI agents and RAG pipelines in mind, and it shows. It returns parsed, LLM-digestible content rather than raw search results, and its research endpoint pulls deep multi-source research through a single API call, cutting down on round-trips inside an agent loop. Pricing starts at $29 a month, an accessible entry point for smaller teams testing agentic retrieval before committing to something heavier. Independent testing from AIMultiple has it scoring lower than You.com on deep research benchmarks specifically, worth weighing if research depth is the priority you're optimizing for.

Firecrawl takes a different approach entirely. It's a scrape-and-crawl engine that returns clean Markdown or structured JSON, built for deep content extraction rather than search-first discovery. Its strengths are recursive crawling, a strong mean relevant score on AIMultiple's deep content retrieval testing, and a sizable open-source community behind it. The fit is specific: agents that already know which URLs they need to ingest deeply, not agents that need help figuring out what to retrieve in the first place. Pricing runs flat-rate: one credit per page scraped, two credits per ten search results.

Perplexity Sonar is an answer-layer product with wide consumer adoption and real strength at returning synthesized responses to straightforward factual queries. In available comparisons it scores lower than You.com on deep research benchmarks, and it's less purpose-built for agentic integration than APIs designed from the ground up around research workflows specifically.

The practical guidance here isn't complicated. For agents running multi-step research or financial workflows where cited accuracy is the binding constraint, a benchmark-verified option like You.com is the defensible pick. For agents doing deep, URL-level content extraction on a known set of sources, a scrape-first tool like Firecrawl pairs well alongside a search-first API. They solve different problems, and most serious pipelines end up needing both.

Building the retrieval loop in practice: where search calls fire and why

Three trigger patterns cover most of how retrieval actually gets wired into an agent loop, and each one trades freshness against cost differently.

Step-gated retrieval fires a search call before every sub-task touching an external fact. It's the most conservative pattern, and it gives the freshest possible context at each step, but it also runs up token costs and latency fastest, since you pay for a retrieval call whether or not the agent actually needed it.

Uncertainty-triggered retrieval only fires when the agent detects low confidence or spots a gap in what it currently knows. It's considerably more efficient, but it only works as well as the agent's self-assessment is reliable, and that's a real dependency, not a footnote to skip past. An agent that's confidently wrong won't trigger the retrieval it actually needs.

Domain-signal triggered retrieval sidesteps that dependency for specific task types. Financial data lookups, regulatory checks, breaking news: these get retrieval fired automatically regardless of how confident the agent claims to be. For compliance-sensitive workflows, this tends to be the most reliable of the three, precisely because it doesn't lean on the model correctly judging its own uncertainty in the moment.

Managing context across multiple rounds of retrieval is its own separate problem. Retrieved content has to fold into working memory without shoving out earlier context that's still relevant three steps later. Compress-and-select strategies, the kind described in Anthropic's 2025 context engineering guidance, start mattering a great deal once a task runs past a handful of steps. ReSum, presented at ICLR 2026, offers one concrete version: summarize context after each retrieval round so the agent's working state stays compact while what actually got retrieved is preserved rather than dropped on the floor.

Citation threading is the piece that solves the unverifiable-output problem from earlier in this piece. Each retrieved fact carries its source along through the reasoning chain, so an intermediate output stays traceable instead of turning into an opaque claim the next step just has to take on faith.

None of this works without a budget, either. Retrieval calls cost money and time, so an agent needs a query budget per task, plus a stopping criterion, some working definition of what counts as sufficient coverage for that task type, built into the loop's termination logic rather than left as a judgment call the agent quietly makes on its own. Otherwise the loop doesn't converge; it just keeps searching, forever, at your expense. MCP provides the plumbing for the agent-to-tool connection here, and where a task splits across multiple specialized agents (a researcher, a writer, a validator, each needing its own retrieval access) A2A handles the coordination between them.

How enterprise teams should think about grounding requirements across different task types

Not every long-horizon task needs the same amount of grounding, and treating them all the same wastes either money or accuracy, depending on which way you err. A content-drafting agent summarizing internal meeting notes doesn't need step-gated retrieval on every sentence. The stakes of an occasional stale reference are low there, and uncertainty-triggered retrieval alone probably covers it fine. A compliance workflow checking regulatory status before approving a transaction is a different animal. Domain-signal triggering is the only defensible design in that case, because the cost of a silently stale regulation isn't something you get to absorb after the fact.

The useful exercise for a team building one of these systems is sorting task types along two axes at once: how fast the underlying facts actually change, and how expensive a wrong answer is if grounding fails. A software agent patching an internal tool sits at moderate stakes, working against a codebase that changes at a pace you can usually track directly. A financial research agent working breaking market data has both fast-changing facts and high stakes at once, which argues for the tightest retrieval loop and the strictest citation requirements you can afford to run. Somewhere in between sits most business process automation (procurement, approval routing, document review) where the right answer is usually uncertainty-triggered retrieval with domain-signal overrides for the specific steps that touch compliance or financial commitment.

None of this is solved, and it's worth saying plainly instead of dressing it up as more settled than it is. The benchmark data covered earlier shows agents still failing on roughly half of well-scoped, extended tasks even with a frontier model doing the reasoning underneath. Search-augmented retrieval narrows the gap between what the model can theoretically reason through and what the agent can reliably check along the way, but it doesn't close that gap outright. What it does do is turn an invisible failure mode into a visible one. A well-built retrieval loop leaves a citation trail a human can actually audit, instead of letting an agent confidently compound an error across ten steps with no trace of where things went wrong. That's the groundwork that makes supervising autonomy worth doing at all.

Sources

  1. arxiv.org
  2. arxiv.org
  3. arxiv.org
  4. ai21.com
Filed underDeep Research

More in Deep Research