Veto
Set it up
Menu

Set it up

The first three steps guard your first tool. The rest can wait.

  1. Run the server

    You need Git, Python 3.12 and uv. This starts Veto on your machine with the six starter rules.

    Terminal
    git clone https://github.com/ritvikreddygangula/Veto.git
    cd Veto
    make install
    make run
    

    Prefer Docker? Run make docker-build, then make docker-run.

  2. Add it to your agent

    The Python package is small and separate from the server.

    Terminal
    pip install veto-guard
    
  3. Guard a tool

    Put one line above the function. Veto checks each call before the function runs, and records how it went.

    Python
    from veto_guard import Veto, VetoBlocked, ApprovalRequired
    
    veto = Veto("http://127.0.0.1:8080", agent_id="support-bot")
    run = veto.start_run()
    
    @run.guard
    def issue_refund(order_id: str, amount: float) -> dict:
    return {"refunded": amount}
    
    try:
    issue_refund("A-1001", 900.0)
    except (VetoBlocked, ApprovalRequired) as reason:
    print(reason)  # hand this back to the model
    
    What it prints
    blocked by Veto: issue_refund called without a successful lookup_order for the same order_id in this run. [refund-requires-order-lookup]; Refund amount is missing or above the 500.0 cap. [refund-amount-cap]; Refund above 100.0 requires approval. [refund-large-needs-approval] (call call_01M91G5W9X7R0Q5FP25SQPP1Y8)
    

    The call id at the end is different every time. Start one run per conversation or task. Rules that look back only see calls from the same run.

  4. Write a rule

    Add a file to the policies folder. The violation line is a CEL expression: when it is true, the call is stopped.

    policies/mine.yaml
    version: 1
    policies:
    - id: no-weekend-deletes
    tools: [delete_record]
    effect: require_approval   # or block
    violation: now.getDayOfWeek() == 0 || now.getDayOfWeek() == 6
    message: Deleting on a weekend needs a person.
    
    Terminal
    make validate   # catches typos before you start the server
    

    A rule can use call, history, attempts, run and now (in UTC). Restart the server to load a change.

  5. Test your rules

    Write down calls and the answer each one should get, one per line. Veto replays them and shows every wrong answer.

    mine.jsonl
    {"run_id":"t1","step":1,"tool":"issue_refund","args":{"amount":20},"expect":"block"}
    
    Terminal
    uv run veto test --traces mine.jsonl
    
  6. Keep runs in Postgres

    By default a restart forgets every run. With Postgres they stay, and several servers can share them. The first command needs Docker running.

    Terminal
    make db-up
    uv run veto serve --store postgres \
    --database-url postgresql://veto:veto@127.0.0.1:5432/veto
    
  7. Guard MCP tools

    The demo server guards three tools. Add it to your MCP client with your own path, and ask for a refund without a lookup.

    MCP client config
    {
    "mcpServers": {
    "veto-shop": {
    "command": "/path/to/Veto/.venv/bin/python",
    "args": ["/path/to/Veto/mcp_demo/server.py"],
    "env": { "VETO_URL": "http://127.0.0.1:8080" }
    }
    }
    }
    

Latin for “I forbid”. A Roman tribune could use it to stop an official’s act.

Try the demo
pip install veto-guard