# Securing Web Agents with the Compile-Then-Execute Paradigm

DevFeed: [Securing Web Agents with the Compile-Then-Execute Paradigm](<https://devfeed.tech/articles/securing-web-agents-with-the-compile-then-execute-paradigm-118697.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.06039>)

Author: Annabella Chow, Jinhao Zhu, Sylvie Venuto, Abdulaziz Alharbi, Basel Alomair, Raluca Popa, David Wagner, Julien Piet

Published: 2026-11-05T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Cryptography and Security](<https://devfeed.tech/sources/arxiv-cryptography-and-security.md>)

Topics: [prompt injection](<https://devfeed.tech/topics/prompt-injection.md>), [agentic browsing](<https://devfeed.tech/topics/agentic-browsing.md>), [Agent Browser](<https://devfeed.tech/topics/agent-browser.md>), [Web](<https://devfeed.tech/topics/web.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [agents](<https://devfeed.tech/tags/agents.md>), [api](<https://devfeed.tech/tags/api.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [compilation](<https://devfeed.tech/tags/compilation.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [cs-cr](<https://devfeed.tech/tags/cs-cr.md>), [evaluation](<https://devfeed.tech/tags/evaluation.md>), [hijacking](<https://devfeed.tech/tags/hijacking.md>), [planning](<https://devfeed.tech/tags/planning.md>), [prompt-injection](<https://devfeed.tech/tags/prompt-injection.md>), [python](<https://devfeed.tech/tags/python.md>), [runtime](<https://devfeed.tech/tags/runtime.md>), [security](<https://devfeed.tech/tags/security.md>), [web](<https://devfeed.tech/tags/web.md>), [website](<https://devfeed.tech/tags/website.md>)

## AI overview

Baya aims to prevent webpage prompt injections from hijacking a web agent's control flow by compiling the user's request into a Python program before accessing the live site. The planning model does not see live content; the compiled program processes it through a Trusted Website API. Untrusted content can supply values or choose among precompiled branches, but cannot redefine the task or prompt the model to create new website operations at runtime. Across 581 valid WebArena Verified tasks, Baya reported 77.8% aggregate utility, compared with 66.7% for API-enabled ReAct and 55.1% for browser-only ReAct. On WASP, its reported attack success rate was 0%, versus 16.2% and 25.5%, respectively. These are reported benchmark results; the supplied text does not describe evaluation limitations.

## Source excerpt

arXiv:2611.06039v1 Announce Type: new Abstract: Web agents commonly follow the ReAct paradigm, selecting each action from runtime observations that inherently mix trusted and untrusted content. This design makes their control flow vulnerable to prompt injections embedded in webpages. We introduce Baya, a compile-then-execute web agent designed to prevent prompt-injection-driven control-flow hijacking by design. Before accessing the live website, Baya compiles the user's request into an executable Python program that calls a Trusted Website API. The planning model does not observe live website content; only the compiled program processes it. Untrusted data may determine program values or select among branches defined during compilation, but it cannot redefine the user task or cause the model to synthesize new website operations at runtime. The Trusted Website API gives the compiler a unified view of the website's action space, enabling ahead-of-time planning without the stepwise action discovery required by reactive agents. Our evaluation across 581 valid WebArena Verified tasks shows that Baya achieves 77.8% aggregate utility, outperforming browser-only ReAct (55.1%) and API-enabled ReAct (66.7%). On WASP, a security benchmark for web agents, Baya achieves 0% attack success rate, compared with 16.2% for API-enabled ReAct and 25.5% for browser-only ReAct.