import os import yaml from smolagents import OpenAIServerModel, CodeAgent, DuckDuckGoSearchTool, VisitWebpageTool model = OpenAIServerModel( model_id="claude-3-5-haiku-20241022", api_base="https://api.anthropic.com/v1/", api_key=os.environ["ANTROPHIC_API_KEY"], ) agent = CodeAgent( model=model, tools=[DuckDuckGoSearchTool(), VisitWebpageTool()], max_steps=10, additional_authorized_imports=["time", "numpy", "pandas"] ) class BasicAgent: def __init__(self): print("BasicAgent initialized.") def __call__(self, question: str) -> str: print(f"Agent received question (first 50 chars): {question[:50]}...") answer = agent.run(question) print(f"Agent returning answer: {answer}") return answer