@@ -41,8 +41,7 @@ async def agent(state: AgentState) -> dict[str, Any]:
4141 if len (tool_results ) == 0 :
4242 return {
4343 "messages" : [
44- "[Agent] I need weather data. "
45- "Calling get_weather for San Francisco."
44+ "[Agent] I need weather data. Calling get_weather for San Francisco."
4645 ]
4746 }
4847 elif len (tool_results ) == 1 :
@@ -56,9 +55,7 @@ async def agent(state: AgentState) -> dict[str, Any]:
5655 facts = "; " .join (tool_results )
5756 return {
5857 "messages" : ["[Agent] I have all the information I need." ],
59- "final_answer" : (
60- f"Here's what I found about San Francisco: { facts } "
61- ),
58+ "final_answer" : (f"Here's what I found about San Francisco: { facts } " ),
6259 }
6360
6461
@@ -67,15 +64,9 @@ async def tools(state: AgentState) -> dict[str, Any]:
6764 last_msg = state ["messages" ][- 1 ]
6865
6966 if "get_weather" in last_msg :
70- return {
71- "messages" : ["[Tool] Weather in San Francisco: 72°F and sunny." ]
72- }
67+ return {"messages" : ["[Tool] Weather in San Francisco: 72°F and sunny." ]}
7368 elif "get_population" in last_msg :
74- return {
75- "messages" : [
76- "[Tool] San Francisco population: ~870,000 residents."
77- ]
78- }
69+ return {"messages" : ["[Tool] San Francisco population: ~870,000 residents." ]}
7970 else :
8071 return {"messages" : ["[Tool] Unknown tool requested." ]}
8172
0 commit comments