Go SDK
Use the Go SDK for low-latency backend services that need explicit guard checks.
Install
go get github.com/haltstate-ai/sdk-go@v1.0.1First-party Go SDK
Status: Preview
Module: github.com/haltstate-ai/sdk-go
Build verification: passed
Automated test files: currently absent.
Guard shape
client, err := haltstate.NewClient(haltstate.Config{
TenantID: os.Getenv("HALTSTATE_TENANT_ID"),
APIKey: os.Getenv("HALTSTATE_API_KEY"),
})
permit, err := client.Guard(ctx, "refund.create", haltstate.GuardOptions{
Params: map[string]any{"amount": 126, "currency": "USD"},
IdempotencyKey: "refund:lge_123",
})
// Execute only when the guard response is allowed or later approved.HTTP guard fallback
req := GuardRequest{
AgentID: "retail-refund-agent",
Action: "refund.create",
IdempotencyKey: fmt.Sprintf("refund:%s", ledgerEntryID),
Context: map[string]any{"amount": 126, "currency": "USD"},
}
// Prefer the SDK. Raw HTTP fallbacks should POST to /api/haltstate/sentinel/action/guard before calling the commerce system.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.