Skip to content

Your lightweight open-source personal agent.

fix(subagent): preserve reasoning_content in assistant messages

lailoo2ffeb9295bdb
diff --git a/nanobot/agent/subagent.py b/nanobot/agent/subagent.py
index f9eda1f8f..308e67d77 100644
--- a/nanobot/agent/subagent.py
+++ b/nanobot/agent/subagent.py
@@ -145,11 +145,19 @@ class SubagentManager:
}
for tc in response.tool_calls
]
- messages.append({
+ assistant_msg: dict[str, Any] = {
"role": "assistant",
"content": response.content or "",
"tool_calls": tool_call_dicts,
- })
+ }
+ # Preserve reasoning_content for providers that require it
+ # (e.g. Deepseek Reasoner mandates this field on every
+ # assistant message when thinking mode is active).
+ if response.reasoning_content is not None:
+ assistant_msg["reasoning_content"] = response.reasoning_content
+ if response.thinking_blocks:
+ assistant_msg["thinking_blocks"] = response.thinking_blocks
+ messages.append(assistant_msg)
# Execute tools
for tool_call in response.tool_calls: