Skip to content

AgentSpec: A Customizable Runtime Constraint Mechanism for LLM Agent Safety and ReliabilityAgentSpec: Customizable Runtime Enforcement for Safe and Reliable LLM Agents

arXiv· arXiv:2503.18666· ICSE 2026· Haoyu Wang, Christopher M. Poskitt, Jun Sun·Indexed by this site · 23 days ago· Originally publishedDefenses
AI summary

The researchers propose AgentSpec, a lightweight domain-specific language for specifying and enforcing runtime safety constraints for LLM agents, in which users define structured rules through triggers, predicates, and execution mechanisms, letting agents operate within preset safety boundaries. The method was validated in three scenarios: code execution, embodied agents, and autonomous driving: it successfully prevented unsafe execution in over 90% of code agent cases, eliminated all dangerous actions in embodied agent tasks, and made autonomous vehicles 100% compliant, with millisecond-level computational overhead. The authors also used LLMs to automatically generate rules and evaluated the results, among which rules generated by OpenAI o1 achieved 95.56% precision and 70.96% recall on embodied agents, identified 87.26% of risky code, and prevented vehicle violations in 5 of 8 autonomous driving scenarios.

Read originalICSE 2026