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.

fix: LangGraph agent improvements — citation indices, defaults, error UX (#3317)

LearningCircuitdbb3006f4b3e
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 07baedbd57..c25e9964d1 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
@@ -75,10 +75,12 @@ class SearchResultsCollector:
citation indices are never duplicated.
"""
if not results:
- return len(self._results)
+ return len(self._all_links)
with self._lock:
- start_idx = len(self._results)
+ # Use global offset (all_links) not per-call offset (results)
+ # so that indices are unique across sections in detailed reports.
+ start_idx = len(self._all_links)
for i, raw in enumerate(results):
if not isinstance(raw, dict):
continue
diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.json
index 1460dde30c..89b9e63118 100644
--- a/src/local_deep_research/defaults/default_settings.json
+++ b/src/local_deep_research/defaults/default_settings.json
@@ -461,7 +461,7 @@
"step": 512.0,
"type": "LLM",
"ui_element": "number",
- "value": 4096,
+ "value": 10000,
"visible": true
},
"llm.supports_max_tokens": {
@@ -981,7 +981,7 @@
"step": null,
"type": "SEARCH",
"ui_element": "select",
- "value": "source-based",
+ "value": "langgraph-agent",
"visible": true
},
"search.region": {
diff --git a/src/local_deep_research/error_handling/report_generator.py b/src/local_deep_research/error_handling/report_generator.py
index 74c48062a1..2da06c264d 100644
--- a/src/local_deep_research/error_handling/report_generator.py
+++ b/src/local_deep_research/error_handling/report_generator.py
@@ -385,6 +385,13 @@ We're here to help you get this working:
"- On Linux/Mac: Check folder permissions\n"
"- Delete and recreate the database file if corrupted"
),
+ "does not support tools|tool calling": (
+ "Your current model does not support tool calling, which is required by the **langgraph-agent** strategy.\n\n"
+ "**Try this:**\n"
+ "- **Switch strategy:** Go to Settings → Search Strategy and select **source-based** or **focused-iteration** instead\n"
+ "- **Switch model:** Use a model that supports tool calling (e.g., qwen3, gpt-oss:20b, mistral, llama3.1)\n"
+ "- The langgraph-agent strategy requires models with native tool/function calling support"
+ ),
"Invalid value.*SearXNG|database.*locked": (
"SearXNG configuration or rate limiting issue.\n\n"
"**Try this:**\n"
diff --git a/tests/settings/golden_master_settings.json b/tests/settings/golden_master_settings.json
index 96b9986510..bdff93b89a 100644
--- a/tests/settings/golden_master_settings.json
+++ b/tests/settings/golden_master_settings.json
@@ -974,7 +974,7 @@
"step": 512.0,
"type": "LLM",
"ui_element": "number",
- "value": 4096,
+ "value": 10000,
"visible": true
},
"llm.max_tokens": {
@@ -7469,7 +7469,7 @@
"step": null,
"type": "SEARCH",
"ui_element": "select",
- "value": "source-based",
+ "value": "langgraph-agent",
"visible": true
},
"search.searches_per_section": {
diff --git a/tests/strategies/test_langgraph_agent_strategy.py b/tests/strategies/test_langgraph_agent_strategy.py
index 822ab79272..d7e85ddbf8 100644
--- a/tests/strategies/test_langgraph_agent_strategy.py
+++ b/tests/strategies/test_langgraph_agent_strategy.py
@@ -357,6 +357,34 @@ class TestCitationOffset:
)
assert len(all_links) == 2
+ def test_citation_indices_unique_across_sections(self):
+ """After reset, new results should get globally unique indices
+ (not restart from 1) so detailed report citations don't collide."""
+ strategy = self._make_strategy()
+
+ # Section 1: adds 2 results → indices "1", "2"
+ strategy.collector.add_results(
+ [
+ {"title": "A", "link": "http://a.com", "snippet": "a"},
+ {"title": "B", "link": "http://b.com", "snippet": "b"},
+ ]
+ )
+ assert strategy.all_links_of_system[0]["index"] == "1"
+ assert strategy.all_links_of_system[1]["index"] == "2"
+
+ # Simulate new section: reset per-call state
+ strategy.collector.reset()
+
+ # Section 2: should continue from "3", not restart at "1"
+ strategy.collector.add_results(
+ [
+ {"title": "C", "link": "http://c.com", "snippet": "c"},
+ {"title": "D", "link": "http://d.com", "snippet": "d"},
+ ]
+ )
+ assert strategy.all_links_of_system[2]["index"] == "3"
+ assert strategy.all_links_of_system[3]["index"] == "4"
+
# ---------------------------------------------------------------------------
# Error handling