Ibtisamkhan/materials-discovery-agent
Materials Discovery Agent
Live demo: a Gradio app on Hugging Face Spaces (bring your own keys, never stored). Code and a no-key demo: this repo.
Describe what you are designing and this agent selects a material the way an engineer actually does, with Ashby's method. It turns your plain-English requirement into a function, an objective and constraints, picks the right performance index, ranks a materials universe, weighs the trade-offs, and writes a cited recommendation you can download as a Word report. With a Materials Project key it also pulls real first-principles candidates.
Flagship of my Agentic Matter series, applying agentic AI to materials and mechanical engineering. It is the kind of work my BEng in Materials Engineering trained me for, now driven by an agent.
Why this is not just "search a database"
Real material selection is a multi-constraint, multi-objective trade-off, and Ashby's method is how it is taught and done (CES EduPack / Granta). The agent uses performance indices: the property group you maximise for a given function. For a light, stiff beam that is E^(1/2)/rho; for a light, strong tie it is strength/rho. It filters by the hard constraints first, then ranks by the index, then reasons over the trade-offs.
What makes it an agent
Design requirement (plain English)
│
▼
┌──────────────────────────────────────────────────┐
│ Claude (agent loop) │
│ derives function + objective + constraints │
│ ├─ list_indices ── Ashby catalogue ► │ pick the right performance index
│ ├─ rank_materials ── selection engine ► │ constrain, then rank the universe
│ ├─ material_detail ── database ────────► │ compare the top candidates
│ ├─ query_materials_project ── live MP API ─────► │ first-principles candidates (optional key)
│ └─ reason on trade-offs, then write the report │
└──────────────────────────────────────────────────┘
│
▼
Recommendation (requirement · index · shortlist · trade-offs · pick · next steps), downloadable as .docxWhat is inside
Run it
Offline Ashby engine (no API key). Proves the selection logic:
python -m src.cli --indices
python -m src.cli --select specific_strength_beam --constraints '{"corrosion_min":4,"Tmax_min":120,"cost_max":50}'A real captured run is in `examples/ashby_demo.txt`. It correctly puts CFRP and titanium at the top of a light, strong, corrosion-proof shortlist, and concrete, wood and steel at the top of a cheap, stiff one.
Full agent (needs a key).
pip install -r requirements.txt
export ANTHROPIC_API_KEY=sk-ant-... # required
export MP_API_KEY=... # optional, enables Materials Project search
python -m src.cli "Pick a material for a lightweight, stiff bike frame that resists corrosion and is affordable."
python -m src.cli --report frame.docx "Choose a marine propeller shaft material: strong, corrosion-proof, tough."What is verified
- The Ashby selection engine runs with no keys and gives textbook-correct results (light-stiff favours woods, CFRP and ceramics; cheap-stiff favours concrete, wood and steel; heat sinks favour copper). See the example file.
- The agent loop and the Materials Project REST client are built and import cleanly. The reasoning step needs your Anthropic key, and the first-principles search needs a free Materials Project key.
Honest notes
- The curated property values are representative engineering values for screening and shortlisting, not final design data. The agent says so and recommends confirming the pick against a supplier datasheet or the Materials Project before committing.
- Performance indices assume a single dominant function and objective; real parts often combine several, which is why the agent reports trade-offs rather than a single "answer."
Sources
Selection method and indices follow M. F. Ashby, Materials Selection in Mechanical Design. First-principles data from the Materials Project (materialsproject.org). Property values are representative engineering ranges.
Built by Ibtisam Ahmed Khan · June 2026 · [linkedin.com/in/ibtisam-ahmed-khan](https://linkedin.com/in/ibtisam-ahmed-khan) · part of the Agentic Matter series
