Skip to main content

Real-time governance and human-in-the-loop approval for AI agents.

Project description

Veto SDK (veto2)

🛡️ Real-time governance and human-in-the-loop approval for AI agents.

Veto allows you to secure your AI agent's tool calls by intercepting them and verifying them against a central policy engine. It supports blocking, monitoring, data masking, and human-in-the-loop approvals.

Installation

pip install veto2

Quick Start

1. Initialize the SDK

Initialize Veto at the start of your application. You can provide credentials directly or use environment variables.

import veto2 as sdk

sdk.init(
    api_key="your_api_key_here",
    agent_name="SupportAgent-01"
)

Environment Variables:

  • GOVERNANCE_API_KEY: Your Veto API Key.
  • GOVERNANCE_AGENT_NAME: Default agent name for this instance.
  • GOVERNANCE_BASE_URL: Custom backend URL (optional).

2. Protect Your Tools

Use the @sdk.guard() decorator on any function (tool) you want to monitor or control.

@sdk.guard()
def process_payment(amount: float, currency: str):
    # This code only runs if Veto policy allows it
    print(f"Processing {amount} {currency}")
    return True

How It Works

When a @sdk.guard() protected function is called:

  1. Intercept: The SDK captures the function name and all arguments.
  2. Verify: It sends this data to the Veto backend for policy evaluation.
  3. Action: Based on the policy set in the Veto Dashboard:
    • APPROVED: The original function executes immediately.
    • BLOCKED: Raises a PermissionDeniedError with an optional feedback message.
    • PAUSE (Human-in-the-loop): The SDK pauses execution and polls the backend until a manager approves or rejects the request via the Dashboard.

Core API

sdk.init(api_key, agent_name, base_url=None)

Initializes the global governance client.

  • api_key: (Required) Found in your Veto Dashboard settings.
  • agent_name: (Optional) Descriptors for your agent. Defaults to "DefaultAgent".
  • base_url: (Optional) The API endpoint of your Veto backend.

@sdk.guard(name=None)

The primary decorator for tool protection.

  • name: (Optional) Override the tool name sent to the dashboard. Defaults to the function's name.

sdk.ping()

Utility function to verify the connection to the Veto backend and validate the API key.

Policy Modes (Configured via Dashboard)

Veto is designed to be "Code-First, Policy-Second". You wrap your functions once, and manage behavior from the UI:

Mode Behavior
BLOCK Denies the request immediately.
SHADOW Allows the request but logs it as a warning for monitoring.
HUMAN_APPROVAL Pauses execution until a person clicks "Approve" in the Dashboard.
MASKING Redacts sensitive parameters from logs while allowing the original call.
FEEDBACK Blocks the call and returns a specific hint/instruction to the LLM.
RULES Dynamically chooses a mode based on argument values (e.g., amount > 1000).

Error Handling

Veto uses specific exceptions to help you manage governance violations:

from veto2 import PermissionDeniedError

try:
    sensitive_operation()
except PermissionDeniedError as e:
    # Log the violation or inform the user/LLM
    print(f"Action blocked by governance: {e}")

Plan-Based Timeouts (Human Approval)

When an action is paused for human review, the SDK will poll for a decision:

  • Basic Plan: Polls for up to 3 hours.
  • Pro Plan: Polls for up to 7 days.

Built for secure AI agent deployment. Get your API key

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

veto2-0.1.7.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

veto2-0.1.7-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file veto2-0.1.7.tar.gz.

File metadata

  • Download URL: veto2-0.1.7.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for veto2-0.1.7.tar.gz
Algorithm Hash digest
SHA256 82f9107b43166145ca7b160e11a1be7e780e4ffdbebe26d4d20faf0ca7a445d0
MD5 21b7a7becdaab0af100709cf298d723f
BLAKE2b-256 ec41c58a66575a1385b57c1ea7d22c45769b97f5137cff2cd6f6b17ab918217b

See more details on using hashes here.

File details

Details for the file veto2-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: veto2-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for veto2-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 18a064a1cd04b17b5b9c1c26150673bb046594d6da4f3ec309a0549ef16c00e0
MD5 c5c9e941cf2937b5c7089ed2cc22a6e8
BLAKE2b-256 16da6dc9ee2e2fd7c9d8ce4fd45916256acbe2cf4085d4f40b05b2127cb93d41

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