
Invalid Format: Missing ‘Action:’ after ‘Thought
快速结论:该报错通常在使用本地模型(如 Llama 2、OpenHermes、Mistral 等)运行 CrewAI agent 时触发,优先排查是否使用了参数量过小(如 7B)的模型,或尝试调低 temperature 参数。
问题场景
用户在 CrewAI 框架中搭配本地模型(如 Llama 2、OpenHermes、Starling、Mistral、phi-2 等)执行 Agent 任务时触发。搭配 OpenAI API 使用时未出现此问题。
报错原文
Invalid Format: Missing 'Action:' after 'Thought
Error executing tool. Missing exact 3 pipe (|) separated values. For example, `coworker|task|information`.
Agent stopped due to iteration limit or time limit.
原因分析
最可能的原因是本地小参数模型在复杂任务场景下“丢失思路”(losing track),即模型忘记遵循 Thought → Action → Action Input 的结构化输出格式,开始输出无关内容或进入死循环。参数量过小(如 7B)的模型更易出现此问题,而参数量更大(如 13B 基础版、Mixtral 8x7B)或调低 temperature 可有效缓解。
环境排查
- 确认使用的模型参数量(7B、13B 等)
- 确认模型类型(base 模型 vs chat/instruct 模型)
- 确认模型运行的上下文窗口长度(如
num_ctx是否设置为 16384) - 确认 temperature 设置(建议尝试 0.1~0.6 之间的值)
- 确认推理硬件(GPU 显存:如 RTX 3090 24GB 以上)
解决步骤
- 优先尝试:将模型 temperature 参数调低至 0.1。有多位用户反馈该设置可显著改善输出稳定性。
- 优先尝试:改用参数量 13B 以上的模型,尤其是 base 版本(非 chat 版)。用户实测 Llama 2 13B base 模型表现良好,而 Llama 2 13B chat 版本同样失败。
- 尝试增加模型上下文窗口长度:例如在 Ollama 中设置
num_ctx=16384,可减少 agent 过早“失忆”的概率。 - 尝试 Mixtral 8x7B(如 dolphin-mixtral:8x7b),用户反馈该模型对 CrewAI 任务兼容性相对较好。
- 如条件允许,考虑使用 GPT-4 替代本地模型——该错误在 OpenAI API 上未复现。
- (注意:本 Issue 为社区求助帖,开发者并未提供官方补丁;未来可能通过微调专用 agent 模型来缓解此问题。)
验证方法
运行相同的 Agent 任务,观察是否不再输出 Invalid Format: Missing 'Action:' after 'Thought 错误,并能在迭代限制或时间限制内返回有效任务输出。

![[Bug]: KeyError: 'answer'](https://www.chat-gpts.plus/wp-content/uploads/2026/07/10212-17c7886c-768x403.jpg)
![[Question]: Elasticsearch Docker Container aways Starting in RAGFlow Deployment](https://www.chat-gpts.plus/wp-content/uploads/2026/07/11569-e0d2ec60-768x403.jpg)
![[Question]: An error occurred when calling the agent through the API in version v0.22.1](https://www.chat-gpts.plus/wp-content/uploads/2026/07/11619-2da891d6-768x403.jpg)