# datawhalechina/agent-tutorial architecture

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

- Interactive diagram: https://gitdiagram.com/datawhalechina/agent-tutorial
- Repository: https://github.com/datawhalechina/agent-tutorial

## Overview

1. **Repository type**
   - This is a **tutorial/documentation repository**, not an application codebase.
   - Its main purpose is to teach Agent concepts and ModelScope Agent usage through **explanatory markdown + runnable notebook demos**.

2. **Top-level structure**
   - The repo is organized into a `README.md` plus a `docs/` tree.
   - `docs/_sidebar.md` acts as the **content navigation layer** for the tutorial site or docs viewer.
   - Most of the actual learning material lives in chapter folders under `docs/`.

3. **Chapter-based content architecture**
   - The content is split into three clear subsystems:
     - **Chapter 1: Agent introduction** — theory and environment setup.
     - **Chapter 2: Agent practice** — a concrete scheduling assistant project.
     - **Chapter 3: Agent outlook** — broader design patterns and future application discussion.
   - This creates a progression from **concepts → implementation → application thinking**.

4. **Theory / concept layer**
   - Chapter 1 explains the Agent principle and deeper Agent mechanics.
   - This layer is the **mental model boundary**: it defines what an Agent is and what components are needed before touching demos.
   - It also includes environment setup guidance, which bridges theory to execution.

5. **Practice / application layer**
   - Chapter 2 is the main applied project section.
   - It centers on a **“日程规划小助手”** (schedule-planning assistant), showing how Agent concepts are assembled into a practical assistant.
   - A separate article covers **Amap (高德) OpenAPI practice**, which indicates the assistant integrates external location or routing data.

6. **Demo runtime layer**
   - The `demo-code/` folders contain **Jupyter notebooks** and configuration files.
   - This is the executable boundary of the repo: readers can run demos locally or remotely rather than only reading static docs.
   - Notebooks are used for both **local function demos** and **remote function demos**, showing multiple execution modes.

7. **External services / integration points**
   - The docs reference **ModelScope Agent**, which is the main agent framework the tutorial is built around.
   - The practice chapter references **Amap OpenAPI**, meaning the assistant depends on an external mapping/service API.
   - Chapter 3 includes a `dashscope-demo.ipynb`, indicating an additional integration with **DashScope** for model or agent capability demonstration.

8. **Configuration boundary**
   - `cfg_tool_template.json` suggests the demos use a **tool configuration template** to define callable tools/functions.
   - This separates **agent logic** from **tool registration/configuration**, which is important for the architecture diagram.
   - The repo therefore has a clear split between tutorial narrative, agent setup, and tool wiring.

9. **Content asset layer**
   - Each major section has `imgs/` directories for diagrams and screenshots.
   - These assets support the explanatory material but are not part of runtime execution.
   - They likely serve as the visual layer for the diagrams, workflow explanations, and examples.

10. **Learning flow / data flow**
   - The intended user flow is: read Agent theory → configure environment → run notebook demos → integrate external APIs/tools → study broader patterns.
   - Data flows from **user prompts** into the Agent framework, then through **configured tools/APIs**, and back as assistant responses or scheduled plans.
   - In the schedule assistant demo, external service data likely feeds the Agent’s reasoning and action steps.

11. **Boundary between documentation and execution**
   - Markdown files are the **authoritative tutorial narrative**.
   - Notebooks are the **interactive execution examples**.
   - Configuration files bridge the two by turning the tutorial’s concepts into runnable agent/tool setups.

12. **What to draw in an architecture diagram**
   - The diagram should show:
     - a **documentation/navigation layer** (`README`, `_sidebar`, markdown chapters),
     - a **runtime/demo layer** (Jupyter notebooks),
     - an **Agent framework layer** (ModelScope Agent),
     - **external API/tool services** (Amap, DashScope),
     - and a **supporting asset/config layer** (`imgs`, JSON config templates).
   - The dominant architectural pattern is a **learning-content system with executable agent demos**, rather than a production service.

Main entry points: [`docs/_sidebar.md`](https://github.com/datawhalechina/agent-tutorial/blob/main/docs/_sidebar.md) (Sidebar), [`docs/第一章：Agent简介/1.2 Agent原理深入+环境配置.md`](https://github.com/datawhalechina/agent-tutorial/blob/HEAD/docs/%E7%AC%AC%E4%B8%80%E7%AB%A0%EF%BC%9AAgent%E7%AE%80%E4%BB%8B/1.2%20Agent%E5%8E%9F%E7%90%86%E6%B7%B1%E5%85%A5%2B%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.md) (原理与环境), [`docs/第二章：Agent实践/2.2 日程规划小助手.md`](https://github.com/datawhalechina/agent-tutorial/blob/HEAD/docs/%E7%AC%AC%E4%BA%8C%E7%AB%A0%EF%BC%9AAgent%E5%AE%9E%E8%B7%B5/2.2%20%E6%97%A5%E7%A8%8B%E8%A7%84%E5%88%92%E5%B0%8F%E5%8A%A9%E6%89%8B.md) (日程助手), [`docs/第一章：Agent简介/1.1 Agent原理.md`](https://github.com/datawhalechina/agent-tutorial/blob/HEAD/docs/%E7%AC%AC%E4%B8%80%E7%AB%A0%EF%BC%9AAgent%E7%AE%80%E4%BB%8B/1.1%20Agent%E5%8E%9F%E7%90%86.md) (Agent原理)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_root["Repository"]
  node_readme["README<br/>entry doc<br/>[README.md]"]
end

subgraph group_docs["Docs"]
  node_sidebar["Sidebar<br/>nav index<br/>[_sidebar.md]"]
end

subgraph group_chap1["Chapter 1"]
  node_chapter1_intro["Agent原理<br/>theory doc<br/>[1.1 Agent原理.md]"]
  node_chapter1_setup["原理与环境<br/>setup doc"]
end

subgraph group_chap2["Chapter 2"]
  node_chapter2_api["高德实践<br/>integration doc<br/>[2.1 高德开放API实践.md]"]
  node_chapter2_project["日程助手<br/>project doc<br/>[2.2 日程规划小助手.md]"]
end

subgraph group_chap3["Chapter 3"]
  node_chapter3_ideas["创作思路<br/>pattern doc<br/>[3.1 Agent通用创作思路.md]"]
  node_chapter3_outlook["应用展望<br/>outlook doc<br/>[3.2 Agent应用展望.md]"]
end

subgraph group_runtime1["Demo runtime"]
  node_demo1_local["本地 demo<br/>notebook demo"]
  node_demo1_remote["远程 demo<br/>notebook demo"]
end

subgraph group_runtime3["Demo runtime"]
  node_chapter3_demo["DashScope demo<br/>notebook demo"]
end

subgraph group_assets["Support assets"]
  node_tool_template["工具模板<br/>tool config"]
  node_chapter1_imgs["Chapter 1 imgs<br/>visual assets"]
  node_chapter2_imgs["Chapter 2 imgs<br/>visual assets"]
  node_chapter3_imgs["Chapter 3 imgs<br/>visual assets"]
end

subgraph group_integrations["Integrations"]
  node_modelscope_agent{{"ModelScope Agent<br/>agent framework"}}
  node_amap_api{{"Amap API<br/>external api"}}
  node_dashscope{{"DashScope<br/>external model api"}}
end

node_readme -->|"organizes"| node_sidebar
node_sidebar -->|"navigates"| node_chapter1_intro
node_sidebar -->|"navigates"| node_chapter2_api
node_sidebar -->|"navigates"| node_chapter3_ideas
node_chapter1_intro -->|"builds into"| node_chapter1_setup
node_chapter1_setup -->|"grounds"| node_demo1_local
node_chapter1_setup -->|"grounds"| node_demo1_remote
node_demo1_local -->|"uses"| node_tool_template
node_demo1_remote -->|"uses"| node_tool_template
node_demo1_local -->|"runs on"| node_modelscope_agent
node_demo1_remote -->|"runs on"| node_modelscope_agent
node_chapter2_api -->|"integrates"| node_amap_api
node_chapter2_project -->|"uses"| node_amap_api
node_chapter2_project -->|"assembles"| node_modelscope_agent
node_chapter3_ideas -->|"develops"| node_chapter3_outlook
node_chapter3_outlook -->|"illustrates"| node_chapter3_demo
node_chapter3_demo -->|"uses"| node_dashscope
node_chapter1_intro -->|"supported by"| node_chapter1_imgs
node_chapter2_project -->|"supported by"| node_chapter2_imgs
node_chapter3_outlook -->|"supported by"| node_chapter3_imgs
node_chapter1_setup -.->|"introduces"| node_modelscope_agent

click node_readme "https://github.com/datawhalechina/agent-tutorial/blob/main/README.md"
click node_sidebar "https://github.com/datawhalechina/agent-tutorial/blob/main/docs/_sidebar.md"
click node_chapter1_intro "https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第一章：Agent简介/1.1 Agent原理.md"
click node_chapter1_setup "https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第一章：Agent简介/1.2 Agent原理深入+环境配置.md"
click node_chapter2_api "https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第二章：Agent实践/2.1 高德开放API实践.md"
click node_chapter2_project "https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第二章：Agent实践/2.2 日程规划小助手.md"
click node_chapter3_ideas "https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第三章：Agent应用展望/3.1 Agent通用创作思路.md"
click node_chapter3_outlook "https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第三章：Agent应用展望/3.2 Agent应用展望.md"
click node_demo1_local "https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第一章：Agent简介/demo-code/本地Function demo.ipynb"
click node_demo1_remote "https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第一章：Agent简介/demo-code/远程Function demo.ipynb"
click node_tool_template "https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第一章：Agent简介/demo-code/cfg_tool_template.json"
click node_chapter1_imgs "https://github.com/datawhalechina/agent-tutorial/tree/main/docs/第一章：Agent简介/imgs"
click node_chapter2_imgs "https://github.com/datawhalechina/agent-tutorial/tree/main/docs/第二章：Agent实践/imgs"
click node_chapter3_demo "https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第三章：Agent应用展望/demo-code/dashscope-demo.ipynb"
click node_chapter3_imgs "https://github.com/datawhalechina/agent-tutorial/tree/main/docs/第三章：Agent应用展望/imgs"

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_readme,node_chapter3_demo toneBlue
class node_sidebar,node_tool_template,node_chapter1_imgs,node_chapter2_imgs,node_chapter3_imgs toneAmber
class node_chapter1_intro,node_chapter1_setup,node_modelscope_agent,node_amap_api,node_dashscope toneMint
class node_chapter2_api,node_chapter2_project toneRose
class node_chapter3_ideas,node_chapter3_outlook toneIndigo
class node_demo1_local,node_demo1_remote toneTeal
```

## Components

### Repository

Top-level tutorial repository structure

- [README](https://github.com/datawhalechina/agent-tutorial/blob/main/README.md): entry doc · Repository landing page and overview · `README.md`

### Docs

Narrative documentation and chapter content

- [Sidebar](https://github.com/datawhalechina/agent-tutorial/blob/main/docs/_sidebar.md): nav index · Documentation navigation structure · `docs/_sidebar.md`

### Chapter 1

Agent introduction and environment setup

- [Agent原理](https://github.com/datawhalechina/agent-tutorial/blob/HEAD/docs/%E7%AC%AC%E4%B8%80%E7%AB%A0%EF%BC%9AAgent%E7%AE%80%E4%BB%8B/1.1%20Agent%E5%8E%9F%E7%90%86.md): theory doc · Core Agent principles · `docs/第一章：Agent简介/1.1 Agent原理.md`
- [原理与环境](https://github.com/datawhalechina/agent-tutorial/blob/HEAD/docs/%E7%AC%AC%E4%B8%80%E7%AB%A0%EF%BC%9AAgent%E7%AE%80%E4%BB%8B/1.2%20Agent%E5%8E%9F%E7%90%86%E6%B7%B1%E5%85%A5%2B%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.md): setup doc · Deeper Agent mechanics and environment setup · `docs/第一章：Agent简介/1.2 Agent原理深入+环境配置.md`

### Chapter 2

Agent practice and schedule assistant project

- [高德实践](https://github.com/datawhalechina/agent-tutorial/blob/HEAD/docs/%E7%AC%AC%E4%BA%8C%E7%AB%A0%EF%BC%9AAgent%E5%AE%9E%E8%B7%B5/2.1%20%E9%AB%98%E5%BE%B7%E5%BC%80%E6%94%BEAPI%E5%AE%9E%E8%B7%B5.md): integration doc · Amap OpenAPI practice for the assistant · `docs/第二章：Agent实践/2.1 高德开放API实践.md`
- [日程助手](https://github.com/datawhalechina/agent-tutorial/blob/HEAD/docs/%E7%AC%AC%E4%BA%8C%E7%AB%A0%EF%BC%9AAgent%E5%AE%9E%E8%B7%B5/2.2%20%E6%97%A5%E7%A8%8B%E8%A7%84%E5%88%92%E5%B0%8F%E5%8A%A9%E6%89%8B.md): project doc · Schedule-planning assistant walkthrough · `docs/第二章：Agent实践/2.2 日程规划小助手.md`

### Chapter 3

Agent outlook and broader application patterns

- [创作思路](https://github.com/datawhalechina/agent-tutorial/blob/HEAD/docs/%E7%AC%AC%E4%B8%89%E7%AB%A0%EF%BC%9AAgent%E5%BA%94%E7%94%A8%E5%B1%95%E6%9C%9B/3.1%20Agent%E9%80%9A%E7%94%A8%E5%88%9B%E4%BD%9C%E6%80%9D%E8%B7%AF.md): pattern doc · General Agent creation patterns · `docs/第三章：Agent应用展望/3.1 Agent通用创作思路.md`
- [应用展望](https://github.com/datawhalechina/agent-tutorial/blob/HEAD/docs/%E7%AC%AC%E4%B8%89%E7%AB%A0%EF%BC%9AAgent%E5%BA%94%E7%94%A8%E5%B1%95%E6%9C%9B/3.2%20Agent%E5%BA%94%E7%94%A8%E5%B1%95%E6%9C%9B.md): outlook doc · Future application discussion · `docs/第三章：Agent应用展望/3.2 Agent应用展望.md`

### Demo runtime

Executable notebook demos for chapter 1

- [本地 demo](https://github.com/datawhalechina/agent-tutorial/blob/HEAD/docs/%E7%AC%AC%E4%B8%80%E7%AB%A0%EF%BC%9AAgent%E7%AE%80%E4%BB%8B/demo-code/%E6%9C%AC%E5%9C%B0Function%20demo.ipynb): notebook demo · Local function execution example · `docs/第一章：Agent简介/demo-code/本地Function demo.ipynb`
- [远程 demo](https://github.com/datawhalechina/agent-tutorial/blob/HEAD/docs/%E7%AC%AC%E4%B8%80%E7%AB%A0%EF%BC%9AAgent%E7%AE%80%E4%BB%8B/demo-code/%E8%BF%9C%E7%A8%8BFunction%20demo.ipynb): notebook demo · Remote function execution example · `docs/第一章：Agent简介/demo-code/远程Function demo.ipynb`

### Demo runtime

Executable notebook demo for chapter 3

- [DashScope demo](https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第三章：Agent应用展望/demo-code/dashscope-demo.ipynb): notebook demo · DashScope capability demonstration · `docs/第三章：Agent应用展望/demo-code/dashscope-demo.ipynb`

### Support assets

Images and configuration templates used by the tutorials

- [工具模板](https://github.com/datawhalechina/agent-tutorial/blob/main/docs/第一章：Agent简介/demo-code/cfg_tool_template.json): tool config · Template for registering callable tools · `docs/第一章：Agent简介/demo-code/cfg_tool_template.json`
- [Chapter 1 imgs](https://github.com/datawhalechina/agent-tutorial/tree/main/docs/第一章：Agent简介/imgs): visual assets · Diagrams and screenshots supporting chapter 1 · `docs/第一章：Agent简介/imgs`
- [Chapter 2 imgs](https://github.com/datawhalechina/agent-tutorial/tree/main/docs/第二章：Agent实践/imgs): visual assets · Diagrams and screenshots supporting chapter 2 · `docs/第二章：Agent实践/imgs`
- [Chapter 3 imgs](https://github.com/datawhalechina/agent-tutorial/tree/main/docs/第三章：Agent应用展望/imgs): visual assets · Diagrams and screenshots supporting chapter 3 · `docs/第三章：Agent应用展望/imgs`

### Integrations

External frameworks and APIs referenced by the tutorials

- **ModelScope Agent**: agent framework · Primary agent framework used throughout the tutorial
- **Amap API**: external api · Mapping and location service used in the practice chapter
- **DashScope**: external model api · Model or agent capability service referenced in chapter 3

## Connections

- README → Sidebar: organizes · Landing page connects to the documentation structure
- Sidebar → Agent原理: navigates · Sidebar exposes chapter 1 content
- Sidebar → 高德实践: navigates · Sidebar exposes chapter 2 content
- Sidebar → 创作思路: navigates · Sidebar exposes chapter 3 content
- Agent原理 → 原理与环境: builds into · Theory leads into deeper mechanics and setup
- 原理与环境 → 本地 demo: grounds · Setup enables runnable local demo
- 原理与环境 → 远程 demo: grounds · Setup enables runnable remote demo
- 本地 demo → 工具模板: uses · Local demo relies on tool configuration template
- 远程 demo → 工具模板: uses · Remote demo relies on tool configuration template
- 本地 demo → ModelScope Agent: runs on · Notebook executes Agent framework examples
- 远程 demo → ModelScope Agent: runs on · Notebook executes Agent framework examples
- 高德实践 → Amap API: integrates · Practice article demonstrates Amap integration
- 日程助手 → Amap API: uses · Schedule assistant depends on mapping/location data
- 日程助手 → ModelScope Agent: assembles · Project combines tutorial concepts with the Agent framework
- 创作思路 → 应用展望: develops · Pattern discussion leads to broader outlook
- 应用展望 → DashScope demo: illustrates · Outlook section is backed by a DashScope notebook demo
- DashScope demo → DashScope: uses · Notebook demonstrates the external capability service
- Agent原理 → Chapter 1 imgs: supported by · Chapter 1 uses visual explanation assets
- 日程助手 → Chapter 2 imgs: supported by · Chapter 2 uses visual explanation assets
- 应用展望 → Chapter 3 imgs: supported by · Chapter 3 uses visual explanation assets
- 原理与环境 → ModelScope Agent: introduces · Environment setup prepares the Agent framework
