router-builder

Build hierarchical semantic routers classifying queries into categories and routing via embeddings.

2|Updated Jan 2, 2026
One-click install
npx skills add https://github.com/mindmorass/reflex --skill router-builder
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: router-builder
Source: https://github.com/mindmorass/reflex/tree/main/plugins/reflex/skills/router-builder
Command: npx skills add https://github.com/mindmorass/reflex --skill router-builder

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The router-builder solves the problem of routing user queries to the correct command, agent, skill, or workflow using a learned semantic embedding.

Core Features & Use Cases

  • Hierarchical two-tier routing: category then resource within category.
  • Embedding-based routing using the same model as RAG for consistency.
  • Easy extension by adding new routes via YAML and dynamic route updates.
  • Use case: Route a query to a specific command or agent or trigger a workflow in an AI assistant.

Quick Start

Install dependencies with pip and run basic tests:

  • pip install semantic-router sentence-transformers pyyaml
  • cd routing
  • python test_router.py

Frequently Asked Questions about router-builder

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I route queries to different commands and agents using semantic similarity?▼

Semantic routing classifies queries into categories (command, agent, skill, workflow) using embeddings, then matches them to specific resources. The router-builder creates a two-tier hierarchy that uses embedding-based similarity for fast, consistent resource selection across your AI assistant.

What's the difference between hierarchical routing and flat routing for NLP queries?▼

Hierarchical routing first classifies queries into broad categories, then selects a specific resource within that category. This two-tier approach reduces ambiguity and improves accuracy compared to flat routing, especially when managing multiple resource types like commands, agents, and workflows.

Can I add new routes dynamically without retraining the semantic router?▼

Yes. The router-builder supports dynamic route addition via YAML configuration, allowing you to extend routing rules and add new resources without retraining the embedding model or modifying core routing logic.

How do I ensure consistent embeddings across my RAG and routing systems?▼

The router-builder uses the same HuggingFaceEncoder model as your RAG pipeline, ensuring consistent embedding representations across both systems and improving routing accuracy and alignment with your retrieval logic.

When should I use semantic routing instead of rule-based routing?▼

Semantic routing excels when queries vary in phrasing but share intent, or when you need to scale routing across many resources. Rule-based routing works well for fixed, predictable patterns. Use semantic routing for flexible, intent-driven classification in multi-resource AI workflows.

What setup steps are required to run the router-builder?▼

Install semantic-router, sentence-transformers, and pyyaml via pip. Define your routes in YAML with categories and resources, then initialize the router with your HuggingFaceEncoder. Test with the provided test suite to verify routing behavior.