Skip to main content

Agentic Router

Agentic Router is a domain-agnostic, zero-shot classification and routing engine designed for modern LLM applications.

Instead of writing rigid if/else statements or hardcoding API logic, Agentic Router allows you to define complex routing topologies and classification guardrails using simple Python dictionaries and arrays. It dynamically compiles these into robust framework-agnostic prompts to intelligently route user queries to the correct database or pipeline.

Features

  • 🛣️ Dynamic Topologies: Route natural language queries across various workflows (e.g., Vector DB vs Graph DB vs SQL) by passing a simple dictionary of rules.
  • 🛡️ Custom Classification: Inject arbitrary categories and guardrails (e.g., PII detection, Sentiment Analysis) into the agent's decision-making pipeline on the fly.
  • 🔌 Model Agnostic: Built on top of LlamaIndex. Inject an OpenAI, Gemini, or even a local Ollama model directly into the constructor.

Installation

pip install agentic-router

Quick Start

1. Dynamic Query Routing

Define your project's unique routing rules, and the Agent will dynamically strictly enforce them:

from agentic_router import AgenticRouter
from llama_index.llms.openai import OpenAI

llm = OpenAI(model="gpt-4o")
router = AgenticRouter(llm=llm)

# A Customer Support topology
support_topology = {
    "Tech_Support": "User is asking about a software bug or failure.",
    "Billing": "User is asking about refunds or credit cards."
}

route = router.route_query(
    query="I was charged twice on my visa.", 
    topology=support_topology, 
    fallback="Tech_Support"
)
print(route)  # Output: Billing

2. Custom Classification & Guardrails

Classify inputs on the fly strictly adhering to your defined arrays:

# A tabletop RPG setting
rpg_vibes = ["Ominous", "Peaceful", "Combat", "Tavern"]
query = "The floorboards creak as three figures step out of the shadows with drawn daggers."

vibe = router.classify_vibe(query=query, valid_vibes=rpg_vibes)
print(vibe)  # Output: Ominous

Release files for agentic-router 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentic-router 0.1.0
File Size Uploaded
agentic_router-0.1.0.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentic-router 0.1.0
File Interpreter ABI Platform
agentic_router-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / agentic_router-0.1.0.tar.gz

Download URL agentic_router-0.1.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4167a0a4483d6ec60f84e2e118b073695a7f383762057778ed15c32ec56fc7d2
BLAKE2b-256 checksum
How to use checksums
40c89b8d849998bda9154e88221b1359113c3302e0cde8d7dfdb45e1143c4615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / agentic_router-0.1.0-py3-none-any.whl

Download URL agentic_router-0.1.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f412798c8f53668d374a67cf20a3feda07d483a52fe9388d25a5115a1d2db883
BLAKE2b-256 checksum
How to use checksums
fd9cd3aeb7d39de41794b68788bb10ce220f5d19fd60cafb7f41f9078f14a895
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page