Running a multi-turn agent with tool calls on a DeepSeek thinking model (deepseek-v4-flash via langchain-deepseek's ChatDeepSeek, built with createagent). The first turn succeeded, but the second turn raised openai.BadRequestError: Error code: 400 with {'error': {'message': 'The `reasoningcontent` in the thinking mode must be passed back to the API.', 'type': 'invalidrequesterror'}}. LangChain dropped reasoningcontent, which lives in AIMessage.additionalkwargs, when serializing messages into the request payload, so the API rejected the follow-up request.
DeepSeek multi-turn agent 400 error: The `reasoning_content` in the thinking mode must be passed back to the API
- DeepSeekorganization
- deepseek-v4-flashproduct
- langchain-deepseeklibrary
- DeepSeek APIservice
- LangChainlibrary
- AIMessagelibrary
- +4 more
A maintainer re-tested this live against the current DeepSeek API and confirmed the 400 no longer reproduces: multi-turn agent loops with tool calling now succeed on deepseek-v4-flash / deepseek-v4-pro with or without reasoningcontent in the payload. It was provider-side behavior that DeepSeek changed, and their current docs say reasoningcontent should be excluded, so the community patch that echoed it back is no longer needed. The fix is to upgrade with pip install -U "langchain-deepseek>=1.1.0". If it still happens on the latest version, open a new issue with a reproducible example. Source: https://github.com/langchain-ai/langchain/issues/37178