File size: 669 Bytes
ef01a34
 
 
 
 
 
 
cf53e59
 
ef01a34
 
 
 
 
cf53e59
 
 
ef01a34
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import logfire

from pydantic_ai import Agent
from tools.safe_duck import safe_duckduckgo_search_tool
logfire.configure()  
logfire.instrument_pydantic_ai()

class BasicAgent:
    def __init__(self):
        self.agent = Agent(
            "openai:o3-mini",
            tools=[safe_duckduckgo_search_tool()],
            system_prompt="Search DuckDuckGo for the given query and return the results.",
        )

    def __call__(self, question: str) -> str:
        print(f"Agent received question (first 50 chars): {question[:50]}...")
        result = self.agent.run_sync(question).output
        print(f"Agent returning fixed answer: {result}")
        return result