Web Agents Need Static Programs, Not Reactive Reasoning, to Block Prompt Injection Attacks
A new research paper argues that large language model agents navigating the web should commit to a fixed execution plan upfront rather than dynamically deciding actions based on each page, making them far harder to manipulate through malicious content.
Researchers are challenging the dominant approach to building web-navigating AI agents. Instead of letting language models react to each new page they encounter—the ReAct paradigm that now dominates the field—they propose agents should plan their entire task beforehand and execute a predetermined program.
The Security Problem with Reactive Agents#
The shift matters because of how mixed web content can exploit reactive agents. When an e-commerce site displays a product listing alongside customer reviews, ads, and recommendations, a reactive agent treats all of it equally. As the model decides what to do next, it processes the seller's content, third-party reviews, and sponsored material in one stream. This creates an opening for prompt injection: a malicious advertiser or reviewer can embed instructions in their content that hijack the agent's decision-making, redirecting it toward unintended actions.
By contrast, a compile-and-execute approach separates planning from observation. The agent commits to a task-specific program—a fixed sequence of steps—before seeing any web content. Untrusted data can affect individual values within that predetermined plan but cannot redefine the overall task or cause the model to invent new actions mid-execution.
What the Research Reveals#
Analysis of WebArena, a popular benchmark for testing web agents, shows the upside is substantial. Researchers found that all tasks in the benchmark are compatible with the compile-and-execute model, and remarkably, 81% could be completed with a purely static program—no runtime language model calls at all. This suggests real-world web tasks often follow predictable patterns that don't require adaptive reasoning to solve.
The Infrastructure Barrier#
However, adoption faces a practical obstacle: websites are not designed around semantic, task-level interfaces. Today's web tools—clicking, typing, scrolling—are page-dependent: the same button click means different things on different screens. An agent can only see actions available on the current page; future actions remain hidden until after it acts. This creates a planning problem: agents can't know the full scope of what they'll need to do until they've already begun.
Solving this requires infrastructure change, not better models. The research identifies the core need: typed, complete APIs that expose website interactions as task-level operations rather than low-level browser commands. Without this layer, even a compile-and-execute agent remains nearly blind to downstream steps.
Why It Matters#
The findings reframe a core assumption in AI agent research. Reactivity has been treated as a feature—the model's ability to adapt to surprise conditions. The paper argues it's actually a liability on the web, where adaptation opens a security door. The real challenge is not building smarter reasoning systems, but designing web infrastructure that lets agents plan with confidence.