Edge Deployment
Run Sparkient decisions locally with zero cloud dependencies.
The Edge SDK lets you export a trained decision type as a standalone bundle and run it locally — on-device, on-premise, or in air-gapped environments. Zero network calls, zero cloud dependencies.
How It Works
A Sparkient edge bundle contains everything needed to make decisions offline:
| Component | Purpose |
|---|---|
| Compiled model | The compiled ML classifier |
| Expression rules | Hard rules, evaluated first |
| Feature config | How to extract features from input |
| Metadata | Decision type name, options, version |
The entire bundle is a single ZIP file, typically 1–5 MB.
Installation
pip install sparkient-edgeFor rule evaluation, text field embeddings, or MCP server support, install optional extras:
pip install sparkient-edge[all]| Extra | Adds | When needed |
|---|---|---|
rules | Rule engine | Decision types with hard rules |
text | Text embedding library | Decision types with free-text input fields |
mcp | mcp | Running as a local MCP server |
all | All of the above | Recommended for full functionality |
Export a Bundle
You need a trained decision type with at least 50 training examples before you can export a bundle.
curl -X GET https://api.sparkient.ai/api/v1/decision-types/{id}/export \
-H "Authorization: Bearer YOUR_API_KEY" \
-o my_decision_type.zipUse in Python
from sparkient_edge import EdgePredictor
# Load the exported bundle
predictor = EdgePredictor.from_bundle("my_decision_type.zip")
# Make a decision (< 10ms, no network)
result = predictor.predict({
"text": "Check out this product",
"user_score": 0.85,
"link_count": 1
})
print(result.decision) # "approve"
print(result.confidence) # 0.94
print(result.reason_codes) # ["safe_content"]
print(result.stage) # "classifier"
print(result.class_probabilities)# {"approve": 0.94, "flag": 0.04, "reject": 0.02}
print(result.rules_triggered) # []EdgeDecision Fields
| Field | Type | Description |
|---|---|---|
decision | str | The chosen outcome (e.g., "approve") |
confidence | float | Confidence score (0.0 to 1.0) |
reason_codes | list[str] | Why this decision was made |
stage | str | Which stage decided: "rules", "classifier", or "fallback" |
class_probabilities | dict[str, float] | Probability for each option |
rules_triggered | list[str] | Names of rules that fired |
Dependencies
The edge predictor requires only:
ML runtime
Rule engine
numpy
Text embeddingsNo FastAPI, no database, no Redis, no cloud SDKs. It's designed for constrained environments.
Use Cases
- On-device inference — Mobile apps, IoT devices, embedded systems
- Air-gapped environments — Government, military, healthcare systems without internet
- Ultra-low latency — Eliminate network round-trip for sub-10ms decisions
- Cost optimization — Zero API calls after the initial bundle download
- Offline-first applications — Apps that need to work without connectivity
Updating
When you retrain and deploy a new model, export a new bundle and replace the old one. The edge predictor loads the latest bundle on initialization.
MCP Server
Run the edge predictor as a local MCP server for Claude Desktop, Cursor, or any MCP-compatible client:
python -m sparkient_edgeThis starts a stdio-based MCP server exposing three tools: make_decision, load_edge_bundle, and get_bundle_info.
