How alpha-innovator/internagent works
Project type and purpose
• InternAgent (formerly “Dolphin”) is an open-source, closed-loop scientific research automation framework. It is a Python-based multi-agent orchestration system that spans idea generation → methodology construction → experimental execution.
• Key indicators:
• launch_dolphin.py / launch_dolphin.sh as CLI entry points
• dolphin_utils/ library modules for agent orchestration (LLM utils, RAG tools, prompt templates, experiment utilities)
• examples/ folder containing end-to-end experiment templates across 12 research tasks
File structure
• Top level:
• dolphin_utils/: core Python package with submodules
– experiments_utils.py: code to schedule, run, log experiments
– generate_ideas.py, prompts.py, llm_utils.py: idea generation pipeline
– rag_tools/: retrieval-augmented generation helpers (literature survey, review tools, utilities)
• examples/: per-task subfolders (e.g. AutoCls2D_Cifar100, AutoSeg_VOC12, AutoPCDet_Once…) each with Baseline vs custom variant, containing experiment.py, launcher.sh, config or prompt files, and result folders
• Configuration & deployment artifacts:
• launch scripts for system headless invocation
• shell wrappers customizing API keys, model choice, target tasks
README for additional insights
• The README outlines a 3-stage closed-loop: (1) Self-evolving idea generation, (2) Idea → methodology construction, (3) Evolutionary experimental planning & execution
• Mentions multi-agent orchestration coordinating Survey, Coding, Idea, Assessment, Execution Agents
• References to external LLM (via Ollama or API) and Google Drive datasets
a. Main components
1. CLI / Launcher Layer
• launch_dolphin.sh / launch_dolphin.py
• Parses user input: API key, model, task list, iteration rounds
2. Core Orchestrator
• Agent Manager (entry point in launch_dolphin.py)
• Scheduling & state machine tracking research rounds
3. Agent Modules (in dolphin_utils/)
• Survey Agent: uses rag_tools to fetch and summarize literature
• Idea Agent: generate_ideas.py, prompts.py to propose hypotheses
• Methodology Agent: assembles code templates, data pipelines, baseline code
• Assessment Agent: validates code snippets, metrics using experiments_utils.py
• Execution Agent: executes experiment scripts in examples/…, captures logs & metrics
4. Supporting Utilities
• LLM Interface (llm_utils.py): wraps remote/local model calls
• Prompt Library (prompts.py / rag_tools/prompts.py)
• RAG Engine (rag_utils.py, rag_tools/utils.py) & Document Store
• Experiment Utilities (experiments_utils.py): handles jobs, logging, result serialization
5. Experiment Repository
• examples/… templates for different tasks
• Config files, launcher scripts, result directories
6. External Services & Data
• LLM API or self-hosted model (via Ollama)
• External dataset sources (e.g., Google Drive links)
• Local compute environment (Python interpreter, CUDA if needed)
b. Relationships & Interactions
• CLI invokes Core Orchestrator
• Orchestrator spins up Agents in sequence or in parallel
• Each Agent calls LLM Interface and/or RAG Engine
• Agents produce artifacts (ideas, code snippets, experiment configs) stored in working directory
• Execution Agent launches experiment scripts from examples/… via shell or Python subprocess
• Results (metrics, logs) flow back into Orchestrator / Assessment Agent for evaluation and next iteration
c. Architectural patterns & design principles
• Modular multi-agent pipeline (each agent as a standalone module)
• Layered separation:
• Presentation (CLI)
• Orchestration (Agent Manager)
• Domain logic (Idea / Survey / Execution Agents)
• Infrastructure (LLM wrapper, RAG tools, experiment utils)
• Extensibility: new tasks added under examples/; new agents plugged into orchestration loop
• Configuration-driven: parameters passed via JSON/YAML configs and shell arguments
d. Key technologies & libraries
• Python 3.11 ecosystem
• LLM API clients (e.g., OpenAI, self-hosted via Ollama)
• Retrieval-augmented generation (RAG) utilities
• Subprocess / shell for experiment execution
• JSON/YAML for configuration, logging