# LangChain's ModelRouterMiddleware routes runs to models using Jev

> Original title: cool project by @dbreunig

- Source: Harrison Chase
- Published: 2026-10-03T20:05:10.000Z
- Bad Influence: https://badinfluence.news/items/py0k6ij3980b2xkr51100kpko
- Original: https://x.com/hwchase17/status/2106475668804657555

## Summary

LangChain's ModelRouterMiddleware uses Jev to read the first message and select a model that handles the entire run. Because Jev is cheap, developers can also re-select a model after each tool result using a custom hook. The router was demonstrated in a quick project by @dbreunig built with DSPy and Jev.

## Post

cool project by @dbreunig

in langchain this is ModelRouterMiddleware - jev reads the first message, picks the model, and that model handles the whole run

jev is cheap enough that you can also re-pick after each tool result with a custom hook

docs: https://docs.langchain.com/oss/python/integrations/providers/typesafe#model-routing

https://x.com/dbreunig/status/2106456056042025235

## Quoted post @dbreunig

> A quick example of a model router, using DSPy and Jev, based on your initial prompt. 
> 
> Sketched this out in ~15 min, by request, and am surprised at how well it works! https://gist.github.com/dbreunig/949b42c7202508881d7c5a64ccd0fb9b

https://x.com/dbreunig/status/2106456056042025235
