Lead Score Flow
Welcome to the Lead Score Flow project, powered by crewAI. This example demonstrates how you can leverage Flows from crewAI to automate the process of scoring leads, including data collection, analysis, and scoring. By utilizing Flows, the process becomes much simpler and more efficient.
Overview
This flow will guide you through the process of setting up an automated lead scoring system. Here's a brief overview of what will happen in this flow:
-
Load Leads: The flow starts by loading lead data from a CSV file named
leads.csv. -
Score Leads: The
LeadScoreCrewis kicked off to score the loaded leads based on predefined criteria. -
Human in the Loop: The top 3 candidates are presented for human review, allowing for additional feedback or proceeding with writing emails.
-
Write and Save Emails: Emails are generated and saved for all leads, with special attention to the top 3 candidates.
By following this flow, you can efficiently automate the process of scoring leads, leveraging the power of multiple AI agents to handle different aspects of the lead scoring workflow.
Installation
Ensure you have Python >=3.10 <=3.13 installed on your system. First, if you haven't already, install CrewAI:
pip install crewai
Next, navigate to your project directory and install the dependencies:
- First lock the dependencies and then install them:
crewai install
Customizing & Dependencies
Add your OPENAI_API_KEY into the .env file
Add your SERPER_API_KEY into the .env file
To customize the behavior of the lead score flow, you can update the agents and tasks defined in the LeadDataCollectionCrew, LeadAnalysisCrew, and LeadScoringCrew. If you want to adjust the flow itself, you will need to modify the flow in main.py.
-
Agents and Tasks: Modify
src/lead_score_flow/config/agents.yamlto define your agents andsrc/lead_score_flow/config/tasks.yamlto define your tasks. This is where you can customize how lead data is collected, analyzed, and scored. -
Flow Adjustments: Modify
src/lead_score_flow/main.pyto adjust the flow. This is where you can change how the flow orchestrates the different crews and tasks.
Running the Project
To kickstart your crew of AI agents and begin task execution, run this from the root folder of your project:
crewai run
This command initializes the lead_score_flow, assembling the agents and assigning them tasks as defined in your configuration.
When you kickstart the flow, it will orchestrate multiple crews to perform the tasks. The flow will first collect lead data, then analyze the data, score the leads, save the scores to a CSV file, and generate email drafts.
Understanding Your Flow
The lead_score_flow is composed of multiple AI agents, each with unique roles, goals, and tools. These agents collaborate on a series of tasks, defined in config/tasks.yaml, leveraging their collective skills to achieve complex objectives. The config/agents.yaml file outlines the capabilities and configurations of each agent in your flow.
Flow Structure
-
Collect Lead Data: This step collects lead data from various sources.
-
Analyze Lead Data: The
LeadAnalysisCrewis kicked off to analyze the collected lead data. -
Score Leads: The analyzed data is then used to score the leads based on predefined criteria.
-
Save Lead Scores: The lead scores are saved to a CSV file named
lead_scores.csv. -
Write and Save Emails: Emails are generated and saved for all leads, with special attention to the top 3 candidates.
By understanding the flow structure, you can see how multiple crews are orchestrated to work together, each handling a specific part of the lead scoring process. This modular approach allows for efficient and scalable lead scoring automation.
Support
For support, questions, or feedback regarding the Lead Score Flow or crewAI:
- Visit our documentation
- Reach out to us through our GitHub repository
- Join our Discord
- Chat with our docs
Let's create wonders together with the power and simplicity of crewAI.