Home/Inference & Serving/semantic-router
semantic-router logo

semantic-router

aurelio-labs/semantic-router

Superfast AI decision making and intelligent processing of multi-modal data

GraphCanon updated 3w · GitHub synced 3w

3.8k stars358 forksLast push 3w Python MIT

Decision brief

Semantic Router is designed for rapid AI decision making by routing through semantic vector space. It supports multi-modal data processing and can be used locally with specific package installs.

Good fit when

  • Use Semantic Router when you require superfast routing decisions based on semantic meaning of multi-modal inputs without waiting for LLM generations.
  • Prefer it if your application is sensitive to decision-making speed and needs a local execution option, allowing the use of 'HuggingFaceEncoder' and 'LlamaCppLLM'.

Avoid when

  • Do not opt for Semantic Router if your application requires detailed LLM-generated responses rather than quick decision routing based on semantic similarity.
  • Avoid it in scenarios where extensive customization of the route logic is needed beyond simple semantic categorization, as its main utility lies in fast response routing.
Pricing:
freemium - Free to use with optional premium support or additional features possibly required.

Observed Jul 17, 2026 · Source: enrich:decision_facts

Verify the decision

Maintenance and security

Full trust report
Maintenance
Very active (4d since push)
As of 3w
Provenance
Not a fork · Organization account
As of 3w
Security (OSV)
No lockfile
As of 1mo

Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.

Install

pip install semantic-router
PyPI

Similar tools

Same-category neighbours. No typed graph edges are catalogued for this tool yet.

Evidence and technical details

Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.

Overview

Semantic Router facilitates rapid AI-driven decisions by leveraging semantic vector space routing for LLMs and agents.

Capability facts

Languages
python

Source: github.language+pyproject.toml · Jul 31, 2026

Categories

Compatibility

Sourced claims from the README excerpt - not unsourced marketing copy.

Python runtimePython

Source: README excerpt (regex_v1, Jul 31, 2026)

<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/semantic-router?logo=python
Source link

Tags

README

PyPI - Python Version GitHub Contributors GitHub Last Commit Badge image GitHub Issues GitHub Pull Requests Badge image Github License

Semantic Router is a superfast decision-making layer for your LLMs and agents. Rather than waiting for slow LLM generations to make tool-use decisions, we use the magic of semantic vector space to make those decisions — routing our requests using semantic meaning.

Read the Docs


Quickstart

To get started with semantic-router we install it like so:

pip install -qU semantic-router

❗️ If wanting to use a fully local version of semantic router you can use HuggingFaceEncoder and LlamaCppLLM (pip install -qU "semantic-router[local]", see here). To use the HybridRouteLayer you must pip install -qU "semantic-router[hybrid]".

We begin by defining a set of Route objects. These are the decision paths that the semantic router can decide to use, let's try two simple routes for now — one for talk on politics and another for chitchat:

from semantic_router import Route

# we could use this as a guide for our chatbot to avoid political conversations
politics = Route(
    name="politics",
    utterances=[
        "isn't politics the best thing ever",
        "why don't you tell me about your political opinions",
        "don't you just love the president",
        "they're going to destroy this country!",
        "they will save the country!",
    ],
)

# this could be used as an indicator to our chatbot to switch to a more
# conversational prompt
chitchat = Route(
    name="chitchat",
    utterances=[
        "how's the weather today?",
        "how are things going?",
        "lovely weather today",
        "the weather is horrendous",
        "let's go to the chippy",
    ],
)

# we place both of our decisions together into single list
routes = [politics, chitchat]

We have our routes ready, now we initialize an embedding / encoder model. We currently support a CohereEncoder and OpenAIEncoder — more encoders will be added soon. To initialize them we do:

import os
from semantic_router.encoders import CohereEncoder, OpenAIEncoder

# for Cohere
os.environ["COHERE_API_KEY"] = "<YOUR_API_KEY>"
encoder = CohereEncoder()

# or for OpenAI
os.environ["OPENAI_API_KEY"] = "<YOUR_API_KEY>"
encoder = OpenAIEncoder()

With our routes and encoder defined we now create a RouteLayer. The route layer handles our semantic decision making.

from semantic_router.routers import SemanticRouter

rl = SemanticRouter(encoder=encoder, routes=routes, auto_sync="local")

We can now use our route layer to make super fast decisions based on user queries. Let's try with two queries that should trigger our route decisions:

rl("don't

For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.