TypeScript SDK
Use TypeScript for Node services, web backends, internal tools, and direct HTTP integration with the guard API.
Reference install
npm install @haltstate/sdkDirect HTTP guard call
const response = await fetch(`${baseUrl}/api/sentinel/action/guard`, {
method: "POST",
headers: {
"content-type": "application/json",
authorization: `Bearer ${apiKey}`,
},
body: JSON.stringify({
tenant_id: tenantId,
agent_id: "retail-refund-agent",
action: "refund.create",
idempotency_key: "refund:lge_123",
context: { amount: 126, currency: "USD" },
}),
});
const decision = await response.json();Browser boundary
Do not place privileged HaltState keys in public frontend code. Browser dashboards should call your backend, and your backend should call HaltState with server-side credentials.
Implementation notes
Keep the HaltState call as close as possible to the side effect. The agent may plan and draft freely, but the wrapper around the actual action should be the place where authority is checked. That wrapper should send only the context required for policy evaluation: safe identifiers, normalized amounts, action names, risk flags, schedule windows, and redaction status. Raw customer payloads and secrets should stay in the business system or protected operator tooling.
Operational evidence
For each action, preserve the decision, the worker outcome, the idempotency key, safe resource references, latency, proof status, and redaction status. This evidence supports incident response and control narratives because it shows what the system did at runtime rather than only describing what the policy document intended. HaltState supports alignment work; it is not a substitute for legal advice or a compliance certification.