VetoClient is the main entry point for the Veto SDK. Use it to check authorization, manage agents and policies, and query the audit log.
Constructor
Options
Your Veto API key. Get one from the Veto dashboard.
Pass it via an environment variable — do not hardcode it in source.
The base URL of the Veto API. Override this when running a local Veto instance.
Request timeout in milliseconds. If a request takes longer than this, it throws a
VetoError with code "TIMEOUT".Authorization
authorize
Check whether an agent is allowed to call a tool with the given parameters. This is the primary method — call it before every tool execution.
AuthorizationResult has these fields:
| Field | Type | Description |
|---|---|---|
allowed | boolean | true if the action is permitted |
outcome | "allowed" | "denied" | "escalated" | The authorization decision |
matchedPolicyId | string | null | ID of the policy that produced the decision, or null for default deny |
reason | string | Human-readable explanation of the decision |
evaluatedAt | string | ISO timestamp of when the decision was made |
authorize() does not throw when a tool is denied. It returns { allowed: false, ... }. Errors are only thrown for network failures, timeouts, and authentication problems. See Error Handling for details.Agents
Agents represent AI systems registered with Veto. Each agent has a unique ID used in authorization checks.createAgent
A human-readable name for the agent.
An optional description of what this agent does.
listAgents
getAgent
deleteAgent
Policies
Policies define what an agent is allowed to do. Each policy contains one or more rules.createPolicy
The ID of the agent this policy applies to.
A human-readable name for the policy.
Policies with higher priority are evaluated first. Useful when you have multiple policies for the same agent.
Set to
false to disable the policy without deleting it.listPolicies
agentId to filter to a specific agent.
getPolicy
updatePolicy
Updated policy name.
Replaces the entire rules array.
Updated priority.
Enable or disable the policy.
deletePolicy
Audit logs
Every authorization decision is recorded. UsequeryAuditLog to retrieve them.
queryAuditLog
Filter to a specific agent.
Filter by action string.
Filter by tool name.
Filter by authorization outcome.
ISO 8601 timestamp — return entries at or after this time.
ISO 8601 timestamp — return entries at or before this time.
Maximum number of entries to return (max 1000).
Number of entries to skip, for pagination.