How lamm-mit/sciagentsdiscovery works
Project type and purpose
• SciAgents is an open-source Python library plus accompanying Jupyter notebooks that implements a modular, multi-agent pipeline for automated scientific discovery via graph reasoning. It is not a web app or microservice platform but rather a research tool and framework you run locally or in a cloud notebook.
File structure
• Top-level:
• setup.py – package installer
• README.md – project overview, architecture figures, usage
• LICENSE.txt
• Notebooks/ – two example workflows (non-automated and automated)
• ScienceDiscovery/ – core Python package modules
• Core modules inside ScienceDiscovery/:
• graph.py – loads and manages the ontological knowledge graph
• agents.py – orchestrates multi-agent interactions (Ontologist, Scientist1, Scientist2, Critic, Planner, Assistant)
• llm_config.py – configuration and wrapper for LLM calls (OpenAI, AG2)
• utils.py – common helpers (I/O, formatting, JSON)
• No web server, no database server—graph files and embeddings are downloaded on demand via Hugging Face Hub. External APIs: OpenAI, Semantic Scholar, AG2.
Extract architecture insights from README
• Two pipelines:
a. Pre-programmed multi-agent sequence
b. Fully automated, flexible multi-agent sequence
• Dependencies: GraphReasoning (AG2), Hugging Face Hub, OpenAI API, Semantic Scholar API, wkhtmltopdf (for PDF generation).
Main components and their relationships
a. Entry points (Notebooks)
• Import ScienceDiscovery package
• Configure LLM and API keys
• Trigger either the non-automated or automated agent pipeline
b. Core Library (ScienceDiscovery)
• Graph Module: loads the global knowledge graph from local cache or HF Hub
• Embedding Module (via utils + HF Hub): fetches precomputed embeddings
• LLM Config Module: sets up calls to OpenAI or AG2 agents
• Agents Module: defines each agent role and orchestrates their interactions in sequence or dynamically
• Utils Module: handles I/O, JSON structure, PDF generation
c. External Services
• OpenAI API – LLM completions
• Semantic Scholar API – paper metadata retrieval
• Hugging Face Hub – graph files and embeddings storage
• AG2 Framework – underpins the multi-agent execution environment
d. Output
• Structured JSON draft → refined text → PDF/HTML report via wkhtmltopdf
Architectural patterns and design principles
• Modular pipeline: each logical step is its own module, enabling replacement or extension
• Agent-based orchestration: roles encapsulated as classes, sequence defined in agents.py
• Data-driven: external graph and embeddings fetched at runtime, no hard-coded data
• Separation of concerns: graph management, LLM configuration, agent logic, and utilities are clearly separated