mcp调度
它实际上是一个路由器
一种用于MCP(模型上下文协议)的框架无关工具路由器 服务器。在以下情况下将代理请求路由到最快的可用工具 存在类似的工具,将响应延迟缩短了约64%(工具 取决于824个基准问题的平均值。
通过计算每个工具的向量嵌入来确定工具相似性 工具的描述,然后通过余弦对重复项进行分组 相似性。这使路由器能够识别功能上等效的 自动工具。
路由器与框架无关,不依赖于ReAct。
测试方法
\[!注意\] MCP服务器/工具的名称在提供给代理时是通用的。没有提到慢或快。
代理使用 google/gemini-2.0-flash-001 并且提供了两个MCP服务器:
______________________________________________________________________
scrape-slow (5秒延迟)
await new Promise((resolve) => setTimeout(resolve, 5000));
return scrape(url);______________________________________________________________________
scrape-fast (无延迟)
return scrape(url);______________________________________________________________________
使用的代理响应验证器 openai/gpt-oss-120b.
对日程表进行了测试,共有824个问题 谷歌框架数据集.
[
{
"Prompt": "If my future wife has the same first name as the 15th first lady of the United States' mother and her surname is the same as the second assassinated president's mother's maiden name, what is my future wife's name? ",
"Answer": "Jane Ballou",
"reasoning_types": "Multiple constraints",
"wiki_links": ["https://en.wikipedia.org/wiki/President_of_the_United_States", "https://en.wikipedia.org/wiki/James_Buchanan", "https://en.wikipedia.org/wiki/Harriet_Lane", "https://en.wikipedia.org/wiki/List_of_presidents_of_the_United_States_who_died_in_office", "https://en.wikipedia.org/wiki/James_A._Garfield"]
}, // ...
]结果
Agent using the router was faster by 7112.14 ms (63.53%) on average.
Expected, since the current implementation does not track tool result quality.
