=true error=400 "auto" tool choice requires --enable-auto-tool-choice and --tool...

2026年03月11日 14:07 processing

错误信息

06:07:09 [agent/embedded] embedded run agent end: runId=ec46364c-c499-4526-971f-58f9d88e6a10 isError=true error=400 "auto" tool choice requires --enable-auto-tool-choice and --tool-call-parser to be set

AI 解决方案

报错分析报告

1.错误翻译


原文:"auto" tool choice requires --enable-auto-tool-choice and --tool-call-parser to be set
译文:“auto”工具选择模式需要设置`--enable-auto-tool-choice`和`--tool-call-parser`参数

2. 原因分析


  • 根本原因:使用"auto"工具选择模式时,未启用自动工具选择开关(--enable-auto-tool-choice)和配置工具调用解析器(--tool-call-parser)。

  • 发生位置:嵌入式代理运行结束时的工具选择配置环节(报错上下文:embedded run agent end)。
  • 3.解决方案


    需补充缺失的参数配置,以下是常见场景的修复示例:

    #### 命令行运行修复

    # 添加必要参数后重新运行(示例)
    your-agent-command \
      --tool-choice auto \
      --enable-auto-tool-choice \  # 启用自动工具选择
      --tool-call-parser <解析器类型>  # 如"json"、"xml"等(根据平台要求填写)
    

    #### 配置文件修复(以JSON为例)

    {
      "runId": "ec46364c-c499-4526-971f-58f9d88e6a10",
      "toolChoice": "auto",
      "enableAutoToolChoice": true,  // 对应--enable-auto-tool-choice
      "toolCallParser": "default"    // 对应--tool-call-parser(值需匹配平台要求)
    }
    

    4. 预防措施


  • 前置校验:使用"auto"工具选择前,通过--help命令或官方文档确认所需参数(如启用开关、解析器类型)。

  • 配置模板:保存常用配置的模板文件(含必填参数),避免遗漏;推荐使用配置校验工具(如jq校验JSON、yamllint校验YAML)。

  • 注:<解析器类型>需替换为平台支持的合法值(如dmx-default),具体参考DMXAPI文档。