Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

docs(strategies): document create_agent/bind_tools bypass of LLM wrapper think-stripping (#4355)

LearningCircuit413060296749
diff --git a/changelog.d/+agent-path-think-strip-bypass.misc.md b/changelog.d/+agent-path-think-strip-bypass.misc.md
new file mode 100644
index 0000000000..bf1657a217
--- /dev/null
+++ b/changelog.d/+agent-path-think-strip-bypass.misc.md
@@ -0,0 +1 @@
+Document a known limitation: LangGraph `create_agent`/`bind_tools` (in the `langgraph-agent` and `mcp` strategies) resolve to the base LLM via `ProcessingLLMWrapper.__getattr__`, bypassing the wrapper's `<think>`-tag stripping. Added in-code notes at the three call sites. This is a cosmetic leak only (reasoning-model `<think>` blocks may appear in agent output); it does not affect direct `invoke()` calls, which still go through the wrapper.
diff --git a/src/local_deep_research/advanced_search_system/strategies/langgraph_agent_strategy.py b/src/local_deep_research/advanced_search_system/strategies/langgraph_agent_strategy.py
index 3c1a321110..02ee1a94c0 100644
--- a/src/local_deep_research/advanced_search_system/strategies/langgraph_agent_strategy.py
+++ b/src/local_deep_research/advanced_search_system/strategies/langgraph_agent_strategy.py
@@ -345,6 +345,14 @@ def _make_research_subtopic_tool(
if sub_fetch is not None:
sub_tools.append(sub_fetch)
try:
+ # NOTE: create_agent() binds tools to the BASE LLM
+ # (bind_tools resolves via ProcessingLLMWrapper.__getattr__),
+ # bypassing the wrapper's <think>-tag stripping. Reasoning-model
+ # output from this agent loop is NOT think-stripped (cosmetic
+ # leak only; does not crash). Known limitation — see
+ # ProcessingLLMWrapper in config/llm_config.py. Do NOT "fix" by
+ # re-wrapping per call; the proper fix is a Runnable wrapper
+ # subclass so bind_tools stays wrapped.
agent = create_agent(
model=model,
tools=sub_tools,
@@ -648,7 +656,12 @@ class LangGraphAgentStrategy(BaseSearchStrategy):
"citing sources as [1], [2], etc.\n"
)
- # Create agent — may fail if model doesn't support tool calling
+ # Create agent — may fail if model doesn't support tool calling.
+ # NOTE: create_agent() binds tools to the BASE LLM (bind_tools resolves
+ # via ProcessingLLMWrapper.__getattr__), bypassing the wrapper's
+ # <think>-tag stripping. Reasoning-model output from this agent loop is
+ # NOT think-stripped (cosmetic leak only; does not crash). Known
+ # limitation — see ProcessingLLMWrapper in config/llm_config.py.
try:
agent = create_agent(
model=self.model,
diff --git a/src/local_deep_research/advanced_search_system/strategies/mcp_strategy.py b/src/local_deep_research/advanced_search_system/strategies/mcp_strategy.py
index f382a8446c..39cb986f78 100644
--- a/src/local_deep_research/advanced_search_system/strategies/mcp_strategy.py
+++ b/src/local_deep_research/advanced_search_system/strategies/mcp_strategy.py
@@ -791,7 +791,13 @@ class MCPSearchStrategy(BaseSearchStrategy):
f"Built {len(tool_schemas)} tool schemas: {[s['function']['name'] for s in tool_schemas]}"
)
- # Bind tools to model if we have schemas
+ # Bind tools to model if we have schemas.
+ # NOTE: bind_tools resolves to the BASE LLM via
+ # ProcessingLLMWrapper.__getattr__, bypassing the wrapper's <think>-tag
+ # stripping — so reasoning-model output on this tool-calling path is NOT
+ # think-stripped (cosmetic leak only; does not crash). The plain
+ # self.model.invoke() fallback below DOES go through the wrapper. Known
+ # limitation — see ProcessingLLMWrapper in config/llm_config.py.
if tool_schemas:
try:
model_with_tools = self.model.bind_tools(tool_schemas)