# boxabirds/openmanus architecture

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

- Interactive diagram: https://gitdiagram.com/boxabirds/openmanus
- Repository: https://github.com/boxabirds/openmanus

## Overview

##### Analyzing the File Structure
- The source code lives primarily under the “app” directory. Its subdirectories illuminate the architectural design:
- agent: Contains modules such as “manus”, “planning”, “react”, “swe”, and “toolcall”. This suggests multiple agent behaviors and strategies.
- flow: Manages flows (likely representing multi-step processes or workflows for the agent’s execution).
- prompt: Holds prompt templates for various agent interactions (mirroring those in the agent components).
- tool: Encapsulates various utility tools (e.g., bash commands, browser tools, google search, file savers, Python code execution, etc.), providing support for external actions or API calls.
- Other significant files include “llm.py” (which most likely wraps or handles interaction with language models), “logger.py” for logging, “config.py” for configuration, and “schema.py” for data structures.
- Top-level scripts (“main.py”, “run_flow.py”) indicate entry points to either run an interactive session or a flow-driven process.

##### Insights from README
- The README reinforces that the system is for running an agent that leverages LLM capabilities by receiving user input via the terminal.
- Configuration details (via a config.toml file in “config”) are used to setup API keys and other settings for the LLM provider.
- The project demo video and demo run commands provide additional context and usage examples.

##### Detail and Clarity
- Every component is included and the interactions among them are clearly labeled.
- Strive for simplicity in recognizing each component while not sacrificing essential interactions; details like configuration flow or error handling via “exceptions.py” can be noted in annotations if they add clarity.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry Points subgraph
    subgraph "Entry Points"
        EP1["Interactive Session (main.py)"]:::entry
        EP2["Flow Driven Process (run_flow.py)"]:::entry
    end

    %% Configuration & Logging subgraph
    subgraph "Configuration & Logging"
        CONFIG["Configuration"]:::config
        LOG["Logging"]:::log
    end

    %% Orchestration subgraph
    subgraph "Orchestration"
        FM["Flow Manager"]:::flow
        subgraph "Agent Core"
            A1["Agent: Manus"]:::agent
            A2["Agent: Planning"]:::agent
            A3["Agent: React"]:::agent
            A4["Agent: Swe"]:::agent
            A5["Agent: ToolCall"]:::agent
        end
    end

    %% External Integrations subgraph
    subgraph "External Integrations"
        LLM["LLM Handler"]:::llm
        PROMPT["Prompt System"]:::prompt
        TOOL["Tool Execution"]:::tool
    end

    %% Connections from Entry Points
    EP1 -->|"triggers"| A1
    EP2 -->|"initiates"| FM

    %% Flow Manager orchestrates Agent Core
    FM -->|"orchestrates"| A2

    %% Agent Core interactions
    A1 -->|"calls"| LLM
    A2 -->|"refers"| PROMPT
    A3 -->|"executes"| TOOL
    A4 -->|"executes"| TOOL
    A5 -->|"executes"| TOOL

    %% Configuration connections (dotted lines)
    CONFIG -.->|"configures"| LLM
    CONFIG -.->|"configures"| A1
    CONFIG -.->|"configures"| TOOL

    %% Logging connections (dotted lines)
    LLM -.->|"logs"| LOG
    A1 -.->|"logs"| LOG
    FM -.->|"logs"| LOG
    PROMPT -.->|"logs"| LOG
    TOOL -.->|"logs"| LOG

    %% Click Events
    click LLM "https://github.com/boxabirds/openmanus/blob/main/app/llm.py"
    click A1 "https://github.com/boxabirds/openmanus/blob/main/app/agent/manus.py"
    click A2 "https://github.com/boxabirds/openmanus/blob/main/app/agent/planning.py"
    click A3 "https://github.com/boxabirds/openmanus/blob/main/app/agent/react.py"
    click A4 "https://github.com/boxabirds/openmanus/blob/main/app/agent/swe.py"
    click A5 "https://github.com/boxabirds/openmanus/blob/main/app/agent/toolcall.py"
    click FM "https://github.com/boxabirds/openmanus/tree/main/app/flow/"
    click PROMPT "https://github.com/boxabirds/openmanus/tree/main/app/prompt/"
    click TOOL "https://github.com/boxabirds/openmanus/tree/main/app/tool/"
    click CONFIG "https://github.com/boxabirds/openmanus/blob/main/app/config.py"
    click LOG "https://github.com/boxabirds/openmanus/blob/main/app/logger.py"
    click EP1 "https://github.com/boxabirds/openmanus/blob/main/main.py"
    click EP2 "https://github.com/boxabirds/openmanus/blob/main/run_flow.py"

    %% Styles
    classDef entry fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef config fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef log fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef agent fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef llm fill:#87CEFA,stroke:#000,stroke-width:2px;
    classDef flow fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef prompt fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef tool fill:#DA70D6,stroke:#000,stroke-width:2px;
```
