# Rust

Use asynchronous Rust clients and the daemon’s explicit capability-authenticated HTTP contract.

Source: https://docs.minds.sh/docs/developers/rust



The Rust crate is `akasha-sdk`. The checked-in version is 0.1.0, with HTTP enabled by default and an optional `router-grpc` feature. Operations use Tokio and return typed `SdkError` results.

## Add the dependency [#add-the-dependency]

```toml
[dependencies]
akasha-sdk = { path = "../minds-rust-sdk" }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
reqwest = { version = "0.11", features = ["json"] }
serde_json = "1"
```

Adjust the local path to your checkout, or use the version available in your approved registry. The additional `reqwest` and `serde_json` dependencies support the explicit request below.

## Read memory with an instance capability [#read-memory-with-an-instance-capability]

```rust
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let base = std::env::var("MINDS_INSTANCE_URL")?;
    let capability = std::env::var("MINDS_CAPABILITY")?;
    let output: Value = reqwest::Client::new()
        .post(format!("{}/v1/mcp/tools/call", base.trim_end_matches('/')))
        .header("x-akasha-capability", capability)
        .timeout(std::time::Duration::from_secs(30))
        .json(&json!({
            "name": "recall",
            "arguments": {"query": "launch review", "limit": 5}
        }))
        .send().await?
        .error_for_status()?
        .json().await?;
    if output.get("is_error").and_then(Value::as_bool) == Some(true) {
        return Err("recall tool failed".into());
    }
    let count = output["result"]["memories"].as_array().map_or(0, Vec::len);
    println!("matches: {count}");
    Ok(())
}
```

This uses the HTTP contract directly because the SDK transport's `token` field sends Bearer authentication; it has no public capability-header configuration in this snapshot.

## SDK structure [#sdk-structure]

`clients::AkashaClient::new(base_url, token, namespace)` constructs clients for core, graph, analytics, ML, memory, continual learning, SNN, neurosymbolic operations, associative memory, cognitive state, and the cognitive cycle. `connect::client_from_uri()` resolves a URI before constructing the same client.

`control_plane::ControlPlaneClient` manages platform records on a separate origin. `router_client` is feature-gated behind `router-grpc`; enable it only when your deployment provides the router and its connection policy.

`Namespace` fields produce scoping headers. They do not grant access to another tenant independently of the credential.

## Error handling and compatibility [#error-handling-and-compatibility]

`SdkError` distinguishes HTTP transport, serialization, configuration, API, and transport errors. Some HTTP methods retry connection-related failures internally; do not add unbounded outer retries to mutations.

`memory.search(query, limit)` and `memory.retrieval_hybrid(text, limit)` use request shapes that match the inspected daemon search handlers, but require a compatible authentication transport. `episodic_store(raw_from, tags)` differs from the current daemon's event wrapper. See [Compatibility](/docs/developers/compatibility).

The [complete Rust reference](/docs/developers/reference/rust) includes exported structs, enums, methods, modules, and feature-gated declarations with source locations.
