langchain-skill-router
Middleware for LangChain deepagents where Jev ranks and verifies which SKILL.md skills each turn needs, keeping the rest out of the prompt.
Overview
langchain-skill-router is a drop-in replacement for the deepagents SkillsMiddleware. By default deepagents lists every skill's name and description in the system prompt on every call, which with hundreds of skills costs tens of thousands of tokens and makes the model pick from a crowd. Skill Router instead decides per user turn: a fast judge ranks the SKILL.md catalog against the request and recent conversation, verifies the top candidates, and loads only a confident pick's instructions. When unsure, the model gets a short list of up to three candidates and can search the rest with a find_skill tool.
The judge is a small protocol, typed questions in and probabilities out, with an included Jev adapter; a self-hosted model or deterministic rules can replace it, and the routing core depends on neither LangChain nor a provider. Ranking is split to fit Jev's limits, thresholds for load, offer and skip are tunable, and failures fall back to the full catalog. On a 236-skill catalog the README reports input tokens per turn falling from 113.0k to 25.8k, with 90% correct answers versus 88% with the full catalog.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Score | How well does each skill match this turn's request and recent conversation? | — |
| Yes / no | Is this top-ranked skill actually needed for this turn? (verification) | — |
How it works
- User turn arrives in a deepagents agent
- Judge ranks the skill catalog in chunks that fit Jev's limits
- Top candidates are verified
- Confident pick is loaded; otherwise up to three are offered
- On timeout or error, the full catalog is used
Strengths
- Large token savings on big skill catalogs
- Pluggable judge, not tied to Jev
- Conversation-aware routing
- Safe fallback
Caveats
- Benchmark is a single catalog
- Requires a judge backend
- Specific to deepagents
Getting started
pip install "langchain-skill-router[jev]" and replace SkillsMiddleware with the router.At a glance
- Type
- Agent skill
- Status
- beta
- Language
- Python
- Runtime
- LangChain deepagents middleware
- Has code
- yes
- Has tests
- yes
Use cases and integrations
How curated lists describe it
Agent infrastructure: per-turn skill routing for LangChain deepagents, where Jev ranks the SKILL.md catalog against the request and the recent conversation and verifies the top candidates, so only the picked skill's instructions reach the prompt; the judge is a protocol that a self-hosted model or static rules can implement instead.
yibie/awesome-jevLangChain deepagents middleware for per-turn skill routing: Jev ranks and verifies which SKILL.md skills each turn needs from a catalog of hundreds, splitting the ranking to fit Jev's limits and falling back to the full catalog on failure. The judge is pluggable. `pip install "langchain-skill-router[jev]"`.
AnotiaWang/awesome-decision-modelsPer-turn skill routing for LangChain deepagents: Jev ranks the SKILL.md catalog against the request and the recent conversation and verifies the top candidates, while the library applies the thresholds and either loads one skill's instructions or offers a short list; the judge is a protocol, so a self-hosted model or static rules can take Jev's place.
cobanov/awesome-jevPer-turn skill selection for LangChain and deepagents agents: a fast judge picks the few skills a turn needs, so a catalog of hundreds stays out of the prompt.
hellogumbo/awesome-jev
Frequently asked questions
What does Jev decide?
Which skills from the catalog the current turn needs, via ranking and verification questions.
Can I use something other than Jev?
Yes, the judge is a protocol; a self-hosted model or rules can implement it.
How much does it save?
On a 236-skill catalog, about 113k to 26k input tokens per turn, per the README.
Related projects
MCP router that catalogs and deduplicates tools and exposes each agent only a relevant, authorised subset using typed decisions.
MCP serverbetaPythonAgent tool router that keeps obvious calls on a fast path, uses Jev via OpenRouter for ambiguous tool choices, and offers bounded MCTS.
MCP serverprototypePythonJev-style skill router for OmO: frozen Qwen2.5-0.5B plus a small head scores the skill catalog and trims the system prompt to top-K.
ModelprototypePythonComposio agent SDK with an optional TypeSafe provider that uses Jev to shortlist and pick tools and closed-set arguments.
ProjectproductionTypeScriptPython multi-agent runtime with native Jev support: agents ask typed questions via a decision client separate from the text model.
LibraryproductionPythonLocal Python MCP service that keeps the skill catalog out of the agent's context and lets Jev pick which SKILL.md files to load.
MCP serverbetaPython