""" id: deep_research title: Deep Research Orchestrator author: admin description: Search → fetch → scrape → summarize across top results; stores pages to /data/adaptai/web/pages and returns structured findings. version: 0.1.0 license: Proprietary """ from typing import List, Dict, Any class Tools: def run(self, query: str, max_results: int = 5, fetch_chars: int = 2000) -> dict: from open_webui.utils.plugin import load_tool_module_by_id web, _ = load_tool_module_by_id("web_search") http, _ = load_tool_module_by_id("http") scraper, _ = load_tool_module_by_id("scraper") res = web.search(query=query, max_results=max_results) hits: List[Dict[str, Any]] = [] for item in res.get("results", [])[:max_results]: url = item.get("url") try: page = http.get(url=url) ext = scraper.extract(html_text=page.get("stdout", ""), url=url) hits.append( { "title": ext.get("title") or item.get("title"), "url": url, "summary": (ext.get("text") or "")[:fetch_chars], } ) except Exception as e: hits.append({"title": item.get("title"), "url": url, "error": str(e)}) return {"query": query, "hits": hits}