Rust SDK
Use the Rust SDK for safety-critical workers and high-throughput services.
Install
Install the Semiotic Probe preview directly from GitHub using this Cargo dependency:
haltstate = { git = "https://github.com/haltstate-ai/sdk-rust", tag = "v0.2.0-dev.0" }
All 22 SDK tests passed; a separate consumer fetched this tag and compiled the public probe API. No crates.io account is required.
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
use haltstate::{Client, Config, GuardOutcome};
use serde_json::json;
let client = Client::new(Config {
tenant_id: Some(std::env::var("HALTSTATE_TENANT_ID")?),
api_key: Some(std::env::var("HALTSTATE_API_KEY")?),
..Default::default()
})?;
let operator_epoch = "11111111-2222-4333-8444-555555555555";
let destination_key = "refund:lge_123";
let guard_key = format!("hsr1:{operator_epoch}:{destination_key}");
let report_id = "40000000-0000-4000-8000-000000000501";
let permit = client
.guard(
"refund.create",
json!({"amount": 126, "currency": "USD"}),
Some(guard_key.as_str()),
Some("retail-refund-agent"),
)
.await?;
permit.ensure_current()?;
match execute_refund_once(destination_key).await {
Ok(result) => {
client.report_guard_outcome(
&permit, report_id, GuardOutcome::Success, Some(result), None,
).await?;
}
Err(action_error) => {
let message = action_error.to_string();
client.report_guard_outcome(
&permit, report_id, GuardOutcome::Error, None, Some(message.as_str()),
).await?;
return Err(action_error.into());
}
}Persist the permit, report ID, outcome, and exact payload before retrying report_guard_outcome. Never rerun the destination action merely to obtain a receipt.
Full operation identity
use haltstate::{Client, Config, GuardOutcome};
use serde_json::json;
let client = Client::new(Config {
tenant_id: Some(std::env::var("HALTSTATE_TENANT_ID")?),
api_key: Some(std::env::var("HALTSTATE_API_KEY")?),
..Default::default()
})?;
let operator_epoch = "11111111-2222-4333-8444-555555555555";
let destination_key = format!("refund:{}", ledger_entry_id);
let guard_key = format!("hsr1:{operator_epoch}:{destination_key}");
let report_id = "40000000-0000-4000-8000-000000000501";
let permit = client
.guard_with_context(
"refund.create",
json!({"amount": 126, "currency": "USD"}),
Some(guard_key.as_str()),
Some("retail-refund-agent"),
Some("refund/ledger-entry"),
Some("low"),
)
.await?;
permit.ensure_current()?;
match execute_refund_once(destination_key.as_str()).await {
Ok(result) => {
client.report_guard_outcome(
&permit, report_id, GuardOutcome::Success, Some(result), None,
).await?;
}
Err(action_error) => {
let message = action_error.to_string();
client.report_guard_outcome(
&permit, report_id, GuardOutcome::Error, None, Some(message.as_str()),
).await?;
return Err(action_error.into());
}
}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.