Docs

SDKs

The TypeScript and Python SDKs call the same endpoints with the same methods, and retry for you.

// npm install @halto/sdk   (Node.js 18+)
import { Halto } from "@halto/sdk";

const halto = new Halto({ apiKey: process.env.HALTO_API_KEY! });
  • Both SDKs retry network errors, 429 and 5xx with backoff.
  • If Halto can't be reached, they throw HaltoUnavailableError instead of returning a decision: the action doesn't run.
  • Python also has AsyncHalto, with the same methods to await.

Methods

TypeScriptPythonWhat it does
check(input)check(tool, action, params)Asks before an action. Never throws for block or pending: read decision.
protect(content, opts)protect(content, type=…)The text for your model, with personal values as placeholders.
guard(input, fn)guard(tool, action, params, fn)Runs fn only on allow, with the parameters to send, and reports how it went.
session()session()One per conversation: what the model read counts for what it does next.
getApproval(id) · waitForApproval(id)get_approval(id) · wait_for_approval(id)The state of an approval, or wait until a person decides.
report(input)report(action_id=…)How an allowed action went, and what it cost.

On this page