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