Rust SDK
ArfClient.
The full surface, in Rust.
The arf-sdk crate provides an async Rust client for the ARF proxy HTTP API. It covers governance queries, provenance reading, session management, and agent dispatch.
# Cargo.toml
[dependencies]
arf-sdk = "0.1"
tokio = { version = "1", features = ["full"] }
Connecting
use arf_sdk::ArfClient;
let client = ArfClient::connect("http://localhost:4554").await?;
// or from environment:
let client = ArfClient::from_env().await?; // reads ARF_PROXY_ADDR
Governance Status
let status = client.governance().status().await?;
println!("Profile: {}, active rules: {}", status.profile, status.rules.len());
// Check whether an action would be allowed before submitting
let check = client.governance().check_action(&GovernanceCheck {
tool: "Write".into(),
path: Some("src/auth/session.ts".into()),
..Default::default()
}).await?;
match check.outcome {
Outcome::Allow => println!("Auto-approved"),
Outcome::Approve => println!("Needs human approval"),
Outcome::Deny => println!("Denied: {}", check.message.unwrap()),
}
Reading Provenance
use arf_sdk::{ProvenanceFilter};
// Fetch all governance events from a session
let events = client
.provenance()
.session("01HX4Q…AB12")
.filter(ProvenanceFilter::Governance)
.fetch()
.await?;
for event in &events {
println!("{}: {} → {}", event.timestamp, event.event_type, event.ulid);
}
// Verify chain integrity
let result = client.provenance().verify_session("01HX4Q…AB12").await?;
assert!(result.is_valid, "Chain invalid: {}", result.error.unwrap_or_default());
Launching an Agent Session
use arf_sdk::{RunnerKind, SubmitOptions};
let session = client.submit()
.runner(RunnerKind::Claude)
.prompt("Implement rate limiting for the auth endpoints")
.profile("standard")
.worktree(true)
.dispatch()
.await?;
println!("Session: {} ({})", session.call_sign, session.session_id);
// Stream output
let mut stream = session.output_stream().await?;
while let Some(chunk) = stream.next().await {
print!("{}", chunk?);
}
Key Methods
Governance
governance().status()
governance().check_action(&check)
governance().rules()
governance().circuit_breakers()
governance().reset_breaker(name)
governance().health_grade(session_id)
Provenance
provenance().fetch(session_id)
provenance().verify_session(id)
provenance().export_bundle(id, path)
provenance().session_list()
provenance().event(ulid)
Sessions & Agents
submit().runner(kind).prompt(s).dispatch()
sessions().list()
sessions().kill(session_id)
sessions().resume(session_id)
steer().pause(session_id)
steer().redirect(session_id, prompt)
Tasks & Knowledge
tasks().list(status?, owner?)
tasks().checkout_next()
tasks().checkin(id, outcome)
knowledge().query(q, min_dikw?)
knowledge().add(content, scope)
knowledge().attest(fact_id, evidence)