LangChain shows how to build a model router in its Open SWE coding agent
Original titleHow to Build a Model Router in the Harness
AISummary
LangChain built a model router inside its open source coding agent Open SWE that picks one of three models for each thread. In an A/B test against always using GPT-6 Astra, the median cost per thread fell 64% with no measurable change in merged PR rate.
The router runs on the thread's first message, using a base prompt, per-tier criteria, and a classifier model, and the post lists next steps including subagent routing and mid-thread re-routing.
Source: LangChain Blog · langchain.comPublished · added here