Enforcing Temporal Constraints for LLM Agents

Adharsh Kamath, Sishen Zhang, Calvin Xu, Shubham Ugare, Gagandeep Singh, Sasa Misailovic · DOI

Abstract

As Large Language Model (LLM) agents transition from simple conversationalists to autonomous systems capable of executing complex tool-based tasks, ensuring safety and policy adherence has become a critical challenge. This paper introduces Agent-C, a novel runtime monitoring framework that utilizes formal temporal logic and Satisfiability Modulo Theories (SMT) solvers to guarantee that agents follow strict, multi-step safety policies. By integrating these formal checks directly into the token generation process, Agent-C achieves 100% safety compliance on complex benchmarks while simultaneously improving overall task success rates by preventing agents from entering invalid states.

Introduction

Existing safety mechanisms for LLM agents typically rely on instruction-based prompting or post-hoc monitoring. Prompting is often brittle and susceptible to jailbreaks, while post-hoc monitoring—checking an action after it has been generated—is frequently too late to prevent harm. Furthermore, these systems struggle with temporal constraints, which govern the required sequence of actions (e.g., an agent must authenticate a user before processing a refund).

Comparison between a generic agent and the Agent-C framework, illustrating how constrained generation prevents unsafe tool calls.

Agent-C addresses these gaps by treating agent safety as a formal verification problem. It monitors the entire execution trace to ensure that every proposed action is logically sound according to a predefined safety specification.

Methods

The Agent-C architecture is built upon three primary pillars designed to bridge the gap between natural language reasoning and formal verification:

  1. Temporal Domain-Specific Language (DSL): Developers define safety policies using predicates such as Before, After, Seq, Exists, and Forall. This allows for precise requirements, such as ensuring a specific data retrieval tool is called and returns a valid result before a modification tool is accessed.
  2. SMT-Backed Verification: Specifications are translated into First-Order Logic (FOL). At runtime, the framework maintains an execution trace. Before any tool call is finalized, Agent-C uses the Z3 SMT solver to verify if the proposed action violates the safety formula.
  3. Constrained Generation and Backtracking:
    • Open-weight models: Agent-C intercepts token generation. If a forbidden tool call is detected mid-generation, the system backtracks to a previous state and forces the model to sample a compliant alternative.
  4. Closed models: For models without token-level access, Agent-C employs a reprompting strategy, rejecting unsafe calls and providing feedback to the model to attempt a different path.

To handle complex environmental states (e.g., verifying order ownership), the system utilizes "state projection functions"—small code snippets that allow the safety checker to query the underlying database directly, rather than relying on the LLM's potentially hallucinated context.

Evaluation and Results

The framework was evaluated using τ-bench, a tool-calling benchmark covering Retail and Airline domains, alongside a newly developed Adversarial τ-bench containing 34 scenarios where a user explicitly attempts to trick the agent into policy violations.

Safety and Utility

Agent-C established a new state-of-the-art for reliable agentic reasoning. Across all tested models—including Qwen3, Claude 4.5, and GPT-5—Agent-C achieved 100% conformance and 0% harm, even under adversarial pressure.

Counter-intuitively, strict safety constraints significantly improved utility. By preventing the LLM from taking "illegal" shortcuts that lead to dead ends or errors, Agent-C keeps the agent on a valid path toward task completion. For example, Qwen3-32B’s utility in the Retail benchmark rose from 25.5% to 53.3% when protected by Agent-C.

Efficiency

While formal checking introduces overhead, the impact is manageable. For a 32B parameter model, Agent-C added approximately 17-44% to the total runtime, a trade-off considered acceptable for safety-critical applications where the cost of failure is high.

Conclusion

Agent-C demonstrates that formal methods can be effectively integrated into LLM agent workflows to provide mathematical guarantees of safety. Future work includes automating the creation of state projection functions and exploring the integration of these temporal constraints directly into the model fine-tuning phase to reduce runtime overhead. By shifting from probabilistic "guardrails" to deterministic formal verification, Agent-C provides a robust path forward for the deployment of autonomous agents in sensitive environments.

Summary updated

BibTeX
@inproceedings{kamath2026enforcing,
  author = {Adharsh Kamath and Sishen Zhang and Calvin Xu and Shubham Ugare and Gagandeep Singh and Sasa Misailovic},
  title = {{Enforcing Temporal Constraints for LLM Agents}},
  booktitle = {VerifAI-2 @ ICLR},
  year = {2026},
  url = {https://openreview.net/forum?id=VeRehDnGJJ},
}
Figure