Production-grade semantic routing for AI systems. Fast Rust core. Hybrid scoring. 9 framework integrations.
StrataRouter is an AI Execution Control Plane — infrastructure-level routing for production AI systems.
While LangChain and LlamaIndex provide prompt-level routing helpers, StrataRouter provides deterministic execution, cost-aware model selection, governance, and compliance at the system level.
graph TD
Q["Your Query"] --> CORE
subgraph CORE["StrataRouter Core · MIT · this repo"]
A["Intent Detection"] --> B["Hybrid Scoring\n(dense · BM25 · rule)"]
B --> C["Confidence Calibration"]
end
CORE --> RUNTIME
subgraph RUNTIME["StrataRouter Runtime · Apache 2.0"]
D["TCFP Execution"] --> E["Semantic Cache"]
E --> F["REST API · Prometheus"]
end
RUNTIME --> ENTERPRISE
subgraph ENTERPRISE["StrataRouter Enterprise · Commercial"]
G["Consensus Engine"] --> H["Immutable Audit Log"]
H --> I["Policy Engine · Multi-tenant"]
end
Most AI frameworks treat routing as an afterthought — a few if/else chains or a
basic vector similarity lookup. StrataRouter treats routing as infrastructure:
| Problem | StrataRouter Answer |
|---|---|
| Slow Python similarity loops | Rust core — 8.7 ms P99 latency |
| Memory bloat at scale | 64 MB for 1K routes (vs 2.1 GB in pure-Python routers) |
| No confidence calibration | Per-route piecewise-linear score normalisation |
| No hybrid keyword + semantic | BM25 + dense embeddings combined |
| No audit trail | Immutable SHA-256 log (Enterprise) |
| No cost control | Per-route budget enforcement (Enterprise) |
| Metric | StrataRouter | semantic-router | Delta |
|---|---|---|---|
| P99 Latency | 8.7 ms | 178 ms | ~20× faster |
| Memory (1K routes) | 64 MB | 2.1 GB | ~33× less |
| Throughput | 18K req/s | 450 req/s | ~40× higher |
| Accuracy | 95.4% | 84.7% | +12.7% |
Benchmarks run on Ubuntu 22.04, AMD EPYC 7B13, Python 3.11, sentence-transformers/all-MiniLM-L6-v2. See
benchmarks/for methodology and reproduction scripts.
| Feature | StrataRouter | semantic-router | LangChain Router | route0x |
|---|---|---|---|---|
| Rust core | ✅ | ❌ | ❌ | ❌ |
| Hybrid BM25 + dense | ✅ | ❌ | ❌ | ❌ |
| Confidence calibration | ✅ | ❌ | ❌ | ❌ |
| Cost-aware routing | ✅ | ❌ | ❌ | ❌ |
| Audit log | ✅ | ❌ | ❌ | ❌ |
| Sub-10ms P99 | ✅ | ❌ | ❌ | ❌ |
pip install stratarouter
pip install stratarouter[huggingface] # local embeddings, no API key
pip install stratarouter[openai] # OpenAI embeddings
pip install stratarouter[cohere] # Cohere embeddings
pip install stratarouter[all] # everythingfrom stratarouter import Route, RouteLayer
from stratarouter.encoders import HuggingFaceEncoder
routes = [
Route(
name="billing",
utterances=["invoice", "payment", "refund", "charge"],
threshold=0.75,
),
Route(
name="support",
utterances=["help", "broken", "error", "can't login"],
threshold=0.75,
),
]
encoder = HuggingFaceEncoder()
rl = RouteLayer(encoder=encoder, routes=routes)
result = rl("I need my April invoice")
print(result.name) # "billing"
print(result.score) # 0.87
print(bool(result)) # True — score >= thresholdfrom stratarouter import Router, Route
router = Router(encoder="sentence-transformers/all-MiniLM-L6-v2")
router.add(Route(name="billing", utterances=["Where's my invoice?", "I need a refund"]))
router.add(Route(name="support", utterances=["App is crashing", "Can't login"]))
router.build_index()
result = router.route("I need my April invoice")
print(result.route_id) # "billing"
print(result.confidence) # 0.89 — calibrated score
print(result.latency_ms) # 2.3
router.save("my_router.json")
router = Router.load("my_router.json") # no re-indexing neededflowchart LR
Q["User Query"] --> E["Embedding\nEncoder"]
E --> HS
subgraph HS["Hybrid Scorer · Rust"]
D["Dense\nCosine\n×0.6427"]
B["BM25\nKeyword\n×0.2891"]
R["Rule\nPattern\n×0.0682"]
end
D --> CAL["Calibration\nper-route\npiecewise-linear"]
B --> CAL
R --> CAL
CAL --> SEL["Route\nSelection\nargmax"]
SEL --> OUT["RouteResult\nroute_id · confidence\nlatency_ms"]
from stratarouter.integrations.langchain import StrataRouterChain
from stratarouter.integrations.langgraph import create_routing_graph
from stratarouter.integrations.crewai import RoutedAgent
from stratarouter.integrations.autogen import StrataRouterGroupChat
from stratarouter.integrations.openai_assistants import StrataRouterAssistant
from stratarouter.integrations.google_agent import StrataRouterVertexAIRunnable examples → integrations/
| Version | Feature | Status |
|---|---|---|
| v0.1 | Prototype — RouteLayer API | ✅ Nov 2025 |
| v0.2 | Production Rust engine, 9 integrations | ✅ Mar 2026 |
| v0.3 | Runtime — TCFP, REST API, cache | ✅ Available |
| v0.4 | Cost optimizer — model selection, budgets | 🔄 In Progress |
| v0.5 | Enterprise governance | ✅ Available (private) |
| v0.6 | JS / Go SDKs | 📋 Q3 2026 |
| v1.0 | StrataRouter Cloud | 📋 Q4 2026 |
Full roadmap → ROADMAP.md
| Getting Started | Install + first router in 5 min |
| API Reference | RouteLayer, Router, Route, RouteChoice |
| Integrations | All 9 framework guides |
| Architecture | Rust internals, scoring, calibration |
| Deployment | Docker, K8s, server |
| Changelog | Release history |
| Roadmap | What's coming |
Full docs → docs.stratarouter.com
git clone https://github.com/ai-deeptech/stratarouter.git
cd stratarouter
pip install -e "python/.[dev]"
cd python && maturin develop --release && cd ..
make test| Core (MIT) | Runtime (Apache 2.0) | Enterprise | |
|---|---|---|---|
| Semantic routing library | ✅ | ✅ | ✅ |
| 9 framework integrations | ✅ | ✅ | ✅ |
| PyPI package | ✅ | — | — |
| TCFP workflow execution | — | ✅ | ✅ |
| REST API + Prometheus | — | ✅ | ✅ |
| Semantic cache + batch dedup | — | ✅ | ✅ |
| Multi-agent consensus | — | — | ✅ |
| Immutable audit log (SOC2/HIPAA) | — | — | ✅ |
| Policy engine (RBAC/ABAC) | — | — | ✅ |
| Multi-tenant isolation | — | — | ✅ |
→ Runtime
→ Enterprise: support@stratarouter.com
→ Docs: docs.stratarouter.com
→ Website: stratarouter.com
See CONTRIBUTING.md · SUPPORT.md · CODE_OF_CONDUCT.md
MIT — LICENSE.txt
Built with PyO3 · Sentence Transformers
Made with ⚡ by StrataRouter Contributors