Skip to main content

A guardrail system for AI agent tool calls - Python SDK

Project description

veto-sdk (Python)

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

Installation

pip install veto-sdk

With provider integrations:

pip install veto-sdk[openai]      # OpenAI support
pip install veto-sdk[anthropic]   # Anthropic support
pip install veto-sdk[langchain]   # LangChain support

Quick Start

from veto_sdk import Veto, ToolCallDeniedError, ToolDefinition

# Define tools
tools = [
    ToolDefinition(
        name="read_file",
        description="Read a file",
        input_schema={
            "type": "object",
            "properties": {"path": {"type": "string"}},
            "required": ["path"]
        },
        handler=lambda args: open(args["path"]).read()
    )
]

# Initialize Veto and wrap tools
veto = await Veto.init()
definitions, implementations = veto.wrap_tools(tools)

# Use implementations - validation happens automatically
try:
    content = await implementations["read_file"]({"path": "/home/user/file.txt"})
except ToolCallDeniedError as e:
    print(f"Blocked: {e.validation_result.reason}")

Configuration

Create veto/rules/defaults.yaml:

rules:
  - id: block-system-paths
    name: Block system path access
    enabled: true
    severity: critical
    action: block
    tools:
      - read_file
    conditions:
      - field: arguments.path
        operator: starts_with
        value: /etc

API Reference

Veto.init(config_dir="./veto", mode=None)

Initialize Veto asynchronously. Loads config and rules from the specified directory.

veto.wrap_tools(tools)

Wrap tools and return (definitions, implementations).

veto.validate_tool_call(call)

Manually validate a tool call.

veto.get_mode()

Get current operating mode ("strict" or "log").

veto.get_loaded_rules()

Get all loaded rules.

License

Apache-2.0

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_sdk-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

veto_sdk-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file veto_sdk-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for veto_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56b9feddcb66e2d04c8d24c50bc8c23ed932e54475b471759c8e320042ba6ce7
MD5 199756d826e5a3eb9050ac6f9af52fc0
BLAKE2b-256 9ad50c78dec63fe5927dc6fb832a6d1a24c57c3a86bd4e7457d3efa9a2f42c1f

See more details on using hashes here.

File details

Details for the file veto_sdk-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for veto_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb7e9bfcc8d2f486cbf0a281d0831ca9e5b202f13f5acf730a62c6d333d85ffd
MD5 6081efefbeec877906a404b07198da6a
BLAKE2b-256 9fe788a865ec7f744e7bfa4d411435a77ca7e12a79e0eed07bd386817c76a161

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