根据任务难度把请求分发给不同价位的模型, ...
Quick Answer
A model routing system in Agent Harness effectively distributes requests based on task difficulty, reducing median costs by 64% from $2.61 to $0.94 without significant quality loss.
Quick Take
The system utilizes three model tiers: Fast (GLM-5.3-Flash), Balanced (GPT-5.6 Sol), and Performance (GPT-6 Astra), demonstrating that most tasks do not require top-tier models.
Key Points
- Routing decisions are made in Agent Harness, not at the gateway layer.
- 56% of requests used the Balanced model, while only 10% needed Performance tier.
- Cost difference between Fast and Performance models is approximately 30 times.
- Initial tests showed a 50x speed improvement with the new decision model Jev.
- User feedback indicated dissatisfaction when simple queries used top-tier models.
📖 Reader Mode
~1 min read在你的 Agent Harness 里怎么构建一个模型路由? 以及,为什么要建在 Harness 里,不能建在网关层? 来自 @LangChain 团队 @sydneyrunkle 的分享,在开源 Coding Agent「Open SWE」构建了一个模型路由,根据任务难度把请求分发给不同价位的模型,结果在 973 个线程的 A/B 测试中,中位成本降低 64%($2.61 → $0.94),质量(合并 PR 率 29.2% vs 27.3%,p=0.49)没有统计学上的显著差异。 Sydney 认为:路由决策应该放在 Agent Harness 里,而不是通用网关层,因为只有 Harness 拥有判断“该用哪个模型”所需的领域与任务上下文。 # 四步构建方法 1. 理解任务(先看数据) 从 LangSmith 追踪数据中取一周的真实线程,用 LLM 分类器打标。任务分布:新功能 22%、bug 修复 17%、测试/空跑 16%。关键发现是复杂度信号清晰,功能调研类线程又长又贵,测试/发布类短且便宜,说明“从初始请求推断难度”是可行的。 2. 理解模型(沿 Pareto 前沿选) 借助 Artificial Analysis 的智能指数绘制“智能-成本”曲线,选出三个层级: · Fast:GLM-5.3-Flash(开放权重,性价比前沿) · Balanced:GPT-5.6 Sol · Performance:GPT-6 Astra(顶级前沿模型) 3. 在 Harness 中构建路由 通过 LangChain 中间件实现,Agent 本身零改动。路由只在线程的首条人类消息上运行一次,由三部分组成:基础提示词(“挑最便宜的可能完成任务的模型”)+ 每个层级的自然语言准入标准 + 分类器。第一版用带结构化输出的 LLM,后换成新发布的决策模型 Jev,分类速度提升近 50 倍。已知局限:模型选定后整个线程不再更换。 4. 追踪任务结果 主指标是合并 PR 率,辅以用户点赞/点踩反馈(虽然稀疏,但恰好暴露了路由错误)。 # 实验结果的关键细节 路由分布:56% 走 balanced,34% 走 fast,只有 10% 真正需要 performance 层,印证了大量日常请求根本用不着顶级模型。 层级间成本差约 30 倍(fast 中位 $0.097,performance $2.88)。 均值只降 42%、p90 只降 37%,而中位数降 64%;说明重度任务该贵还是贵,省的是“大多数普通任务”的钱。 反向验证很有说服力:他们还测了“只用 fast 模型”的对照组,结果一天内就因质量问题被叫停,证明路由不是“全用便宜模型”,而是“该省的省、该花的花”。 用户反馈也印证了痛点:简单查询跑在最强模型上时,工程师会直接吐槽 "pretty expensive for this query"。
— Originally published at x.com
Want this in your inbox every morning?
Daily brief at your local 8am — bilingual EN/中文, free.
More from WebSearch (Tavily)
See more →全球AI芯片峰会,9月上海见!
The 2026 Global AI Chip Summit will take place in Shanghai on September 22-23, focusing on the evolving AI chip landscape, including the shift from training to inference, the rise of diverse chip technologies, and the restructuring of industry competition. Notable speakers include experts from leading universities and companies, discussing advancements in AI chip architecture and applications.
