How hydrocomplexity/decisiongpt works
Project Type and Purpose
• DecisionGPT is a multi-agent LLM system designed to facilitate decision-making discussions.
• It uses Docker Swarm to manage deployment, implying a distributed system with separate containers.
• The system integrates with OpenAI’s API (or Azure OpenAI variant) for LLM capabilities. The README also highlights the possibility of switching endpoints based on deployment needs.
Analyzing the File Structure
• Top-level files and scripts:
• Environment and configuration (.env), licensing, and the README.
• Build and deployment scripts: buildimage.sh, deploy_swarm.sh, start_swarm.sh, stop_swarm.sh, retreat_swarm.sh.
• A Docker compose file (composev3.yaml) indicating container orchestration.
• Directories:
• "prompts": Contains role-specific prompt files (init_prompt, mayor_prompt, moderator_prompt, scientist_prompt, spokesperson_prompt) used for initializing agent behavior.
• "src": Contains the core application code divided into two subdirectories:
▪ "src/macro": Contains modules such as chat_mainframe.py, conference_room.py, backlog.py, and pipe.py – these are likely responsible for high-level coordination and central decision making.
▪ "src/micro": Contains agent.py and associated code – representing individual agents which interact with the core LLM service.
• This arrangement suggests an architecture where macro components (central coordination and interfacing with the user or GUI) work hand-in-hand with multiple micro components (individual LLM agents).
Core Insights from the README
• The README specifies the need for setting up Docker Swarm and pulling a RabbitMQ image, indicating that messaging or event queuing is part of the system.
• It explains how to build the Docker image, deploy the swarm, and provides instructions for accessing logs and the GUI (browsing to localhost:8080). This indicates a web-based monitoring or control panel.
• Instructions to modify source code (if switching APIs) are given in the conference_room (in macro) and agent modules (in micro). This reinforces the division where the macro layer orchestrates the discussion (conference room) and micro agents execute decisions.
a. Main Components to Include:
• Docker Swarm / Container Orchestration Layer: Represents the infrastructure that manages service deployment.
• Macro Layer Services:
▪ Conference Room Service: Acts as the central coordinator for agent discussions.
▪ Chat Mainframe and Backlog: Manage discussion flow and historical data.
• Micro Layer Services:
▪ Individual Agent Services (as per src/micro/agent.py): Run as separate docker services, each possibly representing a decision-making persona.
• External Dependencies:
▪ OpenAI API (or Azure OpenAI service): For LLM capabilities.
▪ RabbitMQ: For message/event queuing if it is used for inter-service communication.
• User Interface:
▪ Web GUI accessible at localhost:8080 for monitoring and control.
b. Relationships and Interactions:
• The Docker Swarm orchestrates both macro and micro containers and ensures they communicate, typically using service discovery.
• The macro (conference_room) component interacts directly with the agents, collecting their responses and mediating discussion.
• The agents in the micro layer communicate with the LLM service (OpenAI/Azure OpenAI) for generating responses.
• There is data flow from the user interface to the macro component and from the macro to the agents, with the possibility of logging and message queuing via RabbitMQ.
c. Key Architectural Patterns and Design Principles:
• Separation of concerns: The macro layer handles orchestration, coordination, and logging while the micro layer handles individual agent logic.
• Containerization: Docker containers encapsulate the services, with Docker Swarm managing service scaling and health.
• Decoupled architecture: Communication (possibly via messaging or RESTful APIs) assists in keeping components independent.
• Extensibility: The modular layout (separate directories for macro and micro) allows plugging in additional agents or modifying orchestration.
d. Relevant Technologies & Frameworks:
• Docker & Docker Swarm for container orchestration.
• RabbitMQ as a potential messaging broker.
• Python as the primary programming language with modules spread across macro and micro directories.
• OpenAI API (or Azure OpenAI) for LLM functionalities.
• Web technologies (implied by the web GUI on localhost:8080).