Towards Enforcing Company Policy Adherence in Agentic Workflows

Naama Zwerdling, David Boaz, Ella Rabinovich, Guy Uziel, David Amid, Ateret Anaby-Tavor

TL;DR

This paper introduces a deterministic framework to ensure LLM agents strictly adhere to company policies by automatically compiling natural language policy documents into executable code-based guardrails ("ToolGuards"). By shifting policy enforcement from unreliable runtime prompting to a structured, test-driven buildtime compilation phase, the framework prevents prohibited actions before they occur, boosting agent success rates on complex business workflows by over 20 percentage points.

What Problem Does This Paper Address?

While Large Language Model (LLM) agents excel at flexible problem-solving and tool use, deploying them in enterprise environments remains risky. Companies govern their workflows with strict, complex policies (e.g., "Only cancel a flight for free within 24 hours of booking").

Currently, developers rely on a "best-effort" approach: stuffing these policy documents directly into the agent's prompt and hoping it complies. This methodology is inherently non-deterministic, prone to hallucinations, and vulnerable to adversarial exploitation. Alternative "post-hoc" guardrails check for violations after an action is taken, which is often too late when dealing with state-mutating operations like processing refunds or booking flights. This paper addresses the need for a proactive, transparent, and deterministic mechanism to enforce compliance before an agent executes an action.

Methods

The authors propose an end-to-end pipeline divided into two main phases: an offline buildtime phase and an online runtime integration phase.

Figure 1: During the offline buildtime step (left), policy documents, along with system schema and tools specification are compiled into compact, easily interpretable mapping of concrete policies onto tools (editable json in this case); which in turn is used to generate ToolGuards – code that verifies that policies hold given a system snapshot. ToolGuards are integrated into agentic runtime at the tool invocation point (right). We mark two possible points of domain-expert intervention: reviewing textual Tool-Policy mapper outcome, and the generated ToolGuards code.

1. Offline Buildtime Phase

  • Tool-Policy Mapper: A multi-step reasoning pipeline implemented via LangGraph parses free-form natural language policy documents. It maps specific policy statements to their corresponding tools (defined by OpenAPI specs), breaks complex rules into atomic units, and generates synthetic examples of policy compliance and violation.
  • ToolGuard Generator: This component automatically writes the validation code. In a novel application of automated Test-Driven Development (TDD), the framework translates the compliance/violation examples into unit tests. An LLM then iteratively generates and refactors Python code ("ToolGuards") within a "red-green-refactor" loop, utilizing syntactic feedback (via Microsoft's pyright type checker) and semantic test execution feedback until all tests pass.

2. Online Runtime Phase

During execution, the generated ToolGuards are seamlessly injected right before an agent invokes a tool within a standard ReAct workflow. The guard evaluates the tool arguments, conversation history, and data state. If a policy violation is detected, the tool execution is blocked, and the agent receives a detailed explanation of the violation, prompting it to self-reflect and revise its plan.

Datasets

The framework was evaluated using the $\tau$-bench (Tau-bench) Airlines domain, a challenging benchmark for tool-agent-user interactions. The dataset includes 14 tools and complex, multi-turn customer service scenarios governed by explicit airline policies. The authors specifically focused their evaluation on a subset of 22 tasks where the user's request explicitly triggers a policy violation condition.

Key Insights and Ideas

  • Automated TDD for Code Generation: Instead of asking an LLM to write complex validation code in a single shot, using automated test-driven development creates a self-repairing loop. Generating tests first and using execution feedback significantly improves code reliability.
  • Prompting is Insufficient for Safety: Simply appending policy documents to runtime prompts or asking the model to "reflect" on policies yields negligible improvements. Hard code-based boundaries are necessary for enterprise-grade compliance.
  • Mitigating Recency Bias: When parsing long, noisy policy documents, LLM mappers suffer from recency bias. The authors discovered that placing the most relevant policy content at the end of the context window yields better extraction results when handling noisy or irrelevant text.

Key Results

The authors evaluated both the individual components and the end-to-end agentic workflow:

  • Code Generation Quality: GPT-4.1 achieved a mean Test Pass Rate (TPR) of 82% when generating ToolGuards from ground-truth policy mappings, outperforming Claude-Sonnet-3.5 (80%) and GPT-4o (31%). When using fully automated policy mappings, the pipeline still achieved a solid TPR of 75%.
  • Workflow Performance: Integrating the fully automated ToolGuard pipeline into the $\tau$-bench Airlines benchmark dramatically improved performance. It raised the $pass^{\wedge}1$ rate (the probability of a successful task completion on the first try) from 0.450 to 0.685, and the $pass^{\wedge}10$ rate from 0.227 to 0.500, marking a steady improvement of over 20 percentage points against the baseline.
Figure 2: τ-bench Airlines benchmark evaluation. De- ploying ToolGuards results in steady improvement of over 20 percent points compared to the original run.

Limitations and Future Work

The authors note two primary limitations:

  1. Pre-tool Activation Scope: The framework only catches proactive violations (i.e., when an agent tries to do something forbidden). It cannot detect passive violations where an agent fails to take an action required by policy (e.g., forgetting to offer compensation when a flight is canceled by the airline).
  2. Evaluation Scale: The pipeline was validated on a single benchmark ($\tau$-bench Airlines) with relatively concise policy documents and a limited toolset. Future work will focus on scaling the approach to larger, multi-domain enterprise policy repositories and broader toolkits.

Summary updated

Abstract

Large Language Model (LLM) agents hold promise for a flexible and scalable alternative to traditional business process automation, but struggle to reliably follow complex company policies. In this study we introduce a deterministic, transparent, and modular framework for enforcing business policy adherence in agentic workflows. Our method operates in two phases: (1) an offline buildtime stage that compiles policy documents into verifiable guard code associated with tool use, and (2) a runtime integration where these guards ensure compliance before each agent action. We demonstrate our approach on the challenging $τ$-bench Airlines domain, showing encouraging preliminary results in policy enforcement, and further outline key challenges for real-world deployments.
BibTeX
@inproceedings{zwerdling2025towards,
  author = {Naama Zwerdling and David Boaz and Ella Rabinovich and Guy Uziel and David Amid and Ateret Anaby-Tavor},
  title = {{Towards Enforcing Company Policy Adherence in Agentic Workflows}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2025},
}
Figure