Rust — Connect to Server
The embedded MicroResolve instance runs entirely in-process. For teams that want a shared training pipeline — auto-learn, Studio UI, review queue — you can point the engine at a self-hosted server using connected mode.
What connected mode does
In connected mode the local engine:
- Still classifies locally (zero added latency on the hot path)
- Pulls approved training updates from the server on a background thread at a configurable interval
- Buffers low-confidence queries and flushes them to the server’s ingest endpoint on each sync tick
- Pushes corrections to the server immediately when
correct()is called
Training happens in the server (Studio UI, auto-learn pipeline, review queue). All connected clients receive the update on the next sync tick. No manual sync call is required — the background thread handles it.
Configure
use microresolve::{MicroResolve, MicroResolveConfig, ServerConfig};
let engine = MicroResolve::new(MicroResolveConfig { data_dir: Some("~/.local/share/microresolve".into()), default_threshold: 0.3, server: Some(ServerConfig { url: "http://localhost:3001".into(), api_key: std::env::var("MICRORESOLVE_API_KEY").ok(), subscribe: vec!["support".into(), "security".into()], ..Default::default() }), ..Default::default()})?;
// Namespaces listed in `subscribe` are pulled from the server on startup// and kept in sync by the background thread. Use them like any other namespace:let ns = engine.namespace("support");let matches = ns.resolve("cancel my order");The subscribe list tells the engine which namespaces to pull. On startup, each is fetched from GET /api/sync. The background poll runs every sync_interval_secs (default: 60).
Corrections are pushed immediately
// This call is forwarded to POST /api/correct on the server in addition to// updating the local engine. No extra step required.ns.correct("stop shipment", Some("cancel_order"), "track_order")?;Calling the server directly over HTTP
For operations not covered by the embedded API (reviewing the queue, triggering auto-learn), call the server’s REST API directly.
curl -X POST http://localhost:3001/api/learn/now \ -H "X-Namespace-ID: support" \ -H "X-Api-Key: $MICRORESOLVE_API_KEY"Next
- Server Install — set up the self-hosted server
- Server Studio — manage intents and review misclassifications via UI
- Server API Reference — full HTTP API
- Git Data Layer — how training data is stored and versioned