Skip to content

Rust Client Reference

The primary entry point for interacting with a HEBBS server.

let client = HebbsClient::builder()
.endpoint("http://localhost:6380")
.api_key("hb_your_key_here")
.tenant_id("acme-corp") // optional — normally derived from API key
.timeout(Duration::from_secs(10))
.retry_policy(RetryPolicy::exponential(3, Duration::from_millis(100)))
.build()
.await?;
MethodDescription
endpoint(impl Into<String>)Server address (required)
timeout(Duration)Default request timeout
api_key(impl Into<String>)API key for authentication
tenant_id(impl Into<String>)Explicit tenant ID for multi-tenant deployments. Normally derived from the API key by the server. Set this only when running without authentication or when you need to override the key-derived tenant.
retry_policy(RetryPolicy)Retry configuration for transient failures
keepalive_interval(Duration)HTTP/2 keepalive interval
connect_lazy(bool)Defer connection to first RPC (default: true)
user_agent(impl Into<String>)Custom User-Agent header
build()Build the client (returns Result<HebbsClient>)

client.remember(content)
.entity(entity)
.kind(MemoryKind)
.edges(vec![Edge { .. }])
.metadata("key", "value")
.send()
.await? -> Memory
client.get(memory_id).await? -> Memory

Returns HebbsError with NotFound kind if the memory does not exist.

client.recall(query)
.entity(entity)
.strategy(RecallStrategy)
.top_k(10)
.threshold(0.7)
.send()
.await? -> RecallOutput
client.prime(query)
.entity(entity)
.strategy(RecallStrategy)
.top_k(20)
.send()
.await? -> PrimeOutput
client.revise(memory_id)
.content("updated text")
.metadata("key", "new-value")
.send()
.await? -> Memory
// Forget specific memories
client.forget(entity)
.memory_ids(vec!["mem_abc", "mem_def"])
.send()
.await? -> ForgetResult
// Forget all memories for entity
client.forget(entity)
.send()
.await? -> ForgetResult

client.set_policy(entity)
.reflect_enabled(true)
.reflect_interval(Duration::from_secs(3600))
.reflect_min_memories(10)
.send()
.await?
client.reflect(entity).await? -> ReflectResult
client.insights(entity)
.top_k(10)
.send()
.await? -> Vec<Memory>

let mut subscription = client.subscribe(entity)
.strategy(RecallStrategy::Similarity)
.top_k(5)
.threshold(0.7)
.open()
.await?;
subscription.feed("new context text").await?;
while let Some(push) = subscription.next().await? {
for result in &push.memories {
println!("[{:.3}] {}", result.score, result.memory.content);
}
}

client.health().await? -> HealthStatus
client.count(entity).await? -> u64

use hebbs_client::RetryPolicy;
// Exponential backoff: 3 retries, starting at 100ms
let policy = RetryPolicy::exponential(3, Duration::from_millis(100));
// Fixed interval: 3 retries, 500ms apart
let policy = RetryPolicy::fixed(3, Duration::from_millis(500));
// No retries
let policy = RetryPolicy::none();

Retries apply only to transient errors (connection failures, timeouts, server unavailable). Non-retryable errors (not found, invalid argument) propagate immediately.


All types are in hebbs_client::types:

TypeDescription
MemoryStored memory with content, entity, kind, edges, metadata, timestamps
MemoryKindEpisodic, Semantic, Procedural, Insight
EdgeDirected relationship (target_id, edge_type, weight)
EdgeTypeRelatedTo, CausedBy, PrecededBy, InsightFrom, RevisedFrom
RecallStrategySimilarity, Temporal, Causal, Analogical
RecallOutputQuery results with ranked memories and latency
RecallResultSingle result with memory and score
PrimeOutputPrime response with count and latency
ForgetResultDeletion response with count
ReflectResultReflection response with insight count and processing stats
HealthStatusServer health, version, uptime
SubscribePushStreamed push with memories and trigger text