from crewai import Task from agents import researcher, analyst, writer def create_tasks(leads_data, service, sender_name, target_audience): research_task = Task( description=f""" Review this list of potential leads for '{target_audience}': {leads_data} For each lead extract and summarize: - Company name - What they do - Who they serve - Their website Return a clean structured list of leads. """, expected_output="A structured list of leads with company name, description, and website", agent=researcher ) analysis_task = Task( description=f""" Using the researched leads, analyze each company. The service being offered is: {service} For each company identify: - Their likely pain points - Why they would benefit from this service - One specific detail that makes them a strong fit Be specific and realistic. """, expected_output="Analysis of each lead with pain points and fit assessment", agent=analyst ) outreach_task = Task( description=f""" Write a personalized outreach message for each lead. Sender name: {sender_name} Service offered: {service} Each message must: - Open by referencing something specific about their business - Clearly explain the value of the service in one sentence - End with a simple low-pressure call to action - Be under 150 words - Feel human and genuine, not salesy Format output as: ## [Company Name] **Website:** [url] **Message:** [outreach message] --- """, expected_output="Personalized outreach messages for each lead formatted cleanly", agent=writer ) return [research_task, analysis_task, outreach_task]