Skip to content

IBM/tool_guard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

📦 AI Agents Policy Adherence

This tool analyzes policy documents and generates deterministic Python code to enforce operational policies when invoking AI agent tools.

🚀 Features

The workflow consists of two main steps:

build-time step 1:

Takes a policy document in Markdown format and an OpenAPI specification describing the available tools. For each tool, it generates a JSON file containing associated policies and examples of both compliance and violations. These files can be reviewed and edited manually before proceeding to Step 2. The OpenAPI document should describe agent tools and optionally include read-only tools that might be used to enforce policies. It’s important that each tool has:

  • A proper operation_id matching the tool name
  • A detailed description of the tool and its functionality
  • Clearly defined input parameters and return types
  • Well-documented data models

build-time step 2:

Uses the output from Step 1 and the OpenAPI spec to generate Python code that enforces each tool’s policies.


🐍 Requirements

  • Python 3.12+
  • pip

🛠 Installation

  1. Clone the repository:

    git clone https://github.com/IBM/tool_guard.git
    cd tool_guard
  2. (Optional) Create and activate a virtual environment:

    python3.12 -m venv venv
    source venv/bin/activate  # On Windows use: venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Create a .env file:

    Copy the .env.example to .env and fill in your environment variables. Replace required keys with your actual API keys.

▶️ Usage

Run main() in tests/run_tau2_airline.py for generating tool guards for the tau-bench airline domain.

Citation

@article{zwerdling2025towards,
  title={Towards Enforcing Company Policy Adherence in Agentic Workflows},
  author={Zwerdling, Naama and Boaz, David and Rabinovich, Ella and Uziel, Guy and Amid, David and Anaby-Tavor, Ateret},
  journal={arXiv preprint arXiv:2507.16459},
  year={2025}
}

About

code for reproducing a conference paper

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •