Skip to content

A2A ClinTrialsGPT: Agentic RAG for Real-Time Querying and Interpretation of ClinicalTrials.gov Data with A2A protocol

License

Notifications You must be signed in to change notification settings

alessandropranzo/ClinTrialsGPT

 
 

Repository files navigation

ClinTrialsGPT v1.0

Harness the power of LLMs to synthesize and reason over live clinical trial data -- bridging trial evidence and insight in real-time!

(c) Copyright 2025. Vin Bhaskara and Dr. Philip Mathew, MD.

Tl;dr. Quick installation: docker run -p 8000:8000 vinbhaskara/clintrialsgpt:latest

Chat just as you would with ChatGPT -- except that any query relevant to clinical trials will trigger an API call to the ClinicalTrials.gov database with relevant search terms inferred from the user's query (i.e. "agentic retrieval"). The responses to queries are grounded in the clinical trial data retrieved with appropriate citations.

Docker hub image link: vinbhaskara/clintrialsgpt:latest

Here is an example screenshot:

screenshot

🔄 Workflow Pipeline

The following diagram illustrates the complete workflow pipeline for ClinTrialsGPT:

graph TD
    A[User Input] --> B{Interface Type}
    B -->|A2A Protocol| C[A2A Server]
    B -->|Web Interface| D[Streamlit App]
    
    C --> E[A2A Agent Executor]
    D --> F[Streamlit Handler]
    
    E --> G[Process Message]
    F --> G
    
    G --> H[LLM Query Analysis]
    H --> I{Clinical Trial<br/>Related?}
    
    I -->|No| J[Regular Chat Response]
    I -->|Yes| K[Extract Search Parameters]
    
    K --> L[Parse Parameters:<br/>- Condition<br/>- Terms<br/>- Intervention]
    L --> M[ClinicalTrials.gov API Call]
    
    M --> N[Retrieve Clinical Trial Data]
    N --> O[Format as JSON Context]
    
    O --> P[Context-Aware LLM Processing]
    P --> Q[Generate Grounded Response<br/>with Citations]
    
    Q --> R{Response Format}
    R -->|A2A| S[A2A Protocol Response]
    R -->|Streamlit| T[Streamlit Chat Display]
    
    S --> U[Client Application]
    T --> V[Web Browser]
    
    J --> W[Standard LLM Response]
    W --> R
    
    %% Context Management
    G --> X[Conversation History]
    X --> P
    
    %% External Services
    M --> Y[ClinicalTrials.gov Database]
    H --> Z[OpenAI API]
    P --> Z
    
    %% Styling
    classDef userInput fill:#e1f5fe
    classDef processing fill:#f3e5f5
    classDef external fill:#e8f5e8
    classDef output fill:#fff3e0
    
    class A,B userInput
    class C,D,E,F,G,H,I,K,L,P,Q,R processing
    class M,Y,Z external
    class S,T,U,V,J,W output
Loading

🆕 A2A Protocol Support

ClinTrialsGPT now supports the A2A (Agent2Agent) protocol developed by Google! This allows the agent to be used as a remote service by other applications and agents.

A2A Features

  • Remote Agent Access: Use ClinTrialsGPT as a service from other applications
  • Standardized Protocol: Follows Google's A2A specification for agent communication
  • Streaming Support: Real-time streaming responses
  • Agent Discovery: Automatic capability discovery via agent cards
  • Context Management: Maintain conversation context across requests

Quick A2A Start

# Start A2A server
python start_a2a_server.py --mode a2a

# Or use Docker
docker run -p 8000:8000 vinbhaskara/clintrialsgpt:latest

For detailed A2A documentation, see README_A2A.md.

How to run the app?

Find your OpenAI API key by following instructions here: Link

Three ways to get the app running -

1. Running on Docker

First, install Docker.

Pull image and run (easiest and preferred way)

After installing Docker, open the Terminal/Command Prompt and run:

For A2A Server (default):

docker run -p 8000:8000 vinbhaskara/clintrialsgpt:latest

For Streamlit App:

docker run -p 8501:8501 -e RUN_MODE=streamlit vinbhaskara/clintrialsgpt:latest

Or, build your own image

Run docker-compose up --build to build your own local image:

2. Installing on your local machine

After installing the required python packages in requirements.txt:

For A2A Server (default):

python start_a2a_server.py --mode a2a
# Or directly: python a2a_server.py

For Streamlit App:

python start_a2a_server.py --mode streamlit
# Or directly: streamlit run clintrialsgpt.py

3. Using the startup script

The start_a2a_server.py script provides an easy way to choose between modes:

# Check if OpenAI API key is configured
python start_a2a_server.py --check-key

# Start A2A server (default)
python start_a2a_server.py

# Start Streamlit app
python start_a2a_server.py --mode streamlit

API Endpoints (A2A Server)

Check the official A2A SDK website for further development info.

Disclaimer

This tool is for informational and educational purposes only. It does not provide medical advice, diagnosis, or treatment. The information is retrieved from publicly available clinical trials data and may be incomplete, outdated, or misinterpreted.

By using this app, you acknowledge that all use is at your own risk. The creators accept no responsibility or liability for any outcomes, decisions, or actions taken based on the information provided.

Always consult a qualified healthcare professional for medical advice.

About

A2A ClinTrialsGPT: Agentic RAG for Real-Time Querying and Interpretation of ClinicalTrials.gov Data with A2A protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.4%
  • Dockerfile 1.6%