AgentSpec: Customizable Runtime Enforcement for Safe and Reliable LLM Agents
On the map: LLM agents and tool use → Agent threats, guardrails and governance
Abstract (arXiv)
Agents built on LLMs are increasingly deployed across diverse domains, automating complex decision-making and task execution. However, their autonomy introduces safety risks, including security vulnerabilities, legal violations, and unintended harmful actions. Existing mitigation methods, such as model-based safeguards and early enforcement strategies, fall short in robustness, interpretability, and adaptability. To address these challenges, we propose AgentSpec, a lightweight domain-specific language for specifying and enforcing runtime constraints on LLM agents. With AgentSpec, users define structured rules that incorporate triggers, predicates, and enforcement mechanisms, ensuring agents operate within predefined safety boundaries. We implement AgentSpec across multiple domains, including code execution, embodied agents, and autonomous driving, demonstrating its adaptability and effectiveness. Our evaluation shows that AgentSpec successfully prevents unsafe executions in over 90% of code agent cases, eliminates all hazardous actions in embodied agent tasks, and enforces 100% compliance by autonomous vehicles (AVs). Despite its strong safety guarantees, AgentSpec remains computationally lightweight, with overheads in milliseconds. By combining interpretability, modularity, and efficiency, AgentSpec provides a practical and scalable solution for enforcing LLM agent safety across diverse applications. We also automate the generation of rules using LLMs and assess their effectiveness. Our evaluation shows that the rules generated by OpenAI o1 achieve a precision of 95.56% and recall of 70.96% for embodied agents, successfully identify 87.26% of the risky code, and prevent AVs from breaking laws in 5 out of 8 scenarios.
Key facts. Cited by 196 papers 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 35 of its 61 references that are in the map. First posted on arXiv 24 Mar 2025.
Builds on
35 of 61 references.
Closest ancestors · 6
Same direction, newest first
- 2024SafeAgentBench: A Benchmark for Safe Task Planning of Embodied LLM Agents17 Dec
- 2024EIA: Environmental Injection Attack on Generalist Web Agents for Privacy Leakage17 Sep
- 2024Breaking Agents: Compromising Autonomous LLM Agents Through Malfunction Amplification30 Jul
- 2024AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases17 Jul
- 2024Watch Out for Your Agents! Investigating Backdoor Threats to LLM-Based Agents17 Feb
- 2023Identifying the Risks of LM Agents with an LM-Emulated Sandbox25 Sep
Other references · 29
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,064
- 2023Generative Agents: Interactive Simulacra of Human Behaviorcited by 3,500
- 2023A Survey on Large Language Model based Autonomous Agentscited by 2,203
- 2023Voyager: An Open-Ended Embodied Agent with Large Language Modelscited by 2,081
- 2023CAMEL: Communicative Agents for "Mind" Exploration of Large Language Model Societycited by 1,348
- 2024Large Language Model based Multi-Agents: A Survey of Progress and Challengescited by 752
- 2022A Survey on In-context Learningcited by 717
- 2024GPT-4V(ision) is a Generalist Web Agent, if Groundedcited by 547
- 2024Executable Code Actions Elicit Better LLM Agentscited by 537
- 2023A Language Agent for Autonomous Drivingcited by 161
- 2024AI Agents Under Threat: A Survey of Key Security Challenges and Future Pathwayscited by 122
17 more
- 2024LLM Multi-Agent Systems: Challenges and Open Problemscited by 119
- 2024Defending Large Language Models Against Jailbreak Attacks via Layer-specific Editingcited by 77
- 2024EHRAgent: Code Empowers Large Language Models for Few-shot Complex Tabular Reasoning on Electronic Health Recordscited by 75
- 2024Safeguarding Large Language Models: A Surveycited by 73
- 2024Understanding the Weakness of Large Language Model Agents within a Complex Android Environmentcited by 60
- 2023From Prompt Injections to SQL Injection Attacks: How Protected is Your LLM-Integrated Web Application?cited by 53
- 2024ALI-Agent: Assessing LLMs' Alignment with Human Values via Agent-based Evaluationcited by 46
- 2024LLMArena: Assessing Capabilities of Large Language Models in Dynamic Multi-Agent Environmentscited by 35
- 2024CROW: Eliminating Backdoors from Large Language Models via Internal Consistency Regularizationcited by 29
- 2022LawBreaker: An Approach for Specifying Traffic Laws and Fuzzing Autonomous Vehiclescited by 15
- 2024LLMScan: Causal Scan for LLM Misbehavior Detectioncited by 13
- 2024Efficient Detection of Toxic Prompts in Large Language Modelscited by 11
- 2018A Survey of Challenges for Runtime Verification from Advanced Application Domains (Beyond Software)cited by 9
- 2025FixDrive: Automatically Repairing Autonomous Vehicle Driving Behaviour for 0.08 per Violationcited by 3
- 2024μDrive: User-Controlled Autonomous Drivingcited by 2
- 2018Detecting Standard Violation Errors in Smart Contractscited by 1
- 2023Runtime Verification for Trustworthy Computingcited by 1
Built on by
Citing papers per year: 2025: 20; 2026: 176.
196 papers.
Sort:
By area:
- 2025A Survey of LLM-Driven AI Agent Communication: Protocols, Security Risks, and Defense Countermeasurescited by 54
- 2026Natural-Language Agent Harnessescited by 54
- 2026Towards Verifiably Safe Tool Use for LLM Agentscited by 34
- 2025MCIP: Protecting MCP Safety via Model Contextual Integrity Protocolcited by 33
- 2025AGENTSAFE: Benchmarking the Safety of Embodied Agents on Hazardous Instructionscited by 33
- 2025Enforcing Temporal Constraints for LLM Agentscited by 31
- 2026Formal Policy Enforcement for Real-World Agentic Systemscited by 31
- 2026ATBench: A Diverse and Realistic Agent Trajectory Benchmark for Safety Evaluation and Diagnosiscited by 30
- 2026From Agent Traces to Trust: A Survey of Evidence Tracing and Execution Provenance in LLM Agentscited by 29
- 2025Security Concerns for Large Language Models: A Surveycited by 26
- 2025Building a Foundational Guardrail for General Agentic Systems via Synthetic Datacited by 26
- 2025Agentic AI Security: Threats, Defenses, Evaluation, and Open Challengescited by 26
38 more
- 2025ProbGuard: Proactive Runtime Monitoring for LLM Agent Safety via Probabilistic Predictioncited by 25
- 2026ClawGuard: A Runtime Security Framework for Tool-Augmented LLM Agents Against Indirect Prompt Injectioncited by 25
- 2026A Survey on Long-Term Memory Security in LLM Agents: Attacks, Defenses, and Governance Across the Memory Lifecyclecited by 21
- 2025A Survey on Agentic Security: Applications, Threats and Defensescited by 17
- 2026Runtime Governance for AI Agents: Policies on Pathscited by 17
- 2026A Framework for Formalizing LLM Agent Securitycited by 16
- 2026Auditable Agentscited by 14
- 2026SafeHarness: Lifecycle-Integrated Security Architecture for LLM-based Agent Deploymentcited by 14
- 2026When Safe Skills Collide: Measuring Compositional Risk in Agent Skill Ecosystemscited by 14
- 2026ARGUS: Defending LLM Agents Against Context-Aware Prompt Injectioncited by 13
- 2025RoboSafe: Safeguarding Embodied Agents via Executable Safety Logiccited by 11
- 2026Wink: Recovering from Misbehaviors in Coding Agentscited by 11
- 2026The Evolution of Tool Use in LLM Agents: From Single-Tool Call to Multi-Tool Orchestrationcited by 11
- 2025Secure and Efficient Access Control for Computer-Use Agents via Context Spacecited by 10
- 2025AGENTSAFE: A Unified Framework for Ethical Assurance and Governance in Agentic AIcited by 9
- 2026AgenTRIM: Tool Risk Mitigation for Agentic AIcited by 9
- 2026ACRFence: Preventing Semantic Rollback Attacks in Agent Checkpoint-Restorecited by 9
- 2026Auditing Automated Evaluation, Error Propagation, and Runtime Mitigation in Tool-Using Language Agentscited by 9
- 2026AIRGuard: Guarding Agent Actions with Runtime Authority Controlcited by 9
- 2025Maris: A Formally Verifiable Privacy Policy Enforcement Paradigm for Multi-Agent Collaboration Systemscited by 8
- 2026Defense Against Indirect Prompt Injection via Tool Result Parsingcited by 8
- 2026AIR: Improving Agent Safety through Incident Responsecited by 8
- 2026Reframing LLM Agent Security as an Agent-Human Interaction Problemcited by 8
- 2026Agent libOS: A Runtime Substrate for Capability-Controlled Self-Evolving LLM Agentscited by 8
- 2026SEAGym: An Evaluation Environment for Self-Evolving LLM Agentscited by 8
- 2026VIGIL: Runtime Enforcement of Behavioral Specifications in AI Agent Skillscited by 8
- 2026Reason Less, Verify More: Deterministic Gates Recover a Silent Policy-Violation Failure Mode in Tool-Using LLM Agentscited by 8
- 2025When Developer Aid Becomes Security Debt: A Systematic Analysis of Insecure Behaviors in LLM Coding Agentscited by 7
- 2025Agentic Services Computingcited by 6
- 2025PARSE: LLM Driven Schema Optimization for Reliable Entity Extractioncited by 6
- 2026Lookahead-then-Verify: Reliable Constrained Decoding for Diffusion LLMs under Context-Free Grammarscited by 6
- 2026Cloak and Detonate: Scanner Evasion and Dynamic Detection of Agent Skill Malwarecited by 6
- 2026AgentRewind: Recoverable Execution for Long-Horizon LLM Agentscited by 6
- 2026StepShield: When, Not Whether to Intervene on Rogue Agentscited by 5
- 2026SMCP: Secure Model Context Protocolcited by 5
- 2026SafeClaw-R: Towards Safe and Secure Multi-Agent Personal Assistantscited by 5
- 2026Sovereign Agentic Loops: Decoupling AI Reasoning from Execution in Real-World Systemscited by 5
- 2026Semia: Auditing Agent Skills via Constraint-Guided Representation Synthesiscited by 5
50 most cited of 196 All 196 (JSON)
- 2026NOMOS: Compiling Written Policies into Statically Verified Tool-Call Gates for LLM Agents8 Oct 2026
- 2026Representation Transitions Reveal Emerging Safety Risks in Multi-Turn LLM Agents30 Sep 2026
- 2026ActionGuard: Tool Call Authorization under Poisoned Skills30 Sep 2026
- 2026HARDE: Optimizing Agent Harnesses for Runtime Risk Detection and Execution Control29 Sep 2026
- 2026The Compiler May Read It, the Agent May Not: Keeping Part of a Research Code Away from a Coding Agent28 Sep 2026
- 2026From Migration to Calibration: Preserving Agent Capabilities across Models, Jurisdictions, and Scale28 Sep 2026
- 2026When Valid Tool Calls Change Meaning: Formation-Consistent Dispatch for LLM Agents28 Sep 2026
- 2026Evaluating System One Models for Agent Security Decisions: Reliability, Calibration, and Selective Automation27 Sep 2026
- 2026Authorization Closure Graph: Minimal Repair for LLM Agents with Evolving User Instructions26 Sep 2026
- 2026Agents as Software: A Programming Languages Agenda for Agent Reliability26 Sep 2026
- 2026AI Harness: Certification under Proposal-Conditioned Information for Foundation-Model Agents26 Sep 2026
- 2026Beyond Approved Actions: Runtime Validation of Persistent Outcomes in Agent Workflows25 Sep 2026
38 more
- 2026Subjects, Not Authors: The Authorship Hazard in Agentic Dataspaces24 Sep 2026
- 2026Who Holds the Pen? Let Specifications, Not Agents, Sign Off24 Sep 2026
- 2026Where Does Exactly-Once Live? Model, Harness, and Tool-Contract Effects on Duplicate Side Effects in LLM Agents24 Sep 2026
- 2026FIRE: Failure-Informed Runtime Engineering for Reliable Language-Model Agents22 Sep 2026
- 2026How Strongly Should Task State Influence an LLM Agent?22 Sep 2026
- 2026Epi-Logic: A Conceptual Framework for Epistemic Runtime Control, Schema Validity Checking, and Controlled Accommodation in Autonomous AI Agents21 Sep 2026
- 2026LeaseGuard: Incumbent-Preserving Admission Control for Privileged LLM Agents21 Sep 2026
- 2026When the Agent Becomes the Kernel: A Systematization of Security on the Path to AI-Native Operating Systems20 Sep 2026
- 2026A Governance-Aware Large Language Model Orchestrated Agentic Digital Twin for Transmission System Operator Control Room Decision Support18 Sep 2026
- 2026Compositional Policy Violations: When Step-Level Compliance Fails In Agentic AI Workflows16 Sep 2026
- 2026Symbolic Temporal Supervision of LLM Agents Using Contracts16 Sep 2026
- 2026Large Language Models in the Loop: A Stability- and Network-Aware Survey in Networked Control, Cyber-Physical, and Multi-Agent Systems15 Sep 2026
- 2026Do Not Restart: Residual Completion for Stateful Agent Handoffs12 Sep 2026
- 2026Agent-Integrated Software: Interaction Contracts and Continuous Assurance10 Sep 2026
- 2026Can AI Agents Deliver Verifiable Network-Wide Outcomes Across Authority Boundaries?9 Sep 2026
- 2026SiLR: Structure-Preserving Admission and Process Reward for LLM Tool Agents4 Sep 2026
- 2026KC-Bench: A Dynamic Interactive Benchmark for Evaluating Knowledge Conflicts in LLM Agents3 Sep 2026
- 2026Where Reliability Lives: Experimental Localisation of Behavioural Properties in an Agent System2 Sep 2026
- 2026Agents in the Large: Perception-Centered Architecture for Persistent Agents31 Aug 2026
- 2026EvoUndo: Recoverability-Constrained Self-Evolution for LLM Agent Harnesses28 Aug 2026
- 2026Persona-Execution Separation: An Architecture Pattern for Evolving LLM Agents under Execution Audit27 Aug 2026
- 2026Safe Skill Retirement for Physical Agents25 Aug 2026
- 2026EviDx: Evidence-Aware Active Diagnosis with Scaffolded LLM Agents25 Aug 2026
- 2026What Guides the Agent? Adjudicating Unauthorized Behavior via Localizing Behavior-Guiding Instructions25 Aug 2026
- 2026Toward Effective and Reliable LLM Agents via Dynamic Ontology24 Aug 2026
- 2026STAGE: Stateful Translation to Agentic Graph Execution with Policy-Scoped Context and Deterministic Control23 Aug 2026
- 2026When May an Agent Stop? Evidence-Carrying Termination for Tool-Using LLMs22 Aug 2026
- 2026Natural-Language Workflows Are Not Software Yet: Artifact-Driven Compilation for Reliable Agent Execution21 Aug 2026
- 2026TraceGrant: A Contract-Governed Security Framework for the Task-Effect Lifecycle of Networked LLM Agents21 Aug 2026
- 2026ClawSentry: A Progressive Multi-Tier Security Monitor for Safeguarding Autonomous LLM Agents21 Aug 2026
- 2026Don't Solve, Just Compare: Tiny Advisors for Runtime Intervention in LLM Agents21 Aug 2026
- 2026Testing and Evaluation of Agentic AI Systems In Military Command and Control20 Aug 2026
- 2026PolicyGuide: From Guarding One Action to Guiding the Whole Workflow for Policy-Compliant LLM Agents20 Aug 2026
- 2026Outcome Monitors: Recovery Affordances for Silent Tool Failures19 Aug 2026
- 2026Beyond Suspicious Steps: Ontological Trust in Long-Horizon Agents18 Aug 2026
- 2026ETHOS: Towards a Modular Ethics Framework for Clinical Multi-Agent Systems15 Aug 2026
- 2026OpenAgentFlow: Enabling System-Wide Safety Boundaries for Heterogeneous AI Agent Fleets14 Aug 2026
- 2026AgentRewind: Recoverable Execution for Long-Horizon LLM Agents14 Aug 2026
50 newest of 196 All 196 (JSON)
- 2025A Survey of LLM-Driven AI Agent Communication: Protocols, Security Risks, and Defense Countermeasurescited by 54
- 2026Towards Verifiably Safe Tool Use for LLM Agentscited by 34
- 2025Enforcing Temporal Constraints for LLM Agentscited by 31
- 2026Formal Policy Enforcement for Real-World Agentic Systemscited by 31
- 2026ATBench: A Diverse and Realistic Agent Trajectory Benchmark for Safety Evaluation and Diagnosiscited by 30
- 2026From Agent Traces to Trust: A Survey of Evidence Tracing and Execution Provenance in LLM Agentscited by 29
- 2025Building a Foundational Guardrail for General Agentic Systems via Synthetic Datacited by 26
- 2025Agentic AI Security: Threats, Defenses, Evaluation, and Open Challengescited by 26
- 2025ProbGuard: Proactive Runtime Monitoring for LLM Agent Safety via Probabilistic Predictioncited by 25
- 2026ClawGuard: A Runtime Security Framework for Tool-Augmented LLM Agents Against Indirect Prompt Injectioncited by 25
- 2026A Survey on Long-Term Memory Security in LLM Agents: Attacks, Defenses, and Governance Across the Memory Lifecyclecited by 21
- 2025A Survey on Agentic Security: Applications, Threats and Defensescited by 17
12 most cited of 147 All 147 (JSON)
- 2026Representation Transitions Reveal Emerging Safety Risks in Multi-Turn LLM Agents30 Sep 2026
- 2026ActionGuard: Tool Call Authorization under Poisoned Skills30 Sep 2026
- 2026HARDE: Optimizing Agent Harnesses for Runtime Risk Detection and Execution Control29 Sep 2026
- 2026When Valid Tool Calls Change Meaning: Formation-Consistent Dispatch for LLM Agents28 Sep 2026
- 2026Evaluating System One Models for Agent Security Decisions: Reliability, Calibration, and Selective Automation27 Sep 2026
- 2026Authorization Closure Graph: Minimal Repair for LLM Agents with Evolving User Instructions26 Sep 2026
- 2026AI Harness: Certification under Proposal-Conditioned Information for Foundation-Model Agents26 Sep 2026
- 2026Beyond Approved Actions: Runtime Validation of Persistent Outcomes in Agent Workflows25 Sep 2026
- 2026Subjects, Not Authors: The Authorship Hazard in Agentic Dataspaces24 Sep 2026
- 2026Who Holds the Pen? Let Specifications, Not Agents, Sign Off24 Sep 2026
- 2026Where Does Exactly-Once Live? Model, Harness, and Tool-Contract Effects on Duplicate Side Effects in LLM Agents24 Sep 2026
- 2026FIRE: Failure-Informed Runtime Engineering for Reliable Language-Model Agents22 Sep 2026
12 newest of 147 All 147 (JSON)
- 2026Reason Less, Verify More: Deterministic Gates Recover a Silent Policy-Violation Failure Mode in Tool-Using LLM Agentscited by 8
- 2026Sovereign Agentic Loops: Decoupling AI Reasoning from Execution in Real-World Systemscited by 5
- 2026FAVA: Formal Authorization for Verified Agents with Evidence-Backed Permission Graphscited by 2
- 2026Agent System Operations: Categorization, Challenges, and Future Directionscited by 0
- 2026FAVA: Formal Authorization for Verified Agents with Evidence-Backed Permission Graphs29 Jul 2026
- 2026Reason Less, Verify More: Deterministic Gates Recover a Silent Policy-Violation Failure Mode in Tool-Using LLM Agents8 Jul 2026
- 2026Agent System Operations: Categorization, Challenges, and Future Directions1 Jun 2026
- 2026Sovereign Agentic Loops: Decoupling AI Reasoning from Execution in Real-World Systems24 Apr 2026
- 2026StepShield: When, Not Whether to Intervene on Rogue Agentscited by 5
- 2026Don't Make Models Guess Security and Safety: Symbolic Guardrails for Domain-Specific AI Agentscited by 1
- 2026Beyond Pattern Matching: Seven Cross-Domain Techniques for Prompt Injection Detectioncited by 0
- 2026Grammar-Constrained Decoding Can Jailbreak LLMs into Generating Malicious Codecited by 0
- 2026Grammar-Constrained Decoding Can Jailbreak LLMs into Generating Malicious Code10 Jun 2026
- 2026Beyond Pattern Matching: Seven Cross-Domain Techniques for Prompt Injection Detection20 Apr 2026
- 2026Don't Make Models Guess Security and Safety: Symbolic Guardrails for Domain-Specific AI Agents16 Apr 2026
- 2026StepShield: When, Not Whether to Intervene on Rogue Agents29 Jan 2026
- 2026Efficient Remote KV Cache Reuse with GPU-native Video Codec10 Feb 2026
- 2026Natural-Language Agent Harnessescited by 54
- 2025MCIP: Protecting MCP Safety via Model Contextual Integrity Protocolcited by 33
- 2025Security Concerns for Large Language Models: A Surveycited by 26
- 2026Lookahead-then-Verify: Reliable Constrained Decoding for Diffusion LLMs under Context-Free Grammarscited by 6
- 2026An AI Agent Execution Environment to Safeguard User Datacited by 3
- 2026Intent-Governed Tool Authorization for AI Agentscited by 3
- 2026LLM-enabled Applications Require System-Level Threat Monitoringcited by 2
- 2026Vertex-Softmax: Tight Transformer Verification via Exact Softmax Optimizationcited by 2
- 2026LabGuard: Grounding Natural-Language Laboratory Rules into Runtime Guards for Embodied Laboratory Agentscited by 2
- 2026Outcome Monitors: Recovery Affordances for Silent Tool Failurescited by 2
- 2026PolicyGuide: From Guarding One Action to Guiding the Whole Workflow for Policy-Compliant LLM Agentscited by 2
- 2026When May an Agent Stop? Evidence-Carrying Termination for Tool-Using LLMscited by 2
12 most cited of 36 All 36 (JSON)
- 2026NOMOS: Compiling Written Policies into Statically Verified Tool-Call Gates for LLM Agents8 Oct 2026
- 2026The Compiler May Read It, the Agent May Not: Keeping Part of a Research Code Away from a Coding Agent28 Sep 2026
- 2026From Migration to Calibration: Preserving Agent Capabilities across Models, Jurisdictions, and Scale28 Sep 2026
- 2026Agents as Software: A Programming Languages Agenda for Agent Reliability26 Sep 2026
- 2026Epi-Logic: A Conceptual Framework for Epistemic Runtime Control, Schema Validity Checking, and Controlled Accommodation in Autonomous AI Agents21 Sep 2026
- 2026Do Not Restart: Residual Completion for Stateful Agent Handoffs12 Sep 2026
- 2026Agent-Integrated Software: Interaction Contracts and Continuous Assurance10 Sep 2026
- 2026Can AI Agents Deliver Verifiable Network-Wide Outcomes Across Authority Boundaries?9 Sep 2026
- 2026Safe Skill Retirement for Physical Agents25 Aug 2026
- 2026When May an Agent Stop? Evidence-Carrying Termination for Tool-Using LLMs22 Aug 2026
- 2026PolicyGuide: From Guarding One Action to Guiding the Whole Workflow for Policy-Compliant LLM Agents20 Aug 2026
- 2026Outcome Monitors: Recovery Affordances for Silent Tool Failures19 Aug 2026
12 newest of 36 All 36 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2026Toward Safe LLM Agents: A Survey of Specification, Verification, and Enforcement
- 2026SafeAgent: A Runtime Protection Architecture for Agentic Systems
- 2025VeriGuard: Enhancing LLM Agent Safety via Verified Code Generation
- 2026AgentWall: A Runtime Safety Layer for Local AI Agents
- 2026Agentao: A Policy-Governed Runtime Harness for Embeddable Tool-Using LLM Agents
- 2026Agent Safety Should Be a Runtime Contract
- 2026AgentFlow: A Flow-Centric Policy Language and Framework for Securing LLM Agent Systems
- 2026From Natural Language Policies to Executable Obligations: A Verification Harness for Dependable In-Car LLM Agents