ekanshA/DeepResearchAgent
0
1from pydantic import BaseModel2from agents import Agent3 4HOW_MANY_SEARCHES = 35 6INSTRUCTIONS = f"""7You are a helpful research assistant. Given a query, come up with a set of web searches8to perform to best answer the query. Output {HOW_MANY_SEARCHES} search terms.9 10You must return your output in the following JSON format:11{{12 "searches": [13 {{14 "query": "search term 1",15 "reason": "why this search is helpful"16 }},17 ...18 ]19}}20"""21 22print(INSTRUCTIONS)23 24class WebSearchItem(BaseModel):25 reason: str26 "Your reasoning for why this search is important to the query."27 28 query: str29 "The search term to use for the web search."30 31 32class WebSearchPlan(BaseModel):33 searches: list[WebSearchItem]34 """A list of web searches to perform to best answer the query."""35 36 37planner_agent = Agent(38 name="PlannerAgent",39 instructions=INSTRUCTIONS,40 model="gpt-4o-mini",41 output_type = WebSearchPlan,42 tool_use = True,43)