hermes - ✅(Solved) Fix [Bug]: Tool calls not parsed correctly with DeepSeek-V4 [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#15453Fetched 2026-04-25 06:22:40
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×1cross-referenced ×1subscribed ×1

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

PR fix notes

PR #15473: fix: parse DeepSeek-V4 DSML tool calls from response content (#15453)

Description (problem / solution / changelog)

Fixes #15453

When using DeepSeek-V4 as the backend model, tool calls are output in DSML (DeepSeek Markup Language) format as raw text in the response content field instead of being parsed into structured tool_calls. The agent never executes any tools and terminates immediately.

Root Cause

No parser existed for DeepSeek-V4's DSML format. The main agent loop only checks assistant_message.tool_calls (which is empty), treats the raw DSML text as the final response, and terminates.

Fix (3 files)

New: environments/tool_call_parsers/deepseek_v4_parser.py

  • DeepSeekV4ToolCallParser class registered as "deepseek_v4" and "deepseek_dsml"
  • Regex handles both Unicode fullwidth delimiters (<|DSML|...|>) and ASCII pipe variants (< | DSML | ... >)
  • Extracts function name + JSON arguments from DSML tool call blocks
  • Returns (content, tool_calls) tuple following the existing parser interface

Modified: environments/tool_call_parsers/__init__.py

  • Added import of DeepSeekV4ToolCallParser to register it

Modified: run_agent.py

  • Added content-based DSML fallback BEFORE the existing tool_calls check
  • When assistant_message.tool_calls is empty AND content contains DSML markers, invokes the parser
  • Wrapped in try/except to never break the existing flow

Fixes NousResearch/hermes-agent#15453

Changed files

  • environments/tool_call_parsers/__init__.py (modified, +1/-0)
  • environments/tool_call_parsers/deepseek_v4_parser.py (added, +127/-0)
  • run_agent.py (modified, +22/-0)

Code Example

Report      https://paste.rs/8Yb7n
agent.log   https://paste.rs/X9Js9

---

N/A
RAW_BUFFERClick to expand / collapse

Bug Description

When using DeepSeek-V4 as the backend model, tool calls do not execute correctly, whether using Flash or Pro. The output shows unparsed, raw DSML tags < | DSML | tool_calls, the agent does not call any tools, and simply terminates the response.

<img width="1049" height="79" alt="Image" src="https://github.com/user-attachments/assets/91d9e9cd-0ff9-402c-b6f7-2de58fe18102" />

Steps to Reproduce

N/A

Expected Behavior

Tool is called correctly and returns a result. For example, when a web search tool is triggered, the agent should execute the search and display the response

Actual Behavior

Tool call tags appear raw in the output without being executed: < | DSML | tool_calls

Affected Component

Tools (terminal, file ops, web, code execution, etc.)

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

Report      https://paste.rs/8Yb7n
agent.log   https://paste.rs/X9Js9

Operating System

Ubuntu 24.04

Python Version

Python 3.11.6

Hermes Version

v0.11.0 (2026.4.23)

Additional Logs / Traceback (optional)

N/A

Root Cause Analysis (optional)

N/A

Proposed Fix (optional)

N/A

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The issue may be related to incorrect handling of DSML tags in the DeepSeek-V4 backend model, and verifying the model's configuration and the tool call implementation could help resolve the issue.

Guidance

  • Review the DeepSeek-V4 model configuration to ensure it is correctly set up to handle DSML tags and tool calls.
  • Investigate the tool call implementation to verify that it is correctly parsing and executing the DSML tags.
  • Check the debug report and agent.log for any errors or warnings related to DSML tag handling or tool call execution.
  • Consider testing the tool calls with a different backend model to isolate the issue.

Example

No code snippet is provided as the issue lacks specific implementation details.

Notes

The issue may be specific to the DeepSeek-V4 model or the tool call implementation, and further investigation is needed to determine the root cause.

Recommendation

Apply workaround: Verify the model configuration and tool call implementation to ensure correct handling of DSML tags, as the issue may be related to a specific model or implementation detail.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: Tool calls not parsed correctly with DeepSeek-V4 [1 pull requests, 1 comments, 2 participants]