from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool import datetime import requests import pytz import yaml from tools.final_answer import FinalAnswerTool from Gradio_UI import GradioUI from bs4 import BeautifulSoup import subprocess @tool def get_zh_top_news() -> tuple[str, str]: """A tool that retrieves the current top news article's title and URL from www.zerohedge.com. Returns: tuple[str, str]: A tuple containing the article title (str) and its URL (str). """ try: # Use curl to fetch the HTML content result = subprocess.run( ["curl", "-s", "https://www.zerohedge.com"], capture_output=True, text=True, check=True ) html_content = result.stdout print(f"DEBUG: Fetched HTML length: {len(html_content)}") # Debug: Check if content is retrieved # Parse HTML with BeautifulSoup soup = BeautifulSoup(html_content, "html.parser") # Find the first