Skip to content

docs(config.example): Claude example silently disables thinking when copied to Claude 4 #2336

@MidasAssessoria

Description

@MidasAssessoria

Summary

The commented Claude example in config.example.yaml:73-82 pairs when_thinking_enabled: { thinking: { type: enabled } } with Claude 3.5 Sonnet but does not include supports_thinking: true. This is coherent for 3.5 (which has no extended thinking), but it's an easy trap when a user copies the block and just swaps the model name to claude-sonnet-4 / claude-opus-4: the model silently runs without thinking.

Why it's silent

packages/harness/deerflow/models/factory.py:48-50 raises ValueError only in direct calls:

if thinking_enabled and has_thinking_settings:
    if not model_config.supports_thinking:
        raise ValueError(f"Model {name} does not support thinking. ...")

But in the normal LangGraph flow, packages/harness/deerflow/agents/lead_agent/agent.py:296-298 intercepts first:

if thinking_enabled and not model_config.supports_thinking:
    logger.warning("... fallback to non-thinking mode.")
    thinking_enabled = False

So the user only sees a warning buried in logs; the model runs without thinking and they never find out they're paying for a thinking-capable model without using thinking.

Additional detail

Per Anthropic's Extended Thinking docs, budget_tokens is required when thinking.type == "enabled" — there is no API default. The current example omits it, which would fail at runtime the moment a user did set supports_thinking: true and sent a request.

Suggested fix

Replace the commented block with a Claude 4 example that shows the full correct set:

# Example: Anthropic Claude model (with extended thinking)
# - name: claude-sonnet-4
#   display_name: Claude Sonnet 4
#   use: langchain_anthropic:ChatAnthropic
#   model: claude-sonnet-4-20250514
#   api_key: $ANTHROPIC_API_KEY
#   max_tokens: 8192
#   supports_vision: true
#   supports_thinking: true      # REQUIRED for Claude 4+ to actually use thinking
#   when_thinking_enabled:
#     thinking:
#       type: enabled
#       budget_tokens: 4096       # REQUIRED by Anthropic API when type=enabled (min 1024, must be < max_tokens)

Optionally also add a warning log at boot when a model has when_thinking_enabled.thinking.type == "enabled" but supports_thinking=False, so misconfig is visible even in the lead-agent fallback path.

Environment

  • DeerFlow HEAD 43ef369
  • Observed during independent code review; not a runtime crash, but a silent cost/quality issue.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions