Set it up
The first three steps guard your first tool. The rest can wait.
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 runPrefer Docker? Run make docker-build, then make docker-run.
Add it to your agent
The Python package is small and separate from the server.
Terminal pip install veto-guardGuard 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 modelWhat 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.
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 serverA rule can use call, history, attempts, run and now (in UTC). Restart the server to load a change.
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.jsonlKeep 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/vetoGuard 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" } } } }