Skip to main content

A guardrail system that intercepts and validates AI agent tool calls

Project description

Veto

A guardrail system for AI agent tool calls. Veto intercepts and validates tool calls made by AI models before execution.

How It Works

  1. Initialize Veto.
  2. Wrap your tools using veto.wrap().
  3. Pass the wrapped tools to your AI agent/model.

When the AI model calls a tool, Veto automatically:

  1. Intercepts the call.
  2. Validates arguments against your rules (via YAML & LLM).
  3. Blocks or Allows execution based on the result.

The AI model remains unaware of the guardrail - the tool interface is preserved.

Installation

pip install veto

For a complete bank transfer escalation example, see the HITL guide.

For LLM provider support:

pip install veto[openai]      # OpenAI support
pip install veto[anthropic]   # Anthropic support
pip install veto[gemini]      # Google Gemini support
pip install veto[all]         # All providers

Quick Start

1. Initialize Veto

Run the CLI to create configuration:

veto init

This creates a veto/ directory with veto.config.yaml and default rules.

2. Wrap Your Tools

from veto import Veto

# 1. Define your tools normally
my_tools = [
    {"name": "my_tool", "handler": my_handler, ...},
    # ...
]

# 2. Initialize Veto
veto = await Veto.init()

# 3. Wrap tools (Validation logic is injected)
wrapped_tools = veto.wrap(my_tools)

# 4. Pass to your Agent/LLM
agent = create_agent(
    tools=wrapped_tools,
    # ...
)

3. Configure Rules

Edit veto/rules/financial.yaml (example):

rules:
  - id: limit-transfers
    name: Limit large transfers
    action: block
    tools:
      - transfer_funds
    conditions:
      - field: arguments.amount
        operator: greater_than
        value: 1000

Configuration

veto.config.yaml

version: "1.0"

# Operating mode
mode: "strict" # "strict" blocks calls, "log" only logs them

# Validation Backend
validation:
  mode: "custom" # "api" or "custom"

# Custom Provider (if mode is custom)
custom:
  provider: "gemini" # or openai, anthropic
  model: "gemini-3-flash-preview"

# Logging
logging:
  level: "info"

# Rules
rules:
  directory: "./rules"
  recursive: true

API Reference

Veto.init(options?)

Initialize Veto. Loads configuration from ./veto by default.

veto = await Veto.init()

veto.wrap(tools)

Wraps an array of tools. The returned tools have Veto validation injected into their execution handler.

wrapped_tools = veto.wrap(my_tools)

veto.wrap_tool(tool)

Wraps a single tool instance.

safe_tool = veto.wrap_tool(my_tool)

veto.get_history_stats()

Returns statistics about allowed vs blocked calls.

stats = veto.get_history_stats()
print(stats)
# {"total_calls": 5, "allowed_calls": 4, "denied_calls": 1, ...}

veto.clear_history()

Resets the history statistics.

veto.clear_history()

veto.export_decisions(format)

Exports decision history as JSON or CSV.

json_audit = veto.export_decisions("json")
csv_audit = veto.export_decisions("csv")

CLI Commands

Command Description
veto init Initialize Veto in current directory
veto version Show version

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

veto-0.9.0.tar.gz (100.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

veto-0.9.0-py3-none-any.whl (81.3 kB view details)

Uploaded Python 3

File details

Details for the file veto-0.9.0.tar.gz.

File metadata

  • Download URL: veto-0.9.0.tar.gz
  • Upload date:
  • Size: 100.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for veto-0.9.0.tar.gz
Algorithm Hash digest
SHA256 06efa0ab2d2080b274ff88def7f79966fab062fb0b93ea42ffab8953626df549
MD5 e54e1d3958f2603849f71077a678377f
BLAKE2b-256 e3ecd04e518cefb2dc6dbc6ea2033551572a9441517eb21ab3e88c3b9a075f17

See more details on using hashes here.

File details

Details for the file veto-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: veto-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 81.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for veto-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 882a496c8e475d02d6ca916354dd6a03a79cf765b27aee28e5fe88ded39d6942
MD5 7ef7b21681a1c75a92e73ce2b08841b7
BLAKE2b-256 0f90138a9967a4913198726ddb7505dae3c19ed03d0affffd7d1c275eaa1ae09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page