Planning Example
Walk through a complete planning example from goal definition to execution plan.
8 min•By Priygop Team•Updated 2026
End-to-End Planning Example
End-to-End Planning Example
# Complete planning example: Weekly Sales Report Agent
from datetime import datetime
def create_weekly_report_plan(recipient_email: str, week: str) -> dict:
"""
Full plan for generating and delivering a weekly sales report.
"""
return {
"plan_id": f"PLAN-{datetime.now().strftime('%Y%m%d-%H%M')}",
"goal": f"Generate and deliver weekly sales report for week {week}",
"estimated_steps": 8,
"max_steps": 15,
"phases": [
{
"phase": 1,
"name": "Data Collection",
"steps": [
{"id": "P1S1", "action": "query_database",
"args": {"table": "sales", "week": week},
"description": "Pull sales data for the week"},
{"id": "P1S2", "action": "query_database",
"args": {"table": "customers", "week": week},
"description": "Pull customer acquisition data",
"depends_on": []}, # Can run in parallel with P1S1
]
},
{
"phase": 2,
"name": "Analysis",
"depends_on_phase": 1,
"steps": [
{"id": "P2S1", "action": "calculate_metrics",
"args": {"sales_data": "{{P1S1.result}}",
"customer_data": "{{P1S2.result}}"},
"description": "Calculate KPIs: revenue, growth, top products"},
]
},
{
"phase": 3,
"name": "Report Generation",
"depends_on_phase": 2,
"steps": [
{"id": "P3S1", "action": "create_report",
"args": {"metrics": "{{P2S1.result}}", "week": week},
"description": "Generate formatted PDF report"},
]
},
{
"phase": 4,
"name": "Delivery",
"depends_on_phase": 3,
"steps": [
{"id": "P4S1", "action": "send_email",
"args": {"to": [recipient_email],
"subject": f"Weekly Sales Report — {week}",
"attachment": "{{P3S1.result}}"},
"description": "Email report to recipient",
"requires_approval": False, # Auto-send for weekly reports
}
]
}
]
}
plan = create_weekly_report_plan("ceo@example.com", "2024-W03")
total_steps = sum(len(p["steps"]) for p in plan["phases"])
print(f"Plan: {plan['goal']}")
print(f"Phases: {len(plan['phases'])}, Total steps: {total_steps}")