AI Agent 高级面试题详解 · 基础篇
什么是 AI Agent?它和普通 LLM 应用有什么区别?
一、一句话定义与核心公式
AI Agent 是以大模型为决策内核、以工具为执行手段、以状态与记忆为连续性载体、以目标为收敛判据的自主执行系统。
它不是一个"更聪明的 LLM 应用",而是一个控制论意义上的闭环系统:
Agent = LLM(决策器) + Tools(效应器) + Memory/State(状态载体) + Goal/Loop(收敛机制)
#mermaid-svg-7qVsvSwRZPrdA5iz{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-7qVsvSwRZPrdA5iz .error-icon{fill:#552222;}#mermaid-svg-7qVsvSwRZPrdA5iz .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-7qVsvSwRZPrdA5iz .marker{fill:#333333;stroke:#333333;}#mermaid-svg-7qVsvSwRZPrdA5iz .marker.cross{stroke:#333333;}#mermaid-svg-7qVsvSwRZPrdA5iz svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-7qVsvSwRZPrdA5iz p{margin:0;}#mermaid-svg-7qVsvSwRZPrdA5iz .edge{stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .section--1 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section--1 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section--1 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section--1 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section--1 path{fill:hsl(240, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section--1 text{fill:#ffffff;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon--1{font-size:40px;color:#ffffff;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge--1{stroke:hsl(240, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth--1{stroke-width:17;}#mermaid-svg-7qVsvSwRZPrdA5iz .section--1 line{stroke:hsl(60, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-0 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-0 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-0 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-0 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section-0 path{fill:hsl(60, 100%, 73.5294117647%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-0 text{fill:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon-0{font-size:40px;color:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge-0{stroke:hsl(60, 100%, 73.5294117647%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth-0{stroke-width:14;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-0 line{stroke:hsl(240, 100%, 83.5294117647%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-1 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-1 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-1 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-1 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section-1 path{fill:hsl(80, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-1 text{fill:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon-1{font-size:40px;color:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge-1{stroke:hsl(80, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth-1{stroke-width:11;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-1 line{stroke:hsl(260, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-2 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-2 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-2 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-2 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section-2 path{fill:hsl(270, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-2 text{fill:#ffffff;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon-2{font-size:40px;color:#ffffff;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge-2{stroke:hsl(270, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth-2{stroke-width:8;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-2 line{stroke:hsl(90, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-3 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-3 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-3 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-3 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section-3 path{fill:hsl(300, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-3 text{fill:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon-3{font-size:40px;color:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge-3{stroke:hsl(300, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth-3{stroke-width:5;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-3 line{stroke:hsl(120, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-4 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-4 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-4 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-4 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section-4 path{fill:hsl(330, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-4 text{fill:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon-4{font-size:40px;color:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge-4{stroke:hsl(330, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth-4{stroke-width:2;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-4 line{stroke:hsl(150, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-5 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-5 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-5 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-5 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section-5 path{fill:hsl(0, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-5 text{fill:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon-5{font-size:40px;color:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge-5{stroke:hsl(0, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth-5{stroke-width:-1;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-5 line{stroke:hsl(180, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-6 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-6 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-6 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-6 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section-6 path{fill:hsl(30, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-6 text{fill:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon-6{font-size:40px;color:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge-6{stroke:hsl(30, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth-6{stroke-width:-4;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-6 line{stroke:hsl(210, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-7 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-7 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-7 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-7 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section-7 path{fill:hsl(90, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-7 text{fill:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon-7{font-size:40px;color:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge-7{stroke:hsl(90, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth-7{stroke-width:-7;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-7 line{stroke:hsl(270, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-8 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-8 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-8 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-8 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section-8 path{fill:hsl(150, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-8 text{fill:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon-8{font-size:40px;color:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge-8{stroke:hsl(150, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth-8{stroke-width:-10;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-8 line{stroke:hsl(330, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-9 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-9 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-9 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-9 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section-9 path{fill:hsl(180, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-9 text{fill:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon-9{font-size:40px;color:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge-9{stroke:hsl(180, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth-9{stroke-width:-13;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-9 line{stroke:hsl(0, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-10 rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-10 path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-10 circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-10 polygon,#mermaid-svg-7qVsvSwRZPrdA5iz .section-10 path{fill:hsl(210, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-10 text{fill:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .node-icon-10{font-size:40px;color:black;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-edge-10{stroke:hsl(210, 100%, 76.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .edge-depth-10{stroke-width:-16;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-10 line{stroke:hsl(30, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled circle,#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:lightgray;}#mermaid-svg-7qVsvSwRZPrdA5iz .disabled text{fill:#efefef;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-root rect,#mermaid-svg-7qVsvSwRZPrdA5iz .section-root path,#mermaid-svg-7qVsvSwRZPrdA5iz .section-root circle,#mermaid-svg-7qVsvSwRZPrdA5iz .section-root polygon{fill:hsl(240, 100%, 46.2745098039%);}#mermaid-svg-7qVsvSwRZPrdA5iz .section-root text{fill:#ffffff;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-root span{color:#ffffff;}#mermaid-svg-7qVsvSwRZPrdA5iz .section-2 span{color:#ffffff;}#mermaid-svg-7qVsvSwRZPrdA5iz .icon-container{height:100%;display:flex;justify-content:center;align-items:center;}#mermaid-svg-7qVsvSwRZPrdA5iz .edge{fill:none;}#mermaid-svg-7qVsvSwRZPrdA5iz .mindmap-node-label{dy:1em;alignment-baseline:middle;text-anchor:middle;dominant-baseline:middle;text-align:center;}#mermaid-svg-7qVsvSwRZPrdA5iz :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} AI Agent
决策内核
LLM 推理
规划 Planning
反思 Reflection
执行手段
工具调用 Tool Use
代码执行
外部 API
状态载体
短期上下文
长期记忆
任务状态
收敛机制
目标定义
终止判据
预算约束
判断一个系统是不是 Agent,看的不是"有没有用大模型",而是看是否同时具备:目标驱动的闭环、自主决策的步骤序列、可观测的状态推进。 缺任何一环,都更接近"LLM 应用"而非"Agent"。
二、Agent 的核心原理:从"一次推理"到"闭环控制"
2.1 普通 LLM 应用的本质:开环函数
普通 LLM 应用(对话、摘要、分类、单次 RAG 问答)本质是一个开环映射:
输入 → Prompt 拼接 → LLM 推理一次 → 输出
它没有"执行---观察---修正"的回路。一次推理结束,系统就结束了。错误无法被自己发现,目标无法被持续推进。
#mermaid-svg-yPxECzggln1H3rlg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-yPxECzggln1H3rlg .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-yPxECzggln1H3rlg .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-yPxECzggln1H3rlg .error-icon{fill:#552222;}#mermaid-svg-yPxECzggln1H3rlg .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-yPxECzggln1H3rlg .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-yPxECzggln1H3rlg .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-yPxECzggln1H3rlg .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-yPxECzggln1H3rlg .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-yPxECzggln1H3rlg .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-yPxECzggln1H3rlg .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-yPxECzggln1H3rlg .marker{fill:#333333;stroke:#333333;}#mermaid-svg-yPxECzggln1H3rlg .marker.cross{stroke:#333333;}#mermaid-svg-yPxECzggln1H3rlg svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-yPxECzggln1H3rlg p{margin:0;}#mermaid-svg-yPxECzggln1H3rlg .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-yPxECzggln1H3rlg .cluster-label text{fill:#333;}#mermaid-svg-yPxECzggln1H3rlg .cluster-label span{color:#333;}#mermaid-svg-yPxECzggln1H3rlg .cluster-label span p{background-color:transparent;}#mermaid-svg-yPxECzggln1H3rlg .label text,#mermaid-svg-yPxECzggln1H3rlg span{fill:#333;color:#333;}#mermaid-svg-yPxECzggln1H3rlg .node rect,#mermaid-svg-yPxECzggln1H3rlg .node circle,#mermaid-svg-yPxECzggln1H3rlg .node ellipse,#mermaid-svg-yPxECzggln1H3rlg .node polygon,#mermaid-svg-yPxECzggln1H3rlg .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-yPxECzggln1H3rlg .rough-node .label text,#mermaid-svg-yPxECzggln1H3rlg .node .label text,#mermaid-svg-yPxECzggln1H3rlg .image-shape .label,#mermaid-svg-yPxECzggln1H3rlg .icon-shape .label{text-anchor:middle;}#mermaid-svg-yPxECzggln1H3rlg .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-yPxECzggln1H3rlg .rough-node .label,#mermaid-svg-yPxECzggln1H3rlg .node .label,#mermaid-svg-yPxECzggln1H3rlg .image-shape .label,#mermaid-svg-yPxECzggln1H3rlg .icon-shape .label{text-align:center;}#mermaid-svg-yPxECzggln1H3rlg .node.clickable{cursor:pointer;}#mermaid-svg-yPxECzggln1H3rlg .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-yPxECzggln1H3rlg .arrowheadPath{fill:#333333;}#mermaid-svg-yPxECzggln1H3rlg .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-yPxECzggln1H3rlg .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-yPxECzggln1H3rlg .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-yPxECzggln1H3rlg .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-yPxECzggln1H3rlg .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-yPxECzggln1H3rlg .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-yPxECzggln1H3rlg .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-yPxECzggln1H3rlg .cluster text{fill:#333;}#mermaid-svg-yPxECzggln1H3rlg .cluster span{color:#333;}#mermaid-svg-yPxECzggln1H3rlg div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-yPxECzggln1H3rlg .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-yPxECzggln1H3rlg rect.text{fill:none;stroke-width:0;}#mermaid-svg-yPxECzggln1H3rlg .icon-shape,#mermaid-svg-yPxECzggln1H3rlg .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-yPxECzggln1H3rlg .icon-shape p,#mermaid-svg-yPxECzggln1H3rlg .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-yPxECzggln1H3rlg .icon-shape .label rect,#mermaid-svg-yPxECzggln1H3rlg .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-yPxECzggln1H3rlg .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-yPxECzggln1H3rlg .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-yPxECzggln1H3rlg :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 用户输入
Prompt 模板拼接
LLM 单次推理
输出/解析
返回用户
2.2 Agent 的本质:闭环控制
Agent 在 LLM 外面包了一层控制回路,把"单次推理"变成"可迭代的决策循环":
#mermaid-svg-SmdJQR4Sewcq9oMb{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-SmdJQR4Sewcq9oMb .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-SmdJQR4Sewcq9oMb .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-SmdJQR4Sewcq9oMb .error-icon{fill:#552222;}#mermaid-svg-SmdJQR4Sewcq9oMb .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-SmdJQR4Sewcq9oMb .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-SmdJQR4Sewcq9oMb .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-SmdJQR4Sewcq9oMb .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-SmdJQR4Sewcq9oMb .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-SmdJQR4Sewcq9oMb .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-SmdJQR4Sewcq9oMb .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-SmdJQR4Sewcq9oMb .marker{fill:#333333;stroke:#333333;}#mermaid-svg-SmdJQR4Sewcq9oMb .marker.cross{stroke:#333333;}#mermaid-svg-SmdJQR4Sewcq9oMb svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-SmdJQR4Sewcq9oMb p{margin:0;}#mermaid-svg-SmdJQR4Sewcq9oMb .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-SmdJQR4Sewcq9oMb .cluster-label text{fill:#333;}#mermaid-svg-SmdJQR4Sewcq9oMb .cluster-label span{color:#333;}#mermaid-svg-SmdJQR4Sewcq9oMb .cluster-label span p{background-color:transparent;}#mermaid-svg-SmdJQR4Sewcq9oMb .label text,#mermaid-svg-SmdJQR4Sewcq9oMb span{fill:#333;color:#333;}#mermaid-svg-SmdJQR4Sewcq9oMb .node rect,#mermaid-svg-SmdJQR4Sewcq9oMb .node circle,#mermaid-svg-SmdJQR4Sewcq9oMb .node ellipse,#mermaid-svg-SmdJQR4Sewcq9oMb .node polygon,#mermaid-svg-SmdJQR4Sewcq9oMb .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-SmdJQR4Sewcq9oMb .rough-node .label text,#mermaid-svg-SmdJQR4Sewcq9oMb .node .label text,#mermaid-svg-SmdJQR4Sewcq9oMb .image-shape .label,#mermaid-svg-SmdJQR4Sewcq9oMb .icon-shape .label{text-anchor:middle;}#mermaid-svg-SmdJQR4Sewcq9oMb .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-SmdJQR4Sewcq9oMb .rough-node .label,#mermaid-svg-SmdJQR4Sewcq9oMb .node .label,#mermaid-svg-SmdJQR4Sewcq9oMb .image-shape .label,#mermaid-svg-SmdJQR4Sewcq9oMb .icon-shape .label{text-align:center;}#mermaid-svg-SmdJQR4Sewcq9oMb .node.clickable{cursor:pointer;}#mermaid-svg-SmdJQR4Sewcq9oMb .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-SmdJQR4Sewcq9oMb .arrowheadPath{fill:#333333;}#mermaid-svg-SmdJQR4Sewcq9oMb .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-SmdJQR4Sewcq9oMb .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-SmdJQR4Sewcq9oMb .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-SmdJQR4Sewcq9oMb .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-SmdJQR4Sewcq9oMb .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-SmdJQR4Sewcq9oMb .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-SmdJQR4Sewcq9oMb .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-SmdJQR4Sewcq9oMb .cluster text{fill:#333;}#mermaid-svg-SmdJQR4Sewcq9oMb .cluster span{color:#333;}#mermaid-svg-SmdJQR4Sewcq9oMb div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-SmdJQR4Sewcq9oMb .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-SmdJQR4Sewcq9oMb rect.text{fill:none;stroke-width:0;}#mermaid-svg-SmdJQR4Sewcq9oMb .icon-shape,#mermaid-svg-SmdJQR4Sewcq9oMb .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-SmdJQR4Sewcq9oMb .icon-shape p,#mermaid-svg-SmdJQR4Sewcq9oMb .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-SmdJQR4Sewcq9oMb .icon-shape .label rect,#mermaid-svg-SmdJQR4Sewcq9oMb .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-SmdJQR4Sewcq9oMb .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-SmdJQR4Sewcq9oMb .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-SmdJQR4Sewcq9oMb :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 否
是
目标 Goal
规划 Planner
决策:下一步做什么
执行:调用工具/子任务
观察:工具返回结果
状态更新:记忆/进度
目标达成?
预算耗尽?
需要人工?
收敛:输出/终止/升级
这条回路里的每一环,都是普通 LLM 应用没有的:
| 环节 | 普通 LLM 应用 | Agent |
|---|---|---|
| 规划 | 无(Prompt 里一次性写死) | 动态生成、可重规划 |
| 执行 | 仅文本输出 | 工具调用、代码执行、外部系统操作 |
| 观察 | 无 | 读取工具结果、环境反馈 |
| 状态 | 仅对话历史 | 任务状态、进度、记忆、检查点 |
| 收敛 | 一次输出即结束 | 目标达成/预算/人工兜底的判据 |
三、Agent 的执行时序:一次任务的生命周期
工具/环境 记忆/状态 LLM 决策内核 Agent 控制器 用户 工具/环境 记忆/状态 LLM 决策内核 Agent 控制器 用户 #mermaid-svg-oO06PKHRyaxlne3e{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-oO06PKHRyaxlne3e .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-oO06PKHRyaxlne3e .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-oO06PKHRyaxlne3e .error-icon{fill:#552222;}#mermaid-svg-oO06PKHRyaxlne3e .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-oO06PKHRyaxlne3e .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-oO06PKHRyaxlne3e .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-oO06PKHRyaxlne3e .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-oO06PKHRyaxlne3e .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-oO06PKHRyaxlne3e .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-oO06PKHRyaxlne3e .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-oO06PKHRyaxlne3e .marker{fill:#333333;stroke:#333333;}#mermaid-svg-oO06PKHRyaxlne3e .marker.cross{stroke:#333333;}#mermaid-svg-oO06PKHRyaxlne3e svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-oO06PKHRyaxlne3e p{margin:0;}#mermaid-svg-oO06PKHRyaxlne3e .actor{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-oO06PKHRyaxlne3e text.actor>tspan{fill:black;stroke:none;}#mermaid-svg-oO06PKHRyaxlne3e .actor-line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-oO06PKHRyaxlne3e .innerArc{stroke-width:1.5;stroke-dasharray:none;}#mermaid-svg-oO06PKHRyaxlne3e .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#mermaid-svg-oO06PKHRyaxlne3e .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#mermaid-svg-oO06PKHRyaxlne3e #arrowhead path{fill:#333;stroke:#333;}#mermaid-svg-oO06PKHRyaxlne3e .sequenceNumber{fill:white;}#mermaid-svg-oO06PKHRyaxlne3e #sequencenumber{fill:#333;}#mermaid-svg-oO06PKHRyaxlne3e #crosshead path{fill:#333;stroke:#333;}#mermaid-svg-oO06PKHRyaxlne3e .messageText{fill:#333;stroke:none;}#mermaid-svg-oO06PKHRyaxlne3e .labelBox{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-oO06PKHRyaxlne3e .labelText,#mermaid-svg-oO06PKHRyaxlne3e .labelText>tspan{fill:black;stroke:none;}#mermaid-svg-oO06PKHRyaxlne3e .loopText,#mermaid-svg-oO06PKHRyaxlne3e .loopText>tspan{fill:black;stroke:none;}#mermaid-svg-oO06PKHRyaxlne3e .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-oO06PKHRyaxlne3e .note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-oO06PKHRyaxlne3e .noteText,#mermaid-svg-oO06PKHRyaxlne3e .noteText>tspan{fill:black;stroke:none;}#mermaid-svg-oO06PKHRyaxlne3e .activation0{fill:#f4f4f4;stroke:#666;}#mermaid-svg-oO06PKHRyaxlne3e .activation1{fill:#f4f4f4;stroke:#666;}#mermaid-svg-oO06PKHRyaxlne3e .activation2{fill:#f4f4f4;stroke:#666;}#mermaid-svg-oO06PKHRyaxlne3e .actorPopupMenu{position:absolute;}#mermaid-svg-oO06PKHRyaxlne3e .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#mermaid-svg-oO06PKHRyaxlne3e .actor-man line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-oO06PKHRyaxlne3e .actor-man circle,#mermaid-svg-oO06PKHRyaxlne3e line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;stroke-width:2px;}#mermaid-svg-oO06PKHRyaxlne3e :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} loop执行循环(直到收敛) 提交目标读取上下文与历史状态注入目标 + 工具描述 + 状态规划:步骤序列 / 下一步决策调用工具(检索/API/代码)返回观察结果更新进度/中间结果注入新观察,请求下一步决策:继续/修正/终止持久化检查点返回结果 + 执行轨迹
关键洞察:LLM 在 Agent 中退化为"决策器",系统的智能来自"LLM 决策 + 控制回路 + 工具效应"的组合,而非单次推理的强弱。 这也是为什么一个中等能力的模型配上好的 Agent 架构,往往能完成强模型单次推理做不到的长任务。
四、核心差异对比表(高级岗必须能说全的维度)
| 维度 | 普通 LLM 应用 | AI Agent | 差异本质 |
|---|---|---|---|
| 执行模型 | 开环,一次推理 | 闭环,迭代控制 | 是否有"观察---修正"回路 |
| 决策粒度 | 单步(整段回答) | 多步(规划+逐步执行) | 是否具备步骤级决策能力 |
| 外部作用 | 只能输出文本 | 可调用工具改变外部世界 | 是否有效应器(副作用能力) |
| 状态管理 | 对话历史 | 任务状态+记忆+检查点 | 是否跨轮次持久化目标进度 |
| 错误处理 | 无法自知,错了就错了 | 可检测失败、重试、重规划 | 是否具备自纠能力 |
| 终止判据 | 生成结束即终止 | 目标达成/预算/人工兜底 | 是否有显式收敛条件 |
| 可控性 | 高(输入输出确定) | 低(路径不确定) | 自由度与风险同步上升 |
| 可观测性 | 看一次请求响应 | 需 Trace 全链路决策 | 调试复杂度显著提升 |
| 成本结构 | 单次 token | 多步 token + 工具 + 重试 | 成本随步数非线性增长 |
| 失败模式 | 幻觉、答非所问 | 死循环、跑飞、误操作、越权 | 失败面从"答错"扩展到"做错" |
| 安全边界 | 输出过滤 | 工具权限、副作用、审批 | 安全从内容层下沉到执行层 |
面试得分点 :能把差异从"能力更强"上升到"控制论差异 + 失败模式差异 + 治理复杂度差异"三个层次,是高级岗与初级岗的分水岭。
五、边界辨析:什么不是 Agent(高频陷阱)
这是高级面试最容易拉开区分度的地方------很多人把所有"用了 LLM 的系统"都叫 Agent,这是错的。
#mermaid-svg-TUjprtcZVCypyxjI{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-TUjprtcZVCypyxjI .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-TUjprtcZVCypyxjI .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-TUjprtcZVCypyxjI .error-icon{fill:#552222;}#mermaid-svg-TUjprtcZVCypyxjI .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-TUjprtcZVCypyxjI .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-TUjprtcZVCypyxjI .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-TUjprtcZVCypyxjI .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-TUjprtcZVCypyxjI .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-TUjprtcZVCypyxjI .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-TUjprtcZVCypyxjI .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-TUjprtcZVCypyxjI .marker{fill:#333333;stroke:#333333;}#mermaid-svg-TUjprtcZVCypyxjI .marker.cross{stroke:#333333;}#mermaid-svg-TUjprtcZVCypyxjI svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-TUjprtcZVCypyxjI p{margin:0;}#mermaid-svg-TUjprtcZVCypyxjI .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-TUjprtcZVCypyxjI .cluster-label text{fill:#333;}#mermaid-svg-TUjprtcZVCypyxjI .cluster-label span{color:#333;}#mermaid-svg-TUjprtcZVCypyxjI .cluster-label span p{background-color:transparent;}#mermaid-svg-TUjprtcZVCypyxjI .label text,#mermaid-svg-TUjprtcZVCypyxjI span{fill:#333;color:#333;}#mermaid-svg-TUjprtcZVCypyxjI .node rect,#mermaid-svg-TUjprtcZVCypyxjI .node circle,#mermaid-svg-TUjprtcZVCypyxjI .node ellipse,#mermaid-svg-TUjprtcZVCypyxjI .node polygon,#mermaid-svg-TUjprtcZVCypyxjI .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-TUjprtcZVCypyxjI .rough-node .label text,#mermaid-svg-TUjprtcZVCypyxjI .node .label text,#mermaid-svg-TUjprtcZVCypyxjI .image-shape .label,#mermaid-svg-TUjprtcZVCypyxjI .icon-shape .label{text-anchor:middle;}#mermaid-svg-TUjprtcZVCypyxjI .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-TUjprtcZVCypyxjI .rough-node .label,#mermaid-svg-TUjprtcZVCypyxjI .node .label,#mermaid-svg-TUjprtcZVCypyxjI .image-shape .label,#mermaid-svg-TUjprtcZVCypyxjI .icon-shape .label{text-align:center;}#mermaid-svg-TUjprtcZVCypyxjI .node.clickable{cursor:pointer;}#mermaid-svg-TUjprtcZVCypyxjI .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-TUjprtcZVCypyxjI .arrowheadPath{fill:#333333;}#mermaid-svg-TUjprtcZVCypyxjI .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-TUjprtcZVCypyxjI .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-TUjprtcZVCypyxjI .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-TUjprtcZVCypyxjI .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-TUjprtcZVCypyxjI .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-TUjprtcZVCypyxjI .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-TUjprtcZVCypyxjI .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-TUjprtcZVCypyxjI .cluster text{fill:#333;}#mermaid-svg-TUjprtcZVCypyxjI .cluster span{color:#333;}#mermaid-svg-TUjprtcZVCypyxjI div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-TUjprtcZVCypyxjI .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-TUjprtcZVCypyxjI rect.text{fill:none;stroke-width:0;}#mermaid-svg-TUjprtcZVCypyxjI .icon-shape,#mermaid-svg-TUjprtcZVCypyxjI .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-TUjprtcZVCypyxjI .icon-shape p,#mermaid-svg-TUjprtcZVCypyxjI .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-TUjprtcZVCypyxjI .icon-shape .label rect,#mermaid-svg-TUjprtcZVCypyxjI .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-TUjprtcZVCypyxjI .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-TUjprtcZVCypyxjI .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-TUjprtcZVCypyxjI :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 否
是
否
是
是
否
是
系统是否具备
目标驱动的多步闭环?
是否有固定编排?
Workflow / 编排系统
不是 Agent
是否单次调用 LLM?
普通 LLM 应用
对话/摘要/RAG问答
步骤是否由模型自主决策?
固定流程自动化
不是 Agent
AI Agent
| 系统形态 | 是不是 Agent | 判断依据 |
|---|---|---|
| 单次 RAG 问答 | 否 | 无多步闭环,检索是固定前置步骤 |
| 固定 Workflow(A→B→C) | 否 | 步骤由人预先编排,模型不决策路径 |
| 单次 Function Calling | 否 | 只调用一次工具,无迭代观察 |
| ReAct 循环 + 工具 | 是 | 模型自主决定每步调用什么工具 |
| Plan-and-Execute | 是 | 模型规划 DAG 并按执行反馈重规划 |
| 多 Agent 协作 | 是(更复杂) | 在单 Agent 闭环上叠加了协作与仲裁 |
边界判据三条:
- 路径是否由模型决策------步骤写死的是 Workflow,步骤动态生成的是 Agent;
- 是否读取执行反馈------调完工具不看结果的是工具调用,看结果并据此调整的是 Agent;
- 是否有收敛判据------跑到自然结束的是脚本,知道"目标达成/该停/该找人"的才是 Agent。
六、为什么这个区分在工程上重要
不是因为概念洁癖,而是因为两者的工程代价和安全模型完全不同:
#mermaid-svg-pkQzjMJt2kumlPE8{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-pkQzjMJt2kumlPE8 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-pkQzjMJt2kumlPE8 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-pkQzjMJt2kumlPE8 .error-icon{fill:#552222;}#mermaid-svg-pkQzjMJt2kumlPE8 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-pkQzjMJt2kumlPE8 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-pkQzjMJt2kumlPE8 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-pkQzjMJt2kumlPE8 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-pkQzjMJt2kumlPE8 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-pkQzjMJt2kumlPE8 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-pkQzjMJt2kumlPE8 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-pkQzjMJt2kumlPE8 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-pkQzjMJt2kumlPE8 .marker.cross{stroke:#333333;}#mermaid-svg-pkQzjMJt2kumlPE8 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-pkQzjMJt2kumlPE8 p{margin:0;}#mermaid-svg-pkQzjMJt2kumlPE8 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-pkQzjMJt2kumlPE8 .cluster-label text{fill:#333;}#mermaid-svg-pkQzjMJt2kumlPE8 .cluster-label span{color:#333;}#mermaid-svg-pkQzjMJt2kumlPE8 .cluster-label span p{background-color:transparent;}#mermaid-svg-pkQzjMJt2kumlPE8 .label text,#mermaid-svg-pkQzjMJt2kumlPE8 span{fill:#333;color:#333;}#mermaid-svg-pkQzjMJt2kumlPE8 .node rect,#mermaid-svg-pkQzjMJt2kumlPE8 .node circle,#mermaid-svg-pkQzjMJt2kumlPE8 .node ellipse,#mermaid-svg-pkQzjMJt2kumlPE8 .node polygon,#mermaid-svg-pkQzjMJt2kumlPE8 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-pkQzjMJt2kumlPE8 .rough-node .label text,#mermaid-svg-pkQzjMJt2kumlPE8 .node .label text,#mermaid-svg-pkQzjMJt2kumlPE8 .image-shape .label,#mermaid-svg-pkQzjMJt2kumlPE8 .icon-shape .label{text-anchor:middle;}#mermaid-svg-pkQzjMJt2kumlPE8 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-pkQzjMJt2kumlPE8 .rough-node .label,#mermaid-svg-pkQzjMJt2kumlPE8 .node .label,#mermaid-svg-pkQzjMJt2kumlPE8 .image-shape .label,#mermaid-svg-pkQzjMJt2kumlPE8 .icon-shape .label{text-align:center;}#mermaid-svg-pkQzjMJt2kumlPE8 .node.clickable{cursor:pointer;}#mermaid-svg-pkQzjMJt2kumlPE8 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-pkQzjMJt2kumlPE8 .arrowheadPath{fill:#333333;}#mermaid-svg-pkQzjMJt2kumlPE8 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-pkQzjMJt2kumlPE8 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-pkQzjMJt2kumlPE8 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-pkQzjMJt2kumlPE8 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-pkQzjMJt2kumlPE8 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-pkQzjMJt2kumlPE8 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-pkQzjMJt2kumlPE8 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-pkQzjMJt2kumlPE8 .cluster text{fill:#333;}#mermaid-svg-pkQzjMJt2kumlPE8 .cluster span{color:#333;}#mermaid-svg-pkQzjMJt2kumlPE8 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-pkQzjMJt2kumlPE8 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-pkQzjMJt2kumlPE8 rect.text{fill:none;stroke-width:0;}#mermaid-svg-pkQzjMJt2kumlPE8 .icon-shape,#mermaid-svg-pkQzjMJt2kumlPE8 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-pkQzjMJt2kumlPE8 .icon-shape p,#mermaid-svg-pkQzjMJt2kumlPE8 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-pkQzjMJt2kumlPE8 .icon-shape .label rect,#mermaid-svg-pkQzjMJt2kumlPE8 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-pkQzjMJt2kumlPE8 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-pkQzjMJt2kumlPE8 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-pkQzjMJt2kumlPE8 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} Agent
目标解析
规划
工具权限校验
副作用执行
状态持久化
循环检测
收敛/人工兜底
全链路审计
LLM应用
输入校验
Prompt
输出过滤
- LLM 应用 的治理重点在输入输出两端(内容安全、幻觉);
- Agent 的治理重点在中间的执行链路(工具越权、副作用不可逆、死循环、成本失控、状态污染)。
所以"这是不是 Agent"的问题,本质是"你要为哪些失败模式负责"的问题。把它当 LLM 应用治理,会漏掉执行层的风险;把它当 Agent 治理,才知道为什么要建权限隔离、循环检测、断点续跑、人工兜底这些机制。
七、总结:一张图看懂差异
#mermaid-svg-1Pf32Do7oZy7W45W{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-1Pf32Do7oZy7W45W .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-1Pf32Do7oZy7W45W .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-1Pf32Do7oZy7W45W .error-icon{fill:#552222;}#mermaid-svg-1Pf32Do7oZy7W45W .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-1Pf32Do7oZy7W45W .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-1Pf32Do7oZy7W45W .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-1Pf32Do7oZy7W45W .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-1Pf32Do7oZy7W45W .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-1Pf32Do7oZy7W45W .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-1Pf32Do7oZy7W45W .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-1Pf32Do7oZy7W45W .marker{fill:#333333;stroke:#333333;}#mermaid-svg-1Pf32Do7oZy7W45W .marker.cross{stroke:#333333;}#mermaid-svg-1Pf32Do7oZy7W45W svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-1Pf32Do7oZy7W45W p{margin:0;}#mermaid-svg-1Pf32Do7oZy7W45W .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-1Pf32Do7oZy7W45W .cluster-label text{fill:#333;}#mermaid-svg-1Pf32Do7oZy7W45W .cluster-label span{color:#333;}#mermaid-svg-1Pf32Do7oZy7W45W .cluster-label span p{background-color:transparent;}#mermaid-svg-1Pf32Do7oZy7W45W .label text,#mermaid-svg-1Pf32Do7oZy7W45W span{fill:#333;color:#333;}#mermaid-svg-1Pf32Do7oZy7W45W .node rect,#mermaid-svg-1Pf32Do7oZy7W45W .node circle,#mermaid-svg-1Pf32Do7oZy7W45W .node ellipse,#mermaid-svg-1Pf32Do7oZy7W45W .node polygon,#mermaid-svg-1Pf32Do7oZy7W45W .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-1Pf32Do7oZy7W45W .rough-node .label text,#mermaid-svg-1Pf32Do7oZy7W45W .node .label text,#mermaid-svg-1Pf32Do7oZy7W45W .image-shape .label,#mermaid-svg-1Pf32Do7oZy7W45W .icon-shape .label{text-anchor:middle;}#mermaid-svg-1Pf32Do7oZy7W45W .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-1Pf32Do7oZy7W45W .rough-node .label,#mermaid-svg-1Pf32Do7oZy7W45W .node .label,#mermaid-svg-1Pf32Do7oZy7W45W .image-shape .label,#mermaid-svg-1Pf32Do7oZy7W45W .icon-shape .label{text-align:center;}#mermaid-svg-1Pf32Do7oZy7W45W .node.clickable{cursor:pointer;}#mermaid-svg-1Pf32Do7oZy7W45W .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-1Pf32Do7oZy7W45W .arrowheadPath{fill:#333333;}#mermaid-svg-1Pf32Do7oZy7W45W .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-1Pf32Do7oZy7W45W .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-1Pf32Do7oZy7W45W .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-1Pf32Do7oZy7W45W .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-1Pf32Do7oZy7W45W .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-1Pf32Do7oZy7W45W .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-1Pf32Do7oZy7W45W .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-1Pf32Do7oZy7W45W .cluster text{fill:#333;}#mermaid-svg-1Pf32Do7oZy7W45W .cluster span{color:#333;}#mermaid-svg-1Pf32Do7oZy7W45W div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-1Pf32Do7oZy7W45W .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-1Pf32Do7oZy7W45W rect.text{fill:none;stroke-width:0;}#mermaid-svg-1Pf32Do7oZy7W45W .icon-shape,#mermaid-svg-1Pf32Do7oZy7W45W .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-1Pf32Do7oZy7W45W .icon-shape p,#mermaid-svg-1Pf32Do7oZy7W45W .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-1Pf32Do7oZy7W45W .icon-shape .label rect,#mermaid-svg-1Pf32Do7oZy7W45W .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-1Pf32Do7oZy7W45W .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-1Pf32Do7oZy7W45W .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-1Pf32Do7oZy7W45W :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 能力边界
AI Agent:闭环
否
是
目标
规划
执行工具
观察反馈
状态更新
收敛?
终止/交付
普通 LLM 应用:开环
输入
一次推理
输出
一句话收尾 :普通 LLM 应用回答"是什么",Agent 负责"把它做成"------前者是生成系统 ,后者是执行系统;前者治理在两端,后者治理在全程。理解这条主线,才谈得上设计 Agent 的规划、工具、记忆、循环与安全。
可能的追问预判(供面试准备):
- "那 ReAct 算不算 Agent?"------算,它是 Agent 最基础的闭环实现,但要注意它与 Plan-and-Execute 在规划时机上的差异。
- "一个 Agent 至少要几个工具才算 Agent?"------与数量无关,与"模型是否根据工具反馈动态决策路径"有关,单工具闭环也可以是 Agent。
- "Agent 一定比 LLM 应用好吗?"------不是。确定性任务用 Workflow 更可靠更便宜;Agent 的价值只在"路径不可预知、需要动态决策"的任务上成立。