# noho/dayu-agent architecture

> Architecture diagram of the GitHub repository noho/dayu-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/noho/dayu-agent
- Repository: https://github.com/noho/dayu-agent
- Video tour (about a minute): https://gitdiagram.com/noho/dayu-agent/video

## Overview

Dayu Agent is a buy-side financial research assistant. Its main workflow is to download or upload filings, process them into a local research corpus, answer questions using that corpus, and optionally produce auditable chapter-based reports and rendered documents. Interfaces include CLI, early-stage Web UI, and a text-based WeChat integration. The graph reflects documented capabilities and relationships visible in the README or indexed source references; unsampled implementation details are not inferred.

Main entry points: [`dayu/cli/commands`](https://github.com/noho/dayu-agent/tree/main/dayu/cli/commands) (CLI commands), [`dayu/services/chat_service.py`](https://github.com/noho/dayu-agent/blob/main/dayu/services/chat_service.py) (Chat service), [`dayu/engine/async_agent.py`](https://github.com/noho/dayu-agent/blob/main/dayu/engine/async_agent.py) (Agent engine), [`dayu/fins/pipelines`](https://github.com/noho/dayu-agent/tree/main/dayu/fins/pipelines) (Market pipelines)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI commands"]
  node_webui["Web UI"]
  node_wechat["WeChat interface"]
end

subgraph group_research["Research runtime"]
  node_chat["Chat service<br/>[chat_service.py]"]
  node_agent["Agent engine<br/>[async_agent.py]"]
  node_webtools["Web research tools<br/>[web_tools.py]"]
end

subgraph group_financials["Financial documents"]
  node_ingestion["Filing ingestion<br/>[service.py]"]
  node_marketpipelines["Market pipelines"]
  node_downloaders["Market downloaders"]
  node_storage[("Filing repository")]
  node_docprocessors["Document processors"]
  node_docmodels["Document models<br/>[document_models.py]"]
  node_search["Filing search<br/>[search_engine.py]"]
end

subgraph group_reports["Report writing"]
  node_write["Report pipeline<br/>[pipeline.py]"]
  node_render["Document rendering<br/>[render.py]"]
end

subgraph group_platform["Host and workspace"]
  node_init["Workspace setup<br/>[init.py]"]
  node_host["Run and session host"]
  node_hoststate[("Conversation state")]
end

node_user(("Investor"))
node_llm{{"Model provider"}}

node_user -->|"runs commands"| node_cli
node_user -->|"uses analysis UI"| node_webui
node_user -->|"asks questions"| node_wechat
node_cli -->|"initializes workspace"| node_init
node_cli -->|"requests filing work"| node_ingestion
node_ingestion -->|"dispatches ingestion"| node_marketpipelines
node_marketpipelines -->|"downloads filings"| node_downloaders
node_marketpipelines -->|"uses repository"| node_storage
node_marketpipelines -->|"uses processors"| node_docprocessors
node_storage -->|"stores document records"| node_docmodels
node_cli -->|"submits questions"| node_chat
node_wechat -->|"supports questions"| node_chat
node_webui -->|"supports analysis"| node_chat
node_chat -.->|"runs agent"| node_agent
node_agent -.->|"requests completion"| node_llm
node_agent -.->|"uses research tools"| node_webtools
node_chat -->|"coordinates execution"| node_host
node_host -.->|"persists conversations"| node_hoststate
node_agent -.->|"queries filings"| node_search
node_cli -->|"starts report writing"| node_write
node_write -->|"executes chapters"| node_host
node_cli -->|"renders reports"| node_render

click node_cli "https://github.com/noho/dayu-agent/tree/main/dayu/cli/commands"
click node_webui "https://github.com/noho/dayu-agent/tree/main/dayu/web/streamlit/pages"
click node_wechat "https://github.com/noho/dayu-agent/tree/main/dayu/wechat"
click node_init "https://github.com/noho/dayu-agent/blob/main/dayu/cli/commands/init.py"
click node_ingestion "https://github.com/noho/dayu-agent/blob/main/dayu/fins/ingestion/service.py"
click node_marketpipelines "https://github.com/noho/dayu-agent/tree/main/dayu/fins/pipelines"
click node_downloaders "https://github.com/noho/dayu-agent/tree/main/dayu/fins/downloaders"
click node_storage "https://github.com/noho/dayu-agent/tree/main/dayu/fins/storage"
click node_docprocessors "https://github.com/noho/dayu-agent/tree/main/dayu/fins/processors"
click node_docmodels "https://github.com/noho/dayu-agent/blob/main/dayu/fins/domain/document_models.py"
click node_search "https://github.com/noho/dayu-agent/blob/main/dayu/fins/tools/search_engine.py"
click node_chat "https://github.com/noho/dayu-agent/blob/main/dayu/services/chat_service.py"
click node_agent "https://github.com/noho/dayu-agent/blob/main/dayu/engine/async_agent.py"
click node_webtools "https://github.com/noho/dayu-agent/blob/main/dayu/engine/tools/web_tools.py"
click node_host "https://github.com/noho/dayu-agent/tree/main/dayu/host"
click node_hoststate "https://github.com/noho/dayu-agent/blob/main/dayu/host/conversation_store.py"
click node_write "https://github.com/noho/dayu-agent/blob/main/dayu/services/internal/write_pipeline/pipeline.py"
click node_render "https://github.com/noho/dayu-agent/blob/main/dayu/render/render.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_webui,node_wechat toneBlue
class node_chat,node_agent,node_webtools toneAmber
class node_ingestion,node_marketpipelines,node_downloaders,node_storage,node_docprocessors,node_docmodels,node_search toneMint
class node_write,node_render toneRose
class node_init,node_host,node_hoststate,node_user,node_llm toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/noho/dayu-agent/tree/main/dayu/cli/commands): `dayu/cli/commands`
- [Web UI](https://github.com/noho/dayu-agent/tree/main/dayu/web/streamlit/pages): `dayu/web/streamlit/pages`
- [WeChat interface](https://github.com/noho/dayu-agent/tree/main/dayu/wechat): `dayu/wechat`

### Research runtime

- [Chat service](https://github.com/noho/dayu-agent/blob/main/dayu/services/chat_service.py): `dayu/services/chat_service.py`
- [Agent engine](https://github.com/noho/dayu-agent/blob/main/dayu/engine/async_agent.py): `dayu/engine/async_agent.py`
- [Web research tools](https://github.com/noho/dayu-agent/blob/main/dayu/engine/tools/web_tools.py): `dayu/engine/tools/web_tools.py`

### Financial documents

- [Filing ingestion](https://github.com/noho/dayu-agent/blob/main/dayu/fins/ingestion/service.py): `dayu/fins/ingestion/service.py`
- [Market pipelines](https://github.com/noho/dayu-agent/tree/main/dayu/fins/pipelines): `dayu/fins/pipelines`
- [Market downloaders](https://github.com/noho/dayu-agent/tree/main/dayu/fins/downloaders): `dayu/fins/downloaders`
- [Filing repository](https://github.com/noho/dayu-agent/tree/main/dayu/fins/storage): `dayu/fins/storage`
- [Document processors](https://github.com/noho/dayu-agent/tree/main/dayu/fins/processors): `dayu/fins/processors`
- [Document models](https://github.com/noho/dayu-agent/blob/main/dayu/fins/domain/document_models.py): `dayu/fins/domain/document_models.py`
- [Filing search](https://github.com/noho/dayu-agent/blob/main/dayu/fins/tools/search_engine.py): `dayu/fins/tools/search_engine.py`

### Report writing

- [Report pipeline](https://github.com/noho/dayu-agent/blob/main/dayu/services/internal/write_pipeline/pipeline.py): `dayu/services/internal/write_pipeline/pipeline.py`
- [Document rendering](https://github.com/noho/dayu-agent/blob/main/dayu/render/render.py): `dayu/render/render.py`

### Host and workspace

- [Workspace setup](https://github.com/noho/dayu-agent/blob/main/dayu/cli/commands/init.py): `dayu/cli/commands/init.py`
- [Run and session host](https://github.com/noho/dayu-agent/tree/main/dayu/host): `dayu/host`
- [Conversation state](https://github.com/noho/dayu-agent/blob/main/dayu/host/conversation_store.py): `dayu/host/conversation_store.py`

### Other components

- **Investor**
- **Model provider**

## Connections

- Investor → CLI commands: runs commands
- Investor → Web UI: uses analysis UI
- Investor → WeChat interface: asks questions
- CLI commands → Workspace setup: initializes workspace
- CLI commands → Filing ingestion: requests filing work
- Filing ingestion → Market pipelines: dispatches ingestion (evidence: `dayu/fins/ingestion/service.py`)
- Market pipelines → Market downloaders: downloads filings (evidence: `dayu/fins/pipelines/cn_pipeline.py`)
- Market pipelines → Filing repository: uses repository (evidence: `dayu/fins/pipelines/cn_pipeline.py`)
- Market pipelines → Document processors: uses processors (evidence: `dayu/fins/pipelines/cn_pipeline.py`)
- Filing repository → Document models: stores document records (evidence: `dayu/fins/storage/_fs_storage_infra.py`)
- CLI commands → Chat service: submits questions
- WeChat interface → Chat service: supports questions
- Web UI → Chat service: supports analysis
- Chat service → Agent engine: runs agent
- Agent engine → Model provider: requests completion
- Agent engine → Web research tools: uses research tools
- Chat service → Run and session host: coordinates execution (evidence: `dayu/services/chat_service.py`)
- Run and session host → Conversation state: persists conversations (evidence: `dayu/host/conversation_session_archive.py`)
- Agent engine → Filing search: queries filings
- CLI commands → Report pipeline: starts report writing
- Report pipeline → Run and session host: executes chapters (evidence: `dayu/services/internal/write_pipeline/pipeline.py`)
- CLI commands → Document rendering: renders reports
