Semantic routing
Semantic routing selects a processing path, model, tool, or retrieval method for an input based on its meaning or intent.
Natural Language Processing in Action, Second Edition
Semantic routing is the classification-driven selection of an appropriate language model or processing path for a natural-language input.
- How it is used
- Routes user prompts toward suitable language models to improve results and the cost–benefit ratio.
- How deep it goes
- Outlines training a prompt classifier and dispatching with conditional logic, without a complete router implementation.
- Examples
- Uses requests for code, poetry, and a child-friendly explanation of AI to illustrate different prompt types.
- What you can do after
- Supports evaluating how prompt classification can guide language-model selection.
Read how Natural Language Processing in Action, Second Edition explains semantic routing →
Designing AI Agents
A routing mechanism that selects a processing path based on the meaning of a request.
- How it is used
- Replaces fixed product-type selection with intent-based capability discovery in open-ended agent action spaces.
- How deep it goes
- Defines the architectural rationale but leaves routing implementation unspecified.
- What you can do after
- Understand why fixed factory taxonomies do not fit runtime-discovered agent capabilities.
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- embeddingAn embedding is a numerical vector representation of an item in a feature space, encoding selected properties or relationships for computational tasks such as comparison or retrieval.
Related concepts
- routingkind of · Routing is the process of directing an item, request, or task to a destination or processing path according to relevant rules or characteristics.
- similarity searchused by · Similarity search is a retrieval technique that finds or ranks items by their similarity to a query, often by comparing feature or vector representations under a similarity or distance measure.
- LangChainimplemented by · LangChain is an open-source software framework for building applications that compose language models with prompts, data sources, tools, and other components.
- factorycontrasts with · A factory is a function, method, or component that creates and returns values or objects while encapsulating construction or selection logic.
- string matchcontrasts with · String matching is the computational task of locating or comparing character sequences according to a specified exact or approximate matching criterion.
- semantic-routerimplemented by · semantic-router is a software package for routing natural-language inputs to different processing destinations based on semantic similarity or classification.
Questions about semantic routing
What is semantic routing?
Semantic routing selects a processing path, model, tool, or retrieval method for an input based on its meaning or intent.
Which Manning books explain semantic routing?
Natural Language Processing in Action, Second Edition and Designing AI Agents.
What should I know before learning semantic routing?
Manning books that teach semantic routing usually introduce language model and embedding first.
What is the difference between semantic routing and factory?
Semantic routing selects a processing path, model, tool, or retrieval method for an input based on its meaning or intent. A factory is a function, method, or component that creates and returns values or objects while encapsulating construction or selection logic.
What is semantic routing a kind of?
Semantic routing is a kind of routing. Routing is the process of directing an item, request, or task to a destination or processing path according to relevant rules or characteristics.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

