# marktechstation/videocode architecture

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

- Interactive diagram: https://gitdiagram.com/marktechstation/videocode
- Repository: https://github.com/marktechstation/videocode

## Overview

This repository is a collection of tutorial examples for building agents and connecting them through ReAct, MCP, A2A, and RAG. The clearest end-to-end paths are the ReAct agent’s model/tool loop, MarkChat’s chat-to-tool flow, MCP weather tools’ calls to the National Weather Service, and A2A weather/flight task handling. Several modules are represented only by their tree entries, so their internal wiring is not inferred.

Main entry points: [`Agent的概念、原理与构建模式/agent.py`](https://github.com/marktechstation/videocode/blob/main/Agent%E7%9A%84%E6%A6%82%E5%BF%B5%E3%80%81%E5%8E%9F%E7%90%86%E4%B8%8E%E6%9E%84%E5%BB%BA%E6%A8%A1%E5%BC%8F/agent.py) (ReAct loop), [`MCP 与 Function Calling 到底什么关系/MarkChat/backend.py`](https://github.com/marktechstation/videocode/blob/main/MCP%20%E4%B8%8E%20Function%20Calling%20%E5%88%B0%E5%BA%95%E4%BB%80%E4%B9%88%E5%85%B3%E7%B3%BB/MarkChat/backend.py) (Chat backend), [`A2A协议深度解析(1)/weather/__main__.py`](https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(1)/weather/__main__.py) (Weather A2A server), [`A2A协议深度解析(2)/flight/__main__.py`](https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(2)/flight/__main__.py) (Flight A2A server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_react["ReAct agent"]
  node_react_cli["Agent CLI<br/>[agent.py]"]
  node_react_loop["ReAct loop<br/>[agent.py]"]
  node_prompt["Prompt template<br/>[prompt_template.py]"]
  node_tools["File and shell tools<br/>[agent.py]"]
end

subgraph group_mcp["MCP examples"]
  node_chat_ui["Chat interface<br/>[script.js]"]
  node_chat_backend["Chat backend<br/>[backend.py]"]
  node_mcp_client["MCP client<br/>[mcp_client.py]"]
  node_mcp_server["Search server<br/>[mcp_server.py]"]
  node_mcp_weather["Weather tools<br/>[weather.py]"]
end

subgraph group_a2a["A2A agents"]
  node_weather_main["Weather A2A server<br/>[__main__.py]"]
  node_weather_exec["Weather executor<br/>[agent_executor.py]"]
  node_weather_store[("In-memory task store<br/>[__main__.py]")]
  node_flight_main["Flight A2A server<br/>[__main__.py]"]
  node_flight_exec["Flight executor<br/>[agent_executor.py]"]
  node_flight_store[("In-memory task store<br/>[__main__.py]")]
end

subgraph group_rag["RAG example"]
  node_rag_example["RAG workflow"]
end

node_user(("User"))
node_model{{"OpenRouter model"}}
node_nws{{"NWS API"}}

node_user -->|"enters task"| node_react_cli
node_react_cli -->|"runs"| node_react_loop
node_react_loop -->|"renders"| node_prompt
node_react_loop -->|"requests completion"| node_model
node_react_loop -->|"executes action"| node_tools
node_user -->|"sends message"| node_chat_ui
node_chat_ui -->|"POST /chat"| node_chat_backend
node_chat_backend -->|"requests completion"| node_model
node_chat_backend -.->|"optional MCP call"| node_mcp_client
node_mcp_client -->|"calls tool"| node_mcp_server
node_mcp_weather -->|"requests weather data"| node_nws
node_weather_main -->|"dispatches tasks"| node_weather_exec
node_weather_main -->|"configures task storage"| node_weather_store
node_flight_main -->|"dispatches tasks"| node_flight_exec
node_flight_main -->|"configures task storage"| node_flight_store

click node_react_cli "https://github.com/marktechstation/videocode/blob/main/Agent%E7%9A%84%E6%A6%82%E5%BF%B5%E3%80%81%E5%8E%9F%E7%90%86%E4%B8%8E%E6%9E%84%E5%BB%BA%E6%A8%A1%E5%BC%8F/agent.py"
click node_react_loop "https://github.com/marktechstation/videocode/blob/main/Agent%E7%9A%84%E6%A6%82%E5%BF%B5%E3%80%81%E5%8E%9F%E7%90%86%E4%B8%8E%E6%9E%84%E5%BB%BA%E6%A8%A1%E5%BC%8F/agent.py"
click node_prompt "https://github.com/marktechstation/videocode/blob/main/Agent%E7%9A%84%E6%A6%82%E5%BF%B5%E3%80%81%E5%8E%9F%E7%90%86%E4%B8%8E%E6%9E%84%E5%BB%BA%E6%A8%A1%E5%BC%8F/prompt_template.py"
click node_tools "https://github.com/marktechstation/videocode/blob/main/Agent%E7%9A%84%E6%A6%82%E5%BF%B5%E3%80%81%E5%8E%9F%E7%90%86%E4%B8%8E%E6%9E%84%E5%BB%BA%E6%A8%A1%E5%BC%8F/agent.py"
click node_chat_ui "https://github.com/marktechstation/videocode/blob/main/MCP%20%E4%B8%8E%20Function%20Calling%20%E5%88%B0%E5%BA%95%E4%BB%80%E4%B9%88%E5%85%B3%E7%B3%BB/MarkChat/static/script.js"
click node_chat_backend "https://github.com/marktechstation/videocode/blob/main/MCP%20%E4%B8%8E%20Function%20Calling%20%E5%88%B0%E5%BA%95%E4%BB%80%E4%B9%88%E5%85%B3%E7%B3%BB/MarkChat/backend.py"
click node_mcp_client "https://github.com/marktechstation/videocode/blob/main/MCP%20%E4%B8%8E%20Function%20Calling%20%E5%88%B0%E5%BA%95%E4%BB%80%E4%B9%88%E5%85%B3%E7%B3%BB/MarkChat/mcp_client.py"
click node_mcp_server "https://github.com/marktechstation/videocode/blob/main/MCP%20%E4%B8%8E%20Function%20Calling%20%E5%88%B0%E5%BA%95%E4%BB%80%E4%B9%88%E5%85%B3%E7%B3%BB/MarkChat/mcp_server.py"
click node_mcp_weather "https://github.com/marktechstation/videocode/blob/main/MCP%E7%BB%88%E6%9E%81%E6%8C%87%E5%8D%97-%E8%BF%9B%E9%98%B6%E7%AF%87/weather/weather.py"
click node_weather_main "https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(1)/weather/__main__.py"
click node_weather_exec "https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(1)/weather/agent_executor.py"
click node_weather_store "https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(1)/weather/__main__.py"
click node_flight_main "https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(2)/flight/__main__.py"
click node_flight_exec "https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(2)/flight/agent_executor.py"
click node_flight_store "https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(2)/flight/__main__.py"
click node_rag_example "https://github.com/marktechstation/videocode/tree/main/%E4%BD%BF%E7%94%A8Python%E6%9E%84%E5%BB%BARAG%E7%B3%BB%E7%BB%9F/rag"

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_react_cli,node_react_loop,node_prompt,node_tools,node_user toneBlue
class node_chat_ui,node_chat_backend,node_mcp_client,node_mcp_server,node_mcp_weather toneAmber
class node_weather_main,node_weather_exec,node_weather_store,node_flight_main,node_flight_exec,node_flight_store,node_model,node_nws toneMint
class node_rag_example toneRose
```

## Components

### ReAct agent

- [Agent CLI](https://github.com/marktechstation/videocode/blob/main/Agent%E7%9A%84%E6%A6%82%E5%BF%B5%E3%80%81%E5%8E%9F%E7%90%86%E4%B8%8E%E6%9E%84%E5%BB%BA%E6%A8%A1%E5%BC%8F/agent.py): `Agent的概念、原理与构建模式/agent.py`
- [ReAct loop](https://github.com/marktechstation/videocode/blob/main/Agent%E7%9A%84%E6%A6%82%E5%BF%B5%E3%80%81%E5%8E%9F%E7%90%86%E4%B8%8E%E6%9E%84%E5%BB%BA%E6%A8%A1%E5%BC%8F/agent.py): `Agent的概念、原理与构建模式/agent.py`
- [Prompt template](https://github.com/marktechstation/videocode/blob/main/Agent%E7%9A%84%E6%A6%82%E5%BF%B5%E3%80%81%E5%8E%9F%E7%90%86%E4%B8%8E%E6%9E%84%E5%BB%BA%E6%A8%A1%E5%BC%8F/prompt_template.py): `Agent的概念、原理与构建模式/prompt_template.py`
- [File and shell tools](https://github.com/marktechstation/videocode/blob/main/Agent%E7%9A%84%E6%A6%82%E5%BF%B5%E3%80%81%E5%8E%9F%E7%90%86%E4%B8%8E%E6%9E%84%E5%BB%BA%E6%A8%A1%E5%BC%8F/agent.py): `Agent的概念、原理与构建模式/agent.py`

### MCP examples

- [Chat interface](https://github.com/marktechstation/videocode/blob/main/MCP%20%E4%B8%8E%20Function%20Calling%20%E5%88%B0%E5%BA%95%E4%BB%80%E4%B9%88%E5%85%B3%E7%B3%BB/MarkChat/static/script.js): `MCP 与 Function Calling 到底什么关系/MarkChat/static/script.js`
- [Chat backend](https://github.com/marktechstation/videocode/blob/main/MCP%20%E4%B8%8E%20Function%20Calling%20%E5%88%B0%E5%BA%95%E4%BB%80%E4%B9%88%E5%85%B3%E7%B3%BB/MarkChat/backend.py): `MCP 与 Function Calling 到底什么关系/MarkChat/backend.py`
- [MCP client](https://github.com/marktechstation/videocode/blob/main/MCP%20%E4%B8%8E%20Function%20Calling%20%E5%88%B0%E5%BA%95%E4%BB%80%E4%B9%88%E5%85%B3%E7%B3%BB/MarkChat/mcp_client.py): `MCP 与 Function Calling 到底什么关系/MarkChat/mcp_client.py`
- [Search server](https://github.com/marktechstation/videocode/blob/main/MCP%20%E4%B8%8E%20Function%20Calling%20%E5%88%B0%E5%BA%95%E4%BB%80%E4%B9%88%E5%85%B3%E7%B3%BB/MarkChat/mcp_server.py): `MCP 与 Function Calling 到底什么关系/MarkChat/mcp_server.py`
- [Weather tools](https://github.com/marktechstation/videocode/blob/main/MCP%E7%BB%88%E6%9E%81%E6%8C%87%E5%8D%97-%E8%BF%9B%E9%98%B6%E7%AF%87/weather/weather.py): `MCP终极指南-进阶篇/weather/weather.py`

### A2A agents

- [Weather A2A server](https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(1)/weather/__main__.py): `A2A协议深度解析(1)/weather/__main__.py`
- [Weather executor](https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(1)/weather/agent_executor.py): `A2A协议深度解析(1)/weather/agent_executor.py`
- [In-memory task store](https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(1)/weather/__main__.py): `A2A协议深度解析(1)/weather/__main__.py`
- [Flight A2A server](https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(2)/flight/__main__.py): `A2A协议深度解析(2)/flight/__main__.py`
- [Flight executor](https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(2)/flight/agent_executor.py): `A2A协议深度解析(2)/flight/agent_executor.py`
- [In-memory task store](https://github.com/marktechstation/videocode/blob/main/A2A%E5%8D%8F%E8%AE%AE%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90(2)/flight/__main__.py): `A2A协议深度解析(2)/flight/__main__.py`

### RAG example

- [RAG workflow](https://github.com/marktechstation/videocode/tree/main/%E4%BD%BF%E7%94%A8Python%E6%9E%84%E5%BB%BARAG%E7%B3%BB%E7%BB%9F/rag): `使用Python构建RAG系统/rag`

### Other components

- **User**
- **OpenRouter model**
- **NWS API**

## Connections

- User → Agent CLI: enters task
- Agent CLI → ReAct loop: runs
- ReAct loop → Prompt template: renders
- ReAct loop → OpenRouter model: requests completion
- ReAct loop → File and shell tools: executes action
- User → Chat interface: sends message
- Chat interface → Chat backend: POST /chat
- Chat backend → OpenRouter model: requests completion
- Chat backend → MCP client: optional MCP call
- MCP client → Search server: calls tool
- Weather tools → NWS API: requests weather data
- Weather A2A server → Weather executor: dispatches tasks
- Weather A2A server → In-memory task store: configures task storage
- Flight A2A server → Flight executor: dispatches tasks
- Flight A2A server → In-memory task store: configures task storage
