# paulzhousz/langmanus-copy architecture

> Architecture diagram of the GitHub repository paulzhousz/langmanus-copy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/paulzhousz/langmanus-copy
- Repository: https://github.com/paulzhousz/langmanus-copy

## Overview

##### Project Identification
- LangManus is an academic, community-driven AI automation framework that leverages language models and specialized tools to perform complex tasks. It implements a hierarchical multi-agent system where different agents (such as the Coordinator, Planner, Supervisor, Researcher, Coder, Browser, and Reporter) work together.
- The project integrates various services including web crawling, search, Python code execution, and even browser control via Chromium. It supports API interactions through a FastAPI-based server and also provides a web UI (via a separate repository).

##### File Structure Analysis
- The top-level files (e.g., main.py, server.py, Dockerfile, docker-compose.yml, and Makefile) indicate multiple run entry points and deployment mechanisms.
- The “src” directory is the core of the project, organized into clear subfolders:
- agents – Contains code for the individual agent roles.
- api – Houses the FastAPI application, suggesting that the project exposes API endpoints.
- config – Responsible for loading environment variables and configurations, e.g., for LLMs and tool setups.
- crawler – Contains modules for web crawling and content extraction.
- graph – Likely builds the workflow or interaction graph between the agents.
- llms – Integrates various large language models through a multi-tier system.
- prompts – Stores markdown templates that define each agent's “personality” and responsibilities.
- service – Hosts logic that likely manages the overall workflow orchestration.
- tools and utils – Provide supporting functionalities (e.g., file system operations, decorators, and search functions).
- Additional directories like “tests”, “docs”, and “assets” round out the support for quality assurance, documentation, and media.
- The presence of configuration files (.env.example, conf.yaml.example, pyproject.toml) alongside Docker setup files suggests the importance of environment-specific behavior and containerized deployment.

##### Insights from the README
- The README explicitly describes the hierarchical multi-agent architecture: a Coordinator hands off tasks to specialized agents.
- It also highlights the separation of concerns between “complex decision-making” (reasoning LLMs), “basic tasks” (basic LLMs), and “vision-language tasks” (vision LLMs). This indicates a layered design regarding LLM functionality.
- The project is meant for academic exploration (e.g., research and publication) and emphasizes open source integrability and modularity.

- Use clear labels for each component (e.g., “API Server (FastAPI)”, “Coordinator Agent”, “Planner Agent”, etc.).
- Rectangles for core Python modules (API, agents, services).
- Rounded rectangles for configuration elements.
- Optionally, group related modules (e.g., all LLM integrations in one block, all crawler functionalities in another).

- Data flows and dependencies (configurations, external tools, and multi-agent interactions).
- Architectural best practices like modular design, clear separation of concerns, and containerized deployments.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Client (Web UI/External)"]:::client
    B["API Server (FastAPI)"]:::backend
    C["Workflow Orchestration Service"]:::backend

    subgraph "Multi-Agent Orchestration"
        D["Coordinator Agent"]:::agent
        E["Planner Agent"]:::agent
        F["Supervisor Agent"]:::agent
        G["Researcher Agent"]:::agent
        H["Coder Agent"]:::agent
        I["Browser Agent"]:::agent
        J["Reporter Agent"]:::agent
    end

    K["LLM Integration"]:::integration
    L["Tool Integration"]:::integration
    M["Web Crawling"]:::integration
    N["Configuration & Environment"]:::config
    O["Utility Functions"]:::config
    P["Containerization & Deployment"]:::deployment

    A -->|"sendsRequest"| B
    B -->|"handlesAPI"| C
    C -->|"delegatesTasks"| D
    D -->|"delegatesSubtasks"| E
    D -->|"delegatesSubtasks"| F
    D -->|"delegatesSubtasks"| G
    D -->|"delegatesSubtasks"| H
    D -->|"delegatesSubtasks"| I
    D -->|"delegatesSubtasks"| J

    D -->|"callsLLM"| K
    D -->|"callsTools"| L
    L -->|"executesTools"| M

    B ---|"loadsConfig"| N
    C ---|"loadsConfig"| N
    D ---|"usesUtils"| O
    B ---|"containerizedBy"| P

    K ---|"usesConfig"| N
    L ---|"usesConfig"| N
    M ---|"usesConfig"| N

    B -->|"sendsResponse"| A
    N ---|"supportsModules"| O

    %% Click Events for API Server
    click B "https://github.com/paulzhousz/langmanus-copy/blob/main/server.py"
    click B "https://github.com/paulzhousz/langmanus-copy/blob/main/src/api/app.py"

    %% Click Events for Coordinator and Other Agents
    click D "https://github.com/paulzhousz/langmanus-copy/blob/main/src/agents/agents.py"
    click D "https://github.com/paulzhousz/langmanus-copy/tree/main/src/prompts"
    click E "https://github.com/paulzhousz/langmanus-copy/blob/main/src/agents/agents.py"
    click E "https://github.com/paulzhousz/langmanus-copy/tree/main/src/prompts"
    click F "https://github.com/paulzhousz/langmanus-copy/blob/main/src/agents/agents.py"
    click F "https://github.com/paulzhousz/langmanus-copy/tree/main/src/prompts"
    click G "https://github.com/paulzhousz/langmanus-copy/blob/main/src/agents/agents.py"
    click G "https://github.com/paulzhousz/langmanus-copy/tree/main/src/prompts"
    click H "https://github.com/paulzhousz/langmanus-copy/blob/main/src/agents/agents.py"
    click H "https://github.com/paulzhousz/langmanus-copy/tree/main/src/prompts"
    click I "https://github.com/paulzhousz/langmanus-copy/blob/main/src/agents/agents.py"
    click I "https://github.com/paulzhousz/langmanus-copy/tree/main/src/prompts"
    click J "https://github.com/paulzhousz/langmanus-copy/blob/main/src/agents/agents.py"
    click J "https://github.com/paulzhousz/langmanus-copy/tree/main/src/prompts"

    %% Click Events for LLM Integration
    click K "https://github.com/paulzhousz/langmanus-copy/tree/main/src/llms"

    %% Click Events for Tool Integration
    click L "https://github.com/paulzhousz/langmanus-copy/tree/main/src/tools"

    %% Click Events for Web Crawling
    click M "https://github.com/paulzhousz/langmanus-copy/tree/main/src/crawler"

    %% Click Event for Workflow Service
    click C "https://github.com/paulzhousz/langmanus-copy/blob/main/src/service/workflow_service.py"

    %% Click Events for Configuration & Environment
    click N "https://github.com/paulzhousz/langmanus-copy/tree/main/src/config"

    %% Click Events for Utility Functions
    click O "https://github.com/paulzhousz/langmanus-copy/tree/main/src/utils"

    %% Click Events for Containerization & Deployment
    click P "https://github.com/paulzhousz/langmanus-copy/tree/main/Dockerfile"
    click P "https://github.com/paulzhousz/langmanus-copy/blob/main/docker-compose.yml"

classDef client fill:#ffcc00,stroke:#333,stroke-width:2px;
classDef backend fill:#aqua,stroke:#333,stroke-width:2px;
classDef agent fill:#cfc,stroke:#333,stroke-width:2px;
classDef integration fill:#f9d,stroke:#333,stroke-width:2px;
classDef config fill:#fc9,stroke:#333,stroke-width:2px;
classDef deployment fill:#c9f,stroke:#333,stroke-width:2px;
```
