loams-rust-sdk
Skill1 starsChanged 39 days agoApache-2.0View on GitHub
Integrate the loams Rust crate into a service: connect, namespaces, collections, documents, hybrid search, SQL, graph, streams, consistency tokens, idempotency, errors, and retries. Use when writing or reviewing the Rust data path.
- Reads credentials
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- company/AGENTS.mdAGENTS.md
- agent-platformSkill
- app-migrationSkill
- byog-deploySkill
- conformance-testingSkill
- cutover-operationsSkill
- data-migrationSkill
- decision-recordsSkill
- identity-authzSkill
- loams-adoptionSkill
- loams-fitSkill
- observability-meteringSkill
- rust-workspaceSkill
- sdk-portabilitySkill
- stack-inventorySkill
- target-architectureSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 69
Treat "already exists" as success.
- Very specific: line 88
Use builders (Schema, Filter, Search, Sort, TextRetriever, VectorOptions, Fusion) instead of constructing proto JSON by hand.
- Distinctive: line 98
Use the SDK's retry policy.
- Distinctive: line 111
Never put credentials in a URL or query string.
- Distinctive: line 112
Never log documents, tokens, or embeddings at info level.
- Distinctive: line 113
Do not use SQL string interpolation.
- Distinctive: line 114
Do not assume a collection exists.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Loams Rust SDK
The loams crate is the public client. Do not call the engine's internal APIs or
hand-write Connect/HTTP requests.
When to use
- A Rust service needs to read or write Loams.
- A review finds a custom HTTP client, a retry loop, or a hand-built filter.
- An upgrade changes the SDK surface.
Inputs
LOAMS_ENDPOINT,LOAMS_API_KEYorLOAMS_TOKEN,LOAMS_NAMESPACE.- Rust SDK README, runtime contract, design 44.
Dependency
# Local `loams dev` serves http://, so TLS is not needed.
loams = { version = "0.1", default-features = false }
# Production/agents over https, with machine-key assertions:
# loams = { version = "0.1", features = ["tls", "machine-key"] }The crate is 0.x. Pin the minor and read the release notes before upgrading.
Connect
let loams = loams::Loams::from_env()?.session_consistency(true);
let opts = loams::CallOptionsOverrides::new;from_env reads LOAMS_ENDPOINT, LOAMS_API_KEY/LOAMS_TOKEN, and
LOAMS_NAMESPACE. session_consistency(true) makes a read see this process's
own writes; a cross-process read needs the consistency token.
Create idempotently
use loams::collection_v1::{CreateCollectionRequest, CreateNamespaceRequest};
use loams::builders::Schema;
let ns = loams.namespace().unwrap_or("company").to_owned();
ignore_already_exists(loams.namespaces().create(
CreateNamespaceRequest { namespace: ns, ..Default::default() }, opts()).await)?;
let schema = Schema::new().text("title").text("body").keyword("tags")
.vector("embedding", 768);
ignore_already_exists(loams.collections().create(
CreateCollectionRequest { name: "notes".into(), schema: schema.to_struct()?.into(), ..Default::default() },
opts()).await)?;Treat "already exists" as success. Do not delete and recreate in a request path.
Read and write
let notes = loams.collection("notes", None);
notes.upsert(&[loams::Document::new(1u64)
.source(serde_json::json!({"title": "Refund policy", "tags": "policy"}))], opts()).await?;
let hits = notes.search(
notes.query()
.text(loams::builders::TextRetriever::fields("refund", ["body"]))
.vector("embedding", &embedding, loams::builders::VectorOptions::k(10))
.fuse(loams::builders::Fusion::rrf(Some(60)))
.filter(loams::builders::Filter::eq("tags", "policy"))
.limit(10)
).await?;Use builders (Schema, Filter, Search, Sort, TextRetriever,
VectorOptions, Fusion) instead of constructing proto JSON by hand.
Errors and retries
- Match
LoamsError/ErrorKind; mapNotFound,AlreadyExists,InvalidArgument,PermissionDenied,Unauthenticated,Unavailable,DeadlineExceeded,ResourceExhaustedto your API. - Reads and idempotent RPCs may retry; mutations retry only with an idempotency key. The SDK mints a UUIDv7 when the request has a key field.
- Use the SDK's retry policy. Do not wrap calls in your own unbounded loop.
- Pass deadlines per call via
CallOptionsOverrides; do not rely on a global timeout alone.
Consistency
- A write returns a consistency token.
- Pass the token to a read that must see the write across processes.
- Parse, merge, and print tokens with the SDK's
ConsistencyToken; never build the string by hand.
Guardrails
- Never put credentials in a URL or query string.
- Never log documents, tokens, or embeddings at info level.
- Do not use SQL string interpolation; use parameters.
- Do not assume a collection exists; create it idempotently at startup.
References
- Rust SDK
- Runtime contract
- Design 44
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

