Agentic Compilation: Mitigating the LLM Rerun Crisis for Minimized-Inference-Cost Web Automation
Organizations: Selfotix
Abstract
LLM-driven web agents operating through continuous inference loops -- repeatedly querying a model to evaluate browser state and select actions -- exhibit a fundamental scalability constraint for repetitive tasks. We characterize this as the Rerun Crisis: the linear growth of token expenditure and API latency relative to execution frequency. For a 5-step workflow over 500 iterations, a continuous agent incurs approximately 150.00 USD in inference costs; even with aggressive caching, this remains near 15.00 USD. We propose a Compile-and-Execute architecture that decouples LLM reasoning from browser execution, reducing per-workflow inference cost to under 0.10 USD. A one-shot LLM invocation processes a token-efficient semantic representation from a DOM Sanitization Module (DSM) and emits a deterministic JSON workflow blueprint. A lightweight runtime then drives the browser without further model queries. We formalize this cost reduction from O(M x N) to amortized O(1) inference scaling, where M is the number of reruns and N is the sequential actions. Empirical evaluation across data extraction, form filling, and fingerprinting tasks yields zero-shot compilation success rates of 80-94%. Crucially, the modularity of the JSON intermediate representation allows minimal Human-in-the-Loop (HITL) patching to elevate execution reliability to near-100%. At per-compilation costs between 0.002 USD and 0.092 USD across five frontier models, these results establish deterministic compilation as a paradigm enabling economically viable automation at scales previously infeasible under continuous architectures.
Figures & tables
| Model | Input Output Tokens | Inference Cost (USD) | Speed (TPS) | Result |
|---|---|---|---|---|
| Claude Opus 4.6 | 11,628 1,340 | $0.0916 | 96.9 | Success |
| Claude Sonnet 4.5 | 11,628 1,670 | $0.0599 | 98.6 | Success |
| GPT-5.2-Codex | 9,951 1,447 | $0.0377 | 115.7 | Success |
| Qwen3.5 397B | 10,738 3,000 | $0.0172 | 56.2 | Success |
| Qwen3 Coder Next | 10,536 550 | $0.0020 | 131.6 | Success |
| Task Modality | Compilation Attempts | Successful Blueprints | Execution Accuracy |
|---|---|---|---|
| T1: High-Volume Extraction | 50 | 46 (92%) | 98.0% |
| T2: Form Filling | 10 | 8 (80%) | 95.0% |
| T3: Technology Stack Detection | 50 | 47 (94%) | 96.0% |
Web Agents
Web agents use language and vision models to navigate websites, gather information, and complete tasks through interactive interfaces.
See all 174 papers