# chatmed/prompt-to-pill architecture

> Architecture diagram of the GitHub repository chatmed/prompt-to-pill, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chatmed/prompt-to-pill
- Repository: https://github.com/chatmed/prompt-to-pill

## Overview

Prompt-to-Pill is an ask-driven, multi-agent drug-development simulation. A user submits a task to the AutoGen orchestrator, which the README says uses a planning agent to select tools across drug discovery, preclinical assessment, and clinical feasibility. The documented path spans molecule generation, profiling, docking and optimization, then trial construction, patient matching, and outcome prediction. The graph includes the distinct MCP tool servers and the docking implementation layer. Most server-to-server runtime handoffs are not shown in the excerpts, so the workflow links are cited to the README rather than presented as direct calls.

Main entry points: [`Prompt_to_pill.py`](https://github.com/chatmed/prompt-to-pill/blob/main/Prompt_to_pill.py) (AutoGen orchestrator), [`name2smiles_mcp_server.py`](https://github.com/chatmed/prompt-to-pill/blob/main/name2smiles_mcp_server.py) (Name to SMILES), [`patient_matching_mcp_server.py`](https://github.com/chatmed/prompt-to-pill/blob/main/patient_matching_mcp_server.py) (Patient matching), [`admet_prediction_mcp_server.py`](https://github.com/chatmed/prompt-to-pill/blob/main/admet_prediction_mcp_server.py) (ADMET profiling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_coord["Workflow coordination"]
  node_orchestrator["AutoGen orchestrator<br/>[Prompt_to_pill.py]"]
  node_planner["Planning agent<br/>[Prompt_to_pill.py]"]
end

subgraph group_discovery["Drug discovery"]
  node_generator["Molecule generation"]
  node_nameconvert["Name to SMILES"]
  node_dockingtool["Docking tool"]
  node_dockengine["Docking engine<br/>[docking_module.py]"]
end

subgraph group_preclinical["Preclinical assessment"]
  node_properties["Chemical properties"]
  node_admet["ADMET profiling"]
  node_optimization["Lead optimization"]
end

subgraph group_clinical["Clinical feasibility"]
  node_trialgen["Trial protocol generation"]
  node_patientmatch["Patient matching"]
  node_trialpred["Trial outcome prediction"]
end

node_user(("Task requester"))
node_pubchem["PubChem"]
node_fda["FDA drug data"]
node_chemfm["ChemFM service"]
node_panacea["Panacea model"]
node_patientdata["Patient XML data"]

node_user -->|"submits task"| node_orchestrator
node_orchestrator -->|"plans workflow"| node_planner
node_orchestrator -->|"selects tool"| node_generator
node_orchestrator -.->|"selects tool"| node_nameconvert
node_orchestrator -->|"selects tool"| node_dockingtool
node_dockingtool -->|"calls"| node_dockengine
node_orchestrator -->|"selects tool"| node_properties
node_orchestrator -->|"selects tool"| node_admet
node_orchestrator -->|"selects tool"| node_optimization
node_orchestrator -->|"selects tool"| node_trialgen
node_orchestrator -->|"selects tool"| node_patientmatch
node_orchestrator -.->|"selects tool"| node_trialpred
node_nameconvert -->|"queries"| node_pubchem
node_nameconvert -->|"looks up brands"| node_fda
node_admet -->|"predicts via"| node_chemfm
node_trialgen -->|"generates with"| node_panacea
node_patientmatch -->|"assesses with"| node_panacea
node_patientmatch -->|"reads XML"| node_patientdata
node_orchestrator -->|"rechecks leads"| node_properties
node_orchestrator -->|"rechecks leads"| node_admet

click node_orchestrator "https://github.com/chatmed/prompt-to-pill/blob/main/Prompt_to_pill.py"
click node_planner "https://github.com/chatmed/prompt-to-pill/blob/main/Prompt_to_pill.py"
click node_generator "https://github.com/chatmed/prompt-to-pill/blob/main/druggen_mcp_server.py"
click node_nameconvert "https://github.com/chatmed/prompt-to-pill/blob/main/name2smiles_mcp_server.py"
click node_dockingtool "https://github.com/chatmed/prompt-to-pill/blob/main/docking_mcp_server.py"
click node_dockengine "https://github.com/chatmed/prompt-to-pill/blob/main/docking_module.py"
click node_properties "https://github.com/chatmed/prompt-to-pill/blob/main/chemical_properties_mcp_sever.py"
click node_admet "https://github.com/chatmed/prompt-to-pill/blob/main/admet_prediction_mcp_server.py"
click node_optimization "https://github.com/chatmed/prompt-to-pill/blob/main/mol_opt_mcp_server.py"
click node_trialgen "https://github.com/chatmed/prompt-to-pill/blob/main/trialgen_mcp_server.py"
click node_patientmatch "https://github.com/chatmed/prompt-to-pill/blob/main/patient_matching_mcp_server.py"
click node_trialpred "https://github.com/chatmed/prompt-to-pill/blob/main/trialpred_mcp_server.py"
click node_patientdata "https://github.com/chatmed/prompt-to-pill/blob/main/diabetes_patients_final.xml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_orchestrator,node_planner toneBlue
class node_generator,node_nameconvert,node_dockingtool,node_dockengine toneAmber
class node_properties,node_admet,node_optimization toneMint
class node_trialgen,node_patientmatch,node_trialpred,node_user toneRose
class node_pubchem,node_fda,node_chemfm,node_panacea toneIndigo
class node_patientdata toneTeal
```

## Components

### Workflow coordination

- [AutoGen orchestrator](https://github.com/chatmed/prompt-to-pill/blob/main/Prompt_to_pill.py): `Prompt_to_pill.py`
- [Planning agent](https://github.com/chatmed/prompt-to-pill/blob/main/Prompt_to_pill.py): `Prompt_to_pill.py`

### Drug discovery

- [Molecule generation](https://github.com/chatmed/prompt-to-pill/blob/main/druggen_mcp_server.py): `druggen_mcp_server.py`
- [Name to SMILES](https://github.com/chatmed/prompt-to-pill/blob/main/name2smiles_mcp_server.py): `name2smiles_mcp_server.py`
- [Docking tool](https://github.com/chatmed/prompt-to-pill/blob/main/docking_mcp_server.py): `docking_mcp_server.py`
- [Docking engine](https://github.com/chatmed/prompt-to-pill/blob/main/docking_module.py): `docking_module.py`

### Preclinical assessment

- [Chemical properties](https://github.com/chatmed/prompt-to-pill/blob/main/chemical_properties_mcp_sever.py): `chemical_properties_mcp_sever.py`
- [ADMET profiling](https://github.com/chatmed/prompt-to-pill/blob/main/admet_prediction_mcp_server.py): `admet_prediction_mcp_server.py`
- [Lead optimization](https://github.com/chatmed/prompt-to-pill/blob/main/mol_opt_mcp_server.py): `mol_opt_mcp_server.py`

### Clinical feasibility

- [Trial protocol generation](https://github.com/chatmed/prompt-to-pill/blob/main/trialgen_mcp_server.py): `trialgen_mcp_server.py`
- [Patient matching](https://github.com/chatmed/prompt-to-pill/blob/main/patient_matching_mcp_server.py): `patient_matching_mcp_server.py`
- [Trial outcome prediction](https://github.com/chatmed/prompt-to-pill/blob/main/trialpred_mcp_server.py): `trialpred_mcp_server.py`

### Other components

- **Task requester**
- **PubChem**
- **FDA drug data**
- **ChemFM service**
- **Panacea model**
- [Patient XML data](https://github.com/chatmed/prompt-to-pill/blob/main/diabetes_patients_final.xml): `diabetes_patients_final.xml`

## Connections

- Task requester → AutoGen orchestrator: submits task (evidence: `README.md`)
- AutoGen orchestrator → Planning agent: plans workflow (evidence: `README.md`)
- AutoGen orchestrator → Molecule generation: selects tool (evidence: `README.md`)
- AutoGen orchestrator → Name to SMILES: selects tool
- AutoGen orchestrator → Docking tool: selects tool (evidence: `Prompt_to_pill.py`)
- Docking tool → Docking engine: calls (evidence: `docking_mcp_server.py`)
- AutoGen orchestrator → Chemical properties: selects tool (evidence: `Prompt_to_pill.py`)
- AutoGen orchestrator → ADMET profiling: selects tool (evidence: `Prompt_to_pill.py`)
- AutoGen orchestrator → Lead optimization: selects tool (evidence: `Prompt_to_pill.py`)
- AutoGen orchestrator → Trial protocol generation: selects tool (evidence: `README.md`)
- AutoGen orchestrator → Patient matching: selects tool (evidence: `Prompt_to_pill.py`)
- AutoGen orchestrator → Trial outcome prediction: selects tool
- Name to SMILES → PubChem: queries (evidence: `name2smiles_mcp_server.py`)
- Name to SMILES → FDA drug data: looks up brands (evidence: `name2smiles_mcp_server.py`)
- ADMET profiling → ChemFM service: predicts via (evidence: `admet_prediction_mcp_server.py`)
- Trial protocol generation → Panacea model: generates with (evidence: `trialgen_mcp_server.py`)
- Patient matching → Panacea model: assesses with (evidence: `patient_matching_mcp_server.py`)
- Patient matching → Patient XML data: reads XML (evidence: `patient_matching_mcp_server.py`)
- AutoGen orchestrator → Chemical properties: rechecks leads (evidence: `Prompt_to_pill.py`)
- AutoGen orchestrator → ADMET profiling: rechecks leads (evidence: `Prompt_to_pill.py`)
