# lamm-mit/protagents architecture

> Architecture diagram of the GitHub repository lamm-mit/protagents, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lamm-mit/protagents
- Repository: https://github.com/lamm-mit/protagents

## Overview

##### Project Type and Purpose
- Type: Python-based research platform combining multi-agent orchestration, LLMs, physics simulations, and vector-store memory.
- Purpose: Automate de novo protein sequence and structure generation, physics-based analysis (natural frequencies, unfolding forces), and property prediction via a pre-trained autoregressive transformer.

##### File Structure
- Core orchestration:
- agents.py: defines and coordinates AI agents
- agent_functions.py: implements agent capabilities (sequence generation, simulation, analysis)
- Model interface:
- ForceGPT.py: wrapper around the pre-trained transformer predicting mechanical properties
- Configuration:
- llm_config.py: OpenAI API key configuration
- Data & Memory:
- protein_force_index/ (Chroma vector store and metadata JSON files)
- Utilities and experiments:
- utils.py: shared helper functions
- exp1.ipynb, exp2.ipynb, exp3.ipynb: Jupyter notebooks driving each experiment

##### README Insights
- Multi-agent LLM environment with dynamic collaboration
- External dependencies: OpenAI API, Chroma vector store, pre-trained transformer model path
- Workflow steps: retrieval (Chroma), generation (LLM), physics simulation, property prediction (ForceGPT)

##### Relationships & Data Flows
- Notebooks → Orchestrator (agents.py) via Python calls
- Orchestrator → Agent Functions (agent_functions.py)
- Agent Functions →
– OpenAI API for LLM calls
– Chroma for retrieving/storing embeddings & documents
– Physics simulation modules for structural analysis
– ForceGPT module for property prediction
- Results flow back up from each service to the orchestrator → notebooks → user

##### Architectural Patterns & Principles
- Modular multi-agent pattern – each agent encapsulates one domain of expertise
- “Separation of concerns” – distinct layers for orchestration, model inference, memory, simulation
- Externalized configuration – credentials and model paths kept in llm_config.py
- Data-driven workflow – intermediate results persist in Chroma for auditability and retrievability

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Notebook UI Layer
    subgraph "Notebook UI"
        Notebook1["exp1.ipynb"]:::frontend
        Notebook2["exp2.ipynb"]:::frontend
        Notebook3["exp3.ipynb"]:::frontend
    end

    %% Orchestration Layer
    subgraph "Orchestration Layer"
        agents["agents.py"]:::orchestration
        agentFuncs["agent_functions.py"]:::orchestration
    end

    %% Configuration
    llmconfig["llm_config.py"]:::config

    %% External Services
    OpenAI["OpenAI API"]:::external
    Chroma["Chroma Vector Store"]:::external

    %% Model & Simulation Components
    PhysicsEngine["Physics Simulation Engine"]:::model
    ForceGPT["ForceGPT.py"]:::model

    %% Utilities
    Utils["utils.py"]:::util

    %% Data Flows
    Notebook1 -->|"invoke agents"| agents
    Notebook2 -->|"invoke agents"| agents
    Notebook3 -->|"invoke agents"| agents

    agents -->|"dispatch tasks"| agentFuncs
    agentFuncs -->|"POST /v1/chat/completions"| OpenAI
    agentFuncs -->|"query embeddings"| Chroma
    agentFuncs -->|"run simulation"| PhysicsEngine
    agentFuncs -->|"predict properties"| ForceGPT
    agents -->|uses| llmconfig
    agentFuncs -->|uses| Utils

    OpenAI -->|"response"| agentFuncs
    Chroma -->|"documents/embeddings"| agentFuncs
    PhysicsEngine -->|"simulation results"| agentFuncs
    ForceGPT -->|"prediction results"| agentFuncs
    agentFuncs -->|"aggregate results"| agents
    agents -->|"return data"| Notebook1
    agents -->|"return data"| Notebook2
    agents -->|"return data"| Notebook3

    %% Click Events
    click Notebook1 "https://github.com/lamm-mit/protagents/blob/main/exp1.ipynb"
    click Notebook2 "https://github.com/lamm-mit/protagents/blob/main/exp2.ipynb"
    click Notebook3 "https://github.com/lamm-mit/protagents/blob/main/exp3.ipynb"
    click agents "https://github.com/lamm-mit/protagents/blob/main/agents.py"
    click agentFuncs "https://github.com/lamm-mit/protagents/blob/main/agent_functions.py"
    click llmconfig "https://github.com/lamm-mit/protagents/blob/main/llm_config.py"
    click ForceGPT "https://github.com/lamm-mit/protagents/blob/main/ForceGPT.py"
    click Chroma "https://github.com/lamm-mit/protagents/tree/main/protein_force_index/"
    click Utils "https://github.com/lamm-mit/protagents/blob/main/utils.py"

    %% Styles
    classDef frontend fill:#E8F1FF,stroke:#2C7BE5,color:#0B2948
    classDef orchestration fill:#DCEEFB,stroke:#1A73E8,color:#1A73E8
    classDef external fill:#E6F4EA,stroke:#34A853,color:#1B5E20
    classDef model fill:#FFF4E5,stroke:#FB8C00,color:#E65100
    classDef config fill:#F3E5F5,stroke:#9C27B0,color:#4A148C
    classDef util fill:#F5F5F5,stroke:#9E9E9E,color:#424242
```
