In my project, I’m using CrewAI to automate the analysis of blood test reports and deliver personalized health recommendations. I’ve set up a multi-agent system with the CrewAI framework that starts by accepting a sample blood test report.
In short CrewAI is a framework for creating multi-agent systems where specialized agents collaborate to achieve complex tasks. It enables efficient teamwork among agents, making it ideal for automation, AI-driven research, and personalized recommendations.
- Medical analyst: This agent analyzes the blood test report, interpreting key health indicators and summarizing them in an understandable format.
- Health Researcher: Using the analysis from the Medical Analyst, this agent searches the internet for relevant health articles that align with the individual’s needs.
- Health Advisor: Based on the analysis and the articles found, this agent provides personalized health recommendations tailored to the individual’s current health status.
- Coordinator: This agent manages the workflow, ensuring that the Medical Analyst, Health Researcher, and Health Advisor work together smoothly and efficiently.
- Analyze Blood Test: The Medical Analyst starts by reviewing the patient's details, then examines and summarizes the provided blood test report. The output includes patient details followed by a simple summary of the blood test findings.
- Search for Articles: The Health Researcher searches for online articles related to the health concerns identified in the blood test summary. The expected output is a collection of articles with URLs and brief descriptions of each.
- Provide Recommendations: The Health Advisor offers personalized health advice based on the blood test summary and the articles found. The output is a comprehensive report with a summary, a table of blood parameter levels, and actionable health tips linked to relevant sources, formatted according to specific guidelines.
- Coordinate Process: The Coordinator oversees the workflow, ensuring that tasks are executed smoothly by the Medical Analyst, Health Researcher, and Health Advisor. The expected output is an organized task flow with combined results from all agents.
Ensure you have Python >=3.10 <=3.13 installed on your system. This project uses Poetry and conda for dependency management and package handling, offering a seamless setup and execution experience.
First, if you haven't already, install Poetry:
pip install poetryNext, navigate to your project directory and install the dependencies:
- First lock the dependencies and then install them:
poetry lockpoetry install-
If you haven't already, install miniconda as per your requirements:
For linux:
curl -o Miniconda3-latest-Linux-x86_64.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda export PATH="$HOME/miniconda/bin:$PATH"
For macOS:
curl -o Miniconda3-latest-MacOSX-x86_64.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh bash Miniconda3-latest-MacOSX-x86_64.sh -b -p $HOME/miniconda export PATH="$HOME/miniconda/bin:$PATH"
For Windows:
curl -o Miniconda3-latest-Windows-x86_64.exe https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe start /wait Miniconda3-latest-Windows-x86_64.exe /InstallationType=JustMe /AddToPath=1 /RegisterPython=0 /S /D=%UserProfile%\Miniconda3 -
Navigate to project's directory and install the dependencies
conda env create --name ${your_env_name} --file environment.yml && conda activate ${your_env_name}
To kickstart your crew of AI agents and begin task execution, run this from the root folder of your project:
$ crewai runor
poetry run blood_sample_agentor
cd src
python -m blood_sample_agent.main ${pdf_path}Replace ${pdf_path} with path of sample report
This command initializes the blood_sample_agent Crew, assembling the agents and assigning them tasks as defined in the configuration.