AgentRX is a MedTech / Agentic-AI platform for accelerating pharmaceutical drug repurposing discovery. It orchestrates autonomous worker agents, manages stateful multi-step pipelines, and produces structured decision outputs rather than chat-based responses.
The current repository contains a backend-first implementation with:
- FastAPI for API endpoints
- LangGraph for stateful orchestration
- Celery / Redis for async task handling
- Local mock enterprise data for IQVIA and EXIM analysis
- A resumable pipeline with human approval pause points
graph TD
U[User / Frontend] -->|POST /api/pipeline/start| API[FastAPI Backend]
API -->|start pipeline| LG[LangGraph Orchestrator]
LG --> WI[Web Intelligence Agent]
LG --> PL[Patent Landscape Agent]
LG --> CV[Commercial Viability Agent]
LG --> IQ[IQVIA Supply Chain Agent]
WI -->|PubMed| PUB[PubMed Entrez API]
PL -->|Europe PMC| EPC[Europe PMC REST API]
CV -->|OpenFDA| FDA[OpenFDA API]
CV -->|ClinicalTrials.gov| CT[ClinicalTrials.gov API]
CV -->|Yahoo Finance| YF[Yahoo Finance]
IQ -->|Local CSV| CSV[Mock IQVIA/EXIM CSV Data]
API -->|checkpoint| SQLITE[SQLite checkpoint file]
API -->|stores reports| MINIO[MinIO / S3]
API -->|optional| REDIS[Redis broker]
API -->|optional| POSTGRES[PostgreSQL]
API -->|optional| CHROMA[ChromaDB]
AgentRX/
├── backend/
│ ├── app/
│ │ ├── agents/ # Worker agents and business logic
│ │ ├── api/ # FastAPI route definitions
│ │ ├── core/ # Configuration, Celery setup
│ │ ├── pipeline/ # LangGraph workflow and state definitions
│ │ ├── models/ # Pydantic models and DB models (planned)
│ │ └── services/ # External API clients and helpers
│ └── templates/ # Jinja2 report templates
├── config/ # Pipeline/config metadata
├── data/ # Persistent data, mock CSVs
├── frontend/ # Frontend integration placeholders
├── infrastructure/ # Docker and deployment assets
├── mock__db_services/ # Local mock API services
│ ├── exim/
│ └── iqvia/
├── requirements.txt
├── docker-compose.yml
├── .env.example
├── context.md
└── README.md
The backend exposes a resumable decision pipeline via:
POST /api/pipeline/startPOST /api/pipeline/resume
The pipeline currently executes:
- Pharmacodynamic Mapping via the Web Intelligence Agent
- Data Merge into
merged_diseases - IP Whitespace Clearance via the Patent Landscape Agent
- Commercial Viability Analysis via the Commercial Viability Agent
- IQVIA / EXIM Supply Chain Analysis via the IQVIA Supply Chain Agent
A manual approval pause occurs before the commercial viability phase.
| Agent | Role | Data Sources | Current Status |
|---|---|---|---|
| Web Intelligence Agent | Extracts alternative indications from literature | PubMed Entrez + Gemini LLM | Implemented |
| Patent Landscape Agent | Filters by active patents / FTO | Europe PMC | Implemented |
| Commercial Viability Agent | Estimates TAM, competition, trial complexity | OpenFDA, ClinicalTrials.gov, Yahoo Finance, OpenRouter LLM | Implemented |
| IQVIA Supply Chain Agent | Reads local IQVIA / EXIM CSV data, builds supply chain output | Local mock CSVs | Implemented |
- Python 3.11+ (recommended)
- Docker / Docker Compose
- Git
- Create a virtual environment:
python -m venv .venv
source .venv/Scripts/activate # Windows
source .venv/bin/activate # macOS/Linux- Install dependencies:
pip install -r requirements.txt- Copy environment variables:
cp .env.example .env- Update
.envwith your API keys and service endpoints.
docker-compose up -dThe compose stack includes:
postgresfor persistent relational storageredisfor Celery broker/backendchromadbfor vector storageminiofor report storage
cd backend
uvicorn app.main:app --reloadUse the /api/pipeline/start endpoint to begin and /api/pipeline/resume to continue paused runs.
Starts the pipeline for a molecule.
Request
{
"molecule": "Metformin"
}Success Response
{
"status": "PAUSED_FOR_HUMAN",
"thread_id": "<uuid>",
"message": "Awaiting human approval for IP-cleared candidates.",
"pending_candidates": []
}Resumes a paused pipeline run.
Request
{
"thread_id": "<uuid>"
}Success Response
{
"status": "COMPLETED",
"molecule": "Metformin",
"final_candidates": [],
"iqvia_exim_analysis": {}
}Health check endpoint for the backend.
Response
{
"status": "online",
"environment": "development",
"orchestrator": "LangGraph Ready",
"message": "AgentRX Neural Backend is operational"
}The repository includes local mock services for enterprise data:
mock__db_services/iqvia/— mock IQVIA market-insights APImock__db_services/exim/— placeholder for EXIM trade data services
Key mock data files are stored in data/mock_seeds/:
IQVIA_DrugProfiles.csvIQVIA_Sales.csvIQVIA_ClinicalPipeline.csvEXIM_CountryMatrix.csvEXIM_TradeData.csv
These files are consumed by the IQVIA Supply Chain Agent to produce supply chain summaries.
The backend uses app/core/config.py to load environment variables from .env.
Important config keys include:
POSTGRES_URLREDIS_URLCHROMADB_HOSTCHROMADB_PORTNEO4J_URIGOOGLE_API_KEYOPENROUTER_API_KEYS3_ENDPOINT_URLAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
- PostgreSQL and Neo4j integrations are referenced in config, but the current pipeline uses SQLite checkpoints for runtime state.
- RAG vector search and Neo4j knowledge graph features are planned, not yet wired into the current flow.
- Some external API calls are mocked or dependent on available API keys.
- The pipeline is defined in
backend/app/pipeline/graph.pyusing LangGraph state nodes. - Worker agent logic lives in
backend/app/agents/workers.py. - The pipeline REST API lives in
backend/app/api/routes/pipeline.py. backend/app/core/celery_app.pyconfigures Celery, but task modules are minimal.
- Fork the repo
- Create a feature branch
- Run the backend locally and test changes
- Submit a PR with clear architectural notes
For this repository, use the internal context.md as the source of truth for architecture, current implementation state, and feature planning.