[BUG]: The agent model failed to respond: 400 The `reasoning_content` in the thinking mode must be passed back to the API.

用户在 Docker 本地部署的 AnythingLLM 中,配置了 DeepSeek 作为 LLM 提供者,并使用 Agent 功能,集成 anysearch.com MCP 服务器。当 Agent 执行工具调用(如 web-scraping、anysearch-search、rag-memory

[BUG]: The agent model failed to respond: 400 The `reasoning_content` in the thinking mode must be passed back to the API.

[BUG]: The agent model failed to respond: 400 The `reasoning_content` in the thinking mode must be passed back to the API.

快速结论:此错误通常在使用 DeepSeek 等支持“thinking mode”(推理模式)的模型作为 AnythingLLM Agent 的 LLM 提供者时触发,多见于 DeepSeek 模型。优先排查 Your API key 是否配置正确,以及 AnythingLLM 版本是否已更新至包含修复的版本(如 1.13.0 之后)。

问题场景

用户在 Docker 本地部署的 AnythingLLM 中,配置了 DeepSeek 作为 LLM 提供者,并使用 Agent 功能,集成 anysearch.com MCP 服务器。当 Agent 执行工具调用(如 web-scraping、anysearch-search、rag-memory)并返回结果后,模型在最终响应时失败,报出该错误。Issue 中提及 DeepSeek 为 LLM Provider,Embedder 为 v4-flash。

报错原文

Error encountered while running: The agent model failed to respond: 400 The `reasoning_content` in the thinking mode must be passed back to the API.

Could not respond to message.
The agent model failed to respond: 400 The `reasoning_content` in the thinking mode must be passed back to the API.

原因分析

可能原因:该错误与 DeepSeek 模型的“thinking mode”(推理模式)有关。当 AnythingLLM 的 Agent 在调用 DeepSeek API 时,如果 API 请求中包含或期望 reasoning_content 参数,但 API 端发现该参数未正确传递回请求,则会返回 400 错误。这可能是由 AnythingLLM 旧版本中 Agent 与 DeepSeek API 的交互逻辑不兼容导致。Issue 中维护者声称已在 #5683、#5711、#5509 中修复,但用户升级至 v1.13.0 和 v1.15.0 后问题仍偶发出现,因此也可能与特定 Prompt、工具调用链长度或 MCP 服务器响应格式有关。

环境排查

  • ThingsLLM 版本:确认是否为 1.13.0 或 1.15.0(问题在升级后仍存在)
  • LLM Provider:DeepSeek 模型(其他支持 thinking mode 的模型也可能触发)
  • 部署方式:Docker(本地或远程服务器)
  • MCP 服务器:anysearch.com MCP 插件(配置见上)
  • API Key:确认 DeepSeek API Key 正确且未过期

解决步骤

  1. 优先尝试:确保 AnythingLLM 已更新到包含 #5683、#5711、#5509 修复的最新版本(Issue 关闭时最新版本为 1.15.0,但用户仍遇到问题,建议关注后续补丁)。
  2. 检查 DeepSeek 模型配置:在 AnythingLLM 的 LLM Provider 设置中,确认已正确选择支持“thinking mode”的 DeepSeek 模型,并填写正确的 API Endpoint 和 API Key。尝试切换“streaming”选项的开启/关闭状态。
  3. 简化 Agent 任务:如果问题在高重复工具调用或复杂 Prompt 下出现,尝试使用更短、更直接的 Prompt 进行测试,或减少单次 Agent 会话中的工具调用次数。
  4. 检查 MCP 服务器配置:确认 anysearch MCP 服务器的 anythingllm.suppressedTools 列表配置正确,避免 Agent 调用无效工具。暂时禁用 anysearch MCP,只使用内置工具(如 web-browsing、rag-memory)测试是否复现。
  5. 查看 DeepSeek API 响应日志:如果可能,检查 AnythingLLM 后端日志中 DeepSeek API 的原始请求和响应,确认 reasoning_content 字段是否存在或缺失。

验证方法

尝试使用同一个 Agent 和 Prompt 组合(如“create a new updated policy based on the AI-Policy_Final policy”)再次执行,观察是否不再返回 400 错误,Agent 能够正常输出最终回复。持续运行至少 5-10 次不同工具调用任务,确保错误不会间歇性出现。

参考来源

Mintplex-Labs/anything-llm #5928

GamsGo AI

AI 工具推荐

想把多个 AI 模型放在一个入口?

GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。

了解 GamsGo AI

推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。

celebrityanime
celebrityanime
文章: 10666

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注