Java SDK
Use the Java SDK for JVM services and enterprise backends.
Install
The Semiotic Probe preview source is published on GitHub at v0.3.0-dev.0. Java 17 tests and local Maven publication pass. The JitPack package metadata and JAR are published and downloadable.
repositories { mavenCentral(); maven { url = uri("https://jitpack.io") } }
dependencies { implementation("com.github.haltstate-ai:sdk-java:v0.3.0-dev.0") }These are explicitly selected previews, including replay-contract candidate APIs. They do not replace stable SDKs or activate replay routing. Existing integrations remain on the Standard contract. Semiotic Probes use an isolated model hook, the existing tenant API key, and the server-managed low-frequency schedule.
Guard shape
HaltStateConfig config = HaltStateConfig.builder(
System.getenv("HALTSTATE_TENANT_ID"),
System.getenv("HALTSTATE_API_KEY")
).agentId("retail-refund-agent").build();
String operatorEpoch = "11111111-2222-4333-8444-555555555555";
String destinationKey = "refund:lge_123";
String guardKey = "hsr1:" + operatorEpoch + ":" + destinationKey;
try (HaltStateClient client = new HaltStateClient(config);
GuardContext guard = client.guard("refund.create", Map.of("amount", 126, "currency", "USD"), guardKey)) {
guard.getPermit().validateForExecution();
try {
executeRefundOnce();
guard.markSucceeded();
} catch (RuntimeException actionError) {
guard.checkFailed(actionError.getMessage());
throw actionError;
}
}Persist guard.getPermit(), guard.getReportId(), and the exact outcome payload. If close cannot confirm a receipt, retry the public reportGuardOutcome call and retain its GuardReceipt; do not rerun the destination action.
Full operation identity
HaltStateConfig config = HaltStateConfig.builder(
System.getenv("HALTSTATE_TENANT_ID"),
System.getenv("HALTSTATE_API_KEY")
).agentId("retail-refund-agent").build();
String operatorEpoch = "11111111-2222-4333-8444-555555555555";
String destinationKey = "refund:" + ledgerEntryId;
String guardKey = "hsr1:" + operatorEpoch + ":" + destinationKey;
try (HaltStateClient client = new HaltStateClient(config);
GuardContext guard = client.guard(
"refund.create",
Map.of("amount", 126, "currency", "USD"),
guardKey,
"retail-refund-agent",
"refund/" + ledgerEntryId,
"low"
)) {
guard.getPermit().validateForExecution();
try {
executeRefundOnce();
guard.markSucceeded();
} catch (RuntimeException actionError) {
guard.checkFailed(actionError.getMessage());
throw actionError;
}
}Replay-safe source candidate contract
The stable retry identity binds the exact agent, action or tool, resource, normalized parameters, risk class, and immutable policy version. With an operator-issued activation epoch, the SDK may create epoch-qualified generated keys only when the caller omitted a key; explicit keys are never changed. Approval expiry blocks a stale permit, while already_started and completed remain terminal. After the side effect, receipt validation requires the durable event ID, receipt hash, received flag, and duplicate marker; retry the same report identity without rerunning the action.
This is a source candidate contract, not evidence that the candidate package is registry-published or production-deployed. Published package baselines and language-specific executable verification status are listed separately above.
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.