最小可运行 Agent 架构图(专业版)

下面给你 最小可运行 Agent 的专业级架构图(Minimal Viable Agent Architecture, MVA)

这是目前 OpenAI/DeepMind/Anthropic/LangGraph 等共识下的最小、可运行、可扩展、可复用的 Agent 架构。

我给你两种版本:
① 概念版 (理解结构)
② 工程版(可以直接落地)


🟦 ① 最小可运行 Agent 架构图(概念版)

scss 复制代码
                 ┌───────────────────────────┐
                 │        User / Goal        │
                 └──────────────┬────────────┘
                                ▼
                     ┌───────────────────┐
                     │  Goal Interpreter │
                     └─────────┬─────────┘
                               ▼
                   ┌──────────────────────┐
                   │   Task Decomposer    │
                   └──────────┬───────────┘
                              ▼
              ┌──────────────────────────────────┐
              │     Agent Runtime (Event Loop)    │
              │    ───────────────────────────    │
              │    • Planning                     │
              │    • Action Selection             │
              │    • Feedback Evaluation          │
              └───────────┬──────────────┬───────┘
                          ▼              ▼
              ┌─────────────────┐   ┌────────────────┐
              │   Memory / VM   │   │  World Model    │
              │ (State Manager) │   │ (State Storage) │
              └───────┬────────┘   └──────┬─────────┘
                      ▼                   ▼
               ┌──────────────────────────────────────────┐
               │             Tool Interface                │
               │  • API Calls                              │
               │  • Browser Actions (Playwright)           │
               │  • Code Execution Sandboxes               │
               │  • File / DB Ops                          │
               └───────────────────────┬───────────────────┘
                                       ▼
                         ┌──────────────────────────┐
                         │   External Environment   │
                         └──────────────────────────┘

🟩 最小可运行 Agent 必须包含 5 个核心模块

1. Goal Interpreter

把用户输入、指令或触发事件 → 转换成"目标"。

ini 复制代码
Goal = parse(user_input)

2. Task Decomposer(任务分解器)

把目标拆成可执行、副任务。

ini 复制代码
Plan = decompose(Goal)

3. Agent Runtime(Agent 运行时)

这是 Agent 的"CPU"。

包括:

  • Planning(重规划)
  • Action Selection(决定下一步)
  • Observation(读环境)
  • Feedback Loop(失败重试)
  • Error Recovery(纠错)
  • Termination Condition(任务完成条件)

它是一个循环:

css 复制代码
while not done:
    observe()
    decide()
    act()
    evaluate()

4. Memory / World Model(状态 + 记忆 + 世界模型)

必须至少包含:

  • Working Memory(当前任务状态)
  • Long-term Memory(持久化知识、历史)
  • World State(工具/环境的最新状态)

5. Tools(工具层)

Agent 通过工具改变世界:

  • 浏览器
  • API
  • 数据库
  • 文件系统
  • 脚本执行
  • 自定义插件

🟦 ② 最小可运行 Agent 架构(工程版)

这是你可以直接用在项目中的结构。

bash 复制代码
src/
└── agent/
    ├── main.py            # 状态机 / Agent Loop
    ├── planning.py        # 任务分解 & 规划
    ├── memory.py          # 状态管理 / 记忆
    ├── tools/
    │   ├── browser.py     # 浏览器工具
    │   ├── http.py        # API 调用工具
    │   ├── code_exec.py   # 代码沙盒
    │   └── ...            # 自定义工具
    ├── world_model.py     # 环境状态
    └── goal_parser.py     # 目标解释器

核心循环(简化版):

scss 复制代码
while not memory.is_done():
    goal = memory.current_goal()
    plan = planning.replan(goal, memory.state())
    action = plan.next_action()

    observation = tools.execute(action)
    memory.update(observation)

    if planning.detect_failure(observation):
        planning.recover()

🟧 ③ Agent 的最小状态机(必需)

csharp 复制代码
[Interpret Goal]
        ↓
[Decompose Task]
        ↓
[Plan]
        ↓
[Act]
        ↓
[Evaluate]
        ↺(失败 → 回到 Plan)
        ↓
     [Done]

这个状态机是当前所有可靠 Agent(OpenAI Swarm、LangGraph、Devin、AutoGPT v2)的核心。


🟪 ④ MVA(最小可运行 Agent)必须满足这 4 条:

  1. 至少能自动分解任务
  2. 至少能连续执行多个工具调用
  3. 至少能根据工具结果做决策和纠错
  4. 至少有状态(记忆)

只有满足这 4 条的系统才算 Agent,

否则都是"工具调用型 LLM"。

相关推荐
维元码簿1 小时前
Claude Code 深度拆解:多 Agent 协作 3 — Task 状态机、SendMessage 与消息邮箱
ai·agent·claude code·ai coding
AI趣实验3 小时前
Hermes Agent LLM Wiki + Obsidian Git 免费替代 Obsidian Sync:保姆级配置教程
aigc·agent
穷人小水滴3 小时前
(AI) 编写简单 AI 助手 (ds-agent)
aigc·agent·deepseek
Chef_Chen4 小时前
论文解读:8K窗口撬动350万Token:MemAgent用强化学习重塑长文本记忆
agent·memory
Joseph Cooper5 小时前
AI 多智能体系统落地:从上下文边界到 A2A 与 Harness 设计
人工智能·ai·agent·多智能体·multi-agent·a2a·harness
SkySeraph5 小时前
SkillNexus:开源 Skills 全生命周期创造平台
llm·agent·skill·skillnexus
HIT_Weston5 小时前
66、【Agent】【OpenCode】用户对话提示词(Agent 主动性)
人工智能·agent·opencode
70asunflower6 小时前
从Chatbot到Agentic AI:系统架构、商业模式与产业认知的深度拆解
ai·agent
深海鱼在掘金6 小时前
深入浅出 LangChain —— 第六章:记忆与状态管理
人工智能·langchain·agent
qq_283720056 小时前
Python+LangChain 调用大模型全方案深度实战:原生调用、统一接口、流式输出、异步、自定义模型全解析
人工智能·langchain·agent·rag