DEV Community

Mathew Joseph
Mathew Joseph

Posted on

Building a Multi-Agent Medical Analysis System with ADK: A Deep Dive into the Medical Agent

Hey Dev.to community!

I'm thrilled to share the details of a project I've been developing: the Medical Agent. This is a sophisticated AI-powered healthcare analysis system built using the Agent Development Kit (ADK), designed to provide in-depth medical insights through a unique multi-agent architecture.

Overview:

The Medical Agent aims to offer comprehensive and nuanced medical information, aiding in preliminary understanding and research. Instead of a single monolithic AI, it leverages specialized sub-agents, each focusing on a distinct medical domain.

Demo:

Want to see it in action? Check out the demo here:
https://www.youtube.com/watch?v=I0Q0vPWSGPo

Agent Architecture:

Our system employs a hierarchical multi-agent architecture to handle diverse medical inquiries:

Medical Agent (Root): Orchestrates the entire medical inquiry process, delegating tasks to the Sub Agent Coordinator.

Sub Agent Coordinator: Coordinates all specialized sub-agents and synthesizes their outputs into a comprehensive medical overview or report.

Sub-Agents: Each sub-agent is responsible for a specific domain of medical analysis. We have:

  • Cardiology Agent

  • Dermatology Agent

  • Neurology Agent

  • Orthology Agent

  • Psychiatry Agent

  • Pediatrics Agent

  • General Medical Agent (fallback for uncategorized queries)

graph TD
    A[Medical Agent] ---> B[Sub Agent Coordinator]

    B --> C[Cardiology Agent]
    B --> D[Dermatology Agent]
    B --> E[Neurology Agent]
    B --> F[Orthology Agent]
    B --> I[Psychiatry Agent]
    B --> J[Pediatrics Agent]
    B --> G[General Medical Agent]
Enter fullscreen mode Exit fullscreen mode

**

Tools and APIs Used :

**
All sub-agents utilize the gemini-2.0-flash model for their LLM-based reasoning, ensuring powerful and accurate analysis within their respective domains.

**

Key Features :

**
Modular, Multi-Agent Design: Enables specialized medical analysis across various domains.

Domain-Specific Expertise: Each sub-agent focuses on a distinct medical discipline.

Comprehensive Insights: Provides detailed overviews or preliminary research based on user queries.

Assists in Understanding: Designed to help users grasp complex medical topics.

**

Setup and Installation:

**
If you're interested in exploring the code or setting up your own instance, here's a quick guide:

Prerequisites:

Python 3.12+

Google Cloud Project with specific roles (Vertex AI User, Storage Admin, Service Usage Consumer, Logs Viewer)

Google Cloud SDK installed and authenticated (gcloud auth login)

aiplatform.googleapis.com API enabled

**

Agent Setup:

**

Clone the repository: git clone https://github.com/mat-joe-the-geek/ADK-Medical-Agent.git

Create and activate a Python virtual environment.

Install dependencies: pip install -r requirements.txt

Configure environment variables (e.g., in a .env file):

Bash

GOOGLE_GENAI_USE_VERTEXAI="True"
GOOGLE_CLOUD_PROJECT="my-project-id"
GOOGLE_CLOUD_LOCATION="my-region"
Enter fullscreen mode Exit fullscreen mode

**

Usage:

**
Run the agent: adk web
Then open http://localhost:8000/ in your browser and select 'medical_agent'.

**

Legal Disclaimer:

**
Important: The information and analysis provided by this AI tool are for educational and informational purposes only. They do not constitute, and should not be interpreted as, medical advice, diagnosis, treatment recommendations, or a substitute for professional medical consultation. Always seek the advice of a qualified healthcare professional.

Top comments (0)