scilink 0.0.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scilink-0.0.10/MANIFEST.in +3 -0
- scilink-0.0.10/PKG-INFO +662 -0
- scilink-0.0.10/README.md +626 -0
- scilink-0.0.10/pyproject.toml +66 -0
- scilink-0.0.10/requirements.txt +15 -0
- scilink-0.0.10/scilink/__init__.py +51 -0
- scilink-0.0.10/scilink/agents/__init__.py +0 -0
- scilink-0.0.10/scilink/agents/exp_agents/__init__.py +26 -0
- scilink-0.0.10/scilink/agents/exp_agents/_deprecation.py +77 -0
- scilink-0.0.10/scilink/agents/exp_agents/analysis_orchestrator.py +773 -0
- scilink-0.0.10/scilink/agents/exp_agents/analysis_orchestrator_tools.py +1266 -0
- scilink-0.0.10/scilink/agents/exp_agents/atomistic_microscopy_agent.py +347 -0
- scilink-0.0.10/scilink/agents/exp_agents/base_agent.py +1082 -0
- scilink-0.0.10/scilink/agents/exp_agents/controllers/atomistic_microscopy_controllers.py +421 -0
- scilink-0.0.10/scilink/agents/exp_agents/controllers/base_controllers.py +222 -0
- scilink-0.0.10/scilink/agents/exp_agents/controllers/curve_fitting_controllers.py +2986 -0
- scilink-0.0.10/scilink/agents/exp_agents/controllers/fft_microscopy_controllers.py +2009 -0
- scilink-0.0.10/scilink/agents/exp_agents/controllers/hyperspectral_controllers.py +1696 -0
- scilink-0.0.10/scilink/agents/exp_agents/controllers/sam_microscopy_controllers.py +1239 -0
- scilink-0.0.10/scilink/agents/exp_agents/curve_fitting_agent.py +649 -0
- scilink-0.0.10/scilink/agents/exp_agents/fft_microscopy_agent.py +623 -0
- scilink-0.0.10/scilink/agents/exp_agents/human_feedback.py +281 -0
- scilink-0.0.10/scilink/agents/exp_agents/hyperspectral_analysis_agent.py +539 -0
- scilink-0.0.10/scilink/agents/exp_agents/instruct.py +1979 -0
- scilink-0.0.10/scilink/agents/exp_agents/metadata_converter.py +244 -0
- scilink-0.0.10/scilink/agents/exp_agents/orchestrator_agent.py +250 -0
- scilink-0.0.10/scilink/agents/exp_agents/pipelines/atomistic_microcopy_pipelines.py +72 -0
- scilink-0.0.10/scilink/agents/exp_agents/pipelines/curve_fitting_pipelines.py +281 -0
- scilink-0.0.10/scilink/agents/exp_agents/pipelines/fft_microscopy_pipelines.py +294 -0
- scilink-0.0.10/scilink/agents/exp_agents/pipelines/hyperspectral_pipelines.py +142 -0
- scilink-0.0.10/scilink/agents/exp_agents/pipelines/sam_microscopy_pipelines.py +176 -0
- scilink-0.0.10/scilink/agents/exp_agents/preprocess.py +837 -0
- scilink-0.0.10/scilink/agents/exp_agents/recommendation_agent.py +198 -0
- scilink-0.0.10/scilink/agents/exp_agents/sam_microscopy_agent.py +447 -0
- scilink-0.0.10/scilink/agents/exp_agents/utils.py +620 -0
- scilink-0.0.10/scilink/agents/lit_agents/__init__.py +45 -0
- scilink-0.0.10/scilink/agents/lit_agents/_deprecation.py +71 -0
- scilink-0.0.10/scilink/agents/lit_agents/instruct.py +24 -0
- scilink-0.0.10/scilink/agents/lit_agents/literature_agent.py +364 -0
- scilink-0.0.10/scilink/agents/lit_agents/novelty_scorer.py +492 -0
- scilink-0.0.10/scilink/agents/lit_agents/optimize_query.py +99 -0
- scilink-0.0.10/scilink/agents/planning_agents/__init__.py +3 -0
- scilink-0.0.10/scilink/agents/planning_agents/_deprecation.py +103 -0
- scilink-0.0.10/scilink/agents/planning_agents/base_agent.py +225 -0
- scilink-0.0.10/scilink/agents/planning_agents/bo_agent.py +284 -0
- scilink-0.0.10/scilink/agents/planning_agents/digest.txt +2631 -0
- scilink-0.0.10/scilink/agents/planning_agents/excel_parser.py +169 -0
- scilink-0.0.10/scilink/agents/planning_agents/html_generator.py +319 -0
- scilink-0.0.10/scilink/agents/planning_agents/ingestor.py +115 -0
- scilink-0.0.10/scilink/agents/planning_agents/instruct.py +379 -0
- scilink-0.0.10/scilink/agents/planning_agents/knowledge_base.py +307 -0
- scilink-0.0.10/scilink/agents/planning_agents/orchestrator_tools.py +1750 -0
- scilink-0.0.10/scilink/agents/planning_agents/parser_utils.py +443 -0
- scilink-0.0.10/scilink/agents/planning_agents/pdf_parser.py +137 -0
- scilink-0.0.10/scilink/agents/planning_agents/planning_agent.py +1561 -0
- scilink-0.0.10/scilink/agents/planning_agents/planning_orchestrator.py +794 -0
- scilink-0.0.10/scilink/agents/planning_agents/rag_engine.py +569 -0
- scilink-0.0.10/scilink/agents/planning_agents/repo_loader.py +61 -0
- scilink-0.0.10/scilink/agents/planning_agents/scalarizer_agent.py +445 -0
- scilink-0.0.10/scilink/agents/planning_agents/user_interface.py +117 -0
- scilink-0.0.10/scilink/agents/sim_agents/__init__.py +3 -0
- scilink-0.0.10/scilink/agents/sim_agents/_deprecation.py +84 -0
- scilink-0.0.10/scilink/agents/sim_agents/atomate2_utils.py +64 -0
- scilink-0.0.10/scilink/agents/sim_agents/docs/aimsgb.txt +1331 -0
- scilink-0.0.10/scilink/agents/sim_agents/force_field_agent.py +1835 -0
- scilink-0.0.10/scilink/agents/sim_agents/instruct.py +419 -0
- scilink-0.0.10/scilink/agents/sim_agents/lammps_agent.py +828 -0
- scilink-0.0.10/scilink/agents/sim_agents/lammps_updater.py +452 -0
- scilink-0.0.10/scilink/agents/sim_agents/lammps_utils.py +412 -0
- scilink-0.0.10/scilink/agents/sim_agents/packmol_agent.py +550 -0
- scilink-0.0.10/scilink/agents/sim_agents/structure_agent.py +430 -0
- scilink-0.0.10/scilink/agents/sim_agents/tools.py +44 -0
- scilink-0.0.10/scilink/agents/sim_agents/utils.py +389 -0
- scilink-0.0.10/scilink/agents/sim_agents/val_agent.py +413 -0
- scilink-0.0.10/scilink/agents/sim_agents/vasp_agent.py +174 -0
- scilink-0.0.10/scilink/agents/sim_agents/vasp_updater.py +109 -0
- scilink-0.0.10/scilink/auth.py +238 -0
- scilink-0.0.10/scilink/cli/__init__.py +14 -0
- scilink-0.0.10/scilink/cli/agents.py +34 -0
- scilink-0.0.10/scilink/cli/analyze.py +537 -0
- scilink-0.0.10/scilink/cli/main.py +191 -0
- scilink-0.0.10/scilink/cli/plan.py +619 -0
- scilink-0.0.10/scilink/cli/run_agent.py +295 -0
- scilink-0.0.10/scilink/cli/simulate.py +56 -0
- scilink-0.0.10/scilink/cli/workflows.py +756 -0
- scilink-0.0.10/scilink/executors.py +173 -0
- scilink-0.0.10/scilink/tools/atomistic_model_manager.py +216 -0
- scilink-0.0.10/scilink/tools/atomistic_tools.py +476 -0
- scilink-0.0.10/scilink/tools/bo_tools.py +397 -0
- scilink-0.0.10/scilink/tools/curve_fitting_tools.py +65 -0
- scilink-0.0.10/scilink/tools/fft_nmf.py +246 -0
- scilink-0.0.10/scilink/tools/hyperspectral_tools.py +825 -0
- scilink-0.0.10/scilink/tools/image_processor.py +271 -0
- scilink-0.0.10/scilink/tools/sam.py +442 -0
- scilink-0.0.10/scilink/tools/spectral_unmixer.py +129 -0
- scilink-0.0.10/scilink/workflows/__init__.py +25 -0
- scilink-0.0.10/scilink/workflows/analyzers.py +175 -0
- scilink-0.0.10/scilink/workflows/dft_recommendation_workflow.py +117 -0
- scilink-0.0.10/scilink/workflows/dft_workflow.py +574 -0
- scilink-0.0.10/scilink/workflows/experiment2dft.py +712 -0
- scilink-0.0.10/scilink/workflows/experiment_novelty_workflow.py +915 -0
- scilink-0.0.10/scilink/workflows/hyperspectral_analysis_workflow.py +85 -0
- scilink-0.0.10/scilink/workflows/md_workflow.py +669 -0
- scilink-0.0.10/scilink/workflows/microscopy_analysis_workflow.py +75 -0
- scilink-0.0.10/scilink/workflows/multimodal_workflow.py +206 -0
- scilink-0.0.10/scilink/workflows/spectroscopy1d_analysis_workflow.py +80 -0
- scilink-0.0.10/scilink/wrappers/__init__.py +49 -0
- scilink-0.0.10/scilink/wrappers/litellm_wrapper.py +735 -0
- scilink-0.0.10/scilink/wrappers/llama_wrapper.py +99 -0
- scilink-0.0.10/scilink/wrappers/openai_wrapper.py +143 -0
- scilink-0.0.10/scilink/wrappers/openai_wrapper_embeddings.py +36 -0
- scilink-0.0.10/scilink/wrappers/openai_wrapper_tools.py +326 -0
- scilink-0.0.10/scilink.egg-info/PKG-INFO +662 -0
- scilink-0.0.10/scilink.egg-info/SOURCES.txt +117 -0
- scilink-0.0.10/scilink.egg-info/dependency_links.txt +1 -0
- scilink-0.0.10/scilink.egg-info/entry_points.txt +4 -0
- scilink-0.0.10/scilink.egg-info/requires.txt +15 -0
- scilink-0.0.10/scilink.egg-info/top_level.txt +4 -0
- scilink-0.0.10/setup.cfg +4 -0
scilink-0.0.10/PKG-INFO
ADDED
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: scilink
|
|
3
|
+
Version: 0.0.10
|
|
4
|
+
Summary: A framework for bridging experimental observations with literature analysis and computational materials modeling via large language models
|
|
5
|
+
Author-email: SciLink Team <maxim.ziatdinov@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/scilink/scilink
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/scilink/scilink/issues
|
|
8
|
+
Keywords: materials science,computational modeling,machine learning,large language models,generative AI,microscopy,spectroscopy,density functional theory,atomic simulation,experimental analysis,literature mining
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
Requires-Dist: litellm>=1.80.16
|
|
22
|
+
Requires-Dist: atomai>=0.8.1
|
|
23
|
+
Requires-Dist: edison-client>=0.7.6
|
|
24
|
+
Requires-Dist: ase>=0.8.5
|
|
25
|
+
Requires-Dist: aimsgb>=1.1.1
|
|
26
|
+
Requires-Dist: gdown>=5.2.0
|
|
27
|
+
Requires-Dist: atomate2>=0.0.21
|
|
28
|
+
Requires-Dist: faiss-cpu>=1.12.0
|
|
29
|
+
Requires-Dist: mdanalysis>=2.9.0
|
|
30
|
+
Requires-Dist: pymupdf>=1.26.5
|
|
31
|
+
Requires-Dist: pdfplumber>=0.11.7
|
|
32
|
+
Requires-Dist: pandas>=2.3.3
|
|
33
|
+
Requires-Dist: openpyxl>=3.1.5
|
|
34
|
+
Requires-Dist: botorch>=0.16.1
|
|
35
|
+
Requires-Dist: lmfit>=1.3.4
|
|
36
|
+
|
|
37
|
+
# SciLink
|
|
38
|
+
|
|
39
|
+
**AI-Powered Scientific Research Automation Platform**
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
SciLink employs a system of intelligent agents to automate experimental design, data analysis, and iterative optimization workflows. Built around large language models with domain-specific tools, these agents act as AI research partners that can plan experiments, analyze results across multiple modalities, and suggest optimal next steps.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Overview
|
|
48
|
+
|
|
49
|
+
SciLink provides three complementary agent systems that cover the full scientific research cycle:
|
|
50
|
+
|
|
51
|
+
| System | Purpose | Key Capabilities |
|
|
52
|
+
|--------|---------|------------------|
|
|
53
|
+
| **Planning Agents** | Experimental design & optimization | Hypothesis generation, Bayesian optimization, literature-aware planning |
|
|
54
|
+
| **Analysis Agents** | Multi-modal data analysis | Microscopy, spectroscopy, particle segmentation, curve fitting |
|
|
55
|
+
| **Simulation Agents** | Computational modeling | DFT calculations, classical MD (LAMMPS), structure recommendations |
|
|
56
|
+
|
|
57
|
+
All systems support configurable autonomy levels—from co-pilot mode where humans lead and AI assists, to fully autonomous operation where the agent chains all tools independently.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install scilink
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Environment Variables
|
|
68
|
+
|
|
69
|
+
Set API keys for your preferred LLM provider:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Google Gemini (default)
|
|
73
|
+
export GEMINI_API_KEY="your-key"
|
|
74
|
+
|
|
75
|
+
# OpenAI
|
|
76
|
+
export OPENAI_API_KEY="your-key"
|
|
77
|
+
|
|
78
|
+
# Anthropic
|
|
79
|
+
export ANTHROPIC_API_KEY="your-key"
|
|
80
|
+
|
|
81
|
+
# Internal proxy (if applicable)
|
|
82
|
+
export SCILINK_API_KEY="your-key"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Quick Start
|
|
88
|
+
|
|
89
|
+
### Planning a New Experiment
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Interactive planning session
|
|
93
|
+
scilink plan
|
|
94
|
+
|
|
95
|
+
# With specific settings
|
|
96
|
+
scilink plan --autonomy supervised --data-dir ./results --knowledge-dir ./papers
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Analyzing Experimental Data
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Interactive analysis session
|
|
103
|
+
scilink analyze
|
|
104
|
+
|
|
105
|
+
# With data file
|
|
106
|
+
scilink analyze --data ./sample.tif --metadata ./metadata.json
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Python API
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from scilink.agents.planning_agents import PlanningAgent, BOAgent
|
|
113
|
+
from scilink.agents.exp_agents import AnalysisOrchestratorAgent, AnalysisMode
|
|
114
|
+
|
|
115
|
+
# Generate an experimental plan
|
|
116
|
+
planner = PlanningAgent(model_name="gemini-2.0-flash")
|
|
117
|
+
plan = planner.propose_experiments(
|
|
118
|
+
objective="Optimize lithium extraction yield",
|
|
119
|
+
knowledge_paths=["./literature/"],
|
|
120
|
+
primary_data_set={"file_path": "./composition_data.xlsx"}
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
# Analyze microscopy data
|
|
124
|
+
analyzer = AnalysisOrchestratorAgent(
|
|
125
|
+
analysis_mode=AnalysisMode.SUPERVISED
|
|
126
|
+
)
|
|
127
|
+
result = analyzer.chat("Analyze ./stem_image.tif and generate scientific claims")
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
# Planning Agents
|
|
133
|
+
|
|
134
|
+
The Planning Agents module provides an AI-powered research orchestration system that automates experimental design, data analysis, and iterative optimization workflows.
|
|
135
|
+
|
|
136
|
+
## Architecture
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
PlanningOrchestratorAgent (main coordinator)
|
|
140
|
+
├── PlanningAgent (scientific strategy)
|
|
141
|
+
│ ├── Dual KnowledgeBase (Docs KB + Code KB)
|
|
142
|
+
│ ├── RAG Engine (retrieval-augmented generation)
|
|
143
|
+
│ └── Literature Agent (external search)
|
|
144
|
+
├── ScalarizerAgent (raw data → scalar metrics)
|
|
145
|
+
└── BOAgent (Bayesian optimization)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
| Agent | Purpose |
|
|
149
|
+
|-------|---------|
|
|
150
|
+
| **PlanningOrchestratorAgent** | Coordinates the full experimental workflow via natural language |
|
|
151
|
+
| **PlanningAgent** | Generates experimental strategies using dual knowledge bases |
|
|
152
|
+
| **ScalarizerAgent** | Converts raw data (CSV, Excel) into optimization-ready metrics |
|
|
153
|
+
| **BOAgent** | Suggests optimal parameters via Bayesian Optimization |
|
|
154
|
+
|
|
155
|
+
### Autonomy Levels
|
|
156
|
+
|
|
157
|
+
- **Co-Pilot** (default): Human leads, AI assists. Reviews every step.
|
|
158
|
+
- **Supervised**: AI leads, human reviews plans/code only.
|
|
159
|
+
- **Autonomous**: Full autonomy, no human review.
|
|
160
|
+
|
|
161
|
+
## CLI Usage
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Start interactive planning session
|
|
165
|
+
scilink plan
|
|
166
|
+
|
|
167
|
+
# Supervised mode with workspace config
|
|
168
|
+
scilink plan --autonomy supervised \
|
|
169
|
+
--data-dir ./experimental_results \
|
|
170
|
+
--knowledge-dir ./papers \
|
|
171
|
+
--code-dir ./opentrons_api
|
|
172
|
+
|
|
173
|
+
# Use a specific model
|
|
174
|
+
scilink plan --model gpt-4o
|
|
175
|
+
scilink plan --model claude-sonnet-4-20250514
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Interactive Session Example
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
$ scilink plan
|
|
182
|
+
|
|
183
|
+
📋 What's your research objective?
|
|
184
|
+
Your objective: Optimize lithium extraction from brine
|
|
185
|
+
|
|
186
|
+
🔧 Initializing agent...
|
|
187
|
+
✅ Agent ready!
|
|
188
|
+
|
|
189
|
+
============================================================
|
|
190
|
+
💬 CHAT SESSION STARTED
|
|
191
|
+
============================================================
|
|
192
|
+
|
|
193
|
+
👤 You: Generate a plan using papers in ./literature/
|
|
194
|
+
|
|
195
|
+
🤖 Agent: I'll generate an experimental plan using your literature.
|
|
196
|
+
|
|
197
|
+
⚡ Tool: Generating Initial Plan...
|
|
198
|
+
📚 Knowledge sources: ['./literature/']
|
|
199
|
+
✅ Retrieved 8 document chunks.
|
|
200
|
+
|
|
201
|
+
============================================================
|
|
202
|
+
✅ PROPOSED EXPERIMENTAL PLAN
|
|
203
|
+
============================================================
|
|
204
|
+
|
|
205
|
+
🔬 EXPERIMENT 1: pH-Controlled Selective Precipitation
|
|
206
|
+
--------------------------------------------------------------------------------
|
|
207
|
+
> 🎯 Hypothesis:
|
|
208
|
+
> Adjusting pH to 10-11 will selectively precipitate Mg(OH)₂ while retaining Li⁺
|
|
209
|
+
|
|
210
|
+
--- 🧪 Experimental Steps ---
|
|
211
|
+
1. Prepare 50mL aliquots of brine sample
|
|
212
|
+
2. Add NaOH dropwise while monitoring pH
|
|
213
|
+
3. Filter precipitate through 0.45μm membrane
|
|
214
|
+
4. Analyze filtrate via ICP-OES
|
|
215
|
+
|
|
216
|
+
📝 Press [ENTER] to approve or type feedback:
|
|
217
|
+
|
|
218
|
+
👤 You: Add implementation code using ./opentrons_api/
|
|
219
|
+
|
|
220
|
+
🤖 Agent: [calls generate_implementation_code]
|
|
221
|
+
→ Builds Code KB from ./opentrons_api/
|
|
222
|
+
→ Maps steps to API calls
|
|
223
|
+
→ Generates Python scripts
|
|
224
|
+
✅ Scripts saved to ./output_scripts/
|
|
225
|
+
|
|
226
|
+
👤 You: Analyze ./results/batch_001.csv and run optimization
|
|
227
|
+
|
|
228
|
+
🤖 Agent: [calls analyze_file]
|
|
229
|
+
→ Generates analysis script
|
|
230
|
+
→ Returns: {"metrics": {"yield": 78.5}}
|
|
231
|
+
|
|
232
|
+
[calls run_optimization]
|
|
233
|
+
→ Bayesian Optimization with 3 data points
|
|
234
|
+
→ Returns: {"recommended_parameters": {"temp": 85.2, "pH": 6.8}}
|
|
235
|
+
|
|
236
|
+
👤 You: /quit
|
|
237
|
+
👋 Session saved at: ./campaign_session
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### CLI Commands
|
|
241
|
+
|
|
242
|
+
| Command | Description |
|
|
243
|
+
|---------|-------------|
|
|
244
|
+
| `/help` | Show available commands |
|
|
245
|
+
| `/tools` | List all available agent tools |
|
|
246
|
+
| `/files` | List files in workspace |
|
|
247
|
+
| `/state` | Show current agent state |
|
|
248
|
+
| `/autonomy [level]` | Show or change autonomy level |
|
|
249
|
+
| `/checkpoint` | Save session checkpoint |
|
|
250
|
+
| `/quit` | Exit session |
|
|
251
|
+
|
|
252
|
+
## Python API
|
|
253
|
+
|
|
254
|
+
### Using the Orchestrator
|
|
255
|
+
|
|
256
|
+
```python
|
|
257
|
+
from scilink.agents.planning_agents.planning_orchestrator import (
|
|
258
|
+
PlanningOrchestratorAgent,
|
|
259
|
+
AutonomyLevel
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
orchestrator = PlanningOrchestratorAgent(
|
|
263
|
+
objective="Optimize reaction yield",
|
|
264
|
+
autonomy_level=AutonomyLevel.SUPERVISED,
|
|
265
|
+
data_dir="./experimental_results",
|
|
266
|
+
knowledge_dir="./papers"
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
response = orchestrator.chat("Generate initial plan and analyze batch_001.csv")
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Using Individual Agents
|
|
273
|
+
|
|
274
|
+
#### PlanningAgent - Experimental Design
|
|
275
|
+
|
|
276
|
+
```python
|
|
277
|
+
from scilink.agents.planning_agents import PlanningAgent
|
|
278
|
+
|
|
279
|
+
agent = PlanningAgent(model_name="gemini-2.0-flash")
|
|
280
|
+
|
|
281
|
+
plan = agent.propose_experiments(
|
|
282
|
+
objective="Screen precipitation conditions for magnesium recovery",
|
|
283
|
+
knowledge_paths=["./literature/", "./protocols.pdf"],
|
|
284
|
+
code_paths=["./opentrons_api/"],
|
|
285
|
+
primary_data_set={"file_path": "./composition_data.xlsx"},
|
|
286
|
+
enable_human_feedback=True
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
# Iterate based on results
|
|
290
|
+
updated_state = agent.update_plan_with_results(
|
|
291
|
+
results=["./results/batch_001.csv", "./plots/yield_curve.png"]
|
|
292
|
+
)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
#### ScalarizerAgent - Data Analysis
|
|
296
|
+
|
|
297
|
+
```python
|
|
298
|
+
from scilink.agents.planning_agents import ScalarizerAgent
|
|
299
|
+
|
|
300
|
+
scalarizer = ScalarizerAgent(model_name="gemini-2.0-flash")
|
|
301
|
+
|
|
302
|
+
result = scalarizer.scalarize(
|
|
303
|
+
data_path="./data/hplc_run_001.csv",
|
|
304
|
+
objective_query="Calculate peak area and purity percentage",
|
|
305
|
+
enable_human_review=True
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
print(f"Metrics: {result['metrics']}")
|
|
309
|
+
# {'peak_area': 12504.2, 'purity_percent': 98.5}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
#### BOAgent - Bayesian Optimization
|
|
313
|
+
|
|
314
|
+
```python
|
|
315
|
+
from scilink.agents.planning_agents import BOAgent
|
|
316
|
+
|
|
317
|
+
bo = BOAgent(model_name="gemini-2.0-flash")
|
|
318
|
+
|
|
319
|
+
result = bo.run_optimization_loop(
|
|
320
|
+
data_path="./optimization_data.csv",
|
|
321
|
+
objective_text="Maximize yield while minimizing cost",
|
|
322
|
+
input_cols=["Temperature", "pH", "Concentration"],
|
|
323
|
+
input_bounds=[[20, 80], [6, 10], [0.1, 2.0]],
|
|
324
|
+
target_cols=["Yield"],
|
|
325
|
+
batch_size=1
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
print(f"Next parameters: {result['next_parameters']}")
|
|
329
|
+
# {'Temperature': 65.2, 'pH': 8.3, 'Concentration': 1.2}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
# Experimental Analysis Agents
|
|
335
|
+
|
|
336
|
+
The Analysis Agents module provides automated scientific data analysis across multiple modalities—microscopy, spectroscopy, particle segmentation, and curve fitting.
|
|
337
|
+
|
|
338
|
+
## Architecture
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
AnalysisOrchestratorAgent (main coordinator)
|
|
342
|
+
├── FFTMicroscopyAnalysisAgent (ID: 0)
|
|
343
|
+
├── SAMMicroscopyAnalysisAgent (ID: 1)
|
|
344
|
+
├── HyperspectralAnalysisAgent (ID: 2)
|
|
345
|
+
└── CurveFittingAgent (ID: 3)
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
| ID | Agent | Use Case |
|
|
349
|
+
|----|-------|----------|
|
|
350
|
+
| 0 | **FFTMicroscopyAnalysisAgent** | Microstructure via FFT/NMF—grains, phases, atomic-resolution |
|
|
351
|
+
| 1 | **SAMMicroscopyAnalysisAgent** | Particle segmentation—counting, size distributions |
|
|
352
|
+
| 2 | **HyperspectralAnalysisAgent** | Spectroscopic datacubes—EELS-SI, EDS, Raman imaging |
|
|
353
|
+
| 3 | **CurveFittingAgent** | 1D fitting—XRD, UV-Vis, PL, DSC, kinetics |
|
|
354
|
+
|
|
355
|
+
### Autonomy Levels
|
|
356
|
+
|
|
357
|
+
- **Co-Pilot** (default): Human leads, AI assists. Reviews agent selection.
|
|
358
|
+
- **Supervised**: AI leads, human approves major decisions.
|
|
359
|
+
- **Autonomous**: Full autonomy for complete analysis pipelines.
|
|
360
|
+
|
|
361
|
+
## CLI Usage
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
# Start interactive analysis session
|
|
365
|
+
scilink analyze
|
|
366
|
+
|
|
367
|
+
# With data and metadata
|
|
368
|
+
scilink analyze --data ./sample.tif --metadata ./metadata.json
|
|
369
|
+
|
|
370
|
+
# Autonomous mode
|
|
371
|
+
scilink analyze --mode autonomous --data ./spectrum.npy
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Interactive Session Example
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
$ scilink analyze --data ./stem_image.tif
|
|
378
|
+
|
|
379
|
+
============================================================
|
|
380
|
+
🔬 SCILINK ANALYSIS ORCHESTRATOR
|
|
381
|
+
============================================================
|
|
382
|
+
|
|
383
|
+
👤 You: Examine my data and suggest an analysis approach
|
|
384
|
+
|
|
385
|
+
🤖 Agent: I'll examine your data file.
|
|
386
|
+
|
|
387
|
+
⚡ Tool: Examining data at ./stem_image.tif...
|
|
388
|
+
|
|
389
|
+
• Type: microscopy
|
|
390
|
+
• Shape: 2048 x 2048 pixels
|
|
391
|
+
• Suggested agents: FFTMicroscopyAnalysisAgent (0) or SAMMicroscopyAnalysisAgent (1)
|
|
392
|
+
|
|
393
|
+
👤 You: Preview the image and select the best agent
|
|
394
|
+
|
|
395
|
+
🤖 Agent: Looking at the image, I can see atomic-resolution features with a crystalline lattice.
|
|
396
|
+
|
|
397
|
+
⚡ Tool: Setting agent to 0...
|
|
398
|
+
|
|
399
|
+
Selected **FFTMicroscopyAnalysisAgent** for microstructure analysis.
|
|
400
|
+
|
|
401
|
+
👤 You: Convert this to metadata: HAADF-STEM of MoS2, 50nm FOV, 300kV
|
|
402
|
+
|
|
403
|
+
🤖 Agent: ⚡ Tool: Converting metadata...
|
|
404
|
+
✅ Metadata saved
|
|
405
|
+
|
|
406
|
+
👤 You: Run the analysis
|
|
407
|
+
|
|
408
|
+
🤖 Agent: ⚡ Tool: Running analysis...
|
|
409
|
+
Analysis ID: stem_image_FFT_20250202_143215_001
|
|
410
|
+
|
|
411
|
+
**Detailed Analysis:**
|
|
412
|
+
The HAADF-STEM image reveals MoS2 with predominantly 2H phase structure.
|
|
413
|
+
FFT analysis identified four distinct spatial frequency patterns...
|
|
414
|
+
|
|
415
|
+
**Scientific Claims Generated:** 3
|
|
416
|
+
|
|
417
|
+
👤 You: What follow-up measurements do you recommend?
|
|
418
|
+
|
|
419
|
+
🤖 Agent:
|
|
420
|
+
1. **[Priority 1] EELS Spectrum Imaging** - Target sulfur vacancy clusters
|
|
421
|
+
2. **[Priority 2] 4D-STEM Strain Mapping** - Quantify grain boundary strain
|
|
422
|
+
3. **[Priority 3] Time-Series Imaging** - Assess defect evolution
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### CLI Commands
|
|
426
|
+
|
|
427
|
+
| Command | Description |
|
|
428
|
+
|---------|-------------|
|
|
429
|
+
| `/help` | Show available commands |
|
|
430
|
+
| `/tools` | List orchestrator tools |
|
|
431
|
+
| `/agents` | List analysis agents with descriptions |
|
|
432
|
+
| `/status` | Show session state |
|
|
433
|
+
| `/mode [level]` | Show or change analysis mode |
|
|
434
|
+
| `/checkpoint` | Save checkpoint |
|
|
435
|
+
| `/schema` | Show metadata JSON schema |
|
|
436
|
+
| `/quit` | Exit session |
|
|
437
|
+
|
|
438
|
+
## Python API
|
|
439
|
+
|
|
440
|
+
### Using the Orchestrator
|
|
441
|
+
|
|
442
|
+
```python
|
|
443
|
+
from scilink.agents.exp_agents import AnalysisOrchestratorAgent, AnalysisMode
|
|
444
|
+
|
|
445
|
+
orchestrator = AnalysisOrchestratorAgent(
|
|
446
|
+
base_dir="./my_analysis",
|
|
447
|
+
analysis_mode=AnalysisMode.SUPERVISED
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
response = orchestrator.chat("Examine ./data/sample.tif")
|
|
451
|
+
response = orchestrator.chat("Select agent 0 and run analysis")
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Using Individual Agents
|
|
455
|
+
|
|
456
|
+
#### FFTMicroscopyAnalysisAgent
|
|
457
|
+
|
|
458
|
+
```python
|
|
459
|
+
from scilink.agents.exp_agents import FFTMicroscopyAnalysisAgent
|
|
460
|
+
|
|
461
|
+
agent = FFTMicroscopyAnalysisAgent(
|
|
462
|
+
output_dir="./fft_output",
|
|
463
|
+
enable_human_feedback=True
|
|
464
|
+
)
|
|
465
|
+
|
|
466
|
+
# Single image
|
|
467
|
+
result = agent.analyze("sample.tif", system_info=metadata)
|
|
468
|
+
|
|
469
|
+
# Batch/series
|
|
470
|
+
result = agent.analyze(
|
|
471
|
+
["frame_001.tif", "frame_002.tif"],
|
|
472
|
+
series_metadata={"series_type": "time", "values": [0, 10], "unit": "s"}
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
# Get recommendations
|
|
476
|
+
recommendations = agent.recommend_measurements(analysis_result=result)
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
#### SAMMicroscopyAnalysisAgent
|
|
480
|
+
|
|
481
|
+
```python
|
|
482
|
+
from scilink.agents.exp_agents import SAMMicroscopyAnalysisAgent
|
|
483
|
+
|
|
484
|
+
agent = SAMMicroscopyAnalysisAgent(
|
|
485
|
+
output_dir="./sam_output",
|
|
486
|
+
sam_settings={"min_area": 100, "sam_parameters": "sensitive"}
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
result = agent.analyze("nanoparticles.tif")
|
|
490
|
+
print(f"Particles: {result['summary']['successful']}")
|
|
491
|
+
print(f"Mean area: {result['statistics']['mean_area_pixels']:.1f} px²")
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
#### HyperspectralAnalysisAgent
|
|
495
|
+
|
|
496
|
+
```python
|
|
497
|
+
from scilink.agents.exp_agents import HyperspectralAnalysisAgent
|
|
498
|
+
|
|
499
|
+
agent = HyperspectralAnalysisAgent(
|
|
500
|
+
output_dir="./hyperspectral_output",
|
|
501
|
+
run_preprocessing=True
|
|
502
|
+
)
|
|
503
|
+
|
|
504
|
+
# 3D datacube: (height, width, energy_channels)
|
|
505
|
+
result = agent.analyze(
|
|
506
|
+
"eels_spectrum_image.npy",
|
|
507
|
+
system_info={"experiment": {"technique": "EELS-SI"}},
|
|
508
|
+
structure_image_path="haadf_reference.tif" # Optional correlation
|
|
509
|
+
)
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
#### CurveFittingAgent
|
|
513
|
+
|
|
514
|
+
```python
|
|
515
|
+
from scilink.agents.exp_agents import CurveFittingAgent
|
|
516
|
+
|
|
517
|
+
agent = CurveFittingAgent(
|
|
518
|
+
output_dir="./curve_output",
|
|
519
|
+
use_literature=True, # Search for fitting models
|
|
520
|
+
r2_threshold=0.95
|
|
521
|
+
)
|
|
522
|
+
|
|
523
|
+
result = agent.analyze(
|
|
524
|
+
"pl_spectrum.csv",
|
|
525
|
+
system_info={"experiment": {"technique": "Photoluminescence"}},
|
|
526
|
+
hints="Focus on band-edge emission"
|
|
527
|
+
)
|
|
528
|
+
|
|
529
|
+
print(f"Model: {result['model_type']}")
|
|
530
|
+
print(f"R²: {result['fit_quality']['r_squared']:.4f}")
|
|
531
|
+
|
|
532
|
+
# Series with trend analysis
|
|
533
|
+
result = agent.analyze(
|
|
534
|
+
["pl_300K.csv", "pl_350K.csv", "pl_400K.csv"],
|
|
535
|
+
series_metadata={"series_type": "temperature", "values": [300, 350, 400], "unit": "K"}
|
|
536
|
+
)
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### Metadata Conversion
|
|
540
|
+
|
|
541
|
+
```python
|
|
542
|
+
from scilink.agents.exp_agents import generate_metadata_json_from_text
|
|
543
|
+
|
|
544
|
+
# Convert natural language to structured metadata
|
|
545
|
+
metadata = generate_metadata_json_from_text("./experiment_notes.txt")
|
|
546
|
+
|
|
547
|
+
# Input: "HAADF-STEM of MoS2 monolayer, 50nm FOV, 300kV"
|
|
548
|
+
# Output: {"experiment_type": "Microscopy", "experiment": {"technique": "HAADF-STEM"}, ...}
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
---
|
|
552
|
+
|
|
553
|
+
## Agent Selection Guide
|
|
554
|
+
|
|
555
|
+
### Planning Agents
|
|
556
|
+
|
|
557
|
+
| Scenario | Agent/Tool |
|
|
558
|
+
|----------|------------|
|
|
559
|
+
| Generate experimental strategy | `PlanningAgent.propose_experiments()` |
|
|
560
|
+
| Extract metrics from raw data | `ScalarizerAgent.scalarize()` |
|
|
561
|
+
| Optimize experimental parameters | `BOAgent.run_optimization_loop()` |
|
|
562
|
+
| Full interactive workflow | `PlanningOrchestratorAgent.chat()` |
|
|
563
|
+
|
|
564
|
+
### Analysis Agents
|
|
565
|
+
|
|
566
|
+
| Data Type | Agent | When to Use |
|
|
567
|
+
|-----------|-------|-------------|
|
|
568
|
+
| Microscopy (atomic) | FFT (0) | Grains, phases, lattices, domains |
|
|
569
|
+
| Microscopy (particles) | SAM (1) | Counting, sizing, segmentation |
|
|
570
|
+
| Hyperspectral | Hyperspectral (2) | EELS-SI, EDS maps, Raman imaging |
|
|
571
|
+
| 1D curves | CurveFitting (3) | XRD, PL, DSC, any x-y fitting |
|
|
572
|
+
|
|
573
|
+
---
|
|
574
|
+
|
|
575
|
+
```bash
|
|
576
|
+
# Use with any provider
|
|
577
|
+
scilink plan --model gpt-4o
|
|
578
|
+
scilink analyze --model claude-sonnet-4-20250514
|
|
579
|
+
|
|
580
|
+
# Custom endpoint
|
|
581
|
+
scilink plan --base-url https://my-proxy.example.com/v1 --model my-model
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
---
|
|
585
|
+
|
|
586
|
+
## Output Structure
|
|
587
|
+
|
|
588
|
+
### Planning Session
|
|
589
|
+
|
|
590
|
+
```
|
|
591
|
+
campaign_session/
|
|
592
|
+
├── optimization_data.csv # Accumulated experimental data
|
|
593
|
+
├── plan.json # Current experimental plan
|
|
594
|
+
├── plan.html # Rendered plan visualization
|
|
595
|
+
├── checkpoint.json # Session state for restoration
|
|
596
|
+
└── output_scripts/ # Generated automation code
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
### Analysis Session
|
|
600
|
+
|
|
601
|
+
```
|
|
602
|
+
analysis_session/
|
|
603
|
+
├── results/
|
|
604
|
+
│ └── analysis_{dataset}_{agent}_{timestamp}/
|
|
605
|
+
│ ├── metadata_used.json
|
|
606
|
+
│ ├── analysis_results.json
|
|
607
|
+
│ ├── visualizations/
|
|
608
|
+
│ └── report.html
|
|
609
|
+
├── chat_history.json
|
|
610
|
+
└── checkpoint.json
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
## Key Features
|
|
616
|
+
|
|
617
|
+
### Planning Agents
|
|
618
|
+
- **Dual Knowledge Base**: Separate retrieval for scientific literature and implementation code
|
|
619
|
+
- **Human-in-the-Loop**: Configurable review points for plans and generated code
|
|
620
|
+
- **Self-Correction**: Automatic plan verification and refinement loops
|
|
621
|
+
- **Bayesian Optimization**: Single and multi-objective parameter optimization
|
|
622
|
+
- **Script Consistency**: Locked analysis scripts ensure reproducible metrics
|
|
623
|
+
|
|
624
|
+
### Analysis Agents
|
|
625
|
+
- **Automatic Agent Selection**: Examines data and routes to appropriate pipeline
|
|
626
|
+
- **Quality Control**: Fit quality assessment with automatic retry (CurveFitting)
|
|
627
|
+
- **Scientific Claims**: Generates literature-searchable claims with keywords
|
|
628
|
+
- **Measurement Recommendations**: Suggests follow-up experiments
|
|
629
|
+
- **Series Analysis**: Built-in support for time series, temperature sweeps
|
|
630
|
+
|
|
631
|
+
### Shared Features
|
|
632
|
+
- **Multi-Provider Support**: OpenAI, Gemini, Anthropic via LiteLLM
|
|
633
|
+
- **Session Persistence**: Checkpoint/restore for long-running workflows
|
|
634
|
+
- **Multimodal Support**: Images, PDFs, Excel, CSV, numpy arrays
|
|
635
|
+
- **Flexible Input**: Single files, batch processing, or directories
|
|
636
|
+
|
|
637
|
+
---
|
|
638
|
+
|
|
639
|
+
# Simulation Agents *(Coming Soon)*
|
|
640
|
+
|
|
641
|
+
The Simulation Agents module provides AI-powered computational modeling capabilities, bridging experimental observations with atomistic simulations.
|
|
642
|
+
|
|
643
|
+
## Planned Capabilities
|
|
644
|
+
|
|
645
|
+
| Agent | Purpose |
|
|
646
|
+
|-------|---------|
|
|
647
|
+
| **DFTAgent** | Density Functional Theory workflow automation |
|
|
648
|
+
| **MDAgent** | Classical molecular dynamics simulations via LAMMPS |
|
|
649
|
+
| **SimulationRecommendationAgent** | Recommends structures and simulation objectives based on experimental analysis (within available DFT/MD methods) |
|
|
650
|
+
|
|
651
|
+
### Key Features (In Development)
|
|
652
|
+
|
|
653
|
+
- **Experiment-to-Simulation Pipeline**: Automatically generate simulation input structures from microscopy analysis
|
|
654
|
+
- **Defect Modeling**: Create supercells with point defects, grain boundaries, and interfaces identified in images
|
|
655
|
+
- **DFT Calculations**: Electronic structure, formation energies, and spectroscopic signatures
|
|
656
|
+
- **Classical MD Simulations**: Large-scale dynamics, thermal properties, mechanical response via LAMMPS
|
|
657
|
+
|
|
658
|
+
### Integration with Analysis Agents
|
|
659
|
+
|
|
660
|
+
The Simulation Agents will integrate directly with the Analysis Agents. Experimental analysis and interpretation will be used to recommend structures and simulation objectives that provide deeper insight into observed phenomena:
|
|
661
|
+
|
|
662
|
+
> **Note**: This module is currently being refactored. Check back for updates.
|