AVRELIO
LEARN / COURSE / SEMANTIC-ROUTERPART · STEP 1 OF 5
[LangChain][Agents SDK][Semantic Router]
§ COURSE · I

Semantic Router Course

Semantic Router is a superfast decision-making layer for your LLMs and agents. In this course you'll build a deterministic decision layer — from your first route to dynamic function calling — routing requests in semantic vector space instead of waiting on slow generations.

BY JAMES BRIGGS
BEGINNER → PRO · ~5 HRS
COURSE REPO ↗
STEP 1 · GETTING STARTED WITH SEMANTIC ROUTERYOUTUBE ↗
§ I

Getting Started with Semantic Router

Where LLM-based decision making breaks down, what a route is, and how to get a routing decision out of SemanticRouter in under ten lines.

Tool selection and safety checks are decisions, not generations — route them in vector space.
A route is a name plus a handful of example utterances — no training required.
auto_sync="local" keeps your route index in step with your definitions; a miss returns None so you can fall through to a default handler.
chapter_01.py
1from semantic_router import Route
2from semantic_router.routers import SemanticRouter
3from semantic_router.encoders import OpenAIEncoder
4
5politics = Route(
6 name="politics",
7 utterances=[
8 "isn't politics the best thing ever",
9 "don't you just love the president",
10 ],
11)
12chitchat = Route(
13 name="chitchat",
14 utterances=["how's the weather today?", "how are things going?"],
15)
16
17router = SemanticRouter(
18 encoder=OpenAIEncoder(),
19 routes=[politics, chitchat],
20 auto_sync="local",
21)
22
23router("don't you love politics?").name
24# 'politics'
STEP 1 OF 5
AMERICA · EVROPA · ASIA© 2026 Aurelio Labs · MIT Licensed