# akhil-bot/instagent architecture

> Architecture diagram of the GitHub repository akhil-bot/instagent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akhil-bot/instagent
- Repository: https://github.com/akhil-bot/instagent

## Overview

The InstAgent project is an AI multi-agent system generator that takes a plain English description of a task and produces a complete, ready-to-run multi-agent network. Its core functionality is defined by a three-stage pipeline: Team Architect, Tool Specialist, and Code Synthesizer. The file tree and README indicate that InstAgent is designed as a tool for rapidly prototyping sophisticated agent architectures, and it also provides several example agent systems (for hedge funds, blog writing, PR reviews, LinkedIn posts, etc.) to illustrate its capabilities.

##### Main Components
- User Interface:
- Streamlit-based frontend (invoked from main.py) that accepts user input (task description) and displays the workflow and resulting agent system.
- Processing Pipeline:
- Team Architect: Analyzes the input task and designs the agent team.
- Tool Specialist: Picks and assigns the right tools to each agent.
- Code Synthesizer: Converts the design into a fully functional Python codebase for the multi-agent system.
- Core Modules & Utilities:
- Prompts.py and Tools.py: Likely contain logic for generating prompts and managing tool integrations.
- main.py: Acts as the central entry point tying everything together.
- Examples Repository:
- Contains pre-built examples demonstrating various agent use cases (e.g., Hedge Fund Agent, Blog Writer Agent). These folders include their own instructions, requirements, and sample outputs.
- Deployment & Containerization:
- Dockerfile, docker-compose.yml, .devcontainer configurations, and associated container files indicate support for both local and container-based deployments.
- External Integrations:
- LangGraph for agent orchestration.
- Composio for tool integration support.
- OpenAI for LLM capabilities.

##### Relationships and Interactions
- The user’s interaction starts at the Streamlit UI, where a task description is submitted.
- The UI feeds the input to a backend processing pipeline (starting with the Team Architect).
- Data flows sequentially from the Team Architect to the Tool Specialist, then to the Code Synthesizer.
- Example directories act as functions or reference implementations showcasing independent agent projects that follow the same underlying architecture.
- Docker-related files are used to encapsulate and deploy the full system in various environments.

##### Architectural Patterns and Design Principles
- Pipeline/Sequential Processing: The three-stage process (Team Architect, Tool Specialist, Code Synthesizer) reflects a clear sequential pipeline.
- Modular Design: Separation of concerns is evident with different modules managing specific functionalities (e.g., prompts, tool integration).
- Containerization: Support for Docker environments ensures consistency in deployment.
- Example-Driven Development: The “Examples” folder showcases varying use cases which could be referred to as micro-projects within the main system.

##### Relevant Technologies and Frameworks
- Streamlit for the user interface.
- Python as the core programming language.
- Docker and Docker Compose for containerization and deployment.
- LangGraph and Composio as external libraries/services integrated into the processing pipeline.
- Git for source control (supported by .gitignore).

##### Final Advice
- Be as detailed as possible—each stage of the multi-agent system pipeline should be represented.
- Use clear, simple labels and ensure that every component’s relationship is explicitly depicted.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main UI Node
    UI["User Interface (Streamlit)"]:::frontend

    %% Processing Pipeline Subgraph
    subgraph "Processing Pipeline"
        TA["Team Architect"]:::pipeline
        TS["Tool Specialist"]:::pipeline
        CS["Code Synthesizer"]:::pipeline
    end

    %% External Integrations Subgraph
    subgraph "External Integrations"
        LG["LangGraph"]:::external
        CP["Composio"]:::external
        OA["OpenAI"]:::external
    end

    %% Example Agent Systems Subgraph
    subgraph "Example Agent Systems"
        HF["Hedge Fund Agent"]:::examples
        BW["Blog Writer Agent"]:::examples
        LP["LinkedIn Post Agent"]:::examples
        PR["PR Review Agent"]:::examples
    end

    %% Deployment & Containerization Subgraph
    subgraph "Deployment & Containerization"
        DF["Dockerfile"]:::docker
        DC["docker-compose.yml"]:::docker
        DV[".devcontainer"]:::docker
    end

    %% Data Flow Connections
    UI -->|"submitTask"| TA
    TA -->|"analyzeTask"| TS
    TS -->|"assignTools"| CS
    CS -->|"generateCode"| UI

    %% External Integration Connections
    TS -->|"uses"| CP
    TS -->|"orchestrates"| LG
    CS -->|"leverages"| OA

    %% Optional connection to examples (showing reference projects)
    UI -->|"viewExamples"| HF
    UI -->|"viewExamples"| BW
    UI -->|"viewExamples"| LP
    UI -->|"viewExamples"| PR

    %% Optional connection to deployment (indicating containerized setup)
    UI -->|"deployUsing"| DF
    DF --> DC
    DC --> DV

    %% Click Events
    click UI "https://github.com/akhil-bot/instagent/blob/master/main.py"
    click TA "https://github.com/akhil-bot/instagent/blob/master/Prompts.py"
    click TS "https://github.com/akhil-bot/instagent/blob/master/Tools.py"
    click CS "https://github.com/akhil-bot/instagent/blob/master/Tools.py"
    click HF "https://github.com/akhil-bot/instagent/tree/master/Examples/AI_Hedge_Fund_Agent"
    click BW "https://github.com/akhil-bot/instagent/tree/master/Examples/Blog_Writer_Agent"
    click LP "https://github.com/akhil-bot/instagent/tree/master/Examples/LinkedIn_Post_Agent"
    click PR "https://github.com/akhil-bot/instagent/tree/master/Examples/PR_Review_Agent"
    click DF "https://github.com/akhil-bot/instagent/tree/master/Dockerfile"
    click DC "https://github.com/akhil-bot/instagent/blob/master/docker-compose.yml"
    click DV "https://github.com/akhil-bot/instagent/blob/master/.devcontainer"

    %% Styles
    classDef frontend fill:#ffdd99,stroke:#cc6600,stroke-width:2px;
    classDef pipeline fill:#cce5ff,stroke:#3399ff,stroke-width:2px;
    classDef external fill:#d9f2d9,stroke:#33cc33,stroke-width:2px;
    classDef examples fill:#e6ccff,stroke:#9933ff,stroke-width:2px;
    classDef docker fill:#ffe6e6,stroke:#ff3333,stroke-width:2px;
```
