ClinicalAgents is an advanced AI-powered multi-agent system designed to revolutionize how healthcare professionals and researchers interact with clinical trial data and drug safety information. By leveraging state-of-the-art Large Language Models (LLMs) and a LangGraph orchestration framework, it automates complex tasks such as trial enrollment analysis, drug safety assessment, and clinical trial discovery.
- Intelligent Agent Orchestration: Built on LangGraph for robust, stateful multi-agent workflows
- Enrollment Agent: Smart patient-to-trial matching using ChromaDB vector search and ML-based success prediction
- Safety Agent: Real-time FDA drug safety analysis with black box warnings and adverse event tracking
- Efficacy Agent: Neo4j graph database integration for complex trial outcome analysis
- General Agent: Conversational AI for general clinical trial inquiries
- Dynamic Session Management: Create, rename, delete, and organize chat sessions with smart auto-generated titles
- Real-time Streaming: Live agent responses with typing indicators and smooth animations
- Stop Generation: Cancel ongoing responses with one click
- Rich Markdown Rendering: Tables, code blocks, and formatted medical insights
- Agent Visualization: See which specialist agents are processing your query
- Context-Aware Conversations: Full conversation history maintained across sessions
- Advanced Search: Find relevant clinical trials by disease name
- Comprehensive Trial Details: View trial status, phases, enrollment criteria, and outcomes
- Real-time Data: Pulls from extensive clinical trials database
- Intuitive UI: Modern, responsive design with smooth animations
- JWT Authentication: Secure user registration and login system
- User Profiles: Personalized settings and preferences
- MongoDB Persistence: All chat history and user data securely stored
- Session Isolation: Each user's conversations are private and isolated
- Framework: FastAPI (Python 3.11+)
- LLM: Grok (Llama 3.3) via Groq API
- Orchestration: LangGraph 2.0 for advanced agent workflows
- Databases:
- MongoDB (User data, chat sessions, audit logs)
- ChromaDB Cloud (Enrollment vector search)
- Neo4j AuraDB (Efficacy graph analytics)
- FAISS (Local vector indices)
- External APIs: ClinicalTrials.gov, openFDA
- Machine Learning: Custom ML models for trial success prediction
- Framework: Next.js 16 (React 19)
- Styling: Tailwind CSS 4 with custom design system
- Animations: Framer Motion for premium UI interactions
- UI Components: Heroicons, Lucide React
- HTTP Client: Axios
- Markdown: React Markdown with GFM support
ClinicalAgent/
├── agents_server/ # Python FastAPI Backend
│ ├── agents/ # Specialized AI Agents
│ │ ├── enrollment_agent.py
│ │ ├── safety_agent.py
│ │ ├── efficacy_agent.py
│ │ └── general_agent.py
│ ├── langgraph_v2/ # LangGraph 2.0 Workflow
│ │ ├── workflow.py # Main orchestration logic
│ │ ├── state.py # State management
│ │ ├── tools.py # Agent tools
│ │ └── config.py # Workflow configuration
│ ├── storage/ # Database connectors
│ ├── ml_models/ # ML prediction models
│ ├── datasets/ # Clinical trial datasets
│ ├── app.py # FastAPI application
│ ├── chatbot.py # Chat logic controller
│ └── auth.py # Authentication & JWT
│
├── client/ # Next.js Frontend
│ ├── app/ # App Router Pages
│ │ ├── chat/ # Chat interface
│ │ ├── trials/ # Trials browser
│ │ └── layout.js # Root layout
│ ├── components/ # React Components
│ │ ├── chat/ # Chat UI
│ │ ├── auth/ # Login/Register
│ │ └── ui/ # Reusable components
│ ├── hooks/ # Custom React hooks
│ └── services/ # API client services
│
└── docs/ # Documentation & Assets
For detailed installation and setup instructions, please refer to the SETUP.md file.
- Python 3.11+
- Node.js 18+
- MongoDB (local or cloud)
- API Keys: Groq, ChromaDB, Neo4j (see
.env.example)
cd agents_server
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # Configure your API keys
python app.pycd client
npm install
npm run devAccess the application at http://localhost:3000
Once the backend is running, access the interactive Swagger UI at:
http://localhost:8000/docs
-
Chat
POST /chat: Send a message to the agent systemGET /history/{session_id}: Get message history for a sessionPOST /chat/stop: Stop ongoing response generation
-
Authentication
POST /auth/register: Create a new user accountPOST /auth/login: Authenticate a userGET /auth/me: Get current user profile
-
Sessions
GET /sessions: Retrieve user chat sessionsPOST /sessions: Create a new chat sessionPUT /sessions/{session_id}: Update session detailsDELETE /sessions/{session_id}: Delete a chat session
-
Trials
GET /trials/search: Search clinical trials by disease
- Trial Enrollment Analysis: "Find suitable clinical trials for Type 2 Diabetes patients"
- Drug Safety Research: "What are the safety concerns for aspirin?"
- Efficacy Evaluation: "Show me efficacy data for recent cancer immunotherapy trials"
- Trial Discovery: Browse and search thousands of clinical trials by disease
- Research Organization: Manage multiple research sessions with smart session titles
- User Query: Type a question about clinical trials or drug safety
- LangGraph Routing: The system analyzes your query and routes it to appropriate agents
- Agent Processing: Specialized agents query databases, APIs, and ML models
- Response Generation: AI synthesizes findings into comprehensive, actionable insights
- Continuous Learning: System learns from interactions to improve future responses
- JWT-based authentication with secure token management
- Password hashing using industry-standard algorithms
- CORS configuration for frontend-backend communication
- Environment-based configuration for sensitive credentials
- User data isolation and privacy protection
# Backend
cd agents_server
pytest
# Frontend
cd client
npm test- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Built with LangGraph by LangChain
- Powered by Grok (Llama 3.3)
- Clinical trial data from ClinicalTrials.gov
- Drug safety data from openFDA
