Edge Deployment
Run exported Sparkient decision bundles locally without a cloud call.
The Edge SDK exports a trained decision type as a bundle for compatible Python 3.10+ environments. You can run it on-premise, at the edge, or air-gapped. After downloading the bundle, inference makes no Sparkient API or LLM call. Sparkient does not currently ship or test native Android, iOS, microcontroller, or embedded-device SDKs.
sparkient-edge is a beta Python package. Benchmark the complete bundle on the target hardware before relying on its latency or capacity in production.
How It Works
A Sparkient edge bundle contains the exported model assets and configuration used 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 bundle is a single ZIP file. Size depends on the model, text-processing assets, and decision type.
Installation
pip install "sparkient-edge[all]"The recommended install includes expression-rule evaluation and the local MCP server. This prevents an optional dependency from changing how a bundle behaves. Use the minimal base package only for rule-free bundles when you do not need MCP:
pip install sparkient-edge| Extra | Adds | When needed |
|---|---|---|
rules | Rule engine | Bundles with expression-based hard rules |
mcp | mcp | Running as a local MCP server |
all | Both optional features | Bundles with rules used through MCP |
Export a Bundle
You need a decision type with an active deployed policy before you can export a bundle. Training starts with at least 38 labelled examples per decision option because the 80/20 split needs 30 per class for training. Review the result and deploy the policy if it was not auto-deployed. Edge export is available on Growth and Scale plans.
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 (no network; benchmark on target hardware)
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 base edge predictor installs:
ML runtime
numpy
Tokenizer for exported text modelsInstall the rules extra when the bundle contains expression rules. No FastAPI, database, Redis, or cloud SDK is required for local inference. Compatible dependency wheels and sufficient memory and compute are still required on the target host.
Limits
- Edge bundles contain the compiled classifier and rules only. They do not use Sparkient's optional cloud LLM escalation.
- Local latency, memory use, and bundle size depend on the model and target hardware.
- Training, retraining, and bundle export still use the Sparkient service. Export a new bundle when you deploy a new model.
- Local compute and the applicable Sparkient plan still have a cost; offline inference is not the same as free inference.
Use Cases
- Local Python inference — Servers, workstations, and edge computers where compatible dependency wheels and sufficient resources are available
- Air-gapped environments — Government, military, healthcare systems without internet
- Local latency — Eliminate network round-trip and benchmark the exported bundle on the target hardware
- Runtime control — No decision API calls after download; account for local compute, packaging, updates, and the applicable Sparkient plan
- 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:
pip install "sparkient-edge[all]"
python -m sparkient_edgeThis starts a stdio-based MCP server exposing three tools: make_decision, load_edge_bundle, and get_bundle_info.
