Skip to main content

Installation

Setup

Authorization

veto.authorize is the primary method. It checks whether an agent is permitted to call a tool with the given parameters and returns an AuthorizationResult.
The AuthorizationResult shape:
If no policy matches the agent and tool, Veto denies by default. You must explicitly create a policy that allows an action for it to be permitted.

Agent management

Policy management

Policies contain one or more rules that determine what an agent can do. Higher priority values are evaluated first.

Rule types

createPolicy

Audit log

queryAuditLog returns a paginated list of every authorization decision Veto has made.

AuditLogFilters

The response also includes a pagination object with limit, offset, count, and total fields.

Error handling

The SDK exports three error classes:
VetoError also covers TIMEOUT (status 408) and NETWORK_ERROR (status 0) when the Veto API is unreachable.

Fail-closed behavior

By default, if the Veto API is unreachable (network error or timeout), the SDK denies the request. This ensures your agent cannot take unauthorized actions simply because authorization is unavailable. When using MCP middleware (createVetoGuard or vetoMiddleware), you can override this with the onError option:
onError: "allow" lets tool calls proceed when Veto is unreachable. This is not recommended for production — a network partition becomes a security gap.