Skip to main content

A high-throughput semantic routing engine for AI agents and LLM applications.

Project description

SynaptoRoute

A high-throughput semantic router for AI agents and LLM applications.

Python 3.10+ License: MIT PyPI Version CI Build


What is SynaptoRoute?

SynaptoRoute is an adaptive control plane designed to sit at the edge of your infrastructure. It intercepts natural language queries and deterministically routes them to predefined system actions, APIs, or workflows based on semantic meaning.

It is not a large language model (LLM). It is a highly optimized mathematical routing engine.

Instead of relying on expensive and comparatively slow LLM generations to infer user intent, SynaptoRoute calculates intent locally using dense vector embeddings. If a query matches a known workflow (e.g., billing inquiries or password resets), SynaptoRoute triggers the action immediately, bypassing the LLM entirely.

Why use SynaptoRoute?

  • Low Latency: Achieves 3.0ms P95 worst-case retrieval latency on a 1,000,000 vector index.
  • Zero-Cost Routing: Defaults to FastEmbedEncoder for zero-overhead, local vector generation on the CPU, avoiding external API token costs.
  • Dynamically Mutable: Routes can be added, updated, or deleted in memory without requiring a server restart, safely executing under heavy load.
  • Persistent Storage: All routing logic is persisted to an embedded SQLite database using Write-Ahead Logging (WAL) for robust state recovery.
  • Framework Integration: Includes native integrations for LangChain and LlamaIndex to serve as a deterministic tool-selector.

Quickstart

Installation

pip install synaptoroute

Usage Example

import asyncio
from synaptoroute import AdaptiveRouter, Route

async def main():
    # 1. Initialize the router (defaults to local FastEmbed models)
    router = AdaptiveRouter()
    
    # 2. Define workflows (routes)
    billing_route = Route(
        name="billing_inquiry",
        utterances=["how much do I owe?", "view my invoice", "payment history"],
        threshold=0.85
    )
    password_route = Route(
        name="password_reset",
        utterances=["I forgot my password", "reset password", "can't log in"],
        threshold=0.85
    )
    
    # 3. Add routes and start the engine
    router.add_route(billing_route)
    router.add_route(password_route)
    await router.start()
    
    # 4. Route incoming user queries
    match = await router.aquery("Where is my latest bill?")
    
    if match and match.name == "billing_inquiry":
        print("Triggering the billing workflow.")
    else:
        print("Falling back to standard LLM generation.")

asyncio.run(main())

Architecture Design

SynaptoRoute separates concerns across strict boundary layers to guarantee stability under concurrent load:

graph TD
    Client["Incoming Query / Mutation"] --> Router["AdaptiveRouter"]
    
    subgraph Core Engine
        Router -- "1. Vectorizes text" --> Encoder["FastEmbedEncoder"]
        Router -- "2. Semantic distance search" --> Index["FaissIndex"]
    end
    
    subgraph Data & Sync
        Router -- "3. Durable WAL persistence" --> Storage[("SQLiteStorage")]
        Router -- "4. Incremental broadcast" --> Sync["RedisSyncManager"]
        Sync -.-> Cluster["Peer Nodes"]
    end

For a detailed breakdown of subsystem ownership and failure domains, refer to the Architecture Documentation.


Engineering Integrity

SynaptoRoute bases its claims strictly on automated, reproducible telemetry located in BENCHMARK_REGISTRY.md.

  • Mathematical Honesty: During the v0.3.0 architectural transition, independent benchmark audits uncovered a telemetry unit conversion bug regarding latency claims. The prior benchmarks were formally retracted, and a strict registry was created to hold unalterable telemetry data.
  • Production Readiness: Single-node deployments utilizing local SQLite and FAISS memory boundaries are fully concurrent-safe and ready for production use.
  • Distributed Sync Limitations: Enterprise-scale deployments (>5 nodes) using Redis PubSub currently face O(N×M) network bottlenecks during cold-boot synchronization. We recommend multi-node deployments for staging only until the integration of a durable external ledger is complete.

Developer Resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

synaptoroute-0.4.1.tar.gz (12.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

synaptoroute-0.4.1-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file synaptoroute-0.4.1.tar.gz.

File metadata

  • Download URL: synaptoroute-0.4.1.tar.gz
  • Upload date:
  • Size: 12.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for synaptoroute-0.4.1.tar.gz
Algorithm Hash digest
SHA256 81db0c4021bb551a3d55592b5a3b27514600562639afa6b14c8ddfc650997d88
MD5 f7ea021a1cffe29bda61851dc564ee53
BLAKE2b-256 487bc5e5a9e68ffe54e62469a21c2c87d76210cc2533217a491781556e39ec9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for synaptoroute-0.4.1.tar.gz:

Publisher: publish.yml on sitanshukr08/SynaptoRoute

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file synaptoroute-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: synaptoroute-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for synaptoroute-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c15063903c3e120a3f1d9cc8cf250eeccc67265de93c5ef0110b2260741ac4e0
MD5 4dfbcf026e44c233333db579a26f1c05
BLAKE2b-256 18f36b3d96003c93fe32a4c262b7ece5890bd6cda7a9cb6953090c9fd0fbe656

See more details on using hashes here.

Provenance

The following attestation bundles were made for synaptoroute-0.4.1-py3-none-any.whl:

Publisher: publish.yml on sitanshukr08/SynaptoRoute

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page