~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix(langgraph-agent): honor agent_enabled for non-collection web engines (#5015) (#5087)
S767bedb88d49
diff --git a/changelog.d/5015.bugfix.md b/changelog.d/5015.bugfix.mdnew file mode 100644index 0000000000..5b0108c13d--- /dev/null+++ b/changelog.d/5015.bugfix.md@@ -0,0 +1,7 @@+`langgraph-agent`: per-engine `search.engine.web.<name>.agent_enabled` opt-out now works for non-collection web engines (arxiv, pubmed, searxng, …) in addition to document collections. Previously the filter only saw the flag for collections, so non-collection engines silently defaulted to "available to the agent" — leaving no way to keep an engine enabled for normal/auto searches while excluding it from the research agent's specialized tool list. Flip the new per-engine setting to `false` to drop a specific engine from the `langgraph-agent` tool list without disabling it elsewhere. The setting has no effect on `source-based`, `focused-iteration`, `topic-organization`, or `news` strategies — those use a single primary engine selected by `search.tool` and never iterate the engine registry, so there is nothing analogous to opt out of (use `use_in_auto_search` for non-agent engine visibility). The engine selected as `search.tool` always keeps its generic `web_search` tool — the `agent_enabled` flag only controls which *additional* specialized tools the agent gets, so a user cannot accidentally leave the agent with no search tool at all. Collection behavior from #4453 is unchanged.++The engine candidates that feed the agent's specialized-tool surface are now discovered from `search_config` directly and filtered by `agent_enabled`, credentials, and egress policy — NOT by `use_in_auto_search` (which governs the separate, non-agent `auto` search surface). Previously the helper reused `get_available_engines`, which silently dropped any engine whose `use_in_auto_search=false`, so setting `agent_enabled=true` could not independently expose engines like Tavily or Google PSE (default `use_in_auto_search=false`), and dynamic document collections (which have no `use_in_auto_search` setting) could not reach the agent's tool list at all. The new primitive `search_engines_config.list_eligible_engine_configs` is the canonical candidate pool for any surface that decides visibility through its own flag.++The primary-skip (the `if name == current: continue` that prevents the configured primary from being re-registered as both `web_search` and `search_<engine>`) now uses the canonical engine id resolved through the hardcoded engine registry, instead of the class-derived fallback that historically produced near-misses like `SemanticScholarSearchEngine → "semanticscholar"` instead of canonical `"semantic_scholar"`. Without this, a user who picked `semantic_scholar` as their primary would receive both the generic `web_search` and a redundant `search_semantic_scholar` tool.++Behavior change: `GitHub` now defaults to `agent_enabled=false`. The langgraph research agent will no longer auto-fan-out to GitHub by default. Re-enable per-user via the settings UI (`Available to Research Agent`) if you relied on this — the engine remains available for non-agent `auto` searches. `Wikinews` stays `agent_enabled=true` (kept available because it is a valuable keyless source for recent-event research and shows up in recurring news-oriented workflows using the langgraph strategy).diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.mdindex bee6343b2f..5cad89d9e0 100644--- a/docs/CONFIGURATION.md+++ b/docs/CONFIGURATION.md@@ -214,6 +214,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.cross_engine_max_context_items` | `LDR_SEARCH_CROSS_ENGINE_MAX_CONTEXT_ITEMS` | `30` | Maximum number of search result previews sent to the LLM for relevance ranking during cross-engine filtering. Higher values let the model evaluate more candidates, improving recall at the cost of increased prompt size and latency. | SEARCH || `search.cross_engine_max_results` | `LDR_SEARCH_CROSS_ENGINE_MAX_RESULTS` | `100` | Maximum number of search results to keep after cross-engine filtering. When results from multiple search engines are combined, this limits how many total results are displayed. Higher values show more comprehensive results. | SEARCH || `search.engine.DEFAULT_SEARCH_ENGINE` | `LDR_SEARCH_ENGINE_DEFAULT_SEARCH_ENGINE` | `wikipedia` | Fallback search engine used when the configured engine is unavailable or has errors. | SEARCH |+| `search.engine.web.arxiv.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_ARXIV_AGENT_ENABLED` | `true` | Include ArXiv as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.arxiv.default_params.max_results` | `LDR_SEARCH_ENGINE_WEB_ARXIV_DEFAULT_PARAMS_MAX_RESULTS` | `20` | Maximum number of papers to retrieve from arXiv per search query. | SEARCH || `search.engine.web.arxiv.default_params.sort_by` | `LDR_SEARCH_ENGINE_WEB_ARXIV_DEFAULT_PARAMS_SORT_BY` | `relevance` | How to sort arXiv results: 'relevance' for best match, 'lastUpdatedDate' for recently updated, 'submittedDate' for newest submissions. | SEARCH || `search.engine.web.arxiv.default_params.sort_order` | `LDR_SEARCH_ENGINE_WEB_ARXIV_DEFAULT_PARAMS_SORT_ORDER` | `descending` | Sort order for arXiv results: 'descending' (newest/most relevant first) or 'ascending' (oldest/least relevant first). | SEARCH |@@ -225,6 +226,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.arxiv.strengths` | `LDR_SEARCH_ENGINE_WEB_ARXIV_STRENGTHS` | ``["scientific papers", "academic research", "physics", "computer science", "mathematics", "statistics", "machine learning", "preprints"]`` | Key advantages of arXiv: Free access to preprints, covers physics/math/CS/biology, fast publication of cutting-edge research. | SEARCH || `search.engine.web.arxiv.use_in_auto_search` | `LDR_SEARCH_ENGINE_WEB_ARXIV_USE_IN_AUTO_SEARCH` | `true` | Include ArXiv in auto search mode | SEARCH || `search.engine.web.arxiv.weaknesses` | `LDR_SEARCH_ENGINE_WEB_ARXIV_WEAKNESSES` | ``["non-academic topics", "consumer products", "news", "general information"]`` | Limitations of arXiv: Preprints aren't peer-reviewed, limited to STEM fields, keyword-based search may miss semantic matches. | SEARCH |+| `search.engine.web.brave.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_BRAVE_AGENT_ENABLED` | `true` | Include Brave as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.brave.api_key` | `LDR_SEARCH_ENGINE_WEB_BRAVE_API_KEY` | `` | The Brave API key to use. | SEARCH || `search.engine.web.brave.default_params.region` | `LDR_SEARCH_ENGINE_WEB_BRAVE_DEFAULT_PARAMS_REGION` | `US` | Geographic region code for Brave search results (e.g., 'US', 'UK', 'DE'). | SEARCH || `search.engine.web.brave.default_params.safe_search` | `LDR_SEARCH_ENGINE_WEB_BRAVE_DEFAULT_PARAMS_SAFE_SEARCH` | `true` | Enable safe search filtering for Brave to exclude adult content. | SEARCH |@@ -238,6 +240,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.brave.supports_full_search` | `LDR_SEARCH_ENGINE_WEB_BRAVE_SUPPORTS_FULL_SEARCH` | `true` | Whether Brave supports fetching full webpage content beyond snippets. | SEARCH || `search.engine.web.brave.use_in_auto_search` | `LDR_SEARCH_ENGINE_WEB_BRAVE_USE_IN_AUTO_SEARCH` | `false` | Include Brave search in auto search mode | SEARCH || `search.engine.web.brave.weaknesses` | `LDR_SEARCH_ENGINE_WEB_BRAVE_WEAKNESSES` | ``["requires API key with usage limits", "smaller index than Google"]`` | Limitations of Brave: Smaller index than Google, requires paid API for production use. | SEARCH |+| `search.engine.web.elasticsearch.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_ELASTICSEARCH_AGENT_ENABLED` | `true` | Include Elasticsearch as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.elasticsearch.default_params.api_key` | `LDR_SEARCH_ENGINE_WEB_ELASTICSEARCH_DEFAULT_PARAMS_API_KEY` | `` | API key for Elasticsearch authentication (optional) | SEARCH || `search.engine.web.elasticsearch.default_params.cloud_id` | `LDR_SEARCH_ENGINE_WEB_ELASTICSEARCH_DEFAULT_PARAMS_CLOUD_ID` | `` | Elastic Cloud ID for cloud-hosted Elasticsearch (optional) | SEARCH || `search.engine.web.elasticsearch.default_params.highlight_fields` | `LDR_SEARCH_ENGINE_WEB_ELASTICSEARCH_DEFAULT_PARAMS_HIGHLIGHT_FIELDS` | ``["content", "title"]`` | Fields to highlight in search results (JSON array) | SEARCH |@@ -256,6 +259,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.elasticsearch.supports_full_search` | `LDR_SEARCH_ENGINE_WEB_ELASTICSEARCH_SUPPORTS_FULL_SEARCH` | `true` | Whether this search engine supports full document search | SEARCH || `search.engine.web.elasticsearch.use_in_auto_search` | `LDR_SEARCH_ENGINE_WEB_ELASTICSEARCH_USE_IN_AUTO_SEARCH` | `false` | Include Elasticsearch in auto search mode | SEARCH || `search.engine.web.elasticsearch.weaknesses` | `LDR_SEARCH_ENGINE_WEB_ELASTICSEARCH_WEAKNESSES` | ``["Requires running Elasticsearch instance", "Needs proper index configuration", "Data must be pre-indexed"]`` | Weaknesses of this search engine | SEARCH |+| `search.engine.web.exa.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_EXA_AGENT_ENABLED` | `true` | Include Exa as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.exa.api_key` | `LDR_SEARCH_ENGINE_WEB_EXA_API_KEY` | `` | The Exa API key to use. Get one at exa.ai. | SEARCH || `search.engine.web.exa.default_params.include_full_content` | `LDR_SEARCH_ENGINE_WEB_EXA_DEFAULT_PARAMS_INCLUDE_FULL_CONTENT` | `true` | Include full webpage content in results | SEARCH || `search.engine.web.exa.default_params.search_type` | `LDR_SEARCH_ENGINE_WEB_EXA_DEFAULT_PARAMS_SEARCH_TYPE` | `auto` | Search type - auto (default), neural (semantic), fast, or deep (comprehensive multi-query) | SEARCH |@@ -267,6 +271,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.exa.supports_full_search` | `LDR_SEARCH_ENGINE_WEB_EXA_SUPPORTS_FULL_SEARCH` | `true` | Indicates this engine can fetch full page content after initial search, not just snippets. | SEARCH || `search.engine.web.exa.use_in_auto_search` | `LDR_SEARCH_ENGINE_WEB_EXA_USE_IN_AUTO_SEARCH` | `false` | Include Exa in auto search mode | SEARCH || `search.engine.web.exa.weaknesses` | `LDR_SEARCH_ENGINE_WEB_EXA_WEAKNESSES` | ``["requires API key with usage limits", "newer service still evolving", "costs scale with usage"]`` | Limitations: Requires paid API key with usage limits, newer service with evolving features. | SEARCH |+| `search.engine.web.github.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_GITHUB_AGENT_ENABLED` | `false` | Include GitHub as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.github.api_key` | `LDR_SEARCH_ENGINE_WEB_GITHUB_API_KEY` | `` | GitHub Personal Access Token for API authentication. Without this, you're limited to 10 requests/minute for search API. With authentication, you get 30 requests/minute for search API. | SEARCH || `search.engine.web.github.default_params.include_issues` | `LDR_SEARCH_ENGINE_WEB_GITHUB_DEFAULT_PARAMS_INCLUDE_ISSUES` | `false` | Include recent GitHub issues in repository search results. | SEARCH || `search.engine.web.github.default_params.include_readme` | `LDR_SEARCH_ENGINE_WEB_GITHUB_DEFAULT_PARAMS_INCLUDE_README` | `true` | Fetch and include README content when searching repositories. | SEARCH |@@ -280,6 +285,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.github.supports_full_search` | `LDR_SEARCH_ENGINE_WEB_GITHUB_SUPPORTS_FULL_SEARCH` | `true` | Whether GitHub supports fetching full content (README, code files) beyond basic search results. | SEARCH || `search.engine.web.github.use_in_auto_search` | `LDR_SEARCH_ENGINE_WEB_GITHUB_USE_IN_AUTO_SEARCH` | `true` | Include GitHub in auto search mode | SEARCH || `search.engine.web.github.weaknesses` | `LDR_SEARCH_ENGINE_WEB_GITHUB_WEAKNESSES` | ``["non-technical content", "content outside GitHub", "rate limits without API key"]`` | Limitations of GitHub: Limited to code/technical content, strict rate limits without authentication. | SEARCH |+| `search.engine.web.google_pse.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_GOOGLE_PSE_AGENT_ENABLED` | `true` | Include Google PSE as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.google_pse.api_key` | `LDR_SEARCH_ENGINE_WEB_GOOGLE_PSE_API_KEY` | `` | The Google PSE API key to use. | SEARCH || `search.engine.web.google_pse.default_params.region` | `LDR_SEARCH_ENGINE_WEB_GOOGLE_PSE_DEFAULT_PARAMS_REGION` | `us` | Geographic region for search results (e.g., 'us', 'uk', 'de'). Results prioritized from this region. | SEARCH || `search.engine.web.google_pse.default_params.safe_search` | `LDR_SEARCH_ENGINE_WEB_GOOGLE_PSE_DEFAULT_PARAMS_SAFE_SEARCH` | `true` | Enable Google SafeSearch to filter explicit content from results. | SEARCH |@@ -300,6 +306,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.gutenberg.requires_api_key` | `LDR_SEARCH_ENGINE_WEB_GUTENBERG_REQUIRES_API_KEY` | `false` | Project Gutenberg is free and does not require an API key. | SEARCH || `search.engine.web.gutenberg.strengths` | `LDR_SEARCH_ENGINE_WEB_GUTENBERG_STRENGTHS` | ``["public domain", "full text", "classic literature", "free ebooks", "multiple formats"]`` | Key strengths of Project Gutenberg. | SEARCH || `search.engine.web.gutenberg.weaknesses` | `LDR_SEARCH_ENGINE_WEB_GUTENBERG_WEAKNESSES` | ``["public domain only", "older works", "limited modern titles"]`` | Limitations of Project Gutenberg. | SEARCH |+| `search.engine.web.mojeek.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_MOJEEK_AGENT_ENABLED` | `true` | Include Mojeek as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.mojeek.api_key` | `LDR_SEARCH_ENGINE_WEB_MOJEEK_API_KEY` | `` | The Mojeek API key to use. Get one at mojeek.com/services/api. | SEARCH || `search.engine.web.mojeek.default_params.language` | `LDR_SEARCH_ENGINE_WEB_MOJEEK_DEFAULT_PARAMS_LANGUAGE` | `en` | Language code in ISO 639-1 format for Mojeek language boost (e.g., 'en', 'fr'). | SEARCH || `search.engine.web.mojeek.default_params.region` | `LDR_SEARCH_ENGINE_WEB_MOJEEK_DEFAULT_PARAMS_REGION` | `` | Country code in ISO 3166-1 alpha-2 format for Mojeek region boost (e.g., 'GB', 'US'). | SEARCH |@@ -327,6 +334,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.nasa_ads.strengths` | `LDR_SEARCH_ENGINE_WEB_NASA_ADS_STRENGTHS` | ``["astronomy papers", "astrophysics research", "physics papers", "space science", "planetary science", "cosmology", "high energy physics", "historical papers", "citation tracking", "natural language queries"]`` | List of research areas where NASA ADS excels | SEARCH || `search.engine.web.nasa_ads.weaknesses` | `LDR_SEARCH_ENGINE_WEB_NASA_ADS_WEAKNESSES` | ``["biomedical content", "computer science papers", "social sciences", "humanities", "requires API key for good performance"]`` | List of research areas where NASA ADS has limited coverage | SEARCH || `search.engine.web.openalex` | `LDR_SEARCH_ENGINE_WEB_OPENALEX` | ``{"requires_api_key": false, "requires_llm": true, "description": "Search 250+ million academic papers with natural language queries", "reliability": 0.95}`` | OpenAlex academic search engine configuration | SEARCH |+| `search.engine.web.openalex.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_OPENALEX_AGENT_ENABLED` | `true` | Include OpenAlex as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.openalex.default_params.filter_open_access` | `LDR_SEARCH_ENGINE_WEB_OPENALEX_DEFAULT_PARAMS_FILTER_OPEN_ACCESS` | `false` | Only return open access papers that are freely available | SEARCH || `search.engine.web.openalex.default_params.from_publication_date` | `LDR_SEARCH_ENGINE_WEB_OPENALEX_DEFAULT_PARAMS_FROM_PUBLICATION_DATE` | `` | Only return papers published after this date (YYYY-MM-DD format, leave empty for all dates) | SEARCH || `search.engine.web.openalex.default_params.max_results` | `LDR_SEARCH_ENGINE_WEB_OPENALEX_DEFAULT_PARAMS_MAX_RESULTS` | `25` | Maximum number of results to retrieve from OpenAlex | SEARCH |@@ -373,6 +381,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.pubchem.requires_api_key` | `LDR_SEARCH_ENGINE_WEB_PUBCHEM_REQUIRES_API_KEY` | `false` | PubChem is free and does not require an API key. | SEARCH || `search.engine.web.pubchem.strengths` | `LDR_SEARCH_ENGINE_WEB_PUBCHEM_STRENGTHS` | ``["chemistry", "compounds", "drug information", "molecular properties", "bioactivity"]`` | Key strengths of PubChem. | SEARCH || `search.engine.web.pubchem.weaknesses` | `LDR_SEARCH_ENGINE_WEB_PUBCHEM_WEAKNESSES` | ``["chemistry only", "technical data", "requires chemical knowledge"]`` | Limitations of PubChem. | SEARCH |+| `search.engine.web.pubmed.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_PUBMED_AGENT_ENABLED` | `true` | Include PubMed as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.pubmed.api_key` | `LDR_SEARCH_ENGINE_WEB_PUBMED_API_KEY` | `` | The PubMed API key to use. | SEARCH || `search.engine.web.pubmed.default_params.days_limit` | `LDR_SEARCH_ENGINE_WEB_PUBMED_DEFAULT_PARAMS_DAYS_LIMIT` | `0` | Restrict results to articles published within the last N days. Leave empty for no time restriction. | SEARCH || `search.engine.web.pubmed.default_params.full_text_limit` | `LDR_SEARCH_ENGINE_WEB_PUBMED_DEFAULT_PARAMS_FULL_TEXT_LIMIT` | `3` | Maximum number of full-text articles to download from PubMed Central when get_full_text is enabled. | SEARCH |@@ -417,6 +426,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.scaleserp.strengths` | `LDR_SEARCH_ENGINE_WEB_SCALESERP_STRENGTHS` | ``["1-hour free caching for repeated searches", "High-quality Google search results", "Real-time results with knowledge graph", "Cached searches don't count against quota", "Rich snippets and related questions"]`` | Strengths of this search engine | SEARCH || `search.engine.web.scaleserp.supports_full_search` | `LDR_SEARCH_ENGINE_WEB_SCALESERP_SUPPORTS_FULL_SEARCH` | `true` | Whether this search engine supports full document search | SEARCH || `search.engine.web.scaleserp.weaknesses` | `LDR_SEARCH_ENGINE_WEB_SCALESERP_WEAKNESSES` | ``["Requires API key with usage limits", "Not specialized for academic content", "Cache only lasts 1 hour"]`` | Weaknesses of this search engine | SEARCH |+| `search.engine.web.searxng.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_SEARXNG_AGENT_ENABLED` | `true` | Include SearXNG as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.searxng.default_params.categories` | `LDR_SEARCH_ENGINE_WEB_SEARXNG_DEFAULT_PARAMS_CATEGORIES` | ``["general"]`` | SearXNG search categories to use (general, images, videos, news, music, files, etc.). | SEARCH || `search.engine.web.searxng.default_params.delay_between_requests` | `SEARXNG_DELAY` | `0` | Seconds to wait between SearXNG requests. Set higher values to avoid rate limiting on public instances. | SEARCH || `search.engine.web.searxng.default_params.include_full_content` | `LDR_SEARCH_ENGINE_WEB_SEARXNG_DEFAULT_PARAMS_INCLUDE_FULL_CONTENT` | `true` | Fetch full webpage content for SearXNG results, not just snippets. | SEARCH |@@ -433,6 +443,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.searxng.use_in_auto_search` | `LDR_SEARCH_ENGINE_WEB_SEARXNG_USE_IN_AUTO_SEARCH` | `true` | Include SearXNG in auto search mode | SEARCH || `search.engine.web.searxng.weaknesses` | `LDR_SEARCH_ENGINE_WEB_SEARXNG_WEAKNESSES` | ``["requires self-hosting", "depends on other search engines", "may be rate limited by underlying engines"]`` | Limitations of SearXNG: Requires self-hosting, public instances may have rate limits, result quality varies. | SEARCH || `search.engine.web.semantic_scholar` | `LDR_SEARCH_ENGINE_WEB_SEMANTIC_SCHOLAR` | ``{"requires_api_key": false, "requires_llm": true, "description": "Search millions of academic papers across all scientific fields with AI-powered features", "reliability": 0.9}`` | Semantic Scholar search engine configuration | SEARCH |+| `search.engine.web.semantic_scholar.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_SEMANTIC_SCHOLAR_AGENT_ENABLED` | `true` | Include Semantic Scholar as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.semantic_scholar.api_key` | `LDR_SEARCH_ENGINE_WEB_SEMANTIC_SCHOLAR_API_KEY` | `` | Semantic Scholar API key (optional but recommended for higher rate limits). Get one at https://www.semanticscholar.org/product/api | SEARCH || `search.engine.web.semantic_scholar.default_params.citation_limit` | `LDR_SEARCH_ENGINE_WEB_SEMANTIC_SCHOLAR_DEFAULT_PARAMS_CITATION_LIMIT` | `10` | Maximum number of citations to fetch per paper | SEARCH || `search.engine.web.semantic_scholar.default_params.get_abstracts` | `LDR_SEARCH_ENGINE_WEB_SEMANTIC_SCHOLAR_DEFAULT_PARAMS_GET_ABSTRACTS` | `true` | Fetch full abstracts for papers | SEARCH |@@ -450,6 +461,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.semantic_scholar.strengths` | `LDR_SEARCH_ENGINE_WEB_SEMANTIC_SCHOLAR_STRENGTHS` | ``["AI-powered features", "TLDR summaries", "citation graphs", "semantic search", "all scientific fields", "no API key required", "computer science focus", "paper influence metrics"]`` | Strengths of this search engine | SEARCH || `search.engine.web.semantic_scholar.use_in_auto_search` | `LDR_SEARCH_ENGINE_WEB_SEMANTIC_SCHOLAR_USE_IN_AUTO_SEARCH` | `true` | Include Semantic Scholar in auto search mode | SEARCH || `search.engine.web.semantic_scholar.weaknesses` | `LDR_SEARCH_ENGINE_WEB_SEMANTIC_SCHOLAR_WEAKNESSES` | ``["rate limits without API key", "not all papers have TLDR", "coverage varies by field", "newer papers may be missing"]`` | Weaknesses of this search engine | SEARCH |+| `search.engine.web.serpapi.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_AGENT_ENABLED` | `true` | Include SerpAPI as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.serpapi.api_key` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_API_KEY` | `` | The Serp API key to use. | SEARCH || `search.engine.web.serpapi.default_params.region` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_DEFAULT_PARAMS_REGION` | `us` | Geographic region for search results (e.g., 'us', 'uk'). Results prioritized from this region. | SEARCH || `search.engine.web.serpapi.default_params.safe_search` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_DEFAULT_PARAMS_SAFE_SEARCH` | `true` | Enable safe search to filter explicit content from results. | SEARCH |@@ -477,6 +489,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.serper.strengths` | `LDR_SEARCH_ENGINE_WEB_SERPER_STRENGTHS` | ``["Lightning-fast response times (1-2 seconds)", "Very affordable pricing", "High-quality Google search results", "Real-time results", "Knowledge graph and related searches", "People Also Ask data", "Simple pay-per-use pricing"]`` | Strengths of this search engine | SEARCH || `search.engine.web.serper.supports_full_search` | `LDR_SEARCH_ENGINE_WEB_SERPER_SUPPORTS_FULL_SEARCH` | `true` | Whether this search engine supports full document search | SEARCH || `search.engine.web.serper.weaknesses` | `LDR_SEARCH_ENGINE_WEB_SERPER_WEAKNESSES` | ``["Requires API key with usage limits", "Not specialized for academic content"]`` | Weaknesses of this search engine | SEARCH |+| `search.engine.web.sofya.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_SOFYA_AGENT_ENABLED` | `true` | Include Sofya as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.sofya.api_key` | `LDR_SEARCH_ENGINE_WEB_SOFYA_API_KEY` | `` | The Sofya API key to use. Get yours at https://sofya.co/dashboard (GitHub sign-up grants 1000 free credits/month). | SEARCH || `search.engine.web.sofya.default_params.freshness` | `LDR_SEARCH_ENGINE_WEB_SOFYA_DEFAULT_PARAMS_FRESHNESS` | `null` | Filter results by recency ('day', 'week', 'month', 'year', or null for all time). | SEARCH || `search.engine.web.sofya.default_params.include_full_content` | `LDR_SEARCH_ENGINE_WEB_SOFYA_DEFAULT_PARAMS_INCLUDE_FULL_CONTENT` | `true` | Fetch extracted page content. On uses Sofya 'basic' depth (content, 3 credits); off uses cheaper 'snippets' depth (1 credit). | SEARCH |@@ -499,6 +512,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.stackexchange.requires_api_key` | `LDR_SEARCH_ENGINE_WEB_STACKEXCHANGE_REQUIRES_API_KEY` | `false` | Stack Exchange is free without an API key (300 requests/day). | SEARCH || `search.engine.web.stackexchange.strengths` | `LDR_SEARCH_ENGINE_WEB_STACKEXCHANGE_STRENGTHS` | ``["programming", "Q&A", "code examples", "community moderated", "multiple sites"]`` | Key strengths of Stack Exchange. | SEARCH || `search.engine.web.stackexchange.weaknesses` | `LDR_SEARCH_ENGINE_WEB_STACKEXCHANGE_WEAKNESSES` | ``["technical focus", "rate limited", "Q&A format only"]`` | Limitations of Stack Exchange. | SEARCH |+| `search.engine.web.tavily.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_TAVILY_AGENT_ENABLED` | `true` | Include Tavily as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.tavily.api_key` | `LDR_SEARCH_ENGINE_WEB_TAVILY_API_KEY` | `` | The Tavily API key to use. | SEARCH || `search.engine.web.tavily.default_params.include_full_content` | `LDR_SEARCH_ENGINE_WEB_TAVILY_DEFAULT_PARAMS_INCLUDE_FULL_CONTENT` | `true` | Include full webpage content in results | SEARCH || `search.engine.web.tavily.default_params.search_depth` | `LDR_SEARCH_ENGINE_WEB_TAVILY_DEFAULT_PARAMS_SEARCH_DEPTH` | `basic` | Search depth - basic for speed, advanced for quality | SEARCH |@@ -510,6 +524,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.tavily.supports_full_search` | `LDR_SEARCH_ENGINE_WEB_TAVILY_SUPPORTS_FULL_SEARCH` | `true` | Indicates this engine can fetch full page content after initial search, not just snippets. | SEARCH || `search.engine.web.tavily.use_in_auto_search` | `LDR_SEARCH_ENGINE_WEB_TAVILY_USE_IN_AUTO_SEARCH` | `false` | Include Tavily in auto search mode | SEARCH || `search.engine.web.tavily.weaknesses` | `LDR_SEARCH_ENGINE_WEB_TAVILY_WEAKNESSES` | ``["requires API key with usage limits", "newer service with smaller historical data"]`` | Limitations: Requires paid API key with usage limits, newer service with less historical data coverage. | SEARCH |+| `search.engine.web.tinyfish.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_TINYFISH_AGENT_ENABLED` | `true` | Include Tinyfish as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.tinyfish.api_key` | `LDR_SEARCH_ENGINE_WEB_TINYFISH_API_KEY` | `` | The TinyFish API key to use. Can also be supplied with LDR_SEARCH_ENGINE_WEB_TINYFISH_API_KEY. | SEARCH || `search.engine.web.tinyfish.default_params.fetch_format` | `LDR_SEARCH_ENGINE_WEB_TINYFISH_DEFAULT_PARAMS_FETCH_FORMAT` | `markdown` | Output format for fetched page content. | SEARCH || `search.engine.web.tinyfish.default_params.include_full_content` | `LDR_SEARCH_ENGINE_WEB_TINYFISH_DEFAULT_PARAMS_INCLUDE_FULL_CONTENT` | `true` | Fetch browser-rendered page content for search results. | SEARCH |@@ -524,6 +539,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.tinyfish.supports_full_search` | `LDR_SEARCH_ENGINE_WEB_TINYFISH_SUPPORTS_FULL_SEARCH` | `true` | Whether this search engine can return extracted page content. | SEARCH || `search.engine.web.tinyfish.use_in_auto_search` | `LDR_SEARCH_ENGINE_WEB_TINYFISH_USE_IN_AUTO_SEARCH` | `false` | Include TinyFish in auto search mode | SEARCH || `search.engine.web.tinyfish.weaknesses` | `LDR_SEARCH_ENGINE_WEB_TINYFISH_WEAKNESSES` | ``["requires hosted API key", "external network requests leave the local environment", "fetch latency depends on target page rendering"]`` | Weaknesses of this search engine. | SEARCH |+| `search.engine.web.wayback.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_WAYBACK_AGENT_ENABLED` | `true` | Include Wayback as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.wayback.default_params.closest_only` | `LDR_SEARCH_ENGINE_WEB_WAYBACK_DEFAULT_PARAMS_CLOSEST_ONLY` | `false` | When enabled, only return the snapshot closest to the target date instead of all available snapshots. | SEARCH || `search.engine.web.wayback.default_params.language` | `LDR_SEARCH_ENGINE_WEB_WAYBACK_DEFAULT_PARAMS_LANGUAGE` | `English` | Preferred language for archived content when multiple versions are available. | SEARCH || `search.engine.web.wayback.default_params.max_results` | `LDR_SEARCH_ENGINE_WEB_WAYBACK_DEFAULT_PARAMS_MAX_RESULTS` | `15` | Maximum number of archived snapshots to return per search query. | SEARCH |@@ -537,6 +553,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.wayback.use_in_auto_search` | `LDR_SEARCH_ENGINE_WEB_WAYBACK_USE_IN_AUTO_SEARCH` | `false` | Include Wayback in auto search mode | SEARCH || `search.engine.web.wayback.weaknesses` | `LDR_SEARCH_ENGINE_WEB_WAYBACK_WEAKNESSES` | ``["limited to previously archived content", "may miss recent changes", "archiving quality varies"]`` | Limitations: Only finds previously archived content, may miss recent changes, archive quality varies by site. | SEARCH || `search.engine.web.wikinews.adaptive_search` | `LDR_SEARCH_ENGINE_WEB_WIKINEWS_ADAPTIVE_SEARCH` | `true` | Automatically adjust the search period based on the query type (recent or historical) to improve news search relevance | SEARCH |+| `search.engine.web.wikinews.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_WIKINEWS_AGENT_ENABLED` | `true` | Include Wikinews as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.wikinews.description` | `LDR_SEARCH_ENGINE_WEB_WIKINEWS_DESCRIPTION` | `Search news articles written by volunteers with verified sources` | Human-readable description of the search engine. | SEARCH || `search.engine.web.wikinews.display_name` | `LDR_SEARCH_ENGINE_WEB_WIKINEWS_DISPLAY_NAME` | `Wikinews` | Display name to use in the U.I. for this search engine. | SEARCH || `search.engine.web.wikinews.reliability` | `LDR_SEARCH_ENGINE_WEB_WIKINEWS_RELIABILITY` | `0.85` | Reliability score (0-1). Wikinews rated moderately high (0.85) - volunteer-written but with verified sources. | SEARCH |@@ -544,6 +561,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.wikinews.strengths` | `LDR_SEARCH_ENGINE_WEB_WIKINEWS_STRENGTHS` | ``["recent and historical news", "verified sources", "general coverage", "quick overviews"]`` | Advantages: Recent and historical news coverage, verified sources, general topic coverage, quick overviews. | SEARCH || `search.engine.web.wikinews.use_in_auto_search` | `LDR_SEARCH_ENGINE_WEB_WIKINEWS_USE_IN_AUTO_SEARCH` | `true` | Include Wikinews in auto search mode | SEARCH || `search.engine.web.wikinews.weaknesses` | `LDR_SEARCH_ENGINE_WEB_WIKINEWS_WEAKNESSES` | ``["less coverage of specialized topics", "limited editorial oversight", "variable article quality", "not ideal for breaking news"]`` | Limitations: Less coverage of specialized topics, variable article quality, not ideal for breaking news. | SEARCH |+| `search.engine.web.wikipedia.agent_enabled` | `LDR_SEARCH_ENGINE_WEB_WIKIPEDIA_AGENT_ENABLED` | `true` | Include Wikipedia as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections. | SEARCH || `search.engine.web.wikipedia.default_params.include_content` | `LDR_SEARCH_ENGINE_WEB_WIKIPEDIA_DEFAULT_PARAMS_INCLUDE_CONTENT` | `true` | Include full article content in results, not just titles and summaries. | SEARCH || `search.engine.web.wikipedia.default_params.max_results` | `LDR_SEARCH_ENGINE_WEB_WIKIPEDIA_DEFAULT_PARAMS_MAX_RESULTS` | `20` | Maximum number of Wikipedia articles to return per search query. | SEARCH || `search.engine.web.wikipedia.description` | `LDR_SEARCH_ENGINE_WEB_WIKIPEDIA_DESCRIPTION` | `Search Wikipedia articles` | Human-readable description of the search engine. | SEARCH |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.pyindex 99ade11106..af246dbb92 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@@ -14,7 +14,7 @@ import threadingimport timefrom concurrent.futures import ThreadPoolExecutorfrom datetime import UTC, datetime-from typing import Any, Dict+from typing import Any, Dict, Optionalfrom langchain_core.language_models import BaseChatModelfrom langchain_core.messages import AIMessage@@ -356,7 +356,7 @@ def _load_specialized_engine_tools(egress_context=None,) -> list:"""Load tools for all available specialized search engines, filtered by- egress policy and per-collection ``agent_enabled`` flag.+ egress policy and per-engine ``agent_enabled`` flag.``skip_engine`` names the engine already exposed through the caller'sgeneric ``web_search`` tool, so it isn't double-registered; pass ``None``@@ -377,7 +377,7 @@ def _load_specialized_engine_tools(tools: list = []try:from local_deep_research.web_search_engines.search_engines_config import (- get_available_engines,+ list_eligible_engine_configs,)from local_deep_research.security.egress.policy import (EgressScope,@@ -388,17 +388,34 @@ def _load_specialized_engine_tools(retriever_registry,)- available = get_available_engines(settings_snapshot=settings_snapshot)- for name, config in available.items():+ # Discover the candidate pool INDEPENDENT of ``use_in_auto_search``.+ # The agent's "specialized tool surface" is governed by per-engine+ # ``agent_enabled``, credentials, and egress policy — NOT the+ # auto-search-mode toggle (which controls the non-agent ``auto``+ # search surface only). The two settings were siblings on the same+ # settings UI prior to #5015, but they actually control two+ # different surfaces; conflating them made it impossible to expose+ # Tavily / Google PSE (default ``use_in_auto_search=false``) to the+ # agent without also re-enabling them in the ``auto`` search path.+ # Dynamic ``collection_*`` engines never had a ``use_in_auto_search``+ # setting, so the old path locked them out of the agent entirely+ # — this discovery change restores symmetry with #4453.+ eligible = list_eligible_engine_configs(+ settings_snapshot=settings_snapshot,+ )+ for name, config in eligible.items():if name == skip_engine:continue- # Per-collection usability switch (independent of egress): a- # collection the user marked "not for the research agent" is- # skipped so it never appears in the tool list.+ # Per-engine usability switch (independent of egress). Collection+ # configs carry their DB flag; built-in engines receive the+ # flattened search.engine.web.<name>.agent_enabled setting.+ # Missing flags default to available for backward compatibility.+ # The primary engine was skipped above and remains reachable+ # through the caller's generic web_search tool.if not config.get("agent_enabled", True):logger.debug(- "specialized tool skipped: collection disabled for "+ "specialized tool skipped: engine disabled for ""the research agent",engine=name,)@@ -1002,17 +1019,53 @@ class LangGraphAgentStrategy(BaseSearchStrategy):return 32return value- def _resolve_engine_name(self) -> str:- """Best-effort extraction of the configured engine name."""- # Try settings first+ def _resolve_engine_name(self) -> Optional[str]:+ """Best-effort extraction of the configured engine name.++ Returns a CANONICAL engine id (the same string that+ ``search_config`` / ``engine_registry`` use as a dict key, e.g.+ ``semantic_scholar`` rather than the class-derived+ ``semanticscholar``). The class-name fallback historically returned+ a lowercased, ``SearchEngine``-stripped variant that was almost+ but not quite canonical — e.g. ``DuckDuckGoSearchEngine`` →+ ``"duckduckgo"`` instead of the registry key ``"ddg"``, and+ ``SemanticScholarSearchEngine`` → ``"semanticscholar"`` instead of+ ``"semantic_scholar"``. That mismatch leaked the configured primary+ engine back into the specialised-tools loop as a redundant+ ``search_<engine>`` tool alongside ``web_search``. Reverse-lookup+ via ``ENGINE_REGISTRY`` so both sides of the+ ``if name == skip_engine: continue`` comparison agree on the+ canonical id (#5015 follow-up).++ Returns ``None`` when no canonical id can be derived — callers+ then fall through and the helper's primary-skip never matches+ (which is the only safe behaviour, since the factory would also+ fail to resolve an unknown engine).+ """+ # Try settings first — `search.tool` is already the canonical id+ # the user typed in the UI / env var.tool_setting = self.get_setting("search.tool", None)if tool_setting and isinstance(tool_setting, str):return tool_setting- # Fall back to class name heuristic+ # Fall back to the engine CLASS, but resolve via the registry so+ # we land on the canonical id (``semantic_scholar``,+ # ``ddg``, ...) rather than the class-derived heuristic. The+ # registry is the single source of truth for which Python class+ # implements which canonical id.if self.search is not None and hasattr(self.search, "__class__"):- name = self.search.__class__.__name__- return name.replace("SearchEngine", "").lower()- return "duckduckgo"+ cls_name = self.search.__class__.__name__+ # Lazy import: ``engine_registry`` already lives in the same+ # package tree the strategy uses for ``ENGINE_REGISTRY``+ # construction; keeping it inside the function avoids a+ # ``from . import engine_registry`` cycle at module load.+ from local_deep_research.web_search_engines.engine_registry import (+ ENGINE_REGISTRY,+ )++ for name, entry in ENGINE_REGISTRY.items():+ if entry.class_name == cls_name:+ return name+ return Nonedef _display_tool_name(self, tool_name: str) -> str:"""Return a user-friendly display name for a tool.diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.jsonindex f6ef78ead0..117a79e464 100644--- a/src/local_deep_research/defaults/default_settings.json+++ b/src/local_deep_research/defaults/default_settings.json@@ -346,10 +346,22 @@"min_value": null,"name": "Follow-up Context Mode","options": [- {"label": "Focused summary (LLM)", "value": "summary"},- {"label": "Raw recent findings", "value": "raw"},- {"label": "Full conversation transcript", "value": "full"},- {"label": "None", "value": "none"}+ {+ "label": "Focused summary (LLM)",+ "value": "summary"+ },+ {+ "label": "Raw recent findings",+ "value": "raw"+ },+ {+ "label": "Full conversation transcript",+ "value": "full"+ },+ {+ "label": "None",+ "value": "none"+ }],"step": null,"type": "CHAT",@@ -3487,6 +3499,20 @@"value": true,"visible": true},+ "search.engine.web.pubmed.agent_enabled": {+ "category": "pubmed",+ "description": "Include PubMed as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.arxiv.use_in_auto_search": {"category": "arxiv","description": "Include ArXiv in auto search mode",@@ -3501,6 +3527,20 @@"value": true,"visible": true},+ "search.engine.web.arxiv.agent_enabled": {+ "category": "arxiv",+ "description": "Include ArXiv as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.searxng.use_in_auto_search": {"category": "searxng","description": "Include SearXNG in auto search mode",@@ -3515,6 +3555,20 @@"value": true,"visible": true},+ "search.engine.web.searxng.agent_enabled": {+ "category": "searxng",+ "description": "Include SearXNG as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.github.use_in_auto_search": {"category": "github","description": "Include GitHub in auto search mode",@@ -3529,6 +3583,20 @@"value": true,"visible": true},+ "search.engine.web.github.agent_enabled": {+ "category": "github",+ "description": "Include GitHub as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": false,+ "visible": true+ },"search.engine.web.wikipedia.use_in_auto_search": {"category": "wikipedia","description": "Include Wikipedia in auto search mode",@@ -3543,6 +3611,20 @@"value": true,"visible": true},+ "search.engine.web.wikipedia.agent_enabled": {+ "category": "wikipedia",+ "description": "Include Wikipedia as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.wikinews.use_in_auto_search": {"category": "wikinews","description": "Include Wikinews in auto search mode",@@ -3557,6 +3639,20 @@"value": true,"visible": true},+ "search.engine.web.wikinews.agent_enabled": {+ "category": "wikinews",+ "description": "Include Wikinews as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.brave.use_in_auto_search": {"category": "brave","description": "Include Brave search in auto search mode",@@ -3571,6 +3667,20 @@"value": false,"visible": true},+ "search.engine.web.brave.agent_enabled": {+ "category": "brave",+ "description": "Include Brave as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.google_pse.use_in_auto_search": {"category": "google_pse","description": "Include Google PSE in auto search mode",@@ -3585,6 +3695,20 @@"value": false,"visible": true},+ "search.engine.web.google_pse.agent_enabled": {+ "category": "google_pse",+ "description": "Include Google PSE as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.serpapi.use_in_auto_search": {"category": "serpapi","description": "Include SerpAPI in auto search mode",@@ -3599,6 +3723,20 @@"value": false,"visible": true},+ "search.engine.web.serpapi.agent_enabled": {+ "category": "serpapi",+ "description": "Include SerpAPI as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.wayback.use_in_auto_search": {"category": "wayback","description": "Include Wayback in auto search mode",@@ -3613,6 +3751,20 @@"value": false,"visible": true},+ "search.engine.web.wayback.agent_enabled": {+ "category": "wayback",+ "description": "Include Wayback as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.tavily.display_name": {"category": "tavily","description": "Display name to use in the U.I. for this search engine.",@@ -3779,6 +3931,20 @@"value": false,"visible": true},+ "search.engine.web.tavily.agent_enabled": {+ "category": "tavily",+ "description": "Include Tavily as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.mojeek.display_name": {"category": "mojeek","description": "Display name to use in the U.I. for this search engine.",@@ -3955,6 +4121,20 @@"value": false,"visible": true},+ "search.engine.web.mojeek.agent_enabled": {+ "category": "mojeek",+ "description": "Include Mojeek as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"app.warnings.dismiss_high_context": {"category": "warnings","description": "Permanently hide the warning shown when your local LLM context window is set above 8,192 tokens, which may cause memory issues on some hardware.",@@ -5004,6 +5184,20 @@"value": false,"visible": true},+ "search.engine.web.exa.agent_enabled": {+ "category": "exa",+ "description": "Include Exa as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"backup.enabled": {"category": "backup","description": "Automatically backup database after successful login. Each backup uses disk space proportional to your database size. Disable this if disk space is limited.",diff --git a/src/local_deep_research/defaults/settings/search_engines/elasticsearch.json b/src/local_deep_research/defaults/settings/search_engines/elasticsearch.jsonindex 2e7cac692d..b3e0604435 100644--- a/src/local_deep_research/defaults/settings/search_engines/elasticsearch.json+++ b/src/local_deep_research/defaults/settings/search_engines/elasticsearch.json@@ -270,5 +270,19 @@"ui_element": "checkbox","value": false,"visible": true+ },+ "search.engine.web.elasticsearch.agent_enabled": {+ "category": "elasticsearch",+ "description": "Include Elasticsearch as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true}}diff --git a/src/local_deep_research/defaults/settings/search_engines/sofya.json b/src/local_deep_research/defaults/settings/search_engines/sofya.jsonindex 9f6c9b9ae8..ebc0d2d19d 100644--- a/src/local_deep_research/defaults/settings/search_engines/sofya.json+++ b/src/local_deep_research/defaults/settings/search_engines/sofya.json@@ -219,5 +219,19 @@"ui_element": "checkbox","value": false,"visible": true+ },+ "search.engine.web.sofya.agent_enabled": {+ "category": "sofya",+ "description": "Include Sofya as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true}}diff --git a/src/local_deep_research/defaults/settings/search_engines/tinyfish.json b/src/local_deep_research/defaults/settings/search_engines/tinyfish.jsonindex d5fb1e690c..b5b6d9c4dd 100644--- a/src/local_deep_research/defaults/settings/search_engines/tinyfish.json+++ b/src/local_deep_research/defaults/settings/search_engines/tinyfish.json@@ -207,5 +207,19 @@"ui_element": "checkbox","value": false,"visible": true+ },+ "search.engine.web.tinyfish.agent_enabled": {+ "category": "tinyfish",+ "description": "Include Tinyfish as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true}}diff --git a/src/local_deep_research/defaults/settings_openalex.json b/src/local_deep_research/defaults/settings_openalex.jsonindex 15ac154622..d517f9ae0b 100644--- a/src/local_deep_research/defaults/settings_openalex.json+++ b/src/local_deep_research/defaults/settings_openalex.json@@ -241,5 +241,19 @@"ui_element": "checkbox","value": true,"visible": true+ },+ "search.engine.web.openalex.agent_enabled": {+ "category": "openalex",+ "description": "Include OpenAlex as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true}}diff --git a/src/local_deep_research/defaults/settings_semantic_scholar.json b/src/local_deep_research/defaults/settings_semantic_scholar.jsonindex d8982c6840..c792902daf 100644--- a/src/local_deep_research/defaults/settings_semantic_scholar.json+++ b/src/local_deep_research/defaults/settings_semantic_scholar.json@@ -256,6 +256,20 @@"value": true,"visible": true},+ "search.engine.web.semantic_scholar.agent_enabled": {+ "category": "semantic_scholar",+ "description": "Include Semantic Scholar as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.semantic_scholar.journal_reputation.enabled": {"category": "semantic_scholar","description": "Enable journal quality filtering for this search engine.",diff --git a/src/local_deep_research/web_search_engines/search_engines_config.py b/src/local_deep_research/web_search_engines/search_engines_config.pyindex 0aa9ea5118..7cf2dc7bf8 100644--- a/src/local_deep_research/web_search_engines/search_engines_config.py+++ b/src/local_deep_research/web_search_engines/search_engines_config.py@@ -272,6 +272,63 @@ def search_config(return search_engines+def list_eligible_engine_configs(+ settings_snapshot: Optional[Dict[str, Any]] = None,+ *,+ use_api_key_services: bool = True,+) -> Dict[str, Any]:+ """Return every engine from ``search_config`` that can be instantiated.++ This is the candidate pool for surfaces that decide visibility+ through their own flag (``agent_enabled`` for the langgraph research+ agent) — NOT for surfaces governed by ``use_in_auto_search``. Engines+ that need a key are dropped when no key is set (or when+ ``use_api_key_services`` is False), so callers don't have to repeat the+ credential check; everything else (retrievers, the built-in ``library``+ engine, dynamic ``collection_*`` entries) flows through.++ The name keys the dict are the canonical engine names from+ ``search_config`` (e.g. ``semantic_scholar``, ``ddg``) — matching the+ registry in ``engine_registry.py`` 1:1, so callers can compare against+ ``search.tool`` directly.++ Args:+ settings_snapshot: Thread-safe settings snapshot.+ use_api_key_services: When False, engines that require an API key+ are excluded even when the key is present.++ Returns:+ Dict of engine_name → config for engines that passed the+ credential check.+ """+ if not settings_snapshot:+ logger.warning(+ "list_eligible_engine_configs called without settings_snapshot, "+ "returning empty dict"+ )+ return {}++ all_engines = search_config(settings_snapshot=settings_snapshot)++ eligible: Dict[str, Any] = {}+ for name, config in all_engines.items():+ requires_key = config.get("requires_api_key", False)++ if requires_key and not use_api_key_services:+ continue+ if requires_key:+ api_key = _resolve_api_key(name, config, settings_snapshot)+ if not api_key:+ logger.debug(+ f"Skipping {name} — requires API key but none configured"+ )+ continue++ eligible[name] = config++ return eligible++def get_available_engines(settings_snapshot: Optional[Dict[str, Any]] = None,use_api_key_services: bool = True,@@ -281,9 +338,12 @@ def get_available_engines(Return search engines that are actually usable: enabled for auto-searchand with valid API keys when required.- This is the single shared filter used by the langgraph-agent tool- builder so it agrees with the rest of the system on which engines are- available.+ This is the single shared filter used by ``auto``-mode search so the+ LangGraph agent agrees with the rest of the system on which engines+ show up in non-agent searches. For the agent's specialised tool list,+ use :func:`list_eligible_engine_configs` instead — the agent's surface+ is governed by per-engine ``agent_enabled``, not by this auto-search+ filter (see #5015).Args:settings_snapshot: Thread-safe settings snapshot.@@ -295,19 +355,14 @@ def get_available_engines(Returns:Dict of engine_name → config for engines that passed all checks."""- if not settings_snapshot:- logger.warning(- "get_available_engines called without settings_snapshot, "- "returning empty dict"- )- return {}-- all_engines = search_config(settings_snapshot=settings_snapshot)+ eligible = list_eligible_engine_configs(+ settings_snapshot=settings_snapshot,+ use_api_key_services=use_api_key_services,+ )excluded = set(exclude_engines) if exclude_engines else set()available: Dict[str, Any] = {}-- for name, config in all_engines.items():+ for name, config in eligible.items():if name in excluded:continue@@ -319,21 +374,6 @@ def get_available_engines(if not use_in_auto:continue- requires_key = config.get("requires_api_key", False)-- # Honour the use_api_key_services flag- if requires_key and not use_api_key_services:- continue-- # Validate the API key is actually present- if requires_key:- api_key = _resolve_api_key(name, config, settings_snapshot)- if not api_key:- logger.debug(- f"Skipping {name} — requires API key but none configured"- )- continue-available[name] = configreturn availablediff --git a/tests/security/test_collection_agent_enabled.py b/tests/security/test_collection_agent_enabled.pyindex ec055b22f9..135a7db7da 100644--- a/tests/security/test_collection_agent_enabled.py+++ b/tests/security/test_collection_agent_enabled.py@@ -57,7 +57,7 @@ def _build(available):with (patch("local_deep_research.web_search_engines.search_engines_config"- ".get_available_engines",+ ".list_eligible_engine_configs",return_value=available,),patch(diff --git a/tests/security/test_egress_langgraph_tool_filter.py b/tests/security/test_egress_langgraph_tool_filter.pyindex e4f33519b3..8d9f9cd3d4 100644--- a/tests/security/test_egress_langgraph_tool_filter.py+++ b/tests/security/test_egress_langgraph_tool_filter.py@@ -14,7 +14,7 @@ survive into the built tool list under each scope.The tests drive the REAL ``_build_tools`` loop and the REAL``evaluate_engine`` / ``evaluate_retriever`` PDP. Only the leaf tool factories(``_make_web_search_tool``, ``_make_specialized_search_tool``,-``build_fetch_tool``) and the engine/retriever *discovery* (``get_available_engines``,+``build_fetch_tool``) and the engine/retriever *discovery* (``list_eligible_engine_configs``,``retriever_registry``) are mocked — so every assertion is about the FILTERdecision, made before any tool is actually constructed.@@ -42,11 +42,11 @@ import local_deep_research.advanced_search_system.strategies.langgraph_agent_strfrom local_deep_research.security import clear_active_context-# Engine discovery configs (what get_available_engines would return). The-# inner dicts mirror the real config shape consumed by the loop: description,-# strengths, is_retriever. For static engines the is_public/is_local-# classification is read from the engine CLASS, not from these dicts, so the-# decision under test is the real registry classification.+# Engine discovery configs (what list_eligible_engine_configs would return).+# The inner dicts mirror the real config shape consumed by the loop:+# description, strengths, is_retriever. For static engines the+# is_public/is_local classification is read from the engine CLASS, not from+# these dicts, so the decision under test is the real registry classification._PUBLIC_ENGINE = "arxiv"_PUBLIC_ENGINE_2 = "wikipedia"_PRIVATE_ENGINE = "paperless"@@ -130,7 +130,7 @@ def _build_tool_names(with (patch("local_deep_research.web_search_engines.search_engines_config"- ".get_available_engines",+ ".list_eligible_engine_configs",return_value=available,),patch(diff --git a/tests/security/test_noncollection_agent_enabled.py b/tests/security/test_noncollection_agent_enabled.pynew file mode 100644index 0000000000..dcba5d3b69--- /dev/null+++ b/tests/security/test_noncollection_agent_enabled.py@@ -0,0 +1,513 @@+"""Per-engine ``agent_enabled`` opt-out for NON-collection engines (#5015).++The research-agent tool filter used to honor ``agent_enabled`` only for+document collections: collection loaders wrote the value onto the engine+config dict, while non-collection web engines (arxiv, pubmed, …) never got+the key, so the filter silently defaulted to ``True``. A user who wanted to+keep arxiv available for normal ``auto`` searches but exclude it from the+research agent had no working control — the only opt-out was to disable+the engine entirely, which also removed it from non-agent searches.++The fix adds a per-engine settings key,+``search.engine.web.<name>.agent_enabled`` (default ``True``). The+``_extract_per_engine_config`` helper in ``search_engines_config.py``+already flattens every ``search.engine.web.<name>.*`` setting into the+engine's config dict, so the original+``config.get("agent_enabled", True)`` check in+``LangGraphAgentStrategy._build_tools`` sees the new value with no extra+code path. Collection behavior from #4453 is unchanged (the loader writes+the DB column onto the same dict).++Drives the REAL ``LangGraphAgentStrategy._build_tools`` loop; only the leaf+tool factories and engine discovery are mocked, so every assertion is about+the FILTER decision (which engine names survive into the built tool list).+"""++from __future__ import annotations++from contextlib import contextmanager+from types import SimpleNamespace+from unittest.mock import MagicMock, patch++import pytest++import local_deep_research.advanced_search_system.strategies.langgraph_agent_strategy as strat # noqa: E501+from local_deep_research.security import clear_active_context++[email protected](autouse=True)+def _clear_ctx():+ clear_active_context()+ yield+ clear_active_context()+++@contextmanager+def _patched_factories():+ """Sentinel-tagged factories so we can name-check both the built tools+ AND the factory calls (the filter ``continue``s before construction, so a+ successful exclusion must leave ``_make_specialized_search_tool``+ untouched for the filtered engine)."""+ spec = MagicMock(+ side_effect=lambda name, *a, **k: SimpleNamespace(name=name)+ )+ with (+ patch.object(+ strat,+ "_make_web_search_tool",+ lambda *a, **k: SimpleNamespace(name="web_search"),+ ),+ patch.object(strat, "build_fetch_tool", lambda *a, **k: None),+ patch.object(strat, "_make_specialized_search_tool", spec),+ ):+ yield spec+++def _engine(name: str, *, agent_enabled=True, is_public=True):+ """Mirror the real ``search_config`` shape for a non-collection engine.++ In production the dict is produced by+ ``_extract_per_engine_config`` in ``search_engines_config.py``, which+ flattens every ``search.engine.web.<name>.*`` setting into the engine's+ config — so ``agent_enabled`` IS present and reflects the snapshot value+ (or the JSON default when no override is set).+ """+ return {+ "is_public": is_public,+ "is_local": not is_public,+ "is_retriever": False,+ "description": f"{name} engine",+ "strengths": ["example"],+ "agent_enabled": agent_enabled,+ }+++def _build(available, *, snapshot_extra=None):+ """Construct a minimal strategy and return ``(tool_names, factory_mock)``.++ ``policy.egress_scope=both`` so a non-collection public engine is allowed+ by egress, leaving ``agent_enabled`` as the only differentiator — the+ fix isolates the new switch from the egress machinery.++ ``self.search`` is a bare ``MagicMock`` so+ ``_get_current_engine_name()`` returns ``"magicmock"`` — no engine in+ ``available`` matches that, so the ``if name == current: continue`` skip+ never fires and every entry in ``available`` is actually evaluated by+ the agent_enabled filter. The primary-engine carve-out has its own+ dedicated test that patches ``_get_current_engine_name``.+ """+ snapshot = {+ "policy.egress_scope": "both",+ "search.fetch.mode": "disabled",+ }+ if snapshot_extra:+ snapshot.update(snapshot_extra)+ reg = MagicMock()+ reg.get_metadata.return_value = None+ with _patched_factories() as spec:+ with (+ patch(+ "local_deep_research.web_search_engines.search_engines_config"+ ".list_eligible_engine_configs",+ return_value=available,+ ),+ patch(+ "local_deep_research.web_search_engines.retriever_registry"+ ".retriever_registry",+ reg,+ ),+ ):+ strategy = strat.LangGraphAgentStrategy(+ model=MagicMock(),+ search=MagicMock(),+ citation_handler=object(),+ include_sub_research=False,+ settings_snapshot=snapshot,+ )+ tools = strategy._build_tools("overall query")+ return {t.name for t in tools}, spec+++# -- The bug from #5015 ------------------------------------------------------+++def test_bug_5015_arxiv_setting_false_excludes_from_agent():+ """arxiv with ``agent_enabled=False`` must not appear as a specialized+ agent tool. Regression of #5015."""+ names, spec = _build({"arxiv": _engine("arxiv", agent_enabled=False)})+ assert "arxiv" not in names, (+ "arxiv with agent_enabled=False must not appear as a specialized "+ "agent tool (regression of #5015)"+ )+ # The factory was never invoked for arxiv (filter continues before+ # construction), proving the exclusion happens upstream of the tool+ # build, not after.+ assert "arxiv" not in {c.args[0] for c in spec.call_args_list}+++def test_bug_5015_pubmed_setting_false_excludes_from_agent():+ """Same fix, different engine — proves the path is generic, not+ arxiv-specific."""+ names, spec = _build({"pubmed": _engine("pubmed", agent_enabled=False)})+ assert "pubmed" not in names+ assert "pubmed" not in {c.args[0] for c in spec.call_args_list}+++# -- Existing-behavior preservation ------------------------------------------+++def test_default_true_keeps_engine_available():+ """An engine whose ``agent_enabled`` defaulted to True (via the JSON+ defaults) stays in the agent's tool list. Existing users see no change+ unless they opt out."""+ names, _ = _build({"arxiv": _engine("arxiv", agent_enabled=True)})+ assert "arxiv" in names+++def test_missing_key_defaults_to_available():+ """An engine whose config dict has no ``agent_enabled`` key defaults to+ True — preserves prior behavior for retrievers and any engine the loader+ forgets to set the flag on. Pins the explicit ``.get(..., True)``+ default."""+ cfg = _engine("arxiv")+ del cfg["agent_enabled"]+ names, _ = _build({"arxiv": cfg})+ assert "arxiv" in names+++# -- Independence from egress / other engines --------------------------------+++def test_setting_is_per_engine_independent():+ """Disabling arxiv must NOT take pubmed down with it — the flag is+ scoped to the engine name."""+ names, _ = _build(+ {+ "arxiv": _engine("arxiv", agent_enabled=False),+ "pubmed": _engine("pubmed", agent_enabled=True),+ },+ )+ assert "arxiv" not in names+ assert "pubmed" in names+++def test_setting_independent_of_egress_scope():+ """The flag is a usability switch, orthogonal to egress. Under+ ``public_only`` (which would normally allow public engines like arxiv),+ an explicit ``agent_enabled=False`` on the engine dict must still drop+ arxiv."""+ names, _ = _build(+ {"arxiv": _engine("arxiv", agent_enabled=False, is_public=True)},+ snapshot_extra={"policy.egress_scope": "public_only"},+ )+ assert "arxiv" not in names+++# -- search.tool primary-engine carve-out -----------------------------------+++def test_primary_engine_stays_reachable_via_web_search_when_disabled():+ """The engine selected as ``search.tool`` always wins: even with+ ``agent_enabled=False`` it must remain reachable via the agent's generic+ ``web_search`` tool (the one specialised tool the agent always gets for+ its primary engine). Otherwise a user could accidentally leave the+ agent with no search tool at all. Pinned by PR #5087 — the setting is a+ carve-out, not an override of the primary selection.++ Also asserts the primary engine is NEVER added as a specialized tool+ (the ``if name == current: continue`` skip), which is the existing+ mechanism that makes the carve-out work today.+ """+ reg = MagicMock()+ reg.get_metadata.return_value = None+ with _patched_factories() as spec:+ with (+ patch(+ "local_deep_research.web_search_engines.search_engines_config"+ ".list_eligible_engine_configs",+ return_value={+ "arxiv": _engine("arxiv", agent_enabled=False),+ },+ ),+ patch(+ "local_deep_research.web_search_engines.retriever_registry"+ ".retriever_registry",+ reg,+ ),+ ):+ strategy = strat.LangGraphAgentStrategy(+ model=MagicMock(),+ search=MagicMock(),+ citation_handler=object(),+ include_sub_research=False,+ settings_snapshot={+ "policy.egress_scope": "both",+ "search.fetch.mode": "disabled",+ "search.tool": "arxiv",+ },+ )+ assert strategy._search_engine_name == "arxiv"+ tools = strategy._build_tools("overall query")+ names = {t.name for t in tools}+ assert "web_search" in names, (+ "Primary engine must remain reachable via web_search even when its "+ "agent_enabled is False — see PR #5087"+ )+ assert "arxiv" not in names, (+ "Primary engine is never added as a specialized tool — that path "+ "is reserved for ADDITIONAL engines"+ )+ assert "arxiv" not in {c.args[0] for c in spec.call_args_list}+++# -- Collection path still wins (#4453 regression guard) --------------------+++def test_collection_db_flag_still_wins_over_missing_setting():+ """The collection loader writes ``agent_enabled`` onto the config dict+ from the DB column. That path is the original #4453 behavior and must+ not regress — a collection whose dict says ``agent_enabled=False`` is+ excluded, even when no per-engine JSON default is involved.+ """+ coll_cfg = _engine("arxiv")+ coll_cfg["agent_enabled"] = False+ names, _ = _build({"collection_x": coll_cfg})+ assert "collection_x" not in names+++# -- End-to-end via the real search_config ----------------------------------+++def test_end_to_end_snapshot_overrides_propagate_to_filter():+ """End-to-end check: the real ``search_config`` pipeline reads+ ``search.engine.web.<name>.agent_enabled`` from the settings snapshot+ via ``_extract_per_engine_config`` and the result reaches the agent's+ filter — no manual snapshot fallback needed in ``_build_tools``.+ """+ from local_deep_research.web_search_engines.search_engines_config import (+ search_config,+ )++ snapshot = {+ "policy.egress_scope": "both",+ "search.fetch.mode": "disabled",+ # Real-format values: dicts with "value" key, like a DB row.+ "search.engine.web.arxiv.agent_enabled": {+ "value": False,+ "ui_element": "checkbox",+ },+ "search.engine.web.arxiv.use_in_auto_search": {+ "value": True,+ "ui_element": "checkbox",+ },+ "search.engine.web.pubmed.agent_enabled": {+ "value": True,+ "ui_element": "checkbox",+ },+ "search.engine.web.pubmed.use_in_auto_search": {+ "value": True,+ "ui_element": "checkbox",+ },+ }+ cfg = search_config(settings_snapshot=snapshot)+ assert cfg["arxiv"].get("agent_enabled") is False, (+ "search_config did not propagate the snapshot's "+ "search.engine.web.arxiv.agent_enabled=False into the engine dict"+ )+ assert cfg["pubmed"].get("agent_enabled") is True++ reg = MagicMock()+ reg.get_metadata.return_value = None+ with _patched_factories() as spec:+ with (+ patch(+ "local_deep_research.web_search_engines.search_engines_config"+ ".list_eligible_engine_configs",+ return_value=cfg,+ ),+ patch(+ "local_deep_research.web_search_engines.retriever_registry"+ ".retriever_registry",+ reg,+ ),+ ):+ strategy = strat.LangGraphAgentStrategy(+ model=MagicMock(),+ search=MagicMock(),+ citation_handler=object(),+ include_sub_research=False,+ settings_snapshot=snapshot,+ )+ tools = strategy._build_tools("overall query")+ names = {t.name for t in tools}+ assert "arxiv" not in names+ assert "arxiv" not in {c.args[0] for c in spec.call_args_list}+ assert "pubmed" in names+++def test_end_to_env_var_string_coerced_through_snapshot_pipeline():+ """Env-var-backed overrides land in the snapshot as raw strings. The+ full pipeline — ``get_typed_setting_value`` inside+ ``get_setting_from_snapshot`` — must coerce ``"false"`` to a real bool+ before the value reaches the agent's filter. End-to-end check that this+ survives without a manual ``to_bool`` fallback in ``_build_tools``.+ """+ from local_deep_research.web_search_engines.search_engines_config import (+ search_config,+ )++ snapshot = {+ "policy.egress_scope": "both",+ "search.fetch.mode": "disabled",+ "search.engine.web.arxiv.agent_enabled": {+ "value": "false", # raw env-var string+ "ui_element": "checkbox",+ },+ "search.engine.web.arxiv.use_in_auto_search": {+ "value": True,+ "ui_element": "checkbox",+ },+ }+ cfg = search_config(settings_snapshot=snapshot)+ assert cfg["arxiv"].get("agent_enabled") is False, (+ "Pipeline must coerce env-var 'false' string to a real bool before "+ "the filter sees it"+ )++ names, _ = _build(cfg)+ assert "arxiv" not in names+++# -- Discovery independence (#5015 follow-up) ----------------------------+#+# Production path the previous review noted was masked: the helper used to+# pull candidates from ``get_available_engines``, which silently drops every+# engine with ``use_in_auto_search=false`` -- so an engine the user toggled+# ``agent_enabled=true`` on could still be invisible to the agent if it was+# disabled for ``auto`` searches. Symmetrically, dynamic ``collection_*``+# engines never register a ``use_in_auto_search`` setting, which defaulted+# them out of the agent entirely (collections can ONLY opt in via their+# dedicated DB column, not via the per-engine ``agent_enabled`` setting).+++def test_engine_with_use_in_auto_search_false_reachable_via_agent():+ """``agent_enabled=true`` must independently expose Tavily to the agent+ even when ``use_in_auto_search=false``. Previously the helper reused+ ``get_available_engines``, so Tavily never entered the candidate pool+ and the agent silently kept its old, smaller tool list -- the user had+ no working surface to flip a single switch.++ Pins the discovery independence: the two settings control two+ different surfaces, and ``agent_enabled`` cannot be silently gated by+ ``use_in_auto_search``. (#5015 review follow-up.)+ """+ # Tavily is a public-only engine that needs an API key. The toggle+ # under test is purely the ``agent_enabled`` / ``use_in_auto_search``+ # split, so any unrelated validation noise is fixed by the dict shape+ # itself.+ tavily_cfg = _engine("tavily", agent_enabled=True)+ # Mark it as if the user had opted out of ``auto``-search visibility+ # while still wanting it on the agent's surface -- the entire point.+ tavily_cfg["requires_api_key"] = False+ tavily_cfg["is_public"] = True++ names, spec = _build({"tavily": tavily_cfg})+ assert "tavily" in names, (+ "agent_enabled=true must expose the engine to the agent even when "+ "use_in_auto_search=false -- the two flags control independent "+ "surfaces (see #5015 follow-up)"+ )+ assert "tavily" in {c.args[0] for c in spec.call_args_list}+++def test_collection_engine_reachable_via_agent_without_use_in_auto_search():+ """Dynamic ``collection_*`` engines have no ``use_in_auto_search``+ setting at all, so the old ``get_available_engines`` discovery+ defaulted them out of the agent (the boolean defaults to ``False``).+ With the new ``list_eligible_engine_configs`` discovery, a collection+ whose loader wrote ``agent_enabled=True`` onto its config dict is+ reachable -- but the per-collection DB column stays the canonical+ ``off-switch`` (a collection with ``agent_enabled=False`` is still+ excluded even when ``use_in_auto_search`` would let it through).+ """+ collection_cfg = _engine(+ "collection_curated", agent_enabled=True, is_public=True+ )+ # Mirror the real collection shape -- the loader tags it with+ # ``is_local`` inverted from ``is_public`` and a few strengths.+ collection_cfg["is_local"] = False++ names, spec = _build({"collection_curated": collection_cfg})+ assert "collection_curated" in names, (+ "Dynamic collections registered through search_config() now flow "+ "into the agent's candidate pool -- they previously never "+ "appeared because they lack a use_in_auto_search setting."+ )+ assert "collection_curated" in {c.args[0] for c in spec.call_args_list}+++# -- Canonical primary-skip (#5015 follow-up) ----------------------------+#+# The primary-skip is the only thing that prevents the configured primary+# engine from being registered as both ``web_search`` and+# ``search_<engine>``. It used to compare canonical names against the+# class-derived fallback of ``_resolve_engine_name`` -- e.g.+# ``SemanticScholarSearchEngine`` -> ``semanticscholar``, not+# ``semantic_scholar`` -- so the skip missed by an underscore and the+# user ended up with BOTH tools.+++def test_canonical_primary_skip_uses_settings_value_not_class_heuristic():+ """When ``search.tool=semantic_scholar``, the canonical name on the+ helper's ``skip_engine`` argument must be ``semantic_scholar`` -- so+ the helper skips ``search_semantic_scholar`` and only ``web_search``+ (backed by the same primary) is exposed. The legacy class-derived+ fallback produced ``semanticscholar`` and the skip missed, so the+ agent received the redundant ``search_semantic_scholar`` tool.+ """+ reg = MagicMock()+ reg.get_metadata.return_value = None+ with _patched_factories() as spec:+ with (+ patch(+ "local_deep_research.web_search_engines.search_engines_config"+ ".list_eligible_engine_configs",+ return_value={+ "semantic_scholar": _engine(+ "semantic_scholar", agent_enabled=False+ ),+ },+ ),+ patch(+ "local_deep_research.web_search_engines.retriever_registry"+ ".retriever_registry",+ reg,+ ),+ ):+ strategy = strat.LangGraphAgentStrategy(+ model=MagicMock(),+ search=MagicMock(),+ citation_handler=object(),+ include_sub_research=False,+ settings_snapshot={+ "policy.egress_scope": "both",+ "search.fetch.mode": "disabled",+ "search.tool": "semantic_scholar",+ },+ )+ assert strategy._search_engine_name == "semantic_scholar"+ tools = strategy._build_tools("overall query")+ names = {t.name for t in tools}+ # Primary reachable via web_search (carve-out from #5015).+ assert "web_search" in names+ # But NOT as a redundant specialized tool -- the canonical skip+ # matched the canonical key in the dict.+ assert "semantic_scholar" not in names, (+ "Primary engine must be skipped from the specialized-tools loop. "+ "If this fires the helper is comparing canonical registry names "+ "against the class-derived fallback -- the regression fixed by "+ "the registry reverse-lookup in _resolve_engine_name."+ )+ # And the factory was never invoked for it either -- the skip+ # happens before construction.+ assert "semantic_scholar" not in {c.args[0] for c in spec.call_args_list}diff --git a/tests/settings/golden_master_settings.json b/tests/settings/golden_master_settings.jsonindex 80fae065cd..0af0244fec 100644--- a/tests/settings/golden_master_settings.json+++ b/tests/settings/golden_master_settings.json@@ -2750,6 +2750,20 @@"value": "wikipedia","visible": true},+ "search.engine.web.arxiv.agent_enabled": {+ "category": "arxiv",+ "description": "Include ArXiv as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.arxiv.default_params.max_results": {"category": "arxiv","description": "Maximum number of papers to retrieve from arXiv per search query.",@@ -2940,6 +2954,20 @@],"visible": true},+ "search.engine.web.brave.agent_enabled": {+ "category": "brave",+ "description": "Include Brave as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.brave.api_key": {"category": "brave","description": "The Brave API key to use.",@@ -3132,6 +3160,20 @@],"visible": true},+ "search.engine.web.elasticsearch.agent_enabled": {+ "category": "elasticsearch",+ "description": "Include Elasticsearch as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.elasticsearch.default_params.api_key": {"category": "elasticsearch","description": "API key for Elasticsearch authentication (optional)",@@ -3404,6 +3446,20 @@],"visible": true},+ "search.engine.web.exa.agent_enabled": {+ "category": "exa",+ "description": "Include Exa as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.exa.api_key": {"category": "exa","description": "The Exa API key to use. Get one at exa.ai.",@@ -3574,6 +3630,20 @@],"visible": true},+ "search.engine.web.github.agent_enabled": {+ "category": "github",+ "description": "Include GitHub as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": false,+ "visible": true+ },"search.engine.web.github.api_key": {"category": "github","description": "GitHub Personal Access Token for API authentication. Without this, you're limited to 10 requests/minute for search API. With authentication, you get 30 requests/minute for search API.",@@ -3784,6 +3854,20 @@],"visible": true},+ "search.engine.web.google_pse.agent_enabled": {+ "category": "google_pse",+ "description": "Include Google PSE as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.google_pse.api_key": {"category": "google_pse","description": "The Google PSE API key to use.",@@ -4066,6 +4150,20 @@],"visible": true},+ "search.engine.web.mojeek.agent_enabled": {+ "category": "mojeek",+ "description": "Include Mojeek as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.mojeek.api_key": {"category": "mojeek","description": "The Mojeek API key to use. Get one at mojeek.com/services/api.",@@ -4492,6 +4590,20 @@},"visible": false},+ "search.engine.web.openalex.agent_enabled": {+ "category": "openalex",+ "description": "Include OpenAlex as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.openalex.default_params.filter_open_access": {"category": "openalex","description": "Only return open access papers that are freely available",@@ -5157,6 +5269,20 @@],"visible": true},+ "search.engine.web.pubmed.agent_enabled": {+ "category": "pubmed",+ "description": "Include PubMed as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.pubmed.api_key": {"category": "pubmed","description": "The PubMed API key to use.",@@ -5803,6 +5929,20 @@],"visible": false},+ "search.engine.web.searxng.agent_enabled": {+ "category": "searxng",+ "description": "Include SearXNG as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.searxng.default_params.categories": {"category": "searxng","description": "SearXNG search categories to use (general, images, videos, news, music, files, etc.).",@@ -6063,6 +6203,20 @@},"visible": false},+ "search.engine.web.semantic_scholar.agent_enabled": {+ "category": "semantic_scholar",+ "description": "Include Semantic Scholar as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.semantic_scholar.api_key": {"category": "semantic_scholar","description": "Semantic Scholar API key (optional but recommended for higher rate limits). Get one at https://www.semanticscholar.org/product/api",@@ -6315,6 +6469,20 @@],"visible": true},+ "search.engine.web.serpapi.agent_enabled": {+ "category": "serpapi",+ "description": "Include SerpAPI as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.serpapi.api_key": {"category": "serpapi","description": "The Serp API key to use.",@@ -6735,6 +6903,20 @@],"visible": false},+ "search.engine.web.sofya.agent_enabled": {+ "category": "sofya",+ "description": "Include Sofya as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.sofya.api_key": {"category": "sofya","description": "The Sofya API key to use. Get yours at https://sofya.co/dashboard (GitHub sign-up grants 1000 free credits/month).",@@ -7082,6 +7264,20 @@],"visible": true},+ "search.engine.web.tavily.agent_enabled": {+ "category": "tavily",+ "description": "Include Tavily as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.tavily.api_key": {"category": "tavily","description": "The Tavily API key to use.",@@ -7248,6 +7444,20 @@],"visible": true},+ "search.engine.web.tinyfish.agent_enabled": {+ "category": "tinyfish",+ "description": "Include Tinyfish as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.tinyfish.api_key": {"category": "tinyfish","description": "The TinyFish API key to use. Can also be supplied with LDR_SEARCH_ENGINE_WEB_TINYFISH_API_KEY.",@@ -7457,6 +7667,20 @@],"visible": true},+ "search.engine.web.wayback.agent_enabled": {+ "category": "wayback",+ "description": "Include Wayback as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.wayback.default_params.closest_only": {"category": "wayback","description": "When enabled, only return the snapshot closest to the target date instead of all available snapshots.",@@ -7649,6 +7873,20 @@"value": true,"visible": true},+ "search.engine.web.wikinews.agent_enabled": {+ "category": "wikinews",+ "description": "Include Wikinews as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.wikinews.description": {"category": "wikinews","description": "Human-readable description of the search engine.",@@ -7757,6 +7995,20 @@],"visible": true},+ "search.engine.web.wikipedia.agent_enabled": {+ "category": "wikipedia",+ "description": "Include Wikipedia as a specialized tool for the langgraph research agent. The engine selected as `search.tool` always keeps its generic web_search tool — this flag only controls additional specialized tools. Independent of egress; the per-collection 'available to the research agent' toggle still wins for collections.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Available to Research Agent",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": true,+ "visible": true+ },"search.engine.web.wikipedia.default_params.include_content": {"category": "wikipedia","description": "Include full article content in results, not just titles and summaries.",diff --git a/tests/settings/test_settings_defaults_integrity.py b/tests/settings/test_settings_defaults_integrity.pyindex 9552ffeea3..b6e51c017d 100644--- a/tests/settings/test_settings_defaults_integrity.py+++ b/tests/settings/test_settings_defaults_integrity.py@@ -663,7 +663,54 @@ class TestSettingsDefaultsIntegrity:f"{len(errors)} reverse type mismatch(es):\n" + "\n".join(errors))- # -- Test 12: Snapshot values match typed get_setting -------------------+ # -- Test 12: agent_enabled / use_in_auto_search parity -----------------++ def test_agent_enabled_parity_with_use_in_auto_search(self, defaults):+ """Every engine with ``use_in_auto_search`` must also have a paired+ ``agent_enabled`` default, and vice versa. The two flags are siblings+ — ``use_in_auto_search`` controls visibility in non-agent searches,+ ``agent_enabled`` controls visibility as a specialised tool for the+ langgraph research agent (#5015). A future engine added with one+ but not the other would either silently leak into the agent's tool+ list (no ``agent_enabled`` defaults to True) or be invisible there+ (no ``use_in_auto_search`` defaults to False). Pin them together so+ adding an engine requires thinking about both.+ """+ prefix = "search.engine.web."+ only_in_auto = []+ only_agent = []+ engine_names = set()+ for key in defaults:+ if not key.startswith(prefix):+ continue+ tail = key[len(prefix) :]+ parts = tail.split(".")+ if len(parts) < 2:+ continue+ engine = parts[0]+ leaf = parts[1]+ engine_names.add(engine)+ if leaf == "use_in_auto_search":+ only_in_auto.append(engine)+ elif leaf == "agent_enabled":+ only_agent.append(engine)++ only_in_auto_set = set(only_in_auto) - set(only_agent)+ only_agent_set = set(only_agent) - set(only_in_auto)+ problems = []+ if only_in_auto_set:+ problems.append(+ "engines with use_in_auto_search but missing agent_enabled: "+ + ", ".join(sorted(only_in_auto_set))+ )+ if only_agent_set:+ problems.append(+ "engines with agent_enabled but missing use_in_auto_search: "+ + ", ".join(sorted(only_agent_set))+ )+ assert not problems, "\n".join(problems)++ # -- Test 13: Snapshot values match typed get_setting -------------------def test_snapshot_values_match_get_setting(self, defaults):"""Snapshot values must equal get_setting() typed values for every key."""diff --git a/tests/strategies/test_langgraph_agent_strategy.py b/tests/strategies/test_langgraph_agent_strategy.pyindex 8f6966f919..a8c11107f3 100644--- a/tests/strategies/test_langgraph_agent_strategy.py+++ b/tests/strategies/test_langgraph_agent_strategy.py@@ -328,7 +328,23 @@ class TestLangGraphAgentStrategy:mock_search = MagicMock()mock_search.__class__.__name__ = "DuckDuckGoSearchEngine"strategy = self._make_strategy(search=mock_search, settings_snapshot={})- assert strategy._search_engine_name == "duckduckgo"+ # Registry reverse-lookup yields the canonical id (``ddg``),+ # NOT the class-derived ``duckduckgo`` the previous heuristic+ # produced — that mismatch let ``search_duckduckgo`` slip into+ # the agent's specialized tool list alongside ``web_search`` when+ # DuckDuckGo was the configured primary.+ assert strategy._search_engine_name == "ddg"++ def test_engine_name_semantic_scholar_resolves_to_canonical(self):+ """``SemanticScholarSearchEngine`` -> ``semantic_scholar`` (canonical),+ not ``semanticscholar`` (class-derived). Without this lookup the+ helper's primary-skip misses by one underscore and the user ends+ up with both ``web_search`` and ``search_semantic_scholar`` (#5015+ follow-up after the original review)."""+ mock_search = MagicMock()+ mock_search.__class__.__name__ = "SemanticScholarSearchEngine"+ strategy = self._make_strategy(search=mock_search, settings_snapshot={})+ assert strategy._search_engine_name == "semantic_scholar"def test_display_tool_name_web_search_uses_curated_engine_name(self):"""``web_search`` renders the configured engine through the curated@@ -1516,7 +1532,7 @@ class TestEgressScopeFiltering:# PRIVATE_ONLY: the collection survives (it's local).strat_priv = self._make_strategy(scope="private_only")with patch(- "local_deep_research.web_search_engines.search_engines_config.get_available_engines",+ "local_deep_research.web_search_engines.search_engines_config.list_eligible_engine_configs",return_value=self._FIXTURE_AVAILABLE,):priv_names = self._tool_names(@@ -1529,7 +1545,7 @@ class TestEgressScopeFiltering:# PUBLIC_ONLY: the collection is filtered (local data stays local).strat_pub = self._make_strategy(scope="public_only")with patch(- "local_deep_research.web_search_engines.search_engines_config.get_available_engines",+ "local_deep_research.web_search_engines.search_engines_config.list_eligible_engine_configs",return_value=self._FIXTURE_AVAILABLE,):pub_names = self._tool_names(@@ -1547,7 +1563,7 @@ class TestEgressScopeFiltering:"""strategy = self._make_strategy(scope="strict")with patch(- "local_deep_research.web_search_engines.search_engines_config.get_available_engines",+ "local_deep_research.web_search_engines.search_engines_config.list_eligible_engine_configs",return_value=self._FIXTURE_AVAILABLE,):tools = strategy._build_tools(overall_query="q")@@ -1573,7 +1589,7 @@ class TestEgressScopeFiltering:"""strategy = self._make_strategy(scope="private_only")with patch(- "local_deep_research.web_search_engines.search_engines_config.get_available_engines",+ "local_deep_research.web_search_engines.search_engines_config.list_eligible_engine_configs",return_value=self._FIXTURE_AVAILABLE,):tools = strategy._build_tools(overall_query="q")@@ -1601,7 +1617,7 @@ class TestEgressScopeFiltering:"""strategy = self._make_strategy(scope="public_only")with patch(- "local_deep_research.web_search_engines.search_engines_config.get_available_engines",+ "local_deep_research.web_search_engines.search_engines_config.list_eligible_engine_configs",return_value=self._FIXTURE_AVAILABLE,):tools = strategy._build_tools(overall_query="q")@@ -1630,7 +1646,7 @@ class TestEgressScopeFiltering:"""strategy = self._make_strategy(scope="both")with patch(- "local_deep_research.web_search_engines.search_engines_config.get_available_engines",+ "local_deep_research.web_search_engines.search_engines_config.list_eligible_engine_configs",return_value=self._FIXTURE_AVAILABLE,):tools = strategy._build_tools(overall_query="q")@@ -1687,7 +1703,7 @@ class TestEgressScopeFiltering:with (loguru_caplog.at_level("INFO"),patch(- "local_deep_research.web_search_engines.search_engines_config.get_available_engines",+ "local_deep_research.web_search_engines.search_engines_config.list_eligible_engine_configs",return_value=self._FIXTURE_AVAILABLE,),):diff --git a/tests/strategies/test_langgraph_subagent_specialized_engines.py b/tests/strategies/test_langgraph_subagent_specialized_engines.pyindex be428c6abe..99d36cb531 100644--- a/tests/strategies/test_langgraph_subagent_specialized_engines.py+++ b/tests/strategies/test_langgraph_subagent_specialized_engines.py@@ -9,8 +9,9 @@ subagents ``web_search`` + ``fetch_content``) did not satisfy:* the subagent tool list includes the specialized engines, so e.g. asubagent researching a medical topic can call ``search_pubmed`` directly;* the specialized-tools list is built ONCE per ``research_subtopic`` call- rather than per subtopic, so ``get_available_engines`` (which hits the- per-user DB) runs once even when the lead agent fans out to ``MAX_SUBTOPICS``;+ rather than per subtopic, so ``list_eligible_engine_configs`` (which hits+ the per-user DB) runs once even when the lead agent fans out to+ ``MAX_SUBTOPICS``;* the egress policy filter and ``agent_enabled`` gate apply to subagentstoo — not just the lead agent — so a STRICT-scoped run never exposesforbidden tool names to a subagent's LLM.@@ -27,8 +28,8 @@ def _stub_subagent_internals():"""Stub the leaf pieces of subagent setup and return (call_log, tool).- ``call_log["get_available_engines"]`` counts how many times the engine- discovery ran during one ``research_subtopic`` invocation.+ ``call_log["list_eligible_engine_configs"]`` counts how many times the+ engine discovery ran during one ``research_subtopic`` invocation.``specialized_engine_names`` controls what the (stubbed) discoveryreturns so individual tests can pin the egress/agent_enabled filtering;pass ``engine_configs`` instead to control the full per-engine config@@ -40,13 +41,13 @@ def _stub_subagent_internals(for name in specialized_engine_names}call_log = {- "get_available_engines": 0,+ "list_eligible_engine_configs": 0,"create_agent_tool_lists": [],"system_prompts": [],}- def fake_get_available_engines(*_a, **_k):- call_log["get_available_engines"] += 1+ def fake_list_eligible_engine_configs(*_a, **_k):+ call_log["list_eligible_engine_configs"] += 1return engine_configsdef fake_make_specialized_tool(name, *_a, **_k):@@ -73,8 +74,8 @@ def _stub_subagent_internals(),patch.object(strat, "build_fetch_tool", lambda *_a, **_k: None),patch(- "local_deep_research.web_search_engines.search_engines_config.get_available_engines",- fake_get_available_engines,+ "local_deep_research.web_search_engines.search_engines_config.list_eligible_engine_configs",+ fake_list_eligible_engine_configs,),patch("langchain.agents.create_agent", fake_create_agent),)@@ -120,7 +121,7 @@ class TestSubagentSpecializedEngines:assert "research_subtopic" not in tool_namesdef test_specialized_tools_built_once_per_call(self):- # Five subtopics but get_available_engines runs only ONCE.+ # Five subtopics but list_eligible_engine_configs runs only ONCE.call_log, tool, ctx = _stub_subagent_internals(specialized_engine_names=["arxiv", "pubmed"])@@ -129,7 +130,7 @@ class TestSubagentSpecializedEngines:finally:_stop(ctx)- assert call_log["get_available_engines"] == 1, (+ assert call_log["list_eligible_engine_configs"] == 1, ("specialized-engine discovery should run once per ""research_subtopic call, not once per subtopic")