📝 docs(tsl): tidy AGENT_PRIMER loop section — drop Agent prefix, remove duplicate loop diagram
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+3
-36
@@ -94,7 +94,7 @@ Prompt 是一次模型调用所接收的输入,可能包括:
|
||||
|
||||
一次性的 Prompt 通常是:用户输入任务,模型给出回答,然后结束。如果任务需要读取文件、修改代码、运行测试并根据报错继续修复,仅靠一次回答往往不够,这时就需要 Loop。
|
||||
|
||||
### 一次性 Prompt 与 Agent Loop 有什么不同?
|
||||
### 一次性 Prompt 与 Loop 有什么不同?
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
@@ -103,7 +103,7 @@ flowchart LR
|
||||
P1[输入任务] --> P2[模型回答] --> P3([结束])
|
||||
end
|
||||
|
||||
subgraph LOOP[Agent Loop]
|
||||
subgraph LOOP[Loop]
|
||||
direction TB
|
||||
L1[设定目标] --> L2[观察当前状态]
|
||||
L2 --> L3[决定下一步]
|
||||
@@ -127,40 +127,7 @@ flowchart LR
|
||||
|
||||
Loop 可以由用户手动推进,例如模型回答后,用户再说一句“继续”。在真正的 Agent 系统中,Loop 通常由外部程序管理:程序反复调用模型、执行工具并更新状态,直到任务完成、需要用户确认、发生错误或达到执行上限。
|
||||
|
||||
### Agent Loop 如何工作?
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A([用户给出目标]) --> B[读取当前状态]
|
||||
B --> C[组装本轮 Prompt]
|
||||
C --> D[调用模型]
|
||||
D --> E{下一步是什么}
|
||||
E -->|调用工具| F[执行工具]
|
||||
F --> G[获得观察结果]
|
||||
G --> H[更新状态与上下文]
|
||||
H --> I{目标是否完成}
|
||||
I -->|尚未完成| C
|
||||
I -->|已经完成| J[验证结果]
|
||||
E -->|可以直接完成| J
|
||||
E -->|需要授权| K[请求用户确认]
|
||||
K --> H
|
||||
J -->|未通过| H
|
||||
J -->|通过| L([输出结果并结束])
|
||||
|
||||
classDef start fill:#e8f3f8,stroke:#2b7489,color:#173b48,stroke-width:2px;
|
||||
classDef prompt fill:#eaf2fd,stroke:#3178c6,color:#173f73,stroke-width:2px;
|
||||
classDef model fill:#f0eafd,stroke:#8250df,color:#3f2675,stroke-width:2px;
|
||||
classDef action fill:#fff4dc,stroke:#c88719,color:#5b3a00,stroke-width:2px;
|
||||
classDef state fill:#f8eee7,stroke:#c96832,color:#6e2f10,stroke-width:2px;
|
||||
classDef done fill:#e8f6ec,stroke:#2ea043,color:#175c2d,stroke-width:2px;
|
||||
|
||||
class A start;
|
||||
class B,C prompt;
|
||||
class D,E model;
|
||||
class F,K action;
|
||||
class G,H,I,J state;
|
||||
class L done;
|
||||
```
|
||||
### Loop 如何工作?
|
||||
|
||||
这里最容易误解的一点是:**Prompt 和 Loop 不是二选一,Prompt 就在 Loop 里面。**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user