Spaces:
Running
Running
Commit
Β·
2dc022a
1
Parent(s):
2763672
feat(architecture): update system design and roadmap for Phases 1-8
Browse files- Revised high-level design to include detailed phases and components of the Magentic system.
- Introduced new agents: Magentic Manager, SearchAgent, HypothesisAgent, JudgeAgent, and ReportAgent, each with specific roles in the research process.
- Updated success criteria to reflect completion of Phases 1-5 and outlined specifications for Phases 6-8.
- Enhanced documentation for clarity on system architecture and agent interactions.
- docs/architecture/overview.md +67 -68
- docs/implementation/roadmap.md +82 -12
docs/architecture/overview.md
CHANGED
|
@@ -63,53 +63,58 @@ Using existing approved drugs to treat NEW diseases they weren't originally desi
|
|
| 63 |
|
| 64 |
## System Architecture
|
| 65 |
|
| 66 |
-
### High-Level Design
|
| 67 |
|
| 68 |
```
|
| 69 |
-
User
|
| 70 |
β
|
| 71 |
-
|
| 72 |
β
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
5. If YES β Synthesize findings
|
| 79 |
β
|
| 80 |
-
Research Report
|
| 81 |
```
|
| 82 |
|
| 83 |
### Key Components
|
| 84 |
|
| 85 |
-
1. **
|
| 86 |
-
-
|
| 87 |
-
-
|
| 88 |
-
-
|
| 89 |
-
-
|
| 90 |
-
|
| 91 |
-
2. **
|
| 92 |
-
- PubMed
|
| 93 |
-
-
|
| 94 |
-
-
|
| 95 |
-
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
-
|
| 100 |
-
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
-
|
| 105 |
-
-
|
| 106 |
-
-
|
| 107 |
-
|
| 108 |
-
5. **
|
| 109 |
-
-
|
| 110 |
-
-
|
| 111 |
-
-
|
| 112 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
---
|
| 115 |
|
|
@@ -275,37 +280,31 @@ httpx = "^0.27"
|
|
| 275 |
|
| 276 |
## Success Criteria
|
| 277 |
|
| 278 |
-
###
|
| 279 |
-
**
|
| 280 |
- [x] User can ask drug repurposing question
|
| 281 |
-
- [
|
| 282 |
-
- [
|
| 283 |
-
- [
|
| 284 |
-
- [
|
| 285 |
-
- [
|
| 286 |
-
- [
|
| 287 |
-
- [
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
- [
|
| 294 |
-
- [
|
| 295 |
-
- [
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
- [ ]
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
**Nice-to-have if time permits:**
|
| 304 |
-
- [ ] Modal integration for local LLM fallback
|
| 305 |
-
- [ ] Clinical trials database search
|
| 306 |
-
- [ ] Checkpoint/resume functionality
|
| 307 |
-
- [ ] OpenFDA drug safety lookup
|
| 308 |
-
- [ ] PDF export of research reports
|
| 309 |
|
| 310 |
### What's EXPLICITLY Out of Scope
|
| 311 |
**NOT building (to stay focused):**
|
|
|
|
| 63 |
|
| 64 |
## System Architecture
|
| 65 |
|
| 66 |
+
### High-Level Design (Phases 1-8)
|
| 67 |
|
| 68 |
```
|
| 69 |
+
User Query
|
| 70 |
β
|
| 71 |
+
Gradio UI (Phase 4)
|
| 72 |
β
|
| 73 |
+
Magentic Manager (Phase 5) β LLM-powered coordinator
|
| 74 |
+
βββ SearchAgent (Phase 2+5) ββ PubMed + Web + VectorDB (Phase 6)
|
| 75 |
+
βββ HypothesisAgent (Phase 7) ββ Mechanistic Reasoning
|
| 76 |
+
βββ JudgeAgent (Phase 3+5) ββ Evidence Assessment
|
| 77 |
+
βββ ReportAgent (Phase 8) ββ Final Synthesis
|
|
|
|
| 78 |
β
|
| 79 |
+
Structured Research Report
|
| 80 |
```
|
| 81 |
|
| 82 |
### Key Components
|
| 83 |
|
| 84 |
+
1. **Magentic Manager (Orchestrator)**
|
| 85 |
+
- LLM-powered multi-agent coordinator
|
| 86 |
+
- Dynamic planning and agent selection
|
| 87 |
+
- Built-in stall detection and replanning
|
| 88 |
+
- Microsoft Agent Framework integration
|
| 89 |
+
|
| 90 |
+
2. **SearchAgent (Phase 2+5+6)**
|
| 91 |
+
- PubMed E-utilities search
|
| 92 |
+
- DuckDuckGo web search
|
| 93 |
+
- Semantic search via ChromaDB (Phase 6)
|
| 94 |
+
- Evidence deduplication
|
| 95 |
+
|
| 96 |
+
3. **HypothesisAgent (Phase 7)**
|
| 97 |
+
- Generates Drug β Target β Pathway β Effect hypotheses
|
| 98 |
+
- Guides targeted searches
|
| 99 |
+
- Scientific reasoning about mechanisms
|
| 100 |
+
|
| 101 |
+
4. **JudgeAgent (Phase 3+5)**
|
| 102 |
+
- LLM-based evidence assessment
|
| 103 |
+
- Mechanism score + Clinical score
|
| 104 |
+
- Recommends continue/synthesize
|
| 105 |
+
- Generates refined search queries
|
| 106 |
+
|
| 107 |
+
5. **ReportAgent (Phase 8)**
|
| 108 |
+
- Structured scientific reports
|
| 109 |
+
- Executive summary, methodology
|
| 110 |
+
- Hypotheses tested with evidence counts
|
| 111 |
+
- Proper citations and limitations
|
| 112 |
+
|
| 113 |
+
6. **Gradio UI (Phase 4)**
|
| 114 |
+
- Chat interface for questions
|
| 115 |
+
- Real-time progress via events
|
| 116 |
+
- Mode toggle (Simple/Magentic)
|
| 117 |
+
- Formatted markdown output
|
| 118 |
|
| 119 |
---
|
| 120 |
|
|
|
|
| 280 |
|
| 281 |
## Success Criteria
|
| 282 |
|
| 283 |
+
### Phase 1-5 (MVP) β
COMPLETE
|
| 284 |
+
**Completed in ONE DAY:**
|
| 285 |
- [x] User can ask drug repurposing question
|
| 286 |
+
- [x] Agent searches PubMed (async)
|
| 287 |
+
- [x] Agent searches web (DuckDuckGo)
|
| 288 |
+
- [x] LLM judge evaluates evidence quality
|
| 289 |
+
- [x] System respects token budget and iterations
|
| 290 |
+
- [x] Output includes drug candidates + citations
|
| 291 |
+
- [x] Works end-to-end for demo query
|
| 292 |
+
- [x] Gradio UI with streaming progress
|
| 293 |
+
- [x] Magentic multi-agent orchestration
|
| 294 |
+
- [x] 38 unit tests passing
|
| 295 |
+
- [x] CI/CD pipeline green
|
| 296 |
+
|
| 297 |
+
### Hackathon Submission β
COMPLETE
|
| 298 |
+
- [x] Gradio UI deployed on HuggingFace Spaces
|
| 299 |
+
- [x] Example queries working and tested
|
| 300 |
+
- [x] Architecture documentation
|
| 301 |
+
- [x] README with setup instructions
|
| 302 |
+
|
| 303 |
+
### Phase 6-8 (Enhanced)
|
| 304 |
+
**Specs ready for implementation:**
|
| 305 |
+
- [ ] Embeddings & Semantic Search (Phase 6)
|
| 306 |
+
- [ ] Hypothesis Agent (Phase 7)
|
| 307 |
+
- [ ] Report Agent (Phase 8)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
|
| 309 |
### What's EXPLICITLY Out of Scope
|
| 310 |
**NOT building (to stay focused):**
|
docs/implementation/roadmap.md
CHANGED
|
@@ -115,26 +115,96 @@ tests/
|
|
| 115 |
|
| 116 |
---
|
| 117 |
|
| 118 |
-
### **Phase 5: Magentic Integration
|
| 119 |
|
| 120 |
*Goal: Upgrade orchestrator to use Microsoft Agent Framework patterns.*
|
| 121 |
|
| 122 |
-
- [
|
| 123 |
-
- [
|
| 124 |
-
- [
|
| 125 |
-
- [
|
| 126 |
- **Deliverable**: Same API, better multi-agent orchestration engine.
|
| 127 |
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
---
|
| 131 |
|
| 132 |
## Spec Documents
|
| 133 |
|
| 134 |
-
1. **[Phase 1 Spec: Foundation](01_phase_foundation.md)**
|
| 135 |
-
2. **[Phase 2 Spec: Search Slice](02_phase_search.md)**
|
| 136 |
-
3. **[Phase 3 Spec: Judge Slice](03_phase_judge.md)**
|
| 137 |
-
4. **[Phase 4 Spec: UI & Loop](04_phase_ui.md)**
|
| 138 |
-
5. **[Phase 5 Spec: Magentic Integration](05_phase_magentic.md)**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
-
*
|
|
|
|
| 115 |
|
| 116 |
---
|
| 117 |
|
| 118 |
+
### **Phase 5: Magentic Integration** β
COMPLETE
|
| 119 |
|
| 120 |
*Goal: Upgrade orchestrator to use Microsoft Agent Framework patterns.*
|
| 121 |
|
| 122 |
+
- [x] Wrap SearchHandler as `AgentProtocol` (SearchAgent) with strict protocol compliance.
|
| 123 |
+
- [x] Wrap JudgeHandler as `AgentProtocol` (JudgeAgent) with strict protocol compliance.
|
| 124 |
+
- [x] Implement `MagenticOrchestrator` using `MagenticBuilder`.
|
| 125 |
+
- [x] Create factory pattern for switching implementations.
|
| 126 |
- **Deliverable**: Same API, better multi-agent orchestration engine.
|
| 127 |
|
| 128 |
+
---
|
| 129 |
+
|
| 130 |
+
### **Phase 6: Embeddings & Semantic Search**
|
| 131 |
+
|
| 132 |
+
*Goal: Add vector search for semantic evidence retrieval.*
|
| 133 |
+
|
| 134 |
+
- [ ] Implement `EmbeddingService` with ChromaDB.
|
| 135 |
+
- [ ] Add semantic deduplication to SearchAgent.
|
| 136 |
+
- [ ] Enable semantic search for related evidence.
|
| 137 |
+
- [ ] Store embeddings in shared context.
|
| 138 |
+
- **Deliverable**: Find semantically related papers, not just keyword matches.
|
| 139 |
+
|
| 140 |
+
---
|
| 141 |
+
|
| 142 |
+
### **Phase 7: Hypothesis Agent**
|
| 143 |
+
|
| 144 |
+
*Goal: Generate scientific hypotheses to guide targeted searches.*
|
| 145 |
+
|
| 146 |
+
- [ ] Implement `MechanismHypothesis` and `HypothesisAssessment` models.
|
| 147 |
+
- [ ] Implement `HypothesisAgent` for mechanistic reasoning.
|
| 148 |
+
- [ ] Add hypothesis-driven search queries.
|
| 149 |
+
- [ ] Integrate into Magentic workflow.
|
| 150 |
+
- **Deliverable**: Drug β Target β Pathway β Effect hypotheses that guide research.
|
| 151 |
+
|
| 152 |
+
---
|
| 153 |
+
|
| 154 |
+
### **Phase 8: Report Agent**
|
| 155 |
+
|
| 156 |
+
*Goal: Generate structured scientific reports with proper citations.*
|
| 157 |
+
|
| 158 |
+
- [ ] Implement `ResearchReport` model with all sections.
|
| 159 |
+
- [ ] Implement `ReportAgent` for synthesis.
|
| 160 |
+
- [ ] Include methodology, limitations, formatted references.
|
| 161 |
+
- [ ] Integrate as final synthesis step in Magentic workflow.
|
| 162 |
+
- **Deliverable**: Publication-quality research reports.
|
| 163 |
+
|
| 164 |
+
---
|
| 165 |
+
|
| 166 |
+
## Complete Architecture (Phases 1-8)
|
| 167 |
+
|
| 168 |
+
```
|
| 169 |
+
User Query
|
| 170 |
+
β
|
| 171 |
+
Gradio UI (Phase 4)
|
| 172 |
+
β
|
| 173 |
+
Magentic Manager (Phase 5)
|
| 174 |
+
βββ SearchAgent (Phase 2+5) ββ PubMed + Web + VectorDB (Phase 6)
|
| 175 |
+
βββ HypothesisAgent (Phase 7) ββ Mechanistic Reasoning
|
| 176 |
+
βββ JudgeAgent (Phase 3+5) ββ Evidence Assessment
|
| 177 |
+
βββ ReportAgent (Phase 8) ββ Final Synthesis
|
| 178 |
+
β
|
| 179 |
+
Structured Research Report
|
| 180 |
+
```
|
| 181 |
|
| 182 |
---
|
| 183 |
|
| 184 |
## Spec Documents
|
| 185 |
|
| 186 |
+
1. **[Phase 1 Spec: Foundation](01_phase_foundation.md)** β
|
| 187 |
+
2. **[Phase 2 Spec: Search Slice](02_phase_search.md)** β
|
| 188 |
+
3. **[Phase 3 Spec: Judge Slice](03_phase_judge.md)** β
|
| 189 |
+
4. **[Phase 4 Spec: UI & Loop](04_phase_ui.md)** β
|
| 190 |
+
5. **[Phase 5 Spec: Magentic Integration](05_phase_magentic.md)** β
|
| 191 |
+
6. **[Phase 6 Spec: Embeddings & Semantic Search](06_phase_embeddings.md)**
|
| 192 |
+
7. **[Phase 7 Spec: Hypothesis Agent](07_phase_hypothesis.md)**
|
| 193 |
+
8. **[Phase 8 Spec: Report Agent](08_phase_report.md)**
|
| 194 |
+
|
| 195 |
+
---
|
| 196 |
+
|
| 197 |
+
## Progress Summary
|
| 198 |
+
|
| 199 |
+
| Phase | Status | Deliverable |
|
| 200 |
+
|-------|--------|-------------|
|
| 201 |
+
| Phase 1: Foundation | β
COMPLETE | CI-ready repo with uv/pytest |
|
| 202 |
+
| Phase 2: Search | β
COMPLETE | PubMed + Web search |
|
| 203 |
+
| Phase 3: Judge | β
COMPLETE | LLM evidence assessment |
|
| 204 |
+
| Phase 4: UI & Loop | β
COMPLETE | Working Gradio app |
|
| 205 |
+
| Phase 5: Magentic | β
COMPLETE | Multi-agent orchestration |
|
| 206 |
+
| Phase 6: Embeddings | π SPEC READY | Semantic search |
|
| 207 |
+
| Phase 7: Hypothesis | π SPEC READY | Mechanistic reasoning |
|
| 208 |
+
| Phase 8: Report | π SPEC READY | Structured reports |
|
| 209 |
|
| 210 |
+
*Phases 1-5 completed in ONE DAY. Phases 6-8 specs ready for implementation.*
|