Rust SDK Quick Start
This guide walks you through adding the HEBBS client to a Rust project, connecting to a server, and performing basic memory operations.
Add the Dependency
Section titled “Add the Dependency”Add hebbs-client to your Cargo.toml:
[dependencies]hebbs-client = "0.1"tokio = { version = "1", features = ["full"] }anyhow = "1"Connect to HEBBS
Section titled “Connect to HEBBS”use hebbs_client::HebbsClient;
#[tokio::main]async fn main() -> anyhow::Result<()> { let client = HebbsClient::builder() .address("http://localhost:50051") .connect() .await?;
let health = client.health().await?; println!("Server: {} ({})", health.version, health.status);
Ok(())}Store Memories
Section titled “Store Memories”use hebbs_client::{HebbsClient, MemoryKind};
let m1 = client .remember("Expanding to European market next quarter") .entity("acme-corp") .kind(MemoryKind::Episodic) .send() .await?;
let m2 = client .remember("GDPR compliance is the top priority for expansion") .entity("acme-corp") .kind(MemoryKind::Semantic) .metadata("source", "discovery-call") .send() .await?;
println!("Stored {} and {}", m1.id, m2.id);Recall Memories
Section titled “Recall Memories”use hebbs_client::RecallStrategy;
let results = client .recall("What are the expansion plans?") .entity("acme-corp") .strategy(RecallStrategy::Similarity) .top_k(5) .send() .await?;
for result in &results.memories { println!( "[{:.3}] {} ({})", result.score, result.memory.content, result.memory.kind, );}
println!("Query took {:.1}ms", results.latency_ms);Revise and Forget
Section titled “Revise and Forget”// Revise a memorylet revised = client .revise(&m1.id) .content("Expanding to European market in Q2 2026") .send() .await?;println!("Revised to version {}", revised.revision);
// Forget all memories for an entity (GDPR erasure)let result = client .forget("acme-corp") .send() .await?;println!("Deleted {} memories", result.deleted_count);Error Handling
Section titled “Error Handling”use hebbs_client::error::{HebbsError, HebbsErrorKind};
match client.get("nonexistent-id").await { Ok(memory) => println!("Found: {}", memory.content), Err(HebbsError { kind: HebbsErrorKind::NotFound, .. }) => { println!("Memory not found"); } Err(e) => return Err(e.into()),}Next Steps
Section titled “Next Steps”- Client Reference — full API documentation
- FFI (C/C++) — use HEBBS from C/C++
- Cookbooks — production-ready examples