From 3e671b86ad302c2ac1c6e6a60d7191348182882a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=9A=D1=83=D1=82?= =?UTF-8?q?=D0=BB=D0=B0=D1=85=D0=BC=D0=B5=D1=82=D0=BE=D0=B2?= Date: Tue, 26 May 2026 01:26:32 +0000 Subject: [PATCH] Add tools.py --- tools.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tools.py diff --git a/tools.py b/tools.py new file mode 100644 index 0000000..b3d5900 --- /dev/null +++ b/tools.py @@ -0,0 +1,20 @@ +import requests + +from virtual_file_system import VirtualFileSystem + +# Web search tool: fetch DuckDuckGo search results page + +def web_search(query: str) -> str: + """Search the web for the given query using DuckDuckGo. + + Returns the raw HTML of the search results page. + """ + url = f"https://duckduckgo.com/html/?q={query}" + try: + response = requests.get(url, timeout=10) + response.raise_for_status() + return response.text + except Exception as e: + return f"Error during web search: {e}" + +# File system tools will be wrapped in agent.py with access to a VirtualFileSystem instance.