agentleFS
albertoclementealbertoclemente/agentic-design-patterns-skills/skills/agentic-routing/SKILL.md

agentic-routing

Skill4 starsChanged 5 months agoMITView on GitHub

Classifies an incoming request and dynamically directs control to the most appropriate tool, function, sub-agent, or workflow. Use when an agent must triage diverse inputs and pick among multiple distinct handlers based on intent or state — e.g., a support bot splitting sales, technical, and account queries. Routing can be driven by an LLM classifier, rules, embedding similarity, or a fine-tuned ML classifier.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every input legitimately follows the same path

    line 19
  2. Distinctive:

    Only one handler exists

    line 20

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Routing

Agentic Design Pattern 2 of 21 — distilled from Antonio Gulli, Agentic Design Patterns: A Hands-On Guide to Building Intelligent Systems (Ch. 2).

What it is. Analyze the input to determine intent or type, then route the flow of control to the best-fit handler, tool, model, or sub-agent — turning a fixed path into a context-aware decision.

Reach for this when

  • Inputs are varied and need different handling
  • An agent must triage or classify requests before acting
  • Multiple specialized tools or sub-agents exist and exactly one should run
  • You want to send simple queries to cheap models and hard ones to strong models

Don't reach for this when

  • Every input legitimately follows the same path
  • Only one handler exists
  • The routing decision is itself as costly or error-prone as just doing the work

Shape of the solution

Implement the classifier with one of four mechanisms: an LLM prompt, a deterministic rule set, embedding-similarity match, or a small discriminative ML model fine-tuned on labeled examples (more setup, but fast and stable once trained). Define an exhaustive set of categories plus an explicit default/fallback, and keep the router's job narrow so accuracy holds as categories grow.

Common failure modes

  • Silent mis-routes with no fallback path
  • A missing default category
  • Router accuracy drifting as categories proliferate

Composes with

  • agentic-prompt-chaining — route into a specific chain
  • agentic-multi-agent — route to a specialist agent
  • agentic-resource-aware-optimization — route by cost/complexity
  • agentic-tool-use — route to the right tool

Selection signals live in this skill's description (used for auto-triggering). To choose among all 21 patterns, see agentic-pattern-selector. Conceptual source: Antonio Gulli, Agentic Design Patterns: A Hands-On Guide to Building Intelligent Systems, Ch. 2 — original distillation from the text, not reproduced prose, code, or figures.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.