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 — blocking, allowing, or routing to human approval.
How it works
- Initialize Veto (loads your YAML rules).
- Wrap your tools with
veto.wrap(). - Pass the wrapped tools to your agent — interface unchanged.
When the AI calls a tool, Veto automatically:
- Intercepts the call.
- Validates arguments against your rules (deterministic conditions first, optional LLM for semantic rules).
- allow → executes · block → denied with reason · ask → approval queue.
The agent is unaware of the guardrail.
Installation
pip install veto
With LLM provider support:
pip install veto[openai] # OpenAI
pip install veto[anthropic] # Anthropic
pip install veto[gemini] # Google Gemini
pip install veto[all] # All providers
For a complete human-in-the-loop example, see the HITL guide.
Quick start
1. Initialize Veto
veto init
Creates ./veto/veto.config.yaml and default rules.
2. Wrap your tools
from veto import Veto
my_tools = [
{"name": "my_tool", "handler": my_handler},
]
veto = await Veto.init()
wrapped_tools = veto.wrap(my_tools)
agent = create_agent(tools=wrapped_tools)
3. Configure rules
Edit veto/rules/financial.yaml:
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"
mode: "strict" # "strict" blocks calls, "log" only logs them
validation:
mode: "custom" # "api" or "custom"
custom:
provider: "gemini" # openai | anthropic | gemini
model: "gemini-3-flash-preview"
logging:
level: "info"
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)
Wrap a list of tools. Injects Veto validation into each tool's execution handler.
wrapped_tools = veto.wrap(my_tools)
veto.wrap_tool(tool)
Wrap a single tool.
safe_tool = veto.wrap_tool(my_tool)
veto.get_history_stats()
Statistics on allowed vs blocked calls.
stats = veto.get_history_stats()
# {"total_calls": 5, "allowed_calls": 4, "denied_calls": 1, ...}
veto.clear_history()
Reset history statistics.
veto.export_decisions(format)
Export decision history as JSON or CSV.
json_audit = veto.export_decisions("json")
csv_audit = veto.export_decisions("csv")
Rule YAML format
Same schema as the TypeScript SDK. See full rule reference.
rules:
- id: unique-rule-id
name: Human readable name
action: block # block | warn | log | allow | ask
tools: [make_payment]
conditions:
- field: arguments.amount
operator: greater_than
value: 1000
description: "Semantic description for LLM validation (optional)."
License
Apache-2.0 © Plaw, Inc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file veto-0.12.1.tar.gz.
File metadata
- Download URL: veto-0.12.1.tar.gz
- Upload date:
- Size: 113.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc52ef6d9332a657f6a570be88cc73e7723cfaf7c98a2fa375ab75025e55f9da
|
|
| MD5 |
38dc2ee50802a00781be6e18800eba5e
|
|
| BLAKE2b-256 |
ace9fc3bdd4f70c0ea3245ef457bec7ce71eff9c07b8e8e5e38e8efe23c3f11a
|
File details
Details for the file veto-0.12.1-py3-none-any.whl.
File metadata
- Download URL: veto-0.12.1-py3-none-any.whl
- Upload date:
- Size: 91.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4acbf83a58b070fd30778ce4b4ebfa49b37f885620b0365b5915324d4158b7d4
|
|
| MD5 |
2dde2338bfb61758997cf511f818982b
|
|
| BLAKE2b-256 |
6459540c21c5282ed4dfc50778570ebc43258b17fc1eb4096d892e0b864f9411
|