| title | Lead Optimization Agent |
|---|---|
| emoji | 🧬 |
| colorFrom | green |
| colorTo | blue |
| sdk | streamlit |
| sdk_version | 1.35.0 |
| app_file | app.py |
| pinned | false |
An AI-assisted medicinal chemistry sandbox for exploring lead-optimization ideas in a visual, iterative workflow.
The app combines:
- an Anthropic-powered agent loop for proposing structural changes
- local RDKit-based property analysis for fast scoring
- a Streamlit UI for reviewing each attempt, change rationale, and property trajectory
Try the live demo on HuggingFace Spaces
Given a starting molecule and a target optimization brief, the agent:
- validates the starting SMILES
- analyzes the molecule locally with RDKit-derived heuristics
- proposes one structural change at a time
- scores each new candidate
- compares property movement across attempts
- surfaces the best candidate found in the run
The UI is built to answer the questions a chemist actually cares about:
- What changed in this attempt?
- Why was that change made?
- Did BBB, CNS MPO, QED, or flexibility improve?
- Which candidate is currently the best balance?
The Streamlit app includes:
Candidate Journeyas the first tab, with live attempt-by-attempt cards- highlighted 2D structures showing the region changed in each attempt
- short plain-English change summaries for each analogue
Performance Overviewwith metric deltas, trajectory plots, and a start-vs-best radar chart- local run persistence, so you can reload past runs without spending LLM credits again
The app ships with a few preset briefs:
Atenolol → Brain PenetrationAspirin → CNS Drug ProfileIbuprofen → Aqueous SolubilityCustom molecule
The agent is responsible for proposing the next chemical edit and explaining the logic behind it.
Property analysis is performed locally in agent_utils.py using RDKit-based calculations and heuristics, including:
- QED
- Lipinski summary
- BBB probability heuristic
- CNS MPO heuristic
- solubility estimate
- GI absorption heuristic
- structural alerts
- synthetic accessibility heuristic
This means the chemistry scoring path is local and fast. The Anthropic API is used for the reasoning loop, not for property calculation.
lead_optimization_agent/
├── app.py
├── agent_utils.py
├── requirements.txt
├── candidates.json
├── saved_runs/
└── notebooks/
├── 01_admet_tool.ipynb
├── 02_agent_loop.ipynb
└── 03_visualization.ipynb
git clone https://github.com/mondalsou/lead_optimization_agent.git
cd lead_optimization_agent
pip install -r requirements.txtIf RDKit installation fails via pip, use:
conda install -c conda-forge rdkitexport ANTHROPIC_API_KEY=sk-ant-...streamlit run app.pyOpen http://localhost:8501.
- Pick a preset or paste your own SMILES.
- Write the optimization brief.
- Click
Run Optimisation. - Watch
Candidate Journeyupdate as new molecules are analyzed. - Open
Performance Overviewto compare start vs best candidate.
Every completed run is saved locally so you can reopen it later without calling the API again.
Saved files are written to:
saved_runs/latest_run.json
saved_runs/run_YYYYMMDD_HHMMSS.json
From the sidebar you can:
- load the latest saved run
- upload a saved JSON run
- download the current run
The notebooks are still useful for exploration and demos:
01_admet_tool.ipynb: property exploration and tool setup02_agent_loop.ipynb: agent-loop walkthrough03_visualization.ipynb: charts and candidate visualization
Core dependencies:
streamlit>=1.35.0
anthropic>=0.40.0
rdkit>=2023.9.5
pandas>=2.0.0
plotly>=5.18.0
matplotlib>=3.8.0
- portfolio/demo project for AI + chemistry tooling
- medicinal chemistry workflow prototyping
- showing iterative agent behavior instead of one-shot prompting
- experimenting with optimization briefs and visual candidate review
- this is a heuristic prototyping tool, not a validated drug-discovery platform
- property outputs are local approximations and should not be treated as experimental truth
- agent suggestions should be reviewed by a domain expert before any serious decision-making
This project sits at the intersection of:
- agentic workflows
- chemistry-aware UI design
- human-in-the-loop lead optimization
- LLM reasoning paired with deterministic local analysis
Sourav Mondal
- GitHub: @mondalsou
- LinkedIn: Sourav Mondal