Rust SDK
The Rust crate is ctxmesh. It is a plane client — every launcher route reachable with typed
clients and a typed Error — over the localhost plane the
platform serves beside your agent.
It holds no credentials. Endpoints and identity arrive in the environment the launcher injects.
Install
Section titled “Install”cargo add ctxmeshcargo add selects the current pre-release while no stable exists. See
Compatibility for the version.
Constructing a client
Section titled “Constructing a client”use ctxmesh::{Client, Entry};
let cx = Client::from_env()?; // reads MEMORY_PORT, CONVERSATION_ID, DELEGATE_PORT, …from_env returns Result, so a binary run outside a pod reports why rather than panicking.
Client::with_config takes an explicit config for tests.
Memory, knowledge, skills
Section titled “Memory, knowledge, skills”cx.memory_append(&Entry { role: "user".into(), content: "what changed?".into() }, None)?;let history = cx.memory_get(None)?;let hits = cx.memory_search("deploy", None, Some(capability))?;
cx.remember("prefers terse answers", None)?; // long-termlet facts = cx.search_agent("contact preference", 5, 0.0)?;
let chunks = cx.knowledge_search("rollback procedure", Some("runbooks"), 5)?;
let skills = cx.skills()?;let body = cx.skill_load("deploy")?;Feedback and agent-to-agent
Section titled “Feedback and agent-to-agent”cx.feedback(&trace_id, "helpfulness", 1.0, Some("clear"))?;let reply = cx.call_agent("billing-agent", serde_json::json!({"q": "invoice 42"}))?;Delegation and handoff
Section titled “Delegation and handoff”let d = cx.delegate("research-agent", "step-1", "call-1", capability, serde_json::json!({"topic": "pricing"}))?;let h = cx.handoff("escalation-agent", capability, Some("over to you"), true)?;Both reach the delegate listener (DELEGATE_PORT, default 2994), not the memory port. step and
call_id are the idempotency key and are required — the crate refuses locally if either is empty.
Errors
Section titled “Errors”Error distinguishes a transport failure from Error::Invalid (a required argument missing) and
from a route the platform has not wired for this agent, so a configuration gap does not present as a
network problem.
What this tier does not include
Section titled “What this tier does not include”The managed agent loop, tool dispatch, the model-gateway client, serve, prompt spotlighting and
record/replay are authoring tier and live in the Python and
TypeScript SDKs only (ADR 0139).
You write your own loop and call the model gateway over plain HTTP at $MODEL_GATEWAY_URL.
That is not a gap so much as the tier’s premise: every capability here is a localhost HTTP endpoint, so this package is convenience, never a requirement. An agent in any language is fully governed and traced without it.
The run capability
Section titled “The run capability”delegate, handoff, per-user session memory and per-user knowledge each need the caller’s run
capability — the X-Ctxmesh-Run-Capability header. It is an explicit per-call parameter rather
than client state, because a capability is minted for one run and a field on a long-lived client
would outlive it.
Where the route requires it, the SDK refuses locally with a typed error instead of sending a request the launcher will reject. Session memory is the one that fails quietly: omit the capability there and the launcher falls back to the agent-wide bucket with no error, so the parameter is visible on every memory call for exactly that reason.
See also
Section titled “See also”- SDKs — the six packages and what each tier gives you
- Compatibility — which SDK works with which ctxmesh
- The launcher contract — the plane this wraps
- Launcher endpoints — the raw HTTP surface