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.
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. Higherpriority values are evaluated first.
Rule types
createPolicy
Audit log
queryAuditLog returns a paginated list of every authorization decision Veto has made.
AuditLogFilters
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: