import os

from crewai import LLM
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
from crewai_tools import (
	EXASearchTool,
	ScrapeWebsiteTool,
	FileReadTool
)






@CrewBase
class LeadGenerationEngineCrew:
    """LeadGenerationEngine crew"""

    
    @agent
    def lead_researcher_prospect_hunter(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["lead_researcher_prospect_hunter"],
            
            
            tools=[				EXASearchTool()],
            reasoning=False,
            max_reasoning_attempts=None,
            inject_date=True,
            allow_delegation=False,
            max_iter=25,
            max_rpm=None,
            
            
            max_execution_time=None,
            llm=LLM(
                model="openai/gpt-4o-mini",
                
                
            ),
            
        )
        
    
    @agent
    def lead_qualifier_data_enrichment_specialist(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["lead_qualifier_data_enrichment_specialist"],
            
            
            tools=[				ScrapeWebsiteTool()],
            reasoning=False,
            max_reasoning_attempts=None,
            inject_date=True,
            allow_delegation=False,
            max_iter=25,
            max_rpm=None,
            
            
            max_execution_time=None,
            llm=LLM(
                model="openai/gpt-4o-mini",
                
                
            ),
            
        )
        
    
    @agent
    def personalization_message_architect(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["personalization_message_architect"],
            
            
            tools=[				FileReadTool()],
            reasoning=False,
            max_reasoning_attempts=None,
            inject_date=True,
            allow_delegation=False,
            max_iter=25,
            max_rpm=None,
            
            
            max_execution_time=None,
            llm=LLM(
                model="openai/gpt-4o-mini",
                
                
            ),
            
        )
        
    

    
    @task
    def research_target_prospects(self) -> Task:
        return Task(
            config=self.tasks_config["research_target_prospects"],
            markdown=False,
            
            
        )
    
    @task
    def qualify_and_enrich_lead_data(self) -> Task:
        return Task(
            config=self.tasks_config["qualify_and_enrich_lead_data"],
            markdown=False,
            
            
        )
    
    @task
    def create_personalized_outreach_messages(self) -> Task:
        return Task(
            config=self.tasks_config["create_personalized_outreach_messages"],
            markdown=False,
            
            
        )
    

    @crew
    def crew(self) -> Crew:
        """Creates the LeadGenerationEngine crew"""

        return Crew(
            agents=self.agents,  # Automatically created by the @agent decorator
            tasks=self.tasks,  # Automatically created by the @task decorator
            process=Process.sequential,
            verbose=True,

            chat_llm=LLM(model="openai/gpt-4o-mini"),
        )


