@@ -43,6 +43,17 @@ class PlanningPrompt(Prompt[HikingPlanInput]):
43
43
Complete this specific planning task with detailed, actionable recommendations.
44
44
"""
45
45
46
+ class SummaryInput (BaseModel ):
47
+ """Input for summary generation with task results."""
48
+
49
+ location : str
50
+ duration_days : int
51
+ group_size : int
52
+ skill_level : str
53
+ season : str
54
+ preferences : str
55
+ task_results : str # Compiled task results
56
+
46
57
47
58
class TaskGenerationPrompt (Prompt [HikingPlanInput ]):
48
59
"""Prompt for AI to generate planning tasks."""
@@ -70,7 +81,7 @@ class TaskGenerationPrompt(Prompt[HikingPlanInput]):
70
81
"""
71
82
72
83
73
- class SummaryPrompt (Prompt [HikingPlanInput ]):
84
+ class SummaryPrompt (Prompt [SummaryInput ]):
74
85
"""Prompt for creating final comprehensive summary."""
75
86
76
87
system_prompt = """
@@ -82,22 +93,18 @@ class SummaryPrompt(Prompt[HikingPlanInput]):
82
93
"""
83
94
84
95
user_prompt = """
85
- Create a comprehensive hiking trip plan for:
96
+ Create a comprehensive hiking trip plan based on the completed research:
97
+
98
+ TRIP DETAILS:
86
99
- {{ duration_days }}-day trip in {{ location }}
87
100
- {{ group_size }} {{ skill_level }} hikers
88
101
- Season: {{ season }}
89
102
- Preferences: {{ preferences }}
90
103
91
- Provide a complete plan including:
92
- • Trail routes and difficulty assessments
93
- • Accommodation recommendations near trailheads
94
- • Detailed budget breakdown with costs
95
- • Weather analysis and gear recommendations
96
- • Daily schedule with sunrise/sunset times
97
- • Post-hike activities and relaxation options
98
- • Safety protocols and emergency contacts
104
+ COMPLETED RESEARCH:
105
+ {{ task_results }}
99
106
100
- Make this a step-by-step plan someone could follow immediately .
107
+ Based on this research, provide a complete plan.. .
101
108
"""
102
109
103
110
@@ -229,14 +236,19 @@ async def smart_hiking_planner() -> None:
229
236
print ("\n 🚀 Processing tasks under the hood..." )
230
237
await asyncio .sleep (1 )
231
238
232
- # Process all tasks under the hood (user sees progress, not details)
239
+ # Process all tasks and capture results
240
+ task_results = []
233
241
for task in planning_agent .tasks :
234
242
# Show current progress
235
243
planning_agent .mark_task (task .id , "in-progress" )
236
244
display_task_list (planning_agent , f"Processing: { task .description [:40 ]} ..." )
237
245
238
- # Process task with AI (under the hood)
239
- await planning_agent .run (trip_input )
246
+ # Process task with AI and CAPTURE results
247
+ task_result = await planning_agent .run (trip_input )
248
+ task_results .append ({
249
+ "task" : task .description ,
250
+ "result" : task_result .content if hasattr (task_result , 'content' ) else str (task_result )
251
+ })
240
252
241
253
# Mark as completed
242
254
planning_agent .mark_task (task .id , "done" )
@@ -246,12 +258,29 @@ async def smart_hiking_planner() -> None:
246
258
display_task_list (planning_agent , "All Planning Tasks Completed!" )
247
259
await asyncio .sleep (2 )
248
260
261
+ # Compile task results
262
+ compiled_results = "\n \n " .join ([
263
+ f"TASK: { result ['task' ]} \n RESULT: { result ['result' ]} "
264
+ for result in task_results
265
+ ])
266
+
267
+ # Create summary input with all task results
268
+ summary_input = SummaryInput (
269
+ location = trip_input .location ,
270
+ duration_days = trip_input .duration_days ,
271
+ group_size = trip_input .group_size ,
272
+ skill_level = trip_input .skill_level ,
273
+ season = trip_input .season ,
274
+ preferences = trip_input .preferences ,
275
+ task_results = compiled_results
276
+ )
277
+
249
278
# Generate and stream comprehensive summary
250
279
print ("\n 🎯 Generating comprehensive trip plan..." )
251
280
print ("🤖 AI compiling all research into actionable plan..." )
252
281
await asyncio .sleep (2 )
253
282
254
- # Create summary agent with all gathered information
283
+ # Summary agent now has access to all task research!
255
284
summary_agent = TodoAgent (llm = llm , prompt = SummaryPrompt )
256
285
257
286
# Clear screen for final summary
@@ -262,7 +291,7 @@ async def smart_hiking_planner() -> None:
262
291
print ()
263
292
264
293
# Stream the comprehensive summary
265
- streaming_result = summary_agent .run_streaming (trip_input )
294
+ streaming_result = summary_agent .run_streaming (summary_input )
266
295
267
296
async for chunk in streaming_result :
268
297
if isinstance (chunk , str ):
0 commit comments