欢迎光临
我们一直在努力

Agent Loop 工程笔记

在这里插入图片描述

1. 为什么需要 loop

单次 LLM 调用是个函数:输入、输出,结束。可一旦需要外部信息、多步依赖或试错,一次调用远远不够——模型看不到你的数据库,也算不出实时价格。

Agent loop 做的事,就是把这个函数放进一个循环里:想一步、做一步、看结果、再想下一步,直到任务真正完成。

拿一个\”不会自己动手、但会打电话的助理\”类比:

#mermaid-svg-6plHYo4Xryphuu4o{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-6plHYo4Xryphuu4o .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-6plHYo4Xryphuu4o .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-6plHYo4Xryphuu4o .error-icon{fill:#552222;}#mermaid-svg-6plHYo4Xryphuu4o .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-6plHYo4Xryphuu4o .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-6plHYo4Xryphuu4o .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-6plHYo4Xryphuu4o .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-6plHYo4Xryphuu4o .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-6plHYo4Xryphuu4o .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-6plHYo4Xryphuu4o .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-6plHYo4Xryphuu4o .marker{fill:#333333;stroke:#333333;}#mermaid-svg-6plHYo4Xryphuu4o .marker.cross{stroke:#333333;}#mermaid-svg-6plHYo4Xryphuu4o svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-6plHYo4Xryphuu4o p{margin:0;}#mermaid-svg-6plHYo4Xryphuu4o .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#mermaid-svg-6plHYo4Xryphuu4o .cluster-label text{fill:#333;}#mermaid-svg-6plHYo4Xryphuu4o .cluster-label span{color:#333;}#mermaid-svg-6plHYo4Xryphuu4o .cluster-label span p{background-color:transparent;}#mermaid-svg-6plHYo4Xryphuu4o .label text,#mermaid-svg-6plHYo4Xryphuu4o span{fill:#333;color:#333;}#mermaid-svg-6plHYo4Xryphuu4o .node rect,#mermaid-svg-6plHYo4Xryphuu4o .node circle,#mermaid-svg-6plHYo4Xryphuu4o .node ellipse,#mermaid-svg-6plHYo4Xryphuu4o .node polygon,#mermaid-svg-6plHYo4Xryphuu4o .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-6plHYo4Xryphuu4o .rough-node .label text,#mermaid-svg-6plHYo4Xryphuu4o .node .label text,#mermaid-svg-6plHYo4Xryphuu4o .image-shape .label,#mermaid-svg-6plHYo4Xryphuu4o .icon-shape .label{text-anchor:middle;}#mermaid-svg-6plHYo4Xryphuu4o .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-6plHYo4Xryphuu4o .rough-node .label,#mermaid-svg-6plHYo4Xryphuu4o .node .label,#mermaid-svg-6plHYo4Xryphuu4o .image-shape .label,#mermaid-svg-6plHYo4Xryphuu4o .icon-shape .label{text-align:center;}#mermaid-svg-6plHYo4Xryphuu4o .node.clickable{cursor:pointer;}#mermaid-svg-6plHYo4Xryphuu4o .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-6plHYo4Xryphuu4o .arrowheadPath{fill:#333333;}#mermaid-svg-6plHYo4Xryphuu4o .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-6plHYo4Xryphuu4o .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-6plHYo4Xryphuu4o .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-6plHYo4Xryphuu4o .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-6plHYo4Xryphuu4o .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-6plHYo4Xryphuu4o .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-6plHYo4Xryphuu4o .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-6plHYo4Xryphuu4o .cluster text{fill:#333;}#mermaid-svg-6plHYo4Xryphuu4o .cluster span{color:#333;}#mermaid-svg-6plHYo4Xryphuu4o 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-6plHYo4Xryphuu4o .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-6plHYo4Xryphuu4o rect.text{fill:none;stroke-width:0;}#mermaid-svg-6plHYo4Xryphuu4o .icon-shape,#mermaid-svg-6plHYo4Xryphuu4o .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-6plHYo4Xryphuu4o .icon-shape p,#mermaid-svg-6plHYo4Xryphuu4o .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-6plHYo4Xryphuu4o .icon-shape .label rect,#mermaid-svg-6plHYo4Xryphuu4o .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-6plHYo4Xryphuu4o .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-6plHYo4Xryphuu4o .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-6plHYo4Xryphuu4o :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}

不够:不知道价格,得去查

够了

赞(0)
未经允许不得转载:171主机测评 » Agent Loop 工程笔记
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址