Agent Chooses the Wrong Tool(Agent 选错工具)
知识库位置:
FDE Knowledge Base/03 Engineering/Troubleshooting/Agent-Chooses-Wrong-Tool.md
Problem(问题)
Section titled “Problem(问题)”Agent(智能体)收到请求后选择了错误工具。
例如用户说:
查询客户订单。
Agent 却调用:
create_order()(创建订单)而不是:
get_order()(获取订单)Common Causes(常见原因)
Section titled “Common Causes(常见原因)”Tool Description Ambiguous(工具描述含糊)
Section titled “Tool Description Ambiguous(工具描述含糊)”例如:
order_tool(订单工具)无法知道它做什么。
更清晰:
get_order_status(获取订单状态)create_order(创建订单)cancel_order(取消订单)Tools Overlap(工具功能重叠)
Section titled “Tools Overlap(工具功能重叠)”例如:
search_customer(搜索客户)find_customer(查找客户)lookup_customer(查询客户)三个 Tool(工具)功能几乎相同。
模型容易混淆。
Too Many Tools(工具过多)
Section titled “Too Many Tools(工具过多)”一次暴露:
80 tools(80 个工具)会显著增加 Tool Selection(工具选择)难度。
Poor Parameter Definition(参数定义不当)
Section titled “Poor Parameter Definition(参数定义不当)”Tool 虽然选对,但参数理解错误。
Diagnostic Steps(诊断步骤)
Section titled “Diagnostic Steps(诊断步骤)”记录:
User Request(用户请求)↓Tools Available(可用工具)↓Tool Selected(选中的工具)↓Arguments Generated(生成的参数)↓Tool Result(工具结果)重点检查:
- 模型为什么认为这个 Tool 合适?
- Tool Description(工具描述)是否区分明显?
- 是否有多个重叠 Tool?
Fixes(修复)
Section titled “Fixes(修复)”Make Tools Specific(让工具具体化)
Section titled “Make Tools Specific(让工具具体化)”不推荐:
manage_order()(管理订单)推荐:
get_order()(获取订单)cancel_order()(取消订单)update_shipping_address()(更新收货地址)Reduce Tool Set(精简工具集)
Section titled “Reduce Tool Set(精简工具集)”根据 Context(上下文)动态提供 Tool:
Support Context(客服场景)→ Support Tools(客服工具集)
Finance Context(财务场景)→ Finance Tools(财务工具集)Improve Tool Description(改进工具描述)
Section titled “Improve Tool Description(改进工具描述)”Description(描述)应写:
- 做什么
- 不做什么
- 什么时候用
Add Tool Routing Layer(增加工具路由层)
Section titled “Add Tool Routing Layer(增加工具路由层)”复杂系统可以:
Request(请求)↓Domain Router(领域路由器)↓Relevant Tool Set(相关工具集)↓Agent(智能体)Prevention(预防)
Section titled “Prevention(预防)”- Tool 数量控制
- 功能不重叠
- Schema(结构定义)清晰
- 建立 Tool Selection Evaluation(工具选择评估)
- 对关键动作增加 Confirmation(人工确认)