langchain · difficulty ◆◆
Standardized reasoning_effort
One knob to tune thinking depth on every provider.
Your model already knows how deep to think. Now you get to say so.
$ model.invoke(msg, reasoning_effort=4000)What it does
reasoning_effort is a new standard parameter on the LangChain chat model interface (langchain-core 1.4.7+). Pass reasoning_effort=<int> to any supported chat model and it controls how much compute the model spends on its internal reasoning chain before answering. Lower values mean faster, cheaper responses; higher values mean longer thought chains and better quality on complex tasks. When unset, the model uses its built-in default.
Why it matters
Before this change every provider had a proprietary knob: xAI Grok used its own parameter, Anthropic had model-specific knobs, OpenAI used o_reasoning_effort, and Fireworks had fireworks_reasoning. Multi-model apps had to write a different code path per vendor. With reasoning_effort standardized, you write one code path and swap the model string to get consistent control over reasoning depth across Grok, Claude, GPT-4o, and Fireworks.
Example
$ grok_fast = init_chat_model("xai:grok-3", temperature=0)
print(grok_fast.invoke("What is 17 × 23? Answer in one sentence.", reasoning_effort=500).content)
claude_deep = init_chat_model("anthropic:claude-sonnet-4-20250514", temperature=0)
print(claude_deep.invoke("What is 17 × 23? Answer in one sentence.", reasoning_effort=4000).content)=== Fast (effort=500) ===
17 × 23 = 391.
=== Deep (effort=4000) ===
17 × 23 = 391. The calculation follows from the distributive property:
17 × 23 = 17 × (20 + 3) = (17 × 20) + (17 × 3) = 340 + 51 = 391.Exact output varies by model. Low effort tends to be direct; high effort often shows step-by-step reasoning.
Common flags
- reasoning_effort=<int>
- Standard chat-model param controlling internal reasoning compute
- init_chat_model("provider:model")
- Universal entry point to initialize any supported chat model
- BaseChatModel.invoke()
- Standard streaming-agnostic invocation accepting reasoning_effort
History
From per-vendor knobs to one standard
PR #38887 added reasoning_effort as a core chat-model parameter. The same feature shipped in langchain-xai 1.3.0, langchain-anthropic 1.5.0, langchain-openai 1.4.0, and langchain-fireworks 1.5.0, making it a genuine cross-cutting improvement rather than a one-package addition.
Fun facts
Pros & cons
pros
- + One code path across providers
- + Cleaner multi-model apps
- + Predictable reasoning depth control
cons
- − Needs langchain-core 1.4.7+
- − Exact behavior varies by model
Takeaways
- 1reasoning_effort is now a standard chat-model parameter.
- 2Lower values = faster and cheaper, higher = deeper.
- 3Write one code path and swap the model string.