LACUNA: Safe Agents as Recursive Program Holes
On the map: LLM agents and tool use → Agent threats, guardrails and governance
Abstract (arXiv)
LLM agents increasingly act by writing code, yet a split persists between the runtime that drives the agent and the code the model writes. The runtime owns the loop, context, and control flow, and the model has little say over any of them. Letting model-written code shape the runtime itself would make agents more expressive, but it would also sharpen safety problems. A model can be diverted by a prompt injection, call the wrong tool, or fail partway and leave an inconsistent state, and each such failure reaches further when the code shapes the runtime than when it expresses a single action. We present LACUNA, a programming model for agents that closes this split while preserving safety. Each agent action is a typed call textttagent[T](task) that the LLM fills with code when execution reaches it, and the code is type-checked against the surrounding program before it runs. Because each action is accepted or rejected as a whole, a rejected one leaves the environment untouched, and its compiler diagnostics drive a retry. The same check also bounds which tools and data an action may use and how they flow. Our primitive expresses ReAct loops, sub-agents, skills, parallel decomposition, and multi-model planning as ordinary control flow. We evaluate LACUNA on a collection of test cases, BrowseComp-Plus, and τ2-bench. On BrowseComp-Plus, 8.6% of generations are rejected before execution, with 0.7 retries per query on average, and the agent reaches 27.1% accuracy. On τ2-bench, LACUNA solves 76.0% of 392 tasks across four domains with a capable model, on par with the baseline agent.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 15 of its 48 references that are in the map. First posted on arXiv 27 May 2026.
Builds on
15 of 48 references.
Closest ancestors · 4
Same direction, newest first
- 2025Systems Security Foundations for Agentic Computing1 Dec
- 2025Design Patterns for Securing LLM Agents against Prompt Injections10 Jun
- 2025MCP Safety Audit: LLMs with the Model Context Protocol Allow Major Security Exploits2 Apr
- 2025Defeating Prompt Injections by Design24 Mar
Other references · 11
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2025Qwen3 Embedding: Advancing Text Embedding and Reranking Through Foundation Modelscited by 1,175
- 2024StruQ: Defending Against Prompt Injection with Structured Queriescited by 325
- 2023Large Language Models as Tool Makerscited by 293
- 2025BrowseComp-Plus: A More Fair and Transparent Evaluation Benchmark of Deep-Research Agentcited by 183
- 2025The Attacker Moves Second: Stronger Adaptive Attacks Bypass Defenses Against Llm Jailbreaks and Prompt Injectionscited by 108
- 2024Statically Contextualizing Large Language Models with Typed Holescited by 9
- 2016Hazelnut: A Bidirectionally Typed Structure Editor Calculuscited by 8
- 2019System FR as Foundations for Stainlesscited by 3
- 2025What's in the Box: Ergonomic and Expressive Capture Tracking over Generic Data Structures (Extended Version)cited by 2
- 2026First-Class Refinement Types for Scalacited by 1
Built on by
Citing papers per year: 2026: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2026LLM-as-Code: Agentic Programming for Agent Harness
- 2026Toward Safe LLM Agents: A Survey of Specification, Verification, and Enforcement
- 2026From Agent Loops to Structured Graphs:A Scheduler-Theoretic Framework for LLM Agent Execution
- 2026Shepherd: Enabling Programmable Meta-Agents via Reversible Agentic Execution Traces
- 2026MAGS: Multi-agent Auto-formalization Guarantees Safety for Agentic Outputs
- 2026Verification as an Architectural Layer for LLM Agents: A V-Model Design, and a Pilot Study of Its Deterministic Core
- 2026Securing LLM Agents Need Intent-to-Execution Integrity
- 2026AgentS4D: Benchmarking Runtime Risks across the Execution Lifecycle of LLM-Based Workspace Agents