Rust Client Reference
HebbsClient
Section titled “HebbsClient”The primary entry point for interacting with a HEBBS server.
Builder
Section titled “Builder”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?;| Method | Description |
|---|---|
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>) |
Core Operations
Section titled “Core Operations”remember
Section titled “remember”client.remember(content) .entity(entity) .kind(MemoryKind) .edges(vec![Edge { .. }]) .metadata("key", "value") .send() .await? -> Memoryclient.get(memory_id).await? -> MemoryReturns HebbsError with NotFound kind if the memory does not exist.
recall
Section titled “recall”client.recall(query) .entity(entity) .strategy(RecallStrategy) .top_k(10) .threshold(0.7) .send() .await? -> RecallOutputclient.prime(query) .entity(entity) .strategy(RecallStrategy) .top_k(20) .send() .await? -> PrimeOutputrevise
Section titled “revise”client.revise(memory_id) .content("updated text") .metadata("key", "new-value") .send() .await? -> Memoryforget
Section titled “forget”// Forget specific memoriesclient.forget(entity) .memory_ids(vec!["mem_abc", "mem_def"]) .send() .await? -> ForgetResult
// Forget all memories for entityclient.forget(entity) .send() .await? -> ForgetResultPolicy and Reflection
Section titled “Policy and Reflection”set_policy
Section titled “set_policy”client.set_policy(entity) .reflect_enabled(true) .reflect_interval(Duration::from_secs(3600)) .reflect_min_memories(10) .send() .await?reflect
Section titled “reflect”client.reflect(entity).await? -> ReflectResultinsights
Section titled “insights”client.insights(entity) .top_k(10) .send() .await? -> Vec<Memory>Streaming
Section titled “Streaming”subscribe
Section titled “subscribe”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); }}Health
Section titled “Health”health
Section titled “health”client.health().await? -> HealthStatusclient.count(entity).await? -> u64Retry Policies
Section titled “Retry Policies”use hebbs_client::RetryPolicy;
// Exponential backoff: 3 retries, starting at 100mslet policy = RetryPolicy::exponential(3, Duration::from_millis(100));
// Fixed interval: 3 retries, 500ms apartlet policy = RetryPolicy::fixed(3, Duration::from_millis(500));
// No retrieslet policy = RetryPolicy::none();Retries apply only to transient errors (connection failures, timeouts, server unavailable). Non-retryable errors (not found, invalid argument) propagate immediately.
Domain Types
Section titled “Domain Types”All types are in hebbs_client::types:
| Type | Description |
|---|---|
Memory | Stored memory with content, entity, kind, edges, metadata, timestamps |
MemoryKind | Episodic, Semantic, Procedural, Insight |
Edge | Directed relationship (target_id, edge_type, weight) |
EdgeType | RelatedTo, CausedBy, PrecededBy, InsightFrom, RevisedFrom |
RecallStrategy | Similarity, Temporal, Causal, Analogical |
RecallOutput | Query results with ranked memories and latency |
RecallResult | Single result with memory and score |
PrimeOutput | Prime response with count and latency |
ForgetResult | Deletion response with count |
ReflectResult | Reflection response with insight count and processing stats |
HealthStatus | Server health, version, uptime |
SubscribePush | Streamed push with memories and trigger text |