Bug Description
When using DeepSeek model with thinking mode enabled (e.g., deepseek-v4-pro), the Hermes agent returns a 400 error from the DeepSeek API after the model performs a tool call:
⚠️ 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'}}
Steps to Reproduce
- Configure Hermes with DeepSeek model (e.g.,
deepseek-v4-pro)
- Enable thinking/reasoning mode
- Send a message that triggers a tool call
- Continue the conversation - API returns 400 error
Expected Behavior
The agent should automatically include reasoning_content when replaying messages to the DeepSeek API after tool calls, similar to how it handles Kimi/Moonshot.
Actual Behavior
The _copy_reasoning_content_for_api() method in run_agent.py handles Kimi/Moonshot reasoning requirements but is missing the DeepSeek check. The API response correctly extracts and stores reasoning_content, but it's not being replayed to the API on subsequent calls.
Affected Component
Other, Agent Core (conversation loop, context compression, memory)
Messaging Platform (if gateway-related)
Telegram
Debug Report
Error details:
Error code: 400
Message: The reasoning_content in the thinking mode must be passed back to the API.
API Endpoint: api.deepseek.com
Operating System
Ubuntu 24.04.4 LTS (Linux 6.17.0-22-generic)
Python Version
Python 3.12.3
Hermes Version
Latest (commit: 2e735b52 with fix; parent likely 2026-04-26)
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
The _copy_reasoning_content_for_api() method handles multiple providers:
- Kimi/Moonshot: checks for
api.kimi.com, moonshot.ai, moonshot.cn
- Missing: DeepSeek (
api.deepseek.com)
When DeepSeek model performs tool calls in thinking mode, subsequent API calls must include the reasoning_content field, but the code doesn't handle this for DeepSeek.
Proposed Fix (optional)
In run_agent.py, method _copy_reasoning_content_for_api(), add DeepSeek check:
# DeepSeek thinking mode fix
if base_url_host_matches(self.base_url, "api.deepseek.com") and source_msg.get("tool_calls"):
if not api_msg.get("reasoning_content"):
api_msg["reasoning_content"] = ""
Location: run_agent.py, lines 7510-7512
### Are you willing to submit a PR for this?
- [ ] I'd like to fix this myself and submit a PR
Bug Description
When using DeepSeek model with thinking mode enabled (e.g.,
⚠️ 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'}}
deepseek-v4-pro), the Hermes agent returns a 400 error from the DeepSeek API after the model performs a tool call:Steps to Reproduce
deepseek-v4-pro)Expected Behavior
The agent should automatically include
reasoning_contentwhen replaying messages to the DeepSeek API after tool calls, similar to how it handles Kimi/Moonshot.Actual Behavior
The
_copy_reasoning_content_for_api()method inrun_agent.pyhandles Kimi/Moonshot reasoning requirements but is missing the DeepSeek check. The API response correctly extracts and storesreasoning_content, but it's not being replayed to the API on subsequent calls.Affected Component
Other, Agent Core (conversation loop, context compression, memory)
Messaging Platform (if gateway-related)
Telegram
Debug Report
Error details: Error code: 400 Message: The reasoning_content in the thinking mode must be passed back to the API. API Endpoint: api.deepseek.comOperating System
Ubuntu 24.04.4 LTS (Linux 6.17.0-22-generic)
Python Version
Python 3.12.3
Hermes Version
Latest (commit: 2e735b52 with fix; parent likely 2026-04-26)
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
The
_copy_reasoning_content_for_api()method handles multiple providers:api.kimi.com,moonshot.ai,moonshot.cnapi.deepseek.com)When DeepSeek model performs tool calls in thinking mode, subsequent API calls must include the
reasoning_contentfield, but the code doesn't handle this for DeepSeek.Proposed Fix (optional)
In
run_agent.py, method_copy_reasoning_content_for_api(), add DeepSeek check: