Skip to content
🔗 分享本题
查看我的学习进度 →

27 模块 Q8 教学图:如何设计一个企业级AI Agent平台(类似Coze/Dify)?

🧠 图解记忆:控制面管规则,执行面跑任务,观测与审计贯穿全程;点击图片可查看原图。

💡 答案要点

平台核心架构:

┌─────────────────────────────────────────────────────────┐
│  用户层:可视化编排 / API 调用                          │
└──────────────────────┬──────────────────────────────────┘

┌──────────────────────────────────────────────────────┐
│  编排层:工作流设计器                                  │
│  - 节点:LLM节点 / 知识库节点 / API节点 / 条件节点    │
│  - 边:数据流 / 条件流                               │
│  - 输出:DSL(领域特定语言)配置文件                  │
└──────────────────────┬───────────────────────────────┘

┌──────────────────────────────────────────────────────┐
│  运行时层:工作流引擎                                  │
│  - 执行节点 → 收集输出 → 路由到下一节点             │
│  - 支持条件分支 / 循环 / 并行                        │
└──────────────────────┬───────────────────────────────┘

┌──────────────────────────────────────────────────────┐
│  能力层:工具生态                                     │
│  - 内置工具:知识库 / SQL / API / Webhook            │
│  - MCP 集成:扩展工具生态                            │
└──────────────────────────────────────────────────────┘

DSL 工作流配置示例:

展开 Yaml 代码示例(44 行)
yaml
workflow:
  name: "智能客服"
  version: "1.0"
  
  nodes:
    - id: "intent"
      type: "llm"
      model: "qwen2.5-14b"
      prompt: "判断用户意图:咨询/下单/售后/投诉"
      output: "user_intent"
    
    - id: "route"
      type: "condition"
      branches:
        - condition: "{{user_intent}} == '咨询'"
          next: "knowledge_base"
        - condition: "{{user_intent}} == '下单'"
          next: "order_agent"
        - condition: "{{user_intent}} == '售后'"
          next: "after_sales"
        default: "human_agent"
    
    - id: "knowledge_base"
      type: "rag"
      knowledge_id: "product_knowledge"
      top_k: 5
      output: "rag_result"
    
    - id: "after_sales"
      type: "api"
      url: "https://api.company.com/order/track"
      params: "{{order_id}}"
      output: "tracking_info"

  edges:
    - from: "intent"
      to: "route"
    - from: "route"
      to: "knowledge_base"
    # ...

  output:
    format: "markdown"
    stream: true

面试话术:

"企业级Agent平台的核心是'编排即服务'。我用DSL描述工作流,节点类型包括LLM、知识库、API、HTTP、代码执行等。工作流引擎解析DSL,按拓扑顺序执行节点,支持条件分支、并行、循环。编排层提供可视化画布,用户拖拖拽拽就能搭工作流,生成的DSL存到数据库,运行时引擎执行。平台还接入了MCP协议,工具生态可以无限扩展。"