{"id":29922,"date":"2026-07-28T07:56:48","date_gmt":"2026-07-27T23:56:48","guid":{"rendered":"https:\/\/aif.amtbbs.org\/?p=29922"},"modified":"2026-07-28T07:56:48","modified_gmt":"2026-07-27T23:56:48","slug":"2026-%e5%b9%b4-ai-agent-%e5%ae%9e%e7%94%a8%e6%8c%87%e5%8d%97%ef%bc%9a%e5%88%ab%e5%86%8d%e6%8a%8a-rag-%e5%92%8c-workflow-%e5%8f%ab%e6%88%90-agent","status":"publish","type":"post","link":"https:\/\/aif.amtbbs.org\/index.php\/2026\/07\/28\/29922\/","title":{"rendered":"2026 \u5e74 AI Agent \u5b9e\u7528\u6307\u5357\uff1a\u522b\u518d\u628a RAG \u548c Workflow \u53eb\u6210 Agent"},"content":{"rendered":"<div class=\"article-desc\">\u628a agent \u5f53\u4f5c\u4e00\u4e2a\u5f88\u9177\u7684\u8425\u9500\u672f\u8bed\uff0c\u800c\u4e0d\u662f\u4e00\u4efd\u4e25\u8c28\u7684\u5de5\u7a0b\u89c4\u683c\uff0c\u662f\u4e00\u4e2a\u771f\u5b9e\u5b58\u5728\u7684\u95ee\u9898\u3002\u5b83\u63a9\u76d6\u4e86\u6211\u4eec\u8bd5\u56fe\u6784\u5efa\u7684\u4e1c\u897f\u6240\u5305\u542b\u7684\u590d\u6742\u6027\u3002\u5982\u679c\u4f60\u65e0\u6cd5\u6e05\u695a\u5730\u6846\u5b9a\u4ec0\u4e48\u662f agent\uff0c\u4f60\u5c31\u65e0\u6cd5\u53ef\u9760\u5730\u6784\u5efa\u5b83\uff1b\u5f53\u5b83\u51fa\u95ee\u9898\u65f6\uff0c\u4f60\u4e5f\u65e0\u6cd5\u8c03\u8bd5\u5b83\uff1b\u66f4\u4e0d\u7528\u8bf4\u628a\u5b83\u4ea4\u4ed8\u7ed9\u7528\u6237\u65f6\u8fd8\u80fd\u4e0d\u9884\u671f\u5404\u79cd\u95ee\u9898\u4f1a\u53d1\u751f\u3002<\/div>\n<div id=\"postspictures\" class=\"article-content\">\n<div id=\"container\" class=\"container am-engine\" data-v-01a18e2f=\"\" data-element=\"root\">\n<p><strong>agent\u00a0\u8fd9\u4e2a\u8bcd\u73b0\u5728\u65e0\u5904\u4e0d\u5728\u3002\u5b83\u51fa\u73b0\u5728\u7f51\u7ad9\u3001Notion \u6587\u6863\u3001PRD\uff0c\u4ee5\u53ca\u5404\u79cd\u4f1a\u8bae\u91cc\uff1b\u90a3\u4e9b\u8fc7\u53bb\u88ab\u79f0\u4e3a\u201c\u5e26\u5de5\u5177\u7684 chatbot\u201d\u7684\u4e1c\u897f\uff0c\u7a81\u7136\u5c31\u53d8\u6210\u4e86 agent\u3002\u800c\u8fd9\u5e76\u4e0d\u53ea\u662f\u63aa\u8f9e\u95ee\u9898\u3002<\/strong><\/p>\n<p>\u628a agent \u5f53\u4f5c\u4e00\u4e2a\u5f88\u9177\u7684\u8425\u9500\u672f\u8bed\uff0c\u800c\u4e0d\u662f\u4e00\u4efd\u4e25\u8c28\u7684\u5de5\u7a0b\u89c4\u683c\uff0c\u662f\u4e00\u4e2a\u771f\u5b9e\u5b58\u5728\u7684\u95ee\u9898\u3002\u5b83\u63a9\u76d6\u4e86\u6211\u4eec\u8bd5\u56fe\u6784\u5efa\u7684\u4e1c\u897f\u6240\u5305\u542b\u7684\u590d\u6742\u6027\u3002\u5982\u679c\u4f60\u65e0\u6cd5\u6e05\u695a\u5730\u6846\u5b9a\u4ec0\u4e48\u662f agent\uff0c\u4f60\u5c31\u65e0\u6cd5\u53ef\u9760\u5730\u6784\u5efa\u5b83\uff1b\u5f53\u5b83\u51fa\u95ee\u9898\u65f6\uff0c\u4f60\u4e5f\u65e0\u6cd5\u8c03\u8bd5\u5b83\uff1b\u66f4\u4e0d\u7528\u8bf4\u628a\u5b83\u4ea4\u4ed8\u7ed9\u7528\u6237\u65f6\u8fd8\u80fd\u4e0d\u9884\u671f\u5404\u79cd\u95ee\u9898\u4f1a\u53d1\u751f\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u6211\u4eec\u6765\u8bd5\u7740\u4fee\u6b63\u8fd9\u4e00\u70b9\u3002\u8fd9\u4e0d\u662f\u53c8\u4e00\u7bc7\u9ad8\u5c4b\u5efa\u74f4\u7684\u601d\u8fa8\u6587\u7ae0\u3002\u5b83\u662f\u4e00\u4efd\u9762\u5411\u5f00\u53d1\u8005\u7684\u5b9e\u7528\u6307\u5357\uff0c\u5199\u7ed9\u90a3\u4e9b\u5df2\u7ecf\u538c\u5026 buzzword\u3001\u60f3\u77e5\u9053 AI agent \u5230\u5e95\u662f\u4ec0\u4e48\u3001\u4ec0\u4e48\u65f6\u5019\u8be5\u6784\u5efa\u4e00\u4e2a\uff0c\u4ee5\u53ca\u66f4\u91cd\u8981\u7684\u662f\uff0c\u4ec0\u4e48\u65f6\u5019\u4e0d\u8be5\u6784\u5efa\u7684\u4eba\u3002<\/p>\n<h3>Agent vs. RAG vs. Workflow<\/h3>\n<p>\u5728\u5b9a\u4e49 agent\u00a0\u662f\u4ec0\u4e48\u00a0\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5148\u660e\u786e\u5b83\u00a0\u4e0d\u662f\u4ec0\u4e48\u3002\u4eca\u5929\u5927\u591a\u6570\u88ab\u79f0\u4e3a agent \u7684\u7cfb\u7edf\uff0c\u5b9e\u9645\u4e0a\u5c5e\u4e8e\u53e6\u5916\u4e24\u4e2a\u7c7b\u522b\uff1aRAG \u5e94\u7528\u548c workflow\u3002<\/p>\n<ul data-id=\"u738a58b-gVKIjK3R\">\n<li data-id=\"ld70c578-eebIbMFH\"><strong>RAG (Retrieval-Augmented Generation)<\/strong>\u00a0\u672c\u8d28\u4e0a\u662f\u667a\u80fd\u641c\u7d22\u3002\u4f60\u6709\u4e00\u4e2a\u95ee\u9898\uff0c\u7cfb\u7edf\u4ece\u77e5\u8bc6\u5e93\u4e2d\u68c0\u7d22\u76f8\u5173\u6587\u6863\uff0c\u7136\u540e LLM \u4f7f\u7528\u8fd9\u4e9b\u6587\u6863\u751f\u6210\u7b54\u6848\u3002\u8fd9\u662f\u4e00\u4e2a\u77e5\u8bc6\u8bbf\u95ee\u95ee\u9898\u3002\u6574\u4e2a\u8fc7\u7a0b\u662f\u65e0\u72b6\u6001\u7684\uff0c\u901a\u5e38\u5728\u5355\u8f6e\u4ea4\u4e92\u4e2d\u5b8c\u6210\u3002<\/li>\n<li data-id=\"ld70c578-SEkO52U7\"><strong><span class=\"\">Workflow<\/span><\/strong>\u00a0\u662f\u4e00\u7cfb\u5217\u786e\u5b9a\u6027\u7684\u6b65\u9aa4\u3002\u4f8b\u5982\uff1a\u4e00\u4e2a Zapier \u96c6\u6210\uff0c\u6216\u4e00\u4e2a\u4f01\u4e1a\u5165\u804c\u6d41\u7a0b\u811a\u672c\u3002\u5982\u679c X \u53d1\u751f\uff0c\u90a3\u4e48\u6267\u884c Y\uff0c\u518d\u6267\u884c Z\u3002\u5b83\u53ef\u80fd\u6709\u5206\u652f\u548c\u903b\u8f91\uff0c\u4f46\u8def\u5f84\u662f\u53ef\u9884\u6d4b\u7684\u3002\u8fd9\u662f\u4e00\u4e2a\u6d41\u7a0b\u95ee\u9898\uff0c\u4e3b\u8981\u6311\u6218\u5728\u4e8e\u786e\u4fdd\u8fd9\u4e9b\u6b65\u9aa4\u662f\u6301\u4e45\u7684\uff0c\u5e76\u4e14\u5728\u5931\u8d25\u65f6\u53ef\u4ee5\u91cd\u8bd5\u3002<\/li>\n<\/ul>\n<p>\u800c Agent \u5219\u8bd5\u56fe\u89e3\u51b3\u4e00\u4e2a\u63a7\u5236\u95ee\u9898\u3002\u5b83\u6709\u4e00\u4e2a\u76ee\u6807\u548c\u4e00\u7ec4\u5de5\u5177\uff0c\u5e76\u4e14\u5fc5\u987b\u81ea\u5df1\u627e\u51fa\u8def\u5f84\u3002\u5b83\u662f\u4e00\u4e2a\u5faa\u73af\uff0c\u800c\u4e0d\u662f\u4e00\u6761\u76f4\u7ebf\u3002\u5b83\u4f1a\u6839\u636e\u5f53\u524d\u60c5\u51b5\u51b3\u5b9a\u4e0b\u4e00\u6b65\u505a\u4ec0\u4e48\u3002\u8fd9\u5c31\u662f\u6839\u672c\u533a\u522b\u3002<\/p>\n<p>\u6700\u5c0f\u53ef\u884c\u7684 agent \u5faa\u73af\u5927\u81f4\u5982\u4e0b\uff1a<code>Event -&gt; Policy(LLM) -&gt; Action(tool) -&gt; State(write) -&gt; Guardrails -&gt; Stop<\/code><\/p>\n<p>\u5b83\u63a5\u6536\u8f93\u5165\uff0cLLM \u505a\u51fa\u51b3\u7b56\uff0c\u53ef\u80fd\u8c03\u7528\u4e00\u4e2a\u5de5\u5177\uff0c\u66f4\u65b0\u81ea\u5df1\u5bf9\u521a\u624d\u53d1\u751f\u4e86\u4ec0\u4e48\u7684\u5185\u90e8\u8bb0\u5fc6\uff0c\u7136\u540e\u51b3\u5b9a\u662f\u5426\u5df2\u7ecf\u5b8c\u6210\uff0c\u6216\u8005\u662f\u5426\u9700\u8981\u518d\u6b21\u5faa\u73af\u3002<\/p>\n<p><img data-dominant-color=\"efeee9\" data-has-transparency=\"true\" style=\"--dominant-color: #efeee9;\" loading=\"lazy\" decoding=\"async\" class=\"has-transparency alignnone size-full wp-image-29923\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/2592afd3302a20b645e824a3e445f72d34cba6.png\" width=\"1080\" height=\"806\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" srcset=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/2592afd3302a20b645e824a3e445f72d34cba6.png 1080w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/2592afd3302a20b645e824a3e445f72d34cba6-300x224.png 300w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/2592afd3302a20b645e824a3e445f72d34cba6-1024x764.png 1024w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/2592afd3302a20b645e824a3e445f72d34cba6-150x112.png 150w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/2592afd3302a20b645e824a3e445f72d34cba6-768x573.png 768w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/2592afd3302a20b645e824a3e445f72d34cba6-681x508.png 681w\" sizes=\"auto, 100vw\" \/><span class=\"data-image-title\">\u56fe\u7247<\/span><\/p>\n<h3>AI Agent \u7684\u5b9e\u7528\u5b9a\u4e49<\/h3>\n<p>\u5982\u679c\u6211\u4eec\u8981\u6784\u5efa\u8fd9\u4e9b\u4e1c\u897f\uff0c\u5c31\u9700\u8981\u4e00\u4e2a\u771f\u6b63\u53ef\u4ee5\u7528\u6765\u68c0\u9a8c\u4ee3\u7801\u7684\u5b9a\u4e49\u3002\u5bf9\u6211\u6765\u8bf4\uff0c\u4e00\u4e2a\u7cfb\u7edf\u53ea\u6709\u5728\u6ee1\u8db3\u56db\u4e2a\u5177\u4f53\u6807\u51c6\u65f6\uff0c\u624d\u6709\u8d44\u683c\u88ab\u79f0\u4e3a\u201cAI agent\u201d\u3002\u5982\u679c\u4f60\u6b63\u5728\u6784\u5efa\u67d0\u4e2a\u4e1c\u897f\uff0c\u5374\u65e0\u6cd5\u52fe\u9009\u8fd9\u56db\u9879\uff0c\u4f60\u62e5\u6709\u7684\u5f88\u53ef\u80fd\u662f\u4e00\u4e2a\u5de5\u5177\u589e\u5f3a\u578b\u804a\u5929\u5e94\u7528\uff0c\u800c\u4e0d\u662f agent\u3002\u8fd9\u5b8c\u5168\u6ca1\u95ee\u9898\uff0c\u4f46\u7528\u6b63\u786e\u7684\u540d\u79f0\u79f0\u547c\u5b83\uff0c\u6709\u52a9\u4e8e\u4f60\u7528\u6b63\u786e\u7684\u65b9\u5f0f\u6784\u5efa\u5b83\u3002<\/p>\n<h4>1. \u5b83\u7ef4\u62a4\u8d85\u51fa\u5355\u4e2a prompt \u7684\u72b6\u6001<\/h4>\n<p>Agent \u9700\u8981\u4e00\u79cd\u4e0d\u53ea\u662f\u804a\u5929\u5386\u53f2\u7684 memory\u3002\u6211\u6307\u7684\u662f\u4e00\u4e2a\u663e\u5f0f\u7684\u3001\u7ed3\u6784\u5316\u7684\u72b6\u6001\u5bf9\u8c61\uff08\u4e00\u4e2a schema\uff09\u3002\u8fd9\u4e2a\u72b6\u6001\u5e94\u8be5\u8ddf\u8e2a\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<ul data-id=\"u738a58b-ZM6Id1EM\">\n<li data-id=\"ld70c578-oMRYdUYd\">\u603b\u4f53\u76ee\u6807\u3002<\/li>\n<li data-id=\"ld70c578-SWgPfLOj\">\u4e0a\u4e00\u6b21\u88ab\u8c03\u7528\u5de5\u5177\u7684\u8f93\u51fa\u3002<\/li>\n<li data-id=\"ld70c578-VkINbgJc\">\u7528\u4e8e agent \u5185\u90e8\u601d\u8003\u548c\u8ba1\u5212\u7684 scratchpad\u3002<\/li>\n<li data-id=\"ld70c578-fOHnFKRm\">\u5b83\u5df2\u7ecf\u6536\u96c6\u5230\u7684\u4efb\u4f55\u4e2d\u95f4\u7ed3\u679c\u6216\u6570\u636e\u3002<\/li>\n<\/ul>\n<p>\u4ec5\u4ec5\u628a\u4e4b\u524d\u7684\u6d88\u606f\u4f20\u56de\u7ed9 LLM \u662f\u4e0d\u591f\u7684\u3002\u90a3\u662f\u5bf9\u8bdd\uff0c\u800c\u4e0d\u662f\u6709\u72b6\u6001\u7684\u6267\u884c\u3002\u72b6\u6001\u8ba9 agent \u80fd\u591f\u63a8\u7406\u81ea\u5df1\u7684\u8fdb\u5c55\uff0c\u5e76\u5728\u5faa\u73af\u4e2d\u505a\u51fa\u6709\u4f9d\u636e\u7684\u51b3\u7b56\u3002<\/p>\n<h4>2. \u5b83\u57fa\u4e8e\u8be5\u72b6\u6001\u9009\u62e9\u884c\u52a8<\/h4>\n<p>Agent \u4e2d\u7684 LLM \u4e0d\u53ea\u662f\u751f\u6210\u6587\u672c\u3002\u5b83\u5145\u5f53\u7684\u662f policy engine \u6216 router\u3002\u57fa\u4e8e\u8f93\u5165\u548c\u5f53\u524d\u72b6\u6001\uff0c\u5b83\u51b3\u5b9a\u4e0b\u4e00\u6b65\u505a\u4ec0\u4e48\u3002<\/p>\n<p>\u53ef\u80fd\u7684\u884c\u52a8\u901a\u5e38\u5305\u62ec\uff1a<\/p>\n<ul data-id=\"u738a58b-j4Q0k6gA\">\n<li data-id=\"ld70c578-KEYKZiZm\">\u4f7f\u7528\u7279\u5b9a\u53c2\u6570\u8c03\u7528\u67d0\u4e2a\u5177\u4f53\u5de5\u5177\u3002<\/li>\n<li data-id=\"ld70c578-GEeoTk16\">\u5411\u7528\u6237\u8bf7\u6c42\u6f84\u6e05\u3002<\/li>\n<li data-id=\"ld70c578-1H8IfX5h\">\u66f4\u65b0\u5176\u5185\u90e8\u72b6\u6001\u6216\u8ba1\u5212\u3002<\/li>\n<li data-id=\"ld70c578-iF7bSMrL\">\u5224\u5b9a\u4efb\u52a1\u5df2\u5b8c\u6210\u5e76\u505c\u6b62\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u79cd\u51b3\u7b56\u8fc7\u7a0b\u5c31\u662f\u201cagentic\u201d\u7684\u90e8\u5206\u3002\u5b83\u628a agent \u548c\u90a3\u79cd\u4e0b\u4e00\u6b65\u5df2\u7ecf\u5199\u6b7b\u7684\u7b80\u5355 workflow \u533a\u5206\u5f00\u6765\u3002<\/p>\n<h4>3. \u5b83\u5728\u9884\u7b97\u7ea6\u675f\u4e0b\u8fd0\u884c<\/h4>\n<p>\u4e00\u4e2a\u5b8c\u5168\u653e\u4efb\u81ea\u6d41\u7684 agent \u53ef\u80fd\u4f1a\u6c38\u8fdc\u8fd0\u884c\u4e0b\u53bb\u3002\u6211\u89c1\u8fc7\u4e00\u4e2a\u5de5\u5177\u5faa\u73af\u56e0\u4e3a\u6ca1\u6709\u00a0<code>max_steps<\/code>\u00a0\u800c\u8fd0\u884c\u4e86\u6570\u767e\u6b65\u3002\u8fd9\u5c31\u662f\u4f60\u4e00\u89c9\u9192\u6765\u6536\u5230\u610f\u5916\u8d26\u5355\u7684\u539f\u56e0\u3002\u6ca1\u6709\u9884\u7b97\u7684 agent \u662f\u751f\u4ea7\u73af\u5883\u4e2d\u7684\u98ce\u9669\u70b9\u3002<\/p>\n<p>\u6bcf\u4e2a agent \u90fd\u9700\u8981\u660e\u786e\u5b9a\u4e49\u7684\u9884\u7b97\uff1a<\/p>\n<ul data-id=\"u738a58b-14aHklGm\">\n<li data-id=\"ld70c578-HE9pSp1c\"><strong>Max steps<\/strong>\uff1a\u5faa\u73af\u53ef\u8fd0\u884c\u6b21\u6570\u7684\u786c\u6027\u4e0a\u9650\uff08\u4f8b\u5982 10 \u6b65\uff09\u3002\u8fd9\u662f\u4f60\u5bf9\u6297\u65e0\u9650\u5faa\u73af\u7684\u4e3b\u8981\u9632\u7ebf\u3002<\/li>\n<li data-id=\"ld70c578-0b7QabIV\"><strong>Timeouts<\/strong>\uff1a\u4e3a\u6574\u4e2a\u8fd0\u884c\u8fc7\u7a0b\u9884\u5148\u5b9a\u4e49\u7684\u8d85\u65f6\u3002<\/li>\n<li data-id=\"ld70c578-WBg2DDfG\"><strong>Cost:<\/strong>\u00a0\u91d1\u989d\u4e0a\u9650\u3002\u8fd9\u4e2a\u66f4\u96be\u5b9e\u73b0\uff0c\u4f46\u5982\u679c\u4f60\u4f7f\u7528\u6602\u8d35\u7684\u6a21\u578b\u6216 API\uff0c\u5b83\u81f3\u5173\u91cd\u8981\u3002<\/li>\n<li data-id=\"ld70c578-K6Tdp5UB\"><strong>Retries<\/strong>\uff1a\u67d0\u4e2a\u5177\u4f53\u5de5\u5177\u5931\u8d25\u65f6\u53ef\u91cd\u8bd5\u6b21\u6570\u7684\u4e0a\u9650\u3002<\/li>\n<\/ul>\n<p>\u6ca1\u6709\u8fd9\u4e9b\uff0c\u4f60\u5c31\u65e0\u6cd5\u4fdd\u8bc1 agent \u6700\u7ec8\u4f1a\u7ed3\u675f\uff0c\u4e5f\u65e0\u6cd5\u9884\u6d4b\u5b83\u4f1a\u82b1\u8d39\u591a\u5c11\u6210\u672c\u3002<\/p>\n<h4>4. \u5b83\u80fd\u591f\u5b89\u5168\u6062\u590d\u6216\u964d\u7ea7<\/h4>\n<p>\u5982\u679c\u4f60\u7684\u670d\u52a1\u5668\u5d29\u6e83\uff0c\u6216\u8005 pod \u5728 agent \u8fd0\u884c\u5230\u4e00\u534a\u65f6\u91cd\u542f\uff0c\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f\u5982\u679c\u7b54\u6848\u662f\u201c\u4e00\u5207\u90fd\u4e22\u5931\u4e86\u201d\uff0c\u90a3\u5b83\u5c31\u4e0d\u662f\u4e00\u4e2a\u751f\u4ea7\u5c31\u7eea\u7684 agent\u3002<\/p>\n<p>\u8fd9\u610f\u5473\u7740\u4f60\u9700\u8981\u4e24\u6837\u4e1c\u897f\uff1a<\/p>\n<ul data-id=\"u738a58b-LCMV7RUe\">\n<li data-id=\"ld70c578-3ItA6QlD\"><strong>Idempotency:<\/strong>\u00a0\u4f7f\u7528\u76f8\u540c\u8f93\u5165\u591a\u6b21\u8c03\u7528\u5de5\u5177\uff0c\u5e94\u8be5\u4ea7\u751f\u76f8\u540c\u7ed3\u679c\u3002\u5982\u679c agent \u91cd\u8bd5\u53d1\u9001\u90ae\u4ef6\uff0c\u5b83\u4e0d\u5e94\u8be5\u628a\u540c\u4e00\u5c01\u90ae\u4ef6\u53d1\u9001\u4e24\u6b21\u3002<\/li>\n<li data-id=\"ld70c578-7zjAVRl2\"><strong>Durable Checkpoints:<\/strong>\u00a0\u5728\u6bcf\u4e00\u6b65\u4e4b\u540e\uff08\u6216\u8005\u81f3\u5c11\u5728\u6bcf\u6b21\u6210\u529f\u7684\u5de5\u5177\u8c03\u7528\u4e4b\u540e\uff09\uff0c\u5fc5\u987b\u628a agent \u7684\u72b6\u6001\u4fdd\u5b58\u5230\u4e00\u4e2a\u6301\u4e45\u5316\u5b58\u50a8\u4e2d\uff0c\u4f8b\u5982\u6570\u636e\u5e93\uff08Postgres\u3001Redis \u7b49\uff09\u3002\u8fd9\u5141\u8bb8\u4e00\u6b21\u8fd0\u884c\u4ece\u5b83\u4e2d\u65ad\u7684\u786e\u5207\u4f4d\u7f6e\u7ee7\u7eed\u3002<\/li>\n<\/ul>\n<p>\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u65e0\u6cd5\u627f\u53d7\u4e00\u6b21\u968f\u673a\u91cd\u542f\uff0c\u5b83\u5c31\u662f\u539f\u578b\uff0c\u800c\u4e0d\u662f\u53ef\u9760\u7684 agent\u3002<\/p>\n<p><img data-dominant-color=\"ecece8\" data-has-transparency=\"true\" style=\"--dominant-color: #ecece8;\" loading=\"lazy\" decoding=\"async\" class=\"has-transparency alignnone size-full wp-image-29925\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/03addf434e52f0fa1c0207e4cd735373704d71.png\" width=\"1080\" height=\"806\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" srcset=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/03addf434e52f0fa1c0207e4cd735373704d71.png 1080w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/03addf434e52f0fa1c0207e4cd735373704d71-300x224.png 300w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/03addf434e52f0fa1c0207e4cd735373704d71-1024x764.png 1024w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/03addf434e52f0fa1c0207e4cd735373704d71-150x112.png 150w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/03addf434e52f0fa1c0207e4cd735373704d71-768x573.png 768w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/03addf434e52f0fa1c0207e4cd735373704d71-681x508.png 681w\" sizes=\"auto, 100vw\" \/><span class=\"data-image-title\">\u56fe\u7247<\/span><\/p>\n<h3>\u4ece\u7cdf\u7cd5\u5230\u66f4\u597d\uff1a\u4e00\u4e2a\u4ee3\u7801\u793a\u4f8b<\/h3>\n<p>\u8ba9\u6211\u4eec\u628a\u8fd9\u4ef6\u4e8b\u8bb2\u5f97\u66f4\u5177\u4f53\u4e00\u4e9b\u3002\u4e0b\u9762\u662f\u5f88\u591a\u4eba\u4e00\u5f00\u59cb\u4f1a\u6784\u5efa\u7684\u201cbad agent\u201d\u3002\u5b83\u5b9e\u9645\u4e0a\u53ea\u662f\u4e00\u4e2a\u4f2a\u88c5\u6210\u66f4\u9ad8\u7ea7\u7cfb\u7edf\u7684\u5de5\u5177\u589e\u5f3a\u578b chatbot\u3002<\/p>\n<h5>\u201cBad agent\u201d\u2014\u2014\u4e0d\u8981\u8fd9\u6837\u505a<\/h5>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_0\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\"># This is NOT a good way to build an agent.\r\n# It's a tool-augmented chatbot pretending to be one.\r\n\r\nimport openai\r\nimport json\r\n\r\ndef bad_travel_agent(prompt: str):\r\n    \"\"\"A 'travel agent' that's really just a single LLM call with a tool.\"\"\"\r\n    print(f\"USER: {prompt}\")\r\n\r\n    response = openai.chat.completions.create(\r\n        model=\"gpt-4o\",\r\n        messages=[{\"role\": \"user\", \"content\": prompt}],\r\n        tools=[{\r\n            \"type\": \"function\",\r\n            \"function\": {\r\n                \"name\": \"search_flights\",\r\n                \"description\": \"Search for flights between two cities\",\r\n                \"parameters\": {\r\n                    \"type\": \"object\",\r\n                    \"properties\": {\r\n                        \"origin\": {\"type\": \"string\"},\r\n                        \"destination\": {\"type\": \"string\"},\r\n                        \"date\": {\"type\": \"string\"},\r\n                    },\r\n                    \"required\": [\"origin\", \"destination\", \"date\"],\r\n                },\r\n            },\r\n        }],\r\n    )\r\n\r\n    msg = response.choices[0].message\r\n\r\n    if msg.tool_calls:\r\n        tc = msg.tool_calls[0]\r\n        args = json.loads(tc.function.arguments)\r\n        # No validation, no error handling, no retries\r\n        result = f\"Found flights from {args['origin']} to {args['destination']}\"\r\n        print(f\"RESULT: {result}\")\r\n    else:\r\n        print(f\"ASSISTANT: {msg.content}\")\r\n\r\n\r\n# --- Why this is broken ---\r\n# 1. No state: It can't plan a multi-step trip. It searches flights,\r\n#    then immediately forgets. It can never book a hotel next.\r\n# 2. No structured output: The LLM returns free text. Good luck\r\n#    parsing \"Found flights...\" into something your UI can render.\r\n# 3. No budget: If the LLM hallucinates a tool loop, you pay forever.\r\n# 4. No validation: What if the LLM sends \"tomorrow\" instead of\r\n#    \"2026-03-15\" for the date? The API call will fail silently.\r\n# 5. No recovery: Crash = all progress lost. No checkpoint, no resume.\r\n# 6. No loop: It can only do ONE thing. A real trip needs flights,\r\n#    hotels, activities, restaurants - all composed together.<\/code><\/pre>\n<ul id=\"code_id_0\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<li>16.<\/li>\n<li>17.<\/li>\n<li>18.<\/li>\n<li>19.<\/li>\n<li>20.<\/li>\n<li>21.<\/li>\n<li>22.<\/li>\n<li>23.<\/li>\n<li>24.<\/li>\n<li>25.<\/li>\n<li>26.<\/li>\n<li>27.<\/li>\n<li>28.<\/li>\n<li>29.<\/li>\n<li>30.<\/li>\n<li>31.<\/li>\n<li>32.<\/li>\n<li>33.<\/li>\n<li>34.<\/li>\n<li>35.<\/li>\n<li>36.<\/li>\n<li>37.<\/li>\n<li>38.<\/li>\n<li>39.<\/li>\n<li>40.<\/li>\n<li>41.<\/li>\n<li>42.<\/li>\n<li>43.<\/li>\n<li>44.<\/li>\n<li>45.<\/li>\n<li>46.<\/li>\n<li>47.<\/li>\n<li>48.<\/li>\n<li>49.<\/li>\n<li>50.<\/li>\n<li>51.<\/li>\n<li>52.<\/li>\n<li>53.<\/li>\n<li>54.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u5bf9\u4e8e\u4efb\u4f55\u771f\u5b9e\u4e16\u754c\u4efb\u52a1\u800c\u8a00\u90fd\u662f\u6839\u672c\u6709\u95ee\u9898\u7684\u3002\u5b83\u53ea\u80fd\u6267\u884c\u4e00\u4e2a\u52a8\u4f5c\uff0c\u7136\u540e\u5c31\u7ed3\u675f\u4e86\u3002\u5b83\u65e0\u6cd5\u89c4\u5212\u591a\u6b65\u9aa4\u65c5\u884c\uff0c\u56e0\u4e3a\u5b83\u6ca1\u6709\u8bb0\u5fc6\u3002\u641c\u7d22\u822a\u73ed\u4e4b\u540e\uff0c\u5b83\u4f1a\u7acb\u523b\u5fd8\u8bb0\u81ea\u5df1\u505a\u8fc7\u4ec0\u4e48\uff0c\u56e0\u6b64\u65e0\u6cd5\u9884\u8ba2\u9152\u5e97\u6216\u5bfb\u627e\u9910\u5385\u3002\u8f93\u51fa\u53ea\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u8fd9\u5bf9 UI \u6beb\u65e0\u7528\u5904\u3002\u800c\u4e14\u5b83\u6ca1\u6709\u6211\u4eec\u8ba8\u8bba\u8fc7\u7684\u4efb\u4f55\u5b89\u5168\u7279\u6027\uff1a\u6ca1\u6709\u9884\u7b97\u3001\u6ca1\u6709\u5bf9\u65e5\u671f\u683c\u5f0f\u7684\u9a8c\u8bc1\uff0c\u4e5f\u6ca1\u6709\u5728\u5d29\u6e83\u65f6\u6062\u590d\u7684\u65b9\u5f0f\u3002<\/p>\n<h4>\u4e00\u4e2a\u6700\u5c0f\u53ef\u884c Agent\u2014\u2014\u5e26 Guardrails \u6784\u5efa<\/h4>\n<p>\u73b0\u5728\uff0c\u6211\u4eec\u6765\u770b\u770b\u5982\u4f55\u6b63\u786e\u5730\u6784\u5efa\u5b83\u3002\u8fd9\u4e2a\u793a\u4f8b\u4f7f\u7528\u4e86\u4e00\u4e2a\u540d\u4e3a\u00a0<code>pydantic-ai<\/code>\u00a0\u7684\u5e93\uff0c\u5b83\u65e8\u5728\u5f3a\u5236\u6267\u884c\u6211\u4eec\u4e00\u76f4\u5728\u8ba8\u8bba\u7684\u89c4\u5219\uff1a\u7ed3\u6784\u5316\u72b6\u6001\u3001\u7ecf\u8fc7\u9a8c\u8bc1\u7684\u5de5\u5177\uff0c\u4ee5\u53ca\u5185\u7f6e\u9884\u7b97\u3002<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_1\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\"># A proper travel itinerary agent with structured state,\r\n# typed outputs, validated tools, and built-in budgets.\r\n#\r\n# pip install pydantic-ai logfire\r\n\r\nimport asyncio\r\nimport httpx\r\nfrom dataclasses import dataclass\r\nfrom datetime import date\r\nfrom dotenv import load_dotenv\r\nimport os\r\nload_dotenv()\r\n\r\nfrom pydantic import BaseModel, Field\r\nfrom pydantic_ai import Agent, RunContext, ModelRetry\r\nfrom pydantic_ai.models.google import GoogleModel\r\nfrom pydantic_ai.providers.google import GoogleProvider\r\n\r\nprovider = GoogleProvider(api_key=os.getenv(\"GEMINI_API_KEY\"))\r\nmodel = GoogleModel(\"gemini-2.5-pro\", provider=provider)\r\n\r\n\r\nimport logfire\r\n\r\n# 1. OBSERVABILITY: Set up tracing from the start\r\n# Every decision, tool call, and token cost is tracked automatically.\r\nlogfire.configure()\r\nlogfire.instrument_pydantic_ai()\r\n\r\n\r\n# 2. STRUCTURED STATE: Define what the agent knows\r\n# This is the agent's \"memory\" - passed via dependency injection,\r\n# not mixed into the prompt.\r\n\r\n@dataclass\r\nclass TripContext:\r\n    origin: str\r\n    destination: str\r\n    start_date: date\r\n    end_date: date\r\n    budget_usd: float\r\n    traveler_notes: str \r\n    http_client: httpx.AsyncClient  # shared client for all tool calls\r\n\r\n\r\n# 3. STRUCTURED OUTPUT: Define exactly what the agent returns\r\n# No more parsing free text. The LLM must return this schema.\r\n# Pydantic AI validates it automatically; if the LLM gets it wrong,\r\n# it retries with the validation error as feedback.\r\n\r\nclass Activity(BaseModel):\r\n    time: str = Field(descriptinotallow=\"e.g., '9:00 AM' or 'Afternoon'\")\r\n    name: str = Field(descriptinotallow=\"Name of the activity or place\")\r\n    description: str = Field(descriptinotallow=\"One-sentence why it's worth it\")\r\n    estimated_cost_usd: float = Field(ge=0)\r\n\r\nclass DayPlan(BaseModel):\r\n    day_number: int = Field(ge=1)\r\n    date: str\r\n    theme: str = Field(descriptinotallow=\"e.g., 'Old City &amp; Street Food'\")\r\n    activities: list[Activity] = Field(min_length=2, max_length=6)\r\n    meals: list[Activity] = Field(min_length=1, max_length=3)\r\n\r\nclass TripItinerary(BaseModel):\r\n    title: str = Field(descriptinotallow=\"A catchy name for the trip\")\r\n    summary: str = Field(descriptinotallow=\"2-3 sentence overview of the trip\")\r\n    days: list[DayPlan] = Field(min_length=1)\r\n    total_estimated_cost_usd: float = Field(ge=0)\r\n    packing_tips: list[str] = Field(min_length=1, max_length=5)\r\n\r\n\r\n# 4. THE AGENT: Configured with guardrails baked in\r\n\r\ntravel_agent = Agent(\r\n    # \"anthropic:claude-sonnet-4-6\",\r\n    # \"google-gla:gemini-2.5-flash\", (can pass like that or we can\r\n    #  define it separately like we are doing here)\r\n    model,\r\n    deps_type=TripContext,\r\n    output_type=TripItinerary,            # &lt;-- Forces structured output\r\n    instructinotallow=(\r\n        \"You are an expert travel planner. Use the available tools to research \"\r\n        \"the destination, then return a detailed day-by-day itinerary. \"\r\n        \"Stay within the traveler's budget. Respect their preferences. \"\r\n        \"Be specific - use real place names, not generic suggestions.\"\r\n    ),\r\n    model_settings={\r\n        \"temperature\": 0.3,             \r\n        \"max_tokens\": 4096,\r\n    },\r\n    retries=2,                             # Auto-retry on validation failure\r\n)\r\n\r\n\r\n# 5. TOOLS: Validated, typed, with access to shared state \r\n# Tools use dependency injection (RunContext) to access TripContext.\r\n# Pydantic AI validates all arguments BEFORE execution.\r\n\r\n@travel_agent.tool\r\nasync def get_weather_forecast(\r\n    ctx: RunContext[TripContext],\r\n    city: str,\r\n    check_date: str,\r\n) -&gt; str:\r\n    \"\"\"Get the weather forecast for a city on a specific date.\"\"\"\r\n    # The key point: ctx.deps gives typed access to shared state.\r\n    try:\r\n        r = await ctx.deps.http_client.get(\r\n            \"https:\/\/api.weatherapi.com\/v1\/forecast.json\",\r\n            params={\"q\": city, \"dt\": check_date, \"key\": os.getenv(\"WEATHERAPI_API_KEY\")},\r\n        )\r\n        if r.status_code != 200:\r\n            # Raise ModelRetry so the agent knows the tool failed\r\n            # and can decide to try again or skip.\r\n            raise ModelRetry(f\"Weather API returned {r.status_code}. Skipping weather forecast.\")\r\n        data = r.json()\r\n        condition = data[\"forecast\"][\"forecastday\"][0][\"day\"][\"condition\"][\"text\"]\r\n        high_c = data[\"forecast\"][\"forecastday\"][0][\"day\"][\"maxtemp_c\"]\r\n        return f\"{city} on {check_date}: {condition}, high of {high_c}\u00b0C\"\r\n    except httpx.RequestError:\r\n        raise ModelRetry(\"Weather API unreachable. Skipping weather forecast.\")\r\n\r\n\r\n@travel_agent.tool\r\nasync def search_attractions(\r\n    ctx: RunContext[TripContext],\r\n    query: str,\r\n    category: str,  # \"sightseeing\" | \"food\" | \"nightlife\" | \"nature\"\r\n) -&gt; str:\r\n    \"\"\"Search for attractions and activities at the destination.\"\"\"\r\n    # In production, this calls Google Places, Yelp, or a similar API.\r\n    # For this repo snippet, we default to a deterministic mock so the demo runs offline.\r\n    base_url = os.getenv(\"ATTRACTIONS_API_URL\")\r\n    if not base_url:\r\n        return (\r\n            f\"(mock) Top {category} ideas near {ctx.deps.destination} for '{query}':\\n\"\r\n            \"- Fushimi Inari Taisha (early morning)\\n\"\r\n            \"- Kiyomizu-dera + Sannenzaka stroll\\n\"\r\n            \"- Nishiki Market (vegetarian-friendly options)\\n\"\r\n            \"- Arashiyama Bamboo Grove + Tenryu-ji\\n\"\r\n        )\r\n\r\n    try:\r\n        r = await ctx.deps.http_client.get(\r\n            f\"{base_url.rstrip('\/')}\/attractions\",\r\n            params={\r\n                \"q\": query,\r\n                \"near\": ctx.deps.destination,\r\n                \"category\": category,\r\n            },\r\n        )\r\n    except httpx.RequestError:\r\n        return (\r\n            f\"(mock) Attractions API unreachable; using fallback results for {ctx.deps.destination}.\\n\"\r\n            \"- Fushimi Inari Taisha\\n\"\r\n            \"- Kiyomizu-dera\\n\"\r\n            \"- Nishiki Market\\n\"\r\n        )\r\n\r\n    if r.status_code != 200:\r\n        raise ModelRetry(\"Attractions API failed. Try a broader query.\")\r\n    return r.text\r\n\r\n\r\n@travel_agent.tool_plain\r\ndef check_budget_remaining(\r\n    total_budget_usd: float,\r\n    spent_so_far_usd: float,\r\n) -&gt; str:\r\n    \"\"\"Check how much budget is left for planning remaining days.\"\"\"\r\n    remaining = total_budget_usd - spent_so_far_usd\r\n    if remaining &lt; 0:\r\n        raise ModelRetry(\r\n            f\"Over budget by ${abs(remaining):.0f}! \"\r\n            \"Re-plan with cheaper alternatives.\"\r\n        )\r\n    return f\"${remaining:.0f} remaining out of ${total_budget_usd:.0f}\"\r\n\r\n\r\n# 6. DYNAMIC INSTRUCTIONS: Inject user context at runtime \r\n# This runs before each agent call and adds personalized context\r\n# to the system prompt, keeping the base instructions clean.\r\n\r\n@travel_agent.instructions\r\ndef personalize(ctx: RunContext[TripContext]) -&gt; str:\r\n    t = ctx.deps\r\n    nights = (t.end_date - t.start_date).days\r\n    return (\r\n        f\"\\n--- Trip Details ---\\n\"\r\n        f\"Route: {t.origin} \u2192 {t.destination}\\n\"\r\n        f\"Dates: {t.start_date} to {t.end_date} ({nights} nights)\\n\"\r\n        f\"Budget: ${t.budget_usd:.0f} total\\n\"\r\n        f\"Traveler notes: {t.traveler_notes}\\n\"\r\n    )\r\n\r\n\r\n# 7. RUN IT: With proper lifecycle management\r\n\r\nasync def plan_trip():\r\n    async with httpx.AsyncClient(timeout=30.0) as client:\r\n        trip_ctx = TripContext(\r\n            origin=\"Delhi\",\r\n            destinatinotallow=\"Kyoto\",\r\n            start_date=date(2026, 4, 1),\r\n            end_date=date(2026, 4, 5),\r\n            budget_usd=2000.0,\r\n            traveler_notes=\"I love temples and street food. Vegetarian.\",\r\n            http_client=client,\r\n        )\r\n\r\n        result = await travel_agent.run(\r\n            \"Plan my trip!\",\r\n            deps=trip_ctx,\r\n        )\r\n\r\n        # result.output is a fully validated TripItinerary object.\r\n        # Not a string. Not JSON you have to parse. A typed Python object.\r\n        itinerary = result.output\r\n\r\n        print(f\"\\n{'='*50}\")\r\n        print(f\"\ud83d\uddfe  {itinerary.title}\")\r\n        print(f\"{'='*50}\")\r\n        print(f\"\\n{itinerary.summary}\\n\")\r\n\r\n        for day in itinerary.days:\r\n            print(f\"\\n\ud83d\udcc5  Day {day.day_number} - {day.theme}\")\r\n            print(f\"   {day.date}\")\r\n            for act in day.activities:\r\n                print(f\"   {act.time}: {act.name} (${act.estimated_cost_usd:.0f})\")\r\n                print(f\"           {act.description}\")\r\n            print(f\"   \ud83c\udf7d \ufe0f Meals:\")\r\n            for meal in day.meals:\r\n                print(f\"      {meal.time}: {meal.name} (${meal.estimated_cost_usd:.0f})\")\r\n\r\n        print(f\"\\n\ud83d\udcb0  Estimated Total: ${itinerary.total_estimated_cost_usd:.0f}\")\r\n        print(f\"\ud83c\udf92  Packing Tips: {', '.join(itinerary.packing_tips)}\")\r\n\r\n        # Observability: token usage and cost are tracked automatically\r\n        # via Logfire. Check your dashboard at https:\/\/logfire.pydantic.dev\r\n        print(f\"\\n\ud83d\udcca  Token usage: {result.usage()}\")\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    asyncio.run(plan_trip())<\/code><\/pre>\n<ul id=\"code_id_1\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<li>16.<\/li>\n<li>17.<\/li>\n<li>18.<\/li>\n<li>19.<\/li>\n<li>20.<\/li>\n<li>21.<\/li>\n<li>22.<\/li>\n<li>23.<\/li>\n<li>24.<\/li>\n<li>25.<\/li>\n<li>26.<\/li>\n<li>27.<\/li>\n<li>28.<\/li>\n<li>29.<\/li>\n<li>30.<\/li>\n<li>31.<\/li>\n<li>32.<\/li>\n<li>33.<\/li>\n<li>34.<\/li>\n<li>35.<\/li>\n<li>36.<\/li>\n<li>37.<\/li>\n<li>38.<\/li>\n<li>39.<\/li>\n<li>40.<\/li>\n<li>41.<\/li>\n<li>42.<\/li>\n<li>43.<\/li>\n<li>44.<\/li>\n<li>45.<\/li>\n<li>46.<\/li>\n<li>47.<\/li>\n<li>48.<\/li>\n<li>49.<\/li>\n<li>50.<\/li>\n<li>51.<\/li>\n<li>52.<\/li>\n<li>53.<\/li>\n<li>54.<\/li>\n<li>55.<\/li>\n<li>56.<\/li>\n<li>57.<\/li>\n<li>58.<\/li>\n<li>59.<\/li>\n<li>60.<\/li>\n<li>61.<\/li>\n<li>62.<\/li>\n<li>63.<\/li>\n<li>64.<\/li>\n<li>65.<\/li>\n<li>66.<\/li>\n<li>67.<\/li>\n<li>68.<\/li>\n<li>69.<\/li>\n<li>70.<\/li>\n<li>71.<\/li>\n<li>72.<\/li>\n<li>73.<\/li>\n<li>74.<\/li>\n<li>75.<\/li>\n<li>76.<\/li>\n<li>77.<\/li>\n<li>78.<\/li>\n<li>79.<\/li>\n<li>80.<\/li>\n<li>81.<\/li>\n<li>82.<\/li>\n<li>83.<\/li>\n<li>84.<\/li>\n<li>85.<\/li>\n<li>86.<\/li>\n<li>87.<\/li>\n<li>88.<\/li>\n<li>89.<\/li>\n<li>90.<\/li>\n<li>91.<\/li>\n<li>92.<\/li>\n<li>93.<\/li>\n<li>94.<\/li>\n<li>95.<\/li>\n<li>96.<\/li>\n<li>97.<\/li>\n<li>98.<\/li>\n<li>99.<\/li>\n<li>100.<\/li>\n<li>101.<\/li>\n<li>102.<\/li>\n<li>103.<\/li>\n<li>104.<\/li>\n<li>105.<\/li>\n<li>106.<\/li>\n<li>107.<\/li>\n<li>108.<\/li>\n<li>109.<\/li>\n<li>110.<\/li>\n<li>111.<\/li>\n<li>112.<\/li>\n<li>113.<\/li>\n<li>114.<\/li>\n<li>115.<\/li>\n<li>116.<\/li>\n<li>117.<\/li>\n<li>118.<\/li>\n<li>119.<\/li>\n<li>120.<\/li>\n<li>121.<\/li>\n<li>122.<\/li>\n<li>123.<\/li>\n<li>124.<\/li>\n<li>125.<\/li>\n<li>126.<\/li>\n<li>127.<\/li>\n<li>128.<\/li>\n<li>129.<\/li>\n<li>130.<\/li>\n<li>131.<\/li>\n<li>132.<\/li>\n<li>133.<\/li>\n<li>134.<\/li>\n<li>135.<\/li>\n<li>136.<\/li>\n<li>137.<\/li>\n<li>138.<\/li>\n<li>139.<\/li>\n<li>140.<\/li>\n<li>141.<\/li>\n<li>142.<\/li>\n<li>143.<\/li>\n<li>144.<\/li>\n<li>145.<\/li>\n<li>146.<\/li>\n<li>147.<\/li>\n<li>148.<\/li>\n<li>149.<\/li>\n<li>150.<\/li>\n<li>151.<\/li>\n<li>152.<\/li>\n<li>153.<\/li>\n<li>154.<\/li>\n<li>155.<\/li>\n<li>156.<\/li>\n<li>157.<\/li>\n<li>158.<\/li>\n<li>159.<\/li>\n<li>160.<\/li>\n<li>161.<\/li>\n<li>162.<\/li>\n<li>163.<\/li>\n<li>164.<\/li>\n<li>165.<\/li>\n<li>166.<\/li>\n<li>167.<\/li>\n<li>168.<\/li>\n<li>169.<\/li>\n<li>170.<\/li>\n<li>171.<\/li>\n<li>172.<\/li>\n<li>173.<\/li>\n<li>174.<\/li>\n<li>175.<\/li>\n<li>176.<\/li>\n<li>177.<\/li>\n<li>178.<\/li>\n<li>179.<\/li>\n<li>180.<\/li>\n<li>181.<\/li>\n<li>182.<\/li>\n<li>183.<\/li>\n<li>184.<\/li>\n<li>185.<\/li>\n<li>186.<\/li>\n<li>187.<\/li>\n<li>188.<\/li>\n<li>189.<\/li>\n<li>190.<\/li>\n<li>191.<\/li>\n<li>192.<\/li>\n<li>193.<\/li>\n<li>194.<\/li>\n<li>195.<\/li>\n<li>196.<\/li>\n<li>197.<\/li>\n<li>198.<\/li>\n<li>199.<\/li>\n<li>200.<\/li>\n<li>201.<\/li>\n<li>202.<\/li>\n<li>203.<\/li>\n<li>204.<\/li>\n<li>205.<\/li>\n<li>206.<\/li>\n<li>207.<\/li>\n<li>208.<\/li>\n<li>209.<\/li>\n<li>210.<\/li>\n<li>211.<\/li>\n<li>212.<\/li>\n<li>213.<\/li>\n<li>214.<\/li>\n<li>215.<\/li>\n<li>216.<\/li>\n<li>217.<\/li>\n<li>218.<\/li>\n<li>219.<\/li>\n<li>220.<\/li>\n<li>221.<\/li>\n<li>222.<\/li>\n<li>223.<\/li>\n<li>224.<\/li>\n<li>225.<\/li>\n<li>226.<\/li>\n<li>227.<\/li>\n<li>228.<\/li>\n<li>229.<\/li>\n<li>230.<\/li>\n<li>231.<\/li>\n<li>232.<\/li>\n<li>233.<\/li>\n<li>234.<\/li>\n<li>235.<\/li>\n<li>236.<\/li>\n<li>237.<\/li>\n<li>238.<\/li>\n<li>239.<\/li>\n<li>240.<\/li>\n<li>241.<\/li>\n<li>242.<\/li>\n<li>243.<\/li>\n<li>244.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>\u8fd9\u4e0e\u6211\u4eec\u6784\u5efa\u7684\u7b2c\u4e00\u4e2a\u7248\u672c\u6709\u5f88\u5927\u4e0d\u540c\u3002\u6211\u4eec\u6765\u62c6\u89e3\u4e00\u4e0b\u4e3a\u4ec0\u4e48\u8fd9\u662f\u4e00\u4e2a\u771f\u6b63\u7684 agent\u3002<\/p>\n<ul data-id=\"u738a58b-n6HLlSW7\">\n<li data-id=\"ld70c578-JrLREvF1\"><strong>\u7ed3\u6784\u5316\u72b6\u6001\uff1a<\/strong><code>TripContext<\/code>\u00a0\u662f\u4e00\u4e2a\u663e\u5f0f\u7684\u3001\u5e26\u7c7b\u578b\u7684\u5bf9\u8c61\uff0c\u5145\u5f53 agent \u7684 memory\u3002\u5b83\u901a\u8fc7 dependency injection \u88ab\u5e72\u51c0\u5730\u4f20\u9012\uff0c\u800c\u4e0d\u662f\u88ab\u63c9\u8fdb\u804a\u5929\u5386\u53f2\u91cc\u3002<\/li>\n<li data-id=\"ld70c578-4Q9UsGMd\"><strong>\u7ed3\u6784\u5316\u8f93\u51fa\uff1a<\/strong>\u00a0agent \u88ab\u5f3a\u5236\u8fd4\u56de\u4e00\u4e2a\u00a0<code>TripItinerary<\/code>\u00a0\u5bf9\u8c61\u3002\u4e0d\u518d\u9700\u8981\u89e3\u6790\u5b57\u7b26\u4e32\u3002Pydantic \u4f1a\u9a8c\u8bc1 LLM \u7684\u8f93\u51fa\uff1b\u5982\u679c\u8f93\u51fa\u6709\u8bef\uff0c\u6846\u67b6\u4f1a\u81ea\u52a8\u544a\u8bc9\u6a21\u578b\u4fee\u6b63\u9519\u8bef\u3002<\/li>\n<li data-id=\"ld70c578-ggi1NsNm\"><strong>\u9884\u7b97\u4e0e Guardrails\uff1a<\/strong><code>retries=2<\/code>\u00a0\u5bf9 agent \u53ef\u91cd\u8bd5\u5931\u8d25\u6b65\u9aa4\u7684\u6b21\u6570\u8bbe\u7f6e\u4e86\u786c\u6027\u4e0a\u9650\u3002\u5728\u5de5\u5177\u5185\u90e8\u629b\u51fa\u00a0<code>ModelRetry<\/code>\u00a0\u662f\u4e00\u79cd\u8ba9\u5de5\u5177\u5411 agent \u8868\u793a\u53ef\u6062\u590d\u5931\u8d25\u7684\u65b9\u5f0f\uff0c\u4ece\u800c\u7ed9 agent \u4e00\u4e2a\u81ea\u6211\u7ea0\u6b63\u7684\u673a\u4f1a\u3002<\/li>\n<li data-id=\"ld70c578-aJpoINzJ\"><strong>\u5de5\u5177\u9a8c\u8bc1\uff1a<\/strong>\u00a0\u8fd9\u4e2a\u5e93\u4f1a\u81ea\u52a8\u6839\u636e\u7c7b\u578b\u63d0\u793a\u9a8c\u8bc1\u4f20\u7ed9\u5de5\u5177\u7684\u6240\u6709\u53c2\u6570\u3002LLM \u4e0d\u80fd\u5728\u4e0d\u88ab\u6355\u83b7\u7684\u60c5\u51b5\u4e0b\u53d1\u9001\u683c\u5f0f\u9519\u8bef\u7684\u65e5\u671f\u6216\u7f3a\u5931\u53c2\u6570\u3002<\/li>\n<li data-id=\"ld70c578-X7O3KHAF\"><strong>\u53ef\u89c2\u6d4b\u6027\uff1a<\/strong>\u00a0\u901a\u8fc7\u4f7f\u7528 Logfire \u8fd9\u7c7b\u5de5\u5177\u8fdb\u884c instrumentation\uff0c\u6bcf\u4e00\u6b21 LLM \u8c03\u7528\u3001\u5de5\u5177\u8c03\u7528\u548c token \u6210\u672c\u90fd\u4f1a\u88ab\u81ea\u52a8 trace\uff0c\u8fd9\u5bf9\u8c03\u8bd5\u6765\u8bf4\u975e\u5e38\u5173\u952e\u3002<\/li>\n<li data-id=\"ld70c578-tgTgbL5z\"><strong>\u6062\u590d\u4e0e dependency injection\uff1a<\/strong>\u00a0\u8fd9\u7c7b\u6846\u67b6\u901a\u5e38\u652f\u6301 durable execution\uff0c\u4e5f\u5c31\u662f\u8bf4\u4f60\u53ef\u4ee5 checkpoint \u72b6\u6001\uff0c\u5e76\u5728\u5d29\u6e83\u540e\u6062\u590d\u3002\u6b64\u5916\uff0c<code>RunContext<\/code>\u00a0\u4e3a\u5de5\u5177\u8bbf\u95ee HTTP client \u8fd9\u7c7b\u5171\u4eab\u8d44\u6e90\u63d0\u4f9b\u4e86\u4e00\u79cd\u5e72\u51c0\u65b9\u5f0f\uff0c\u800c\u65e0\u9700\u4f7f\u7528\u5168\u5c40\u53d8\u91cf\u3002<\/li>\n<\/ul>\n<h4>Agent \u53ef\u80fd\u51fa\u95ee\u9898\u7684\u8bf8\u591a\u65b9\u5f0f<\/h4>\n<p><img data-dominant-color=\"e5e5e1\" data-has-transparency=\"true\" style=\"--dominant-color: #e5e5e1;\" loading=\"lazy\" decoding=\"async\" class=\"has-transparency alignnone size-full wp-image-29926\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/088797e043692966d0b3489bb74bc441fbfd5e.png\" width=\"1080\" height=\"806\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" srcset=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/088797e043692966d0b3489bb74bc441fbfd5e.png 1080w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/088797e043692966d0b3489bb74bc441fbfd5e-300x224.png 300w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/088797e043692966d0b3489bb74bc441fbfd5e-1024x764.png 1024w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/088797e043692966d0b3489bb74bc441fbfd5e-150x112.png 150w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/088797e043692966d0b3489bb74bc441fbfd5e-768x573.png 768w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/07\/088797e043692966d0b3489bb74bc441fbfd5e-681x508.png 681w\" sizes=\"auto, 100vw\" \/><\/p>\n<p>\u6784\u5efa\u4e00\u4e2a\u5065\u58ee\u7684 agent\uff0c\u672c\u8d28\u4e0a\u4e3b\u8981\u662f\u5728\u9884\u5224\u5931\u8d25\u3002\u4e0b\u9762\u662f\u6211\u7ecf\u5e38\u89c1\u5230\u7684\u5e38\u89c1 failure modes\uff0c\u4ee5\u53ca\u5982\u4f55\u9632\u62a4\u3002<\/p>\n<ul data-id=\"u738a58b-SP3VONOP\">\n<li data-id=\"ld70c578-XHIcW0Jw\"><strong>\u65e0\u9650\u5faa\u73af\uff1a<\/strong>\u00a0agent \u5361\u4f4f\u4e86\u3002\u4e5f\u8bb8\u5b83\u8ba4\u4e3a\u81ea\u5df1\u9700\u8981\u5929\u6c14\u4fe1\u606f\uff0c\u8c03\u7528\u4e86\u5de5\u5177\uff0c\u4f46\u968f\u540e\u53c8\u51b3\u5b9a\u81ea\u5df1\u4ecd\u7136\u9700\u8981\u5929\u6c14\u4fe1\u606f\u3002\u6700\u7b80\u5355\u7684\u4fee\u590d\u65b9\u5f0f\u662f\u8bbe\u7f6e\u786c\u6027\u7684\u00a0<code>max_steps<\/code>\u00a0\u9884\u7b97\u3002\u5982\u679c\u5b83\u5728 10 \u6b65\u5185\u8fd8\u6ca1\u89e3\u51b3\u95ee\u9898\uff0c\u5927\u6982\u7387\u4e5f\u89e3\u51b3\u4e0d\u4e86\u3002<\/li>\n<li data-id=\"ld70c578-MR3ovCbC\"><strong>Tool Misuse<\/strong>\uff1aLLM \u4e3a\u4f60\u7684\u5de5\u5177\u5e7b\u89c9\u51fa\u53c2\u6570\u3002\u5b83\u53ef\u80fd\u5728\u671f\u671b\u6574\u6570\u7684\u5730\u65b9\u53d1\u9001\u5b57\u7b26\u4e32\uff0c\u6216\u8005\u5e72\u8106\u7f16\u9020\u53c2\u6570\u3002\u4fee\u590d\u65b9\u5f0f\u662f\u4e25\u683c\u7684\u9a8c\u8bc1\u3002\u4f7f\u7528 Pydantic \u6216 JSON Schema \u4e4b\u7c7b\u7684\u4e1c\u897f\uff0c\u5728\u6267\u884c\u5de5\u5177\u8c03\u7528\u00a0\u4e4b\u524d\u00a0\u9a8c\u8bc1\u53c2\u6570\u3002\u5982\u679c\u9a8c\u8bc1\u5931\u8d25\uff0c\u5c31\u5411 agent \u8fd4\u56de\u9519\u8bef\u6d88\u606f\uff0c\u8ba9\u5b83\u53ef\u4ee5\u81ea\u6211\u7ea0\u6b63\u3002<\/li>\n<li data-id=\"ld70c578-d4bYkc2B\"><strong>\u6210\u672c\u5931\u63a7\uff1a<\/strong>\u00a0agent \u4e0d\u65ad\u91cd\u8bd5\u4e00\u4e2a\u6301\u7eed\u5931\u8d25\u7684\u5de5\u5177\u3002\u8fd9\u4f1a\u5f88\u5feb\u70e7\u5149\u4f60\u7684 API \u9884\u7b97\u3002\u4fee\u590d\u65b9\u5f0f\u662f\u5b9e\u73b0\u5e26 exponential backoff \u7684\u91cd\u8bd5\u4e0a\u9650\u3002\u8fde\u7eed\u5931\u8d25 3 \u6b21\u540e\uff0c\u505c\u6b62\u5e76\u62a5\u544a\u5931\u8d25\u3002\u5bf9\u4e8e\u5173\u952e\u7cfb\u7edf\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 circuit breaker pattern\uff1a\u5982\u679c\u67d0\u4e2a\u5de5\u5177\u7684\u9519\u8bef\u7387\u8fc7\u9ad8\uff0c\u5c31\u4e34\u65f6\u7981\u7528\u5b83\u3002<\/li>\n<li data-id=\"ld70c578-Wtxl7GI9\"><strong>\u975e\u6301\u4e45\u5316\u6267\u884c\uff1a<\/strong>\u00a0\u670d\u52a1\u5668\u5d29\u6e83\uff0cagent \u7684\u5168\u90e8\u8fdb\u5ea6\u88ab\u6e05\u7a7a\u3002\u6b63\u5982\u6211\u4eec\u8ba8\u8bba\u8fc7\u7684\uff0c\u552f\u4e00\u771f\u6b63\u7684\u4fee\u590d\u65b9\u5f0f\u662f checkpointing\u3002\u6bcf\u5b8c\u6210\u4e00\u6b65\u4e4b\u540e\uff0c\u90fd\u8981\u5e8f\u5217\u5316 agent \u7684\u72b6\u6001\u5e76\u4fdd\u5b58\u5230\u6570\u636e\u5e93\u3002\u4f60\u7684 agent runner \u5e94\u8be5\u8bbe\u8ba1\u4e3a\u80fd\u591f\u4ece DB \u52a0\u8f7d\u72b6\u6001\u5e76\u6062\u590d\u6267\u884c\u3002<\/li>\n<li data-id=\"ld70c578-6OkkT6y8\"><strong>Prompt injection\uff1a<\/strong>\u00a0\u6076\u610f\u7528\u6237\u6784\u9020 prompt\uff0c\u8bf1\u5bfc\u4f60\u7684 agent \u4f7f\u7528\u5de5\u5177\u9020\u6210\u5371\u5bb3\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u6709\u4e00\u4e2a\u00a0<code>run_bash_command<\/code>\u00a0\u5de5\u5177\uff0c\u4ed6\u4eec\u53ef\u80fd\u8bd5\u56fe\u8ba9\u5b83\u8fd0\u884c\u00a0<code>rm -rf \/<\/code>\u3002\u8fd9\u91cc\u7684\u4fee\u590d\u65b9\u5f0f\u662f\u591a\u5c42\u9632\u62a4\u3002\u9996\u5148\uff0c\u5bf9\u53ef\u4f7f\u7528\u7684\u5de5\u5177\u8bbe\u7f6e\u4e25\u683c\u7684 allowlist\u3002\u5176\u6b21\uff0c\u5b9e\u73b0 policy checks\u3002\u5728\u6267\u884c\u5de5\u5177\u4e4b\u524d\uff0c\u68c0\u67e5\u53c2\u6570\u6216\u884c\u52a8\u672c\u8eab\u662f\u5426\u8fdd\u53cd\u5b89\u5168\u7b56\u7565\u3002\u6c38\u8fdc\u4e0d\u8981\u5728\u6ca1\u6709 human in the loop \u7684\u60c5\u51b5\u4e0b\uff0c\u8ba9 agent \u8bbf\u95ee\u5f3a\u5927\u4e14\u5177\u6709\u7834\u574f\u6027\u7684\u5de5\u5177\u3002<\/li>\n<\/ul>\n<h4>\u4f60\u770b\u4e0d\u89c1\u7684\u4e1c\u897f\uff0c\u5c31\u65e0\u6cd5\u4fee\u590d<\/h4>\n<p>\u5f53 agent \u505a\u51fa\u610f\u5916\u884c\u4e3a\u65f6\uff0c\u4f60\u9700\u8981\u80fd\u591f\u5f04\u6e05\u695a\u539f\u56e0\u3002\u9ed1\u76d2\u662f\u4e0d\u53ef\u80fd\u8c03\u8bd5\u7684\u3002\u826f\u597d\u7684\u53ef\u89c2\u6d4b\u6027\u662f\u4e0d\u53ef\u534f\u5546\u7684\u3002<\/p>\n<p><strong>Logging<\/strong>\uff1a\u8981\u8db3\u591f\u8be6\u7ec6\u3002\u5bf9\u4e8e\u6bcf\u4e00\u6b21\u8fd0\u884c\uff0c\u4f60\u90fd\u5e94\u8be5\u8bb0\u5f55\uff1a<\/p>\n<ul data-id=\"u738a58b-E4I7tRgG\">\n<li data-id=\"ld70c578-Rul6Jtcz\">agent \u5728\u6bcf\u4e00\u6b65\u7684\u51b3\u7b56\uff08\u5b83\u9009\u62e9\u4e86\u54ea\u4e2a\u5de5\u5177\uff0c\u4ee5\u53ca\u5982\u679c\u53ef\u80fd\u7684\u8bdd\uff0c\u4e3a\u4ec0\u4e48\u9009\u62e9\uff09\u3002<\/li>\n<li data-id=\"ld70c578-a9c1gXTY\">\u6bcf\u6b21\u5de5\u5177\u8c03\u7528\u7684\u786e\u5207\u8f93\u5165\u3002<\/li>\n<li data-id=\"ld70c578-dhsS4Cbf\">\u6bcf\u6b21\u5de5\u5177\u8c03\u7528\u7684\u786e\u5207\u8f93\u51fa\uff08\u786e\u4fdd\u5bf9\u654f\u611f\u6570\u636e\u8fdb\u884c\u8131\u654f\uff09\u3002<\/li>\n<li data-id=\"ld70c578-Y21EzC4S\">\u6b65\u6570\u548c\u65f6\u95f4\u6233\u3002<\/li>\n<\/ul>\n<p><strong>Metrics<\/strong>\uff1a\u4f60\u7684 dashboard \u5e94\u8be5\u8ddf\u8e2a\u9ad8\u5c42\u8d8b\u52bf\uff1a<\/p>\n<ul data-id=\"u738a58b-aJaEjFaF\">\n<li data-id=\"ld70c578-5AUW7Ssf\">\u6bcf\u6b21\u8fd0\u884c\u7684\u5e73\u5747\u6b65\u6570\u3002\u8fd9\u4e2a\u6570\u5b57\u4e0a\u5347\u53ef\u80fd\u610f\u5473\u7740\u4f60\u7684 agent \u6b63\u5728\u53d8\u5f97\u66f4\u4f4e\u6548\u3002<\/li>\n<li data-id=\"ld70c578-uSf7MZ4N\">\u5de5\u5177\u9519\u8bef\u7387\u3002\u67d0\u4e2a\u5177\u4f53\u5de5\u5177\u7684\u9519\u8bef\u7a81\u7136\u98d9\u5347\uff0c\u8bf4\u660e\u90a3\u91cc\u6709\u95ee\u9898\u3002<\/li>\n<li data-id=\"ld70c578-qxAZCYsy\">\u6bcf\u6b21\u8fd0\u884c\u6210\u672c\u3002\u8981\u4e25\u683c\u8ddf\u8e2a token \u4f7f\u7528\u91cf\u548c API \u6210\u672c\u3002<\/li>\n<li data-id=\"ld70c578-FZ0SqZEM\">\u7aef\u5230\u7aef\u5ef6\u8fdf\u3002\u7528\u6237\u9700\u8981\u7b49\u591a\u4e45\u624d\u80fd\u5f97\u5230\u7b54\u6848\uff1f<\/li>\n<\/ul>\n<p><strong>Tracing<\/strong>\uff1a\u5bf9\u4e8e\u8c03\u8bd5\u5355\u6b21\u8fd0\u884c\uff0ctrace \u975e\u5e38\u5b9d\u8d35\u3002\u4f7f\u7528 OpenTelemetry \u8fd9\u6837\u7684\u5de5\u5177\uff0c\u4e3a\u6574\u4e2a agent \u8fd0\u884c\u521b\u5efa\u4e00\u4e2a span\u3002\u5728\u5176\u4e2d\uff0c\u4e3a\u6bcf\u4e2a\u201cdecide\u201d\u6b65\u9aa4\u548c\u6bcf\u6b21\u5de5\u5177\u8c03\u7528\u521b\u5efa\u5b50 span\u3002\u8fd9\u4f1a\u8ba9\u4f60\u51c6\u786e\u53ef\u89c6\u5316\u65f6\u95f4\u82b1\u5728\u54ea\u91cc\uff0c\u5e76\u5b9a\u4f4d\u74f6\u9888\u3002<\/p>\n<h4>\u7ed9\u4e0b\u4e00\u4e2a\u9879\u76ee\u7684 Checklist<\/h4>\n<p>\u628a\u5b83\u653e\u5728\u624b\u8fb9\u3002\u5728\u4f60\u4ea4\u4ed8\u4efb\u4f55\u79f0\u4e3a\u201cagent\u201d\u7684\u529f\u80fd\u4e4b\u524d\uff0c\u5148\u8fc7\u4e00\u904d\u8fd9\u4efd checklist\u3002\u5982\u679c\u4f60\u65e0\u6cd5\u52fe\u9009\u6240\u6709\u9879\uff0c\u53ef\u80fd\u503c\u5f97\u91cd\u65b0\u601d\u8003\u8bbe\u8ba1\u3002<\/p>\n<ul data-id=\"u738a58b-R1FZ287t\">\n<li data-id=\"ld70c578-4KaG6r6h\">\u6211\u4eec\u662f\u5426\u6709\u4e00\u4e2a\u660e\u786e\u7684\u3001\u72ec\u7acb\u4e8e\u804a\u5929\u5386\u53f2\u7684\u72b6\u6001 schema\uff1f<\/li>\n<li data-id=\"ld70c578-mME1lpmr\">\u6211\u4eec\u662f\u5426\u6709\u7edd\u5bf9\u505c\u6b62\u6761\u4ef6\uff08\u4f8b\u5982 max_steps\u3001timeouts \u6216 cost budgets\uff09\uff1f<\/li>\n<li data-id=\"ld70c578-cUp7BtJT\">\u6240\u6709\u5de5\u5177\u8f93\u5165\u548c\u8f93\u51fa\u662f\u5426\u90fd\u6839\u636e schema \u8fdb\u884c\u4e86\u9a8c\u8bc1\uff1f<\/li>\n<li data-id=\"ld70c578-N2iLykuU\">\u5de5\u5177\u6267\u884c\u662f\u5426\u5177\u5907 idempotent \u7279\u6027\uff0c\u4ee5\u4fbf\u91cd\u8bd5\u4e0d\u4f1a\u9020\u6210\u91cd\u590d\u64cd\u4f5c\uff1f<\/li>\n<li data-id=\"ld70c578-X4KQkFc3\">agent \u7684\u8fd0\u884c\u662f\u5426\u53ef\u4ee5\u5728\u5d29\u6e83\u540e\u4ece checkpoint \u6062\u590d\uff1f<\/li>\n<li data-id=\"ld70c578-tqcRq5LT\">\u6211\u4eec\u662f\u5426\u8bb0\u5f55\u4e86\u6bcf\u4e00\u6b21\u51b3\u7b56\u548c\u5de5\u5177\u8c03\u7528\uff0c\u4ee5\u4fbf\u8c03\u8bd5\uff1f<\/li>\n<\/ul>\n<h4>\u63a5\u4e0b\u6765<\/h4>\n<p>\u628a\u5b9a\u4e49\u5f04\u6e05\u695a\u662f\u7b2c\u4e00\u6b65\u3002\u5b83\u7ed9\u4e86\u6211\u4eec\u5171\u540c\u8bed\u8a00\u548c\u4e00\u7ec4\u539f\u5219\uff0c\u7528\u4e8e\u6784\u5efa\u66f4\u53ef\u9760\u7684\u7cfb\u7edf\u3002\u4f46\u771f\u6b63\u7684\u6311\u6218\u5728\u4e8e\u5b9e\u73b0\u7ec6\u8282\u3002\u6211\u4eec\u5728\u793a\u4f8b\u4e2d\u4f7f\u7528\u7684\u7b80\u5355\u72b6\u6001\u5bf9\u8c61\uff0c\u5f88\u5feb\u5c31\u4f1a\u53d8\u5f97\u6df7\u4e71\u3002<\/p>\n<p>\u6587\u7ae0\u6765\u81ea\uff1a51CTO<\/p>\n<\/div>\n<\/div>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_29922\" class=\"pvc_stats total_only  \" data-element-id=\"29922\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u628a agent \u5f53\u4f5c\u4e00\u4e2a\u5f88\u9177\u7684\u8425\u9500\u672f\u8bed\uff0c\u800c\u4e0d\u662f\u4e00\u4efd\u4e25\u8c28\u7684\u5de5\u7a0b\u89c4\u683c\uff0c\u662f\u4e00\u4e2a\u771f\u5b9e\u5b58\u5728\u7684\u95ee\u9898\u3002\u5b83\u63a9\u76d6\u4e86\u6211\u4eec\u8bd5\u56fe\u6784\u5efa\u7684 &hellip; <a href=\"https:\/\/aif.amtbbs.org\/index.php\/2026\/07\/28\/29922\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;2026 \u5e74 AI Agent \u5b9e\u7528\u6307\u5357\uff1a\u522b\u518d\u628a RAG \u548c Workflow \u53eb\u6210 Agent&#8221;<\/span><\/a><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_29922\" class=\"pvc_stats total_only  \" data-element-id=\"29922\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":56,"featured_media":29923,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[3,23,20,80],"tags":[2256],"class_list":["post-29922","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-23","category-20","category-80","tag-2026--ai-agent--rag--workflow--agent"],"_links":{"self":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/29922","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/comments?post=29922"}],"version-history":[{"count":1,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/29922\/revisions"}],"predecessor-version":[{"id":29927,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/29922\/revisions\/29927"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media\/29923"}],"wp:attachment":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media?parent=29922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/categories?post=29922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/tags?post=29922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}