How fermiq/drugagent works
Project Type & Purpose
• This is a back‐end, full-pipeline ML framework (“DrugAgent”) for automated, LLM-driven drug-discovery programming.
• It orchestrates two collaborating large-language-model agents—a Planner (for high-level solution planning) and an Instructor (for code synthesis)—against benchmark “env” tasks (ADMET, DTI, HTS).
Core Directory Analysis
• Top-level scripts & entrypoints:
• runner.py ← orchestrator that bootstraps tasks, agents, and environment
• environment.py ← generic env interface for benchmark tasks
• prepare_task.py ← turns raw datasets into agent-readable tasks
• eval.py ← local evaluation harness (complemented by MLAgentBench.eval)
• retriever.py ← optional data/information retriever (e.g., literature or embeddings)
• Agents:
• agents/agent_planner.py & actions_planner.py
• agents/agent_instructor.py & actions_instructor.py
• agents/agent.py ← shared base class for multi-agent behavior
• Domain-specific tooling:
• agent_tools/ ← drug_utils, protein_utils, featurizer, pybiomed_helper, plus precomputed embeddings
• Benchmarks:
• benchmarks/{admet,dti,hts}/env/*.py & scripts/*.py
• tasks.json ← master task list
• Support:
• schema.py ← standard definitions for task metadata
• utils.py ← cross-cutting utilities
• high_level_actions.py & low_level_actions.py ← predefined action vocabularies
• Logging & outputs:
• runner spawns workspace/ and log-dir/ (agent_log/, env_log/, traces/)
• eval harness reads these logs for metrics
• Orchestration Layer (runner.py + prepare_task.py + schema.py + environment.py + retriever.py)
• Agent Layer
– Planner Agent (agents/agent_planner.py + actions_planner.py)
– Instructor Agent (agents/agent_instructor.py + actions_instructor.py)
• Domain Tools (agent_tools/…)
• Benchmark Environments (benchmarks/{admet,dti,hts}/env & scripts)
• Evaluation & Logging (eval.py + MLAgentBench.eval + log directories)
• External Services (OpenAI/GPT API & any embedding store)
1. Runner → Prepare_Task → Benchmark Env (loads data)
2. Runner ↔ Planner Agent (requests high-level strategies)
3. Planner Agent → Instructor Agent (passes refined sub-tasks)
4. Instructor Agent → agent_tools (invokes featurizer/embeddings)
5. Instructor Agent → LLM API (concrete code synthesis)
6. Instructor Agent → Runner (executes code in workspace)
7. Runner → Env (executes generated code, collects feedback)
8. Runner → Logging (agent_log, env_log, traces)
9. eval.py/MLAgentBench.eval → Logs (post-run metrics)
c. Architectural Patterns & Principles:
• Multi-agent orchestration (master/worker pattern)
• Separation of concerns (planning vs. implementation)
• Plugin-style domain toolboxes
• Benchmark-environment abstraction (Gym-style interface)
• File-based logging for reproducibility
d. Key Technologies & Frameworks:
• Python 3.10
• OpenAI GPT API (configurable via --llm-name arguments)
• MLAgentBench (underlying evaluation framework)
• Conda environment
• Domain dependencies in requirements.txt (e.g., PyBiomed, ESM embeddings)