Preventative healthcare outreach is undergoing a paradigm shift – moving from traditional models of passive care to a data-driven, AI-augmented ecosystem that anticipates and mitigates health risks before they occur. Agentic systems - AI that acts with autonomy, intent and contextual awareness - are transforming how we approach population health. The importance of such systems lies in their potential to reduce the strain on healthcare providers and minimize preventable diseases.
In this blog, we will demonstrate the preventative healthcare outreach agentic system that we built on Hugging Face Spaces using AutoGen agents.
Get Started
The predictive healthcare agentic system combines multiple agents, LLMs, and asynchronous programming to streamline the process of identifying patients who meet specific screening criteria, filter patient data, and generate personalized outreach emails. This system will use model endpoints hosted by Denvr Dataworks on Intel® Gaudi® AI accelerators using an OpenAI-compatible API key.
Agents used in the application are:
- User proxy agent: responsible for passing along the user's preventative healthcare task to the other agents.
- Epidemiologist agent: this disease specialist agent will gather the preventative healthcare task and decide on patient screening criteria.
- Doctor Critic agent: this doctor critic agent reviews the criteria from the epidemiologist and either passes it along or provides corrected criteria. The output will be used to identify patients to screen from the patient data.
- Outreach email: not an agent but still uses an LLM to build the outreach email.
Note: All the agents in the application except for the DoctoCritic Agent are leveraging the Llama-3.3-70B-Instruct model. The DoctoCritic Agent will use the DeepSeek-R1-Distill-Llama-70B model. These model endpoints are hosted on Intel Gaudi AI accelerators and deployed on Denvr Dataworks cloud servers.
Application Workflow
- Define Screening Criteria: First, the user will input the general screening task. This input will be passed to the GroupChatManger, which will coordinate the chatting between agents such as UserProxy Agent, Epidemiologist Agent, and DoctoCritic Agent. Then the UserProxy Agent will start a conversation between the Epidemiologist Agent and the Doctor Critic Agent, which will define the criteria for patient outreach based on the target screening type. The output criteria are age range (e.g., 40–70), gender, and relevant medical history.
- Filter Patients: The output criteria will be passed to another GroupChatManger, which will manage agents such as UserProxy Agent, and Data Analyst Agent. The Data Analyst Agent will filter patient data from a CSV file based on the defined criteria, including age range, gender, and medical conditions. The patient data is synthetically generated. You can find the sample data under data/patients.csv.
- Generate Outreach Emails: The program generates outreach email drafts or filtered patients using LLMs and saves them as text files.
Preventative Healthcare Outreach Agentic System Workflow
How to run the application
There are three different ways to run this application:
- Hugging Face Spaces - Use the sidebar on the left of the application’s user interface with default values or customized agent prompts, upload your own CSV file for patient data, describe the medical screening task and click on “Generate Outreach Emails” to create draft emails to patients.
- Locally on your machine – Run the steps mentioned in the README file to deploy the local version with a Streamlit frontend.
- Using a Python script without any front-end - Add your API key to the OAI_CONFIG_LIST.json file and don't expose your precious API key to the world. You can modify the api_key, model and base_url to the model’s name and endpoint URL that you are using.
To gain additional insights into the architecture of the agentic framework, the OpenAI compatible API for models hosted on cloud servers, and the Streamlit and Hugging Face Spaces front-end elements - watch the Cloud Native Computing Foundation on-demand webinar and check out the README file.
Best Practices while building AI Agents
1. Prompt engineering – design specific, detailed prompts with exact output format examples and test the prompts to control agent behavior.
2. Model selection – Experiment to find which LLMs perform better than others at certain tasks and adjust them accordingly after seeing the results. In this example, for email generation, the meta-llama/Llama-3.3-70B-Instruct model was much more consistent and hallucinated less when compared to the mistralai/Mixtral-8x7B-v0.1 model.
3. Combine Traditional Programming with AI – there are certain tasks that are easier to manage with traditional programming rather than building an agent to do it. For our use case, we wrote a function for getting data consistently from a database with a specified format instead of building an agent. While the strength of LLMs is the ability to creatively generate text, this may be detrimental for well-defined tasks.
Resources
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.