# hkuds/ai-researcher architecture

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

- Interactive diagram: https://gitdiagram.com/hkuds/ai-researcher
- Repository: https://github.com/hkuds/ai-researcher

## Overview

##### Overall System Context
– The Research Agent layer, which handles user queries (at Level 1 and Level 2), orchestrates research tasks, and commands paper writing.
– The INNO engine, a module used by the research agent to execute the research workflow.

##### Main Components to Highlight
- INNO Core: Represent the core orchestration engine (folder “research_agent/inno/”) as a central component. This core handles the logic for research task management.
- Workflow: Optionally, include a “Workflow” component (research_agent/inno/workflow) that shows the dynamic flow—like flowgraph and flowcache—used to schedule and propagate research tasks.

##### Data Flow and Interactions
- Agents block to the Memory module, demonstrating that agents refer to stored code trees, previous paper drafts, and other past work.
- Tools to both INNO and Environment—since tools serve as the bridge to external APIs (e.g., GitHub, arXiv, and other research databases).
- Feedback loops: For example, upon experiment validation, results are stored back into the Memory module and then influence subsequent iterations.

– From user input → Research Agent → INNO.
– From Agents to Environment and Tools for accessing external data.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Research Agent Layer
    RA("Research Agent"):::agent

    %% INNO System subgraph
    subgraph "INNO System"
        IC("INNO Core"):::innocore
        subgraph "Agents Module"
            IA("Agents (draft_agent,idea_agent,exp_analyser,judge_agent,ml_agent,plan_agent,prepare_agent,survey_agent)"):::agents
        end
        M("Memory (code_memory, codetree_memory, paper_memory, rag_memory, tool_memory)"):::memory
        E("Environment (browser_env, docker_env, tcp_server, cookies, markdown_browser)"):::environment
        T("Tools (arxiv_source, Github operations, file surfing, etc.)"):::tools
        W("Workflow (flowgraph, flowcache)"):::workflow
    end

    %% Data Flow Connections
    RA -->|"query_processing"| IC
    IC -->|"task_delegation"| IA
    IA -->|"retrieve_context"| M
    IA -->|"external_interface"| E
    IA -->|"utilize_tools"| T
    T -->|"data_bridge"| E
    T -->|"external_data"| IC
    W -->|"schedule_tasks"| IC
    M -->|"feedback_loop"| IC

    %% Click Events for Component Mappings
    click RA "https://github.com/hkuds/ai-researcher/blob/main/research_agent/run_infer_idea.py"
    click IC "https://github.com/hkuds/ai-researcher/blob/main/research_agent/inno/core.py"
    click IA "https://github.com/hkuds/ai-researcher/tree/main/research_agent/inno/agents/inno_agent"
    click M "https://github.com/hkuds/ai-researcher/tree/main/research_agent/inno/memory"
    click E "https://github.com/hkuds/ai-researcher/tree/main/research_agent/inno/environment"
    click T "https://github.com/hkuds/ai-researcher/tree/main/research_agent/inno/tools"
    click W "https://github.com/hkuds/ai-researcher/tree/main/research_agent/inno/workflow"

    %% Styles
    classDef agent fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef innocore fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef agents fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef memory fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef environment fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef tools fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    classDef workflow fill:#fefefe,stroke:#818182,stroke-width:2px;
```
