Skip to content
/docs

Validation Modes

How the current TypeScript SDK validates tool calls.

The current TypeScript SDK has two explicit validation paths.

Cloud guard path

Veto.init(), protect(), veto.wrap(), veto.wrapMCPTools(), and the Vercel AI middleware call Veto Cloud before executable tools run.

import { protect } from "veto-sdk";

const safeTools = await protect(tools);

Set the API key with VETO_API_KEY or pass it directly:

import { Veto } from "veto-sdk";

const veto = await Veto.init({
  apiKey: process.env.VETO_API_KEY,
  baseUrl: process.env.VETO_API_URL,
});

The guard response can return:

DecisionRuntime behavior
allowTool call proceeds
denyWrapped execution throws ToolCallDeniedError
require_approvalWrapped execution blocks by default, or waits when approvalMode: "wait" is set

Local rules utility path

The package also exports deterministic rule utilities from veto-sdk/rules. These are explicit helpers for tests, simulations, and custom runtimes; they are not automatically wired into protect().

import { evaluateRulesLocally } from "veto-sdk/rules";

const result = evaluateRulesLocally(
  rules,
  "transfer_funds",
  { amount: 5000, currency: "USD" },
);

if (result.decision === "deny") {
  throw new Error(result.reason ?? "Denied by local rule");
}

The local evaluator supports the operators implemented in the SDK rules module, including equality, membership, containment, and feed-backed condition values.

What is not automatic

The current SDK does not auto-detect local, cloud, api, custom, or kernel modes from a config file. It also does not auto-apply policy packs from protect() options. Configure policies in Veto Cloud or use the local rules utilities intentionally in your own runtime.

Charter behavior

Charter always keeps policy-changing results behind a verification link. Chat answers can return directly, but compiled policies and lifecycle actions are not live until reviewed and approved.