[FEATURE]The latest version of DeepSeek is incompatible with reasoning_content.
Feature Area
Core functionality
Is your feature request related to a an existing bug? Please link it here.
LLM Call Failed │
│ Error: OpenAI API call failed: Error code: 400 - {'error': {'message': 'The reasoning_content in the thinking mode │
│ must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
[CrewAIEventsBus] Warning: Event pairing mismatch. 'llm_call_failed' closed 'agent_execution_started' (expected
'llm_call_started')
ERROR:crewai.flow.flow:Error executing listener call_llm_native_tools: Error code: 400 - {'error': {'message': 'The reasoning_content in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
The latest version of DeepSeek has added DeepSeek-V4-Flash and DeepSeek-V4-Pro. In the thinking mode, in addition to the "content" parameter, it will also return the "reasoning_content" parameter. Currently, this may not be compatible.
Describe the solution you'd like
Hope to achieve better compatibility with the return type of deepseek
Describe alternatives you've considered
No response
Additional context
No response
Willingness to Contribute
I can test the feature once it's implemented
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This is still broken on current main (ae7e4dc, v1.15.48), and with the current DeepSeek models it now fails every tool loop, not just some.
DeepSeek's thinking mode is on by default for deepseek-flash and deepseek-v4-pro. When a request includes tools, the API requires every earlier assistant message to carry its reasoning_content; otherwise it returns 400 (https://api-docs.deepseek.com/guides/thinking_mode). crewAI never sends it back. reasoning_content does not appear anywhere in lib/crewai/src/crewai.
Repro, offline: LLM(model="deepseek/deepseek-flash", base_url=<local stub>), one agent with one @tool, and a stub that answers turn 1 with reasoning_content plus a tool call. These are the messages crewAI sends on the second request:
request 1: [system, user] tools=yes tool_choice=auto
request 2: [system, user, assistant, tool] tools=yes tool_choice=auto
assistant.reasoning_content = None <- DeepSeek returns 400 here
This happens with both stream=False and stream=True. The real API answers request 2 with a 400 error, so any crew that uses tools with a current DeepSeek model fails on its first tool call. The fix is to keep reasoning_content from the response, both the non-streaming message and the streamed deltas, and send it back on that assistant message. Earlier attempts were #5879 and #5880. Could this be reopened?