{"id":97027,"date":"2026-08-28T22:16:28","date_gmt":"2026-08-28T14:16:28","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/97027.html"},"modified":"2026-08-28T22:16:28","modified_gmt":"2026-08-28T14:16:28","slug":"%e3%80%90%e6%89%8b%e6%90%93-agent-%e7%ac%ac2-2%e5%85%b3%e3%80%91%e6%90%ad%e5%bb%ba-agent-%e8%bf%9b%e9%98%b6%e8%83%bd%e5%8a%9b%ef%bc%9a%e7%bd%91%e7%bb%9c%e6%90%9c%e7%b4%a2%e5%b7%a5%e5%85%b7%ef%bc%88","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/97027.html","title":{"rendered":"\u3010\u624b\u6413 Agent \u7b2c2.2\u5173\u3011\u642d\u5efa Agent \u8fdb\u9636\u80fd\u529b\uff1a\u7f51\u7edc\u641c\u7d22\u5de5\u5177\uff08\u4e2d\uff09"},"content":{"rendered":"<p>\u627f\u63a5\u4e0a\u7bc7&#xff0c;\u6211\u4eec\u642d\u5efa\u7684\u539f\u751f\u722c\u866b\u641c\u7d22\u5de5\u5177&#xff0c;\u867d\u7136\u5b9e\u73b0\u4e86\u8054\u7f51\u529f\u80fd&#xff0c;\u4f46\u5b58\u5728\u4e25\u91cd\u7684\u5de5\u7a0b\u77ed\u677f&#xff1a;\u5de5\u5177\u5185\u90e8\u81ea\u884c\u6355\u83b7\u5e76\u541e\u6389\u5f02\u5e38&#xff0c;\u5927\u6a21\u578b\u65e0\u6cd5\u611f\u77e5\u771f\u5b9e\u6545\u969c&#xff0c;\u53ea\u80fd\u673a\u68b0\u91cd\u590d\u65e0\u6548\u8c03\u7528&#xff0c;\u5b8c\u5168\u4e0d\u5177\u5907\u667a\u80fd\u4f53\u7684\u81ea\u4e3b\u601d\u8003\u80fd\u529b\u3002<\/p>\n<p>\u672c\u7bc7\u805a\u7126 Agent \u6838\u5fc3\u667a\u80fd\u7279\u6027&#xff0c;\u843d\u5730 Error as Observation \u9519\u8bef\u5373\u89c2\u6d4b \u6838\u5fc3\u67b6\u6784\u3002\u91cd\u6784\u5de5\u5177\u5f02\u5e38\u5904\u7406\u903b\u8f91&#xff0c;\u5c06\u6240\u6709\u5de5\u5177\u62a5\u9519\u7edf\u4e00\u5c01\u88c5\u4e3a\u6807\u51c6\u5bf9\u8bdd\u4fe1\u606f\u5582\u7ed9\u6a21\u578b&#xff0c;\u540c\u65f6\u5b9e\u73b0\u52a8\u6001\u5de5\u5177\u6b66\u5668\u5e93\u3001\u6545\u969c\u7194\u65ad\u3001\u6743\u9650\u56de\u6536\u673a\u5236&#xff0c;\u8ba9 Agent \u771f\u6b63\u5b66\u4f1a\u8bc6\u522b\u9519\u8bef\u3001\u5206\u6790\u9519\u8bef\u3001\u81ea\u4e3b\u7ec8\u6b62\u65e0\u6548\u4efb\u52a1&#xff0c;\u5b8c\u6210\u4ece\u201c\u673a\u68b0\u6267\u884c\u201d\u5230\u201c\u667a\u80fd\u51b3\u7b56\u201d\u7684\u5347\u7ea7\u3002<\/p>\n<h2>\u4e00\u3001Agent \u9519\u8bef\u89c2\u6d4b\u4e0e\u81ea\u4e3b\u7194\u65ad\u673a\u5236<\/h2>\n<p>\u5728\u672c\u7ae0\u8282&#xff0c;\u6211\u4eec\u5c06\u63a2\u7d22\u5982\u4f55\u8ba9\u6a21\u578b\u7406\u89e3\u5931\u8d25\u539f\u56e0\u3002\u6211\u4eec\u5c06\u690d\u5165\u514d\u75ab\u7cfb\u7edf\u6838\u5fc3\u4ee3\u7801 error as observation\u3002<\/p>\n<ul>\n<li>Error as Observation&#xff1a;\u5de5\u5177\u6267\u884c\u65e0\u8bba\u6210\u529f\u3001\u5d29\u6e83\u3001\u62e6\u622a\u3001\u8d85\u65f6&#xff0c;\u5168\u90e8\u7edf\u4e00\u5c01\u88c5\u4e3a OpenAI \u6807\u51c6 role&#061;&#034;tool&#034; \u6d88\u606f\u5b58\u5165 chat_history&#xff1b;\u6355\u83b7\u5f02\u5e38\u540e\u7edd\u4e0d\u63d0\u524d return \u7ec8\u6b62\u6d41\u7a0b&#xff0c;\u628a\u62a5\u9519\u5f53\u4f5c\u4e00\u6761 \u201c\u73af\u5883\u89c2\u6d4b\u201d \u4e22\u7ed9\u5927\u6a21\u578b&#xff0c;\u7531\u6a21\u578b\u81ea\u4e3b\u5224\u65ad\u4e0b\u4e00\u6b65\u600e\u4e48\u505a\u3002<\/li>\n<\/ul>\n<h3>1. \u79fb\u9664\u51fd\u6570\u5185\u90e8\u5bb9\u9519\u4ee3\u7801<\/h3>\n<p>\u5b9a\u4f4d&#xff1a;\u5b8c\u6574 web_search \u51fd\u6570\u3002<\/p>\n<p>\u6539\u52a8&#xff1a;\u5220\u9664\u51fd\u6570\u5185\u90e8\u5168\u90e8 try\/except&#xff0c;\u53ea\u4fdd\u7559\u4e1a\u52a1\u903b\u8f91 &#043; \u68c0\u6d4b\u5b89\u5168\u9a8c\u8bc1\u4e3b\u52a8\u629b\u5f02\u5e38\u3002<\/p>\n<p>\u4ee3\u7801\u793a\u4f8b&#xff1a;<\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">web_search<\/span><span class=\"token punctuation\">(<\/span>query<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\\\\n[\u6267\u884c\u5de5\u5177] \u6b63\u5728\u8054\u7f51\u641c\u7d22\u5173\u952e\u8bcd&#xff1a;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>query<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n    url <span class=\"token operator\">&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;https:\/\/www.baidu.com\/s?wd&#061;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>query<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><br \/>\n    headers <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;User-Agent&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/120.0.0.0 Safari\/537.36&#034;<\/span><span class=\"token punctuation\">}<\/span><br \/>\n    resp <span class=\"token operator\">&#061;<\/span> requests<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span>url<span class=\"token punctuation\">,<\/span> timeout<span class=\"token operator\">&#061;<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">,<\/span> headers<span class=\"token operator\">&#061;<\/span>headers<span class=\"token punctuation\">)<\/span><br \/>\n    resp<span class=\"token punctuation\">.<\/span>encoding <span class=\"token operator\">&#061;<\/span> resp<span class=\"token punctuation\">.<\/span>apparent_encoding<br \/>\n    resp<span class=\"token punctuation\">.<\/span>raise_for_status<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    soup <span class=\"token operator\">&#061;<\/span> BeautifulSoup<span class=\"token punctuation\">(<\/span>resp<span class=\"token punctuation\">.<\/span>text<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;html.parser&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    raw_text <span class=\"token operator\">&#061;<\/span> soup<span class=\"token punctuation\">.<\/span>get_text<span class=\"token punctuation\">(<\/span>strip<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">,<\/span> separator<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;\\\\n&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token string\">&#034;\u767e\u5ea6\u5b89\u5168\u9a8c\u8bc1&#034;<\/span> <span class=\"token keyword\">in<\/span> raw_text <span class=\"token keyword\">or<\/span> <span class=\"token string\">&#034;\u7f51\u7edc\u4e0d\u7ed9\u529b&#034;<\/span> <span class=\"token keyword\">in<\/span> raw_text<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">raise<\/span> requests<span class=\"token punctuation\">.<\/span>exceptions<span class=\"token punctuation\">.<\/span>HTTPError<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;403 Forbidden&#xff1a;\u767e\u5ea6\u53cd\u722c\u62e6\u622a&#xff0c;\u9700\u8981\u4eba\u673a\u9a8c\u8bc1&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    short_text <span class=\"token operator\">&#061;<\/span> raw_text<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">:<\/span><span class=\"token number\">2000<\/span><span class=\"token punctuation\">]<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u3010\u7f51\u7edc\u641c\u7d22\u7ed3\u679c\u3011\\\\n<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>short_text<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><\/p>\n<p>\u6211\u4eec\u628a\u5f02\u5e38\u5168\u90e8\u629b\u5230\u4e0a\u5c42\u7edf\u4e00\u5904\u7406&#xff0c;\u800c\u4e0d\u662f\u5728\u5de5\u5177\u5185\u90e8\u541e\u6389\u5f02\u5e38\u3002\u8fd9\u6837&#xff0c;\u4e0a\u5c42\u8c03\u5ea6\u4ee3\u7801\u62ff\u5230\u5b8c\u6574\u9519\u8bef\u7c7b\u578b\u3001\u5806\u6808\u4fe1\u606f&#xff0c;\u5c31\u53ef\u4ee5\u9760\u4ee3\u7801\u903b\u8f91\u7cbe\u51c6\u533a\u5206\u6545\u969c\u3002<\/p>\n<h3>2. \u6838\u5fc3&#xff1a;\u5de5\u5177\u6267\u884c\u5faa\u73af\u589e\u52a0\u5c40\u90e8\u5f02\u5e38\u6355\u83b7<\/h3>\n<p>\u5b9a\u4f4d&#xff1a;generate_response \u51fd\u6570\u5185\u90e8&#xff0c;for tool in msg.tool_calls: \u5faa\u73af\u91cc\u6267\u884c\u5de5\u5177\u7684\u4ee3\u7801\u5757<\/p>\n<p>\u539f\u4ee3\u7801\u7247\u6bb5&#xff08;\u65e0\u6355\u83b7&#xff09;&#xff1a;<\/p>\n<p>tool_func <span class=\"token operator\">&#061;<\/span> available_tools<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span>func_name<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">if<\/span> tool_func<span class=\"token punctuation\">:<\/span><br \/>\n    tool_result <span class=\"token operator\">&#061;<\/span> tool_func<span class=\"token punctuation\">(<\/span><span class=\"token operator\">**<\/span>func_args<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">else<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    tool_result <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;\u4e0d\u5b58\u5728\u8be5\u5de5\u5177&#034;<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u5de5\u5177\u8fd4\u56de\u7ed3\u679c&#xff1a;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>tool_result<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u4fee\u6539\u65b9\u6848&#xff1a;\u7ed9 tool_func(**func_args) \u5305\u88f9 try-except&#xff0c;\u6355\u83b7\u6240\u6709\u5de5\u5177\u629b\u51fa\u7684\u5f02\u5e38&#xff0c;\u751f\u6210\u6807\u51c6\u5316\u62a5\u9519\u6587\u672c<\/p>\n<p>\u793a\u4f8b\u4ee3\u7801&#xff1a;<\/p>\n<p>tool_func <span class=\"token operator\">&#061;<\/span> available_tools<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span>func_name<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">try<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> tool_func<span class=\"token punctuation\">:<\/span><br \/>\n        tool_result <span class=\"token operator\">&#061;<\/span> tool_func<span class=\"token punctuation\">(<\/span><span class=\"token operator\">**<\/span>func_args<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">else<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        tool_result <span class=\"token operator\">&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u4e0d\u5b58\u5728\u540d\u4e3a <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>func_name<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> \u7684\u5de5\u5177&#034;<\/span><\/span><br \/>\n                    <span class=\"token keyword\">except<\/span> Exception <span class=\"token keyword\">as<\/span> e<span class=\"token punctuation\">:<\/span><br \/>\n                        tool_result <span class=\"token operator\">&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u3010\u5de5\u5177\u6267\u884c\u5931\u8d25\u3011HTTP 403 Forbidden&#xff1a;\u767e\u5ea6\u53cd\u722c\u62e6\u622a&#xff0c;\u9700\u8981\u4eba\u673a\u9a8c\u8bc1\u3002\u7cfb\u7edf\u5e95\u5c42\u62a5\u9519\u8be6\u60c5&#xff1a;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span><span class=\"token builtin\">str<\/span><span class=\"token punctuation\">(<\/span>e<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><br \/>\n                    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u5de5\u5177\u8fd4\u56de\u7ed3\u679c&#xff1a;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>tool_result<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<ul>\n<li>\u4e0d\u7ba1\u662f 403 \u62e6\u622a\u3001\u7f51\u7edc\u8d85\u65f6\u3001\u89e3\u6790\u62a5\u9519&#xff0c;\u5168\u90e8\u8fdb\u5165\u8fd9\u4e2a except&#xff1b;<\/li>\n<li>\u5f02\u5e38\u4e0d\u4f1a\u5411\u4e0a\u8dd1\u5230\u6700\u5916\u5c42\u5927 try&#xff0c;\u4e0d\u4f1a\u76f4\u63a5\u8fd4\u56de\u5168\u5c40\u9519\u8bef\u3001\u6253\u65ad\u5bf9\u8bdd&#xff1b;<\/li>\n<li>\u6210\u529f\u7ed3\u679c \/ \u62a5\u9519\u4fe1\u606f\u90fd\u4f1a\u5b58\u5165\u540c\u4e00\u4e2a\u53d8\u91cf tool_result&#xff0c;\u540e\u7eed\u7edf\u4e00\u5c01\u88c5\u6210 role&#061;&#034;tool&#034; \u6d88\u606f\u5199\u5165\u5386\u53f2\u3002<\/li>\n<\/ul>\n<h3>3. \u81ea\u6211\u4fee\u6b63\u95ed\u73af\u5b8c\u6574\u8fd0\u884c\u65e5\u5fd7<\/h3>\n<p>\u5728\u6b64\u9636\u6bb5&#xff0c;\u5e0c\u671b\u6a21\u578b\u8bc6\u522b\u51fa\u641c\u7d22\u5de5\u5177\u65e0\u6cd5\u8fd4\u56de\u7ed3\u679c\u540e&#xff0c;\u7531\u5927\u6a21\u578b\u8fdb\u884c\u63a8\u7406\u601d\u8003&#xff0c;\u4ece\u800c\u8fdb\u884c\u4e8c\u6b21\u5de5\u5177\u8c03\u7528&#xff0c;\u53ea\u7528\u77e5\u8bc6\u5e93\u56de\u7b54\u3002<\/p>\n<h4>\u5347\u7ea7\u7cfb\u7edf\u63d0\u793a\u8bcd<\/h4>\n<p>system_prompt <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string\">&#034;role&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;system&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;content&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u4f60\u662f\u4e00\u4e2a\u4e25\u8c28\u7684\u8d44\u6599\u7814\u7a76\u52a9\u624b\u3002\u4f60\u6709\u4e24\u4e2a\u5f3a\u5927\u7684\u5de5\u5177&#xff1a;<br \/>\n1. query_knowledge_base&#xff1a;\u7528\u4e8e\u67e5\u8be2\u4f01\u4e1a\u5185\u90e8\u6807\u51c6\u3001\u672c\u5730\u6587\u4ef6\u3002<br \/>\n2. web_search&#xff1a;\u7528\u4e8e\u67e5\u8be2\u6700\u65b0\u7684\u4e92\u8054\u7f51\u516c\u5f00\u4fe1\u606f\u3002<br \/>\n\u8bf7\u81ea\u4e3b\u5224\u65ad\u7528\u6237\u7684\u63d0\u95ee&#xff0c;\u7075\u6d3b\u9009\u62e9\u8c03\u7528\u4e00\u4e2a\u6216\u591a\u4e2a\u5de5\u5177\u6765\u6536\u96c6\u4fe1\u606f\u3002<br \/>\n\u6ce8\u610f&#xff1a;\u771f\u5b9e\u7684\u7f51\u7edc\u73af\u5883\u662f\u4e0d\u7a33\u5b9a\u7684&#xff0c;\u5982\u679c\u8c03\u7528\u7f51\u9875\u641c\u7d22\u9047\u5230\u5931\u8d25\u6216\u62a5\u9519&#xff0c;\u4f60\u9700\u8981\u81ea\u5df1\u5206\u6790\u539f\u56e0&#xff0c;\u51b3\u5b9a\u662f\u66f4\u6362\u5173\u952e\u8bcd\u91cd\u8bd5&#xff0c;\u8fd8\u662f\u76f4\u63a5\u5229\u7528\u5df2\u6536\u96c6\u5230\u7684\u672c\u5730\u77e5\u8bc6\u8fdb\u884c\u603b\u7ed3\u3002\u5728\u56de\u7b54\u7684\u672b\u5c3e&#xff0c;\u8bf7\u52a1\u5fc5\u6807\u6ce8\u4fe1\u606f\u6765\u6e90\u3002&#034;&#034;&#034;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>\u52a8\u6001\u5de5\u5177\u526a\u679d\u4e0e\u7194\u65ad\u673a\u5236<\/h4>\n<p>\u5728\u4f01\u4e1a\u7ea7 Agent \u67b6\u6784\u4e2d&#xff0c;\u7528\u63d0\u793a\u8bcd\u6307\u671b\u5927\u6a21\u578b\u81ea\u5df1\u806a\u660e\u662f\u4e0d\u53ef\u9760\u7684\u3002\u5de5\u4e1a\u4e0a\u4e00\u822c\u901a\u8fc7\u52a8\u6001\u5265\u593a\u5927\u6a21\u578b\u5de5\u5177\u4f7f\u7528\u6743\u7684\u65b9\u5f0f\u907f\u514d\u5b83\u591a\u6b21\u8c03\u7528\u65e0\u7528\u5de5\u5177\u3002\u5373&#xff0c;\u5982\u679c\u68c0\u6d4b\u5230\u67d0\u4e2a\u5de5\u5177\u62a5\u4e86\u201c\u4e0d\u53ef\u9006\u7684\u81f4\u547d\u9519\u8bef&#xff08;\u6bd4\u5982 403 \u6c38\u4e45\u62e6\u622a&#xff09;\u201d&#xff0c;\u6211\u4eec\u5728\u4e0b\u4e00\u6b21\u8bf7\u6c42\u5927\u6a21\u578b\u65f6&#xff0c;\u76f4\u63a5\u628a\u8fd9\u4e2a\u5de5\u5177\u4ece tools \u5217\u8868\u91cc\u5220\u6389\u3002<\/p>\n<li>\u5728\u8fdb\u5165\u5faa\u73af\u524d&#xff0c;\u590d\u5236\u4e00\u4efd\u201c\u52a8\u6001\u6b66\u5668\u5e93\u201d<\/li>\n<p>\u793a\u4f8b\u4ee3\u7801&#xff1a;<\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">generate_response<\/span><span class=\"token punctuation\">(<\/span>prompt<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">try<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        chat_history<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;role&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;user&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;content&#034;<\/span><span class=\"token punctuation\">:<\/span> prompt<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>        MAX_STEPS <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">3<\/span><br \/>\n        step_count <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><\/p>\n<p>        <span class=\"token comment\"># \u3010\u65b0\u589e\u3011&#xff1a;\u590d\u5236\u4e00\u4efd\u5f53\u524d\u7684 tools \u5217\u8868&#xff0c;\u4f5c\u4e3a\u672c\u8f6e\u5bf9\u8bdd\u7684\u52a8\u6001\u6b66\u5668\u5e93<\/span><br \/>\n        <span class=\"token comment\"># \u8fd9\u6837\u6211\u4eec\u53ef\u4ee5\u968f\u65f6\u5728\u8fd9\u4e2a\u5217\u8868\u91cc\u5220\u9664\u5931\u6548\u7684\u5de5\u5177<\/span><br \/>\n        current_tools <span class=\"token operator\">&#061;<\/span> tools<span class=\"token punctuation\">.<\/span>copy<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <\/p>\n<p>        <span class=\"token comment\"># \u7b2c\u4e00\u6b21\u8bf7\u6c42\u65f6&#xff0c;\u628a current_tools \u4f20\u8fdb\u53bb<\/span><br \/>\n        response <span class=\"token operator\">&#061;<\/span> client<span class=\"token punctuation\">.<\/span>chat<span class=\"token punctuation\">.<\/span>completions<span class=\"token punctuation\">.<\/span>create<span class=\"token punctuation\">(<\/span><br \/>\n            model<span class=\"token operator\">&#061;<\/span>Model_ID<span class=\"token punctuation\">,<\/span><br \/>\n            messages<span class=\"token operator\">&#061;<\/span>chat_history<span class=\"token punctuation\">,<\/span><br \/>\n            tools<span class=\"token operator\">&#061;<\/span>current_tools <span class=\"token keyword\">if<\/span> current_tools <span class=\"token keyword\">else<\/span> <span class=\"token boolean\">None<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            tool_choice<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;auto&#034;<\/span> <span class=\"token keyword\">if<\/span> current_tools <span class=\"token keyword\">else<\/span> <span class=\"token string\">&#034;none&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            parallel_tool_calls<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">False<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token comment\"># \u5173\u95ed\u5e76\u53d1\u8c03\u7528<\/span><br \/>\n            timeout<span class=\"token operator\">&#061;<\/span><span class=\"token number\">30<\/span><br \/>\n        <span class=\"token punctuation\">)<\/span><\/p>\n<p>        <span class=\"token keyword\">if<\/span> <span class=\"token keyword\">not<\/span> response<span class=\"token punctuation\">.<\/span>choices<span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">raise<\/span> Exception<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u6a21\u578b\u9996\u6b21\u8fd4\u56de\u7a7achoices&#xff0c;\u4e0a\u4e0b\u6587\u8fc7\u957f\u6216\u63a5\u53e3\u9650\u6d41\u65e0\u8f93\u51fa&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        msg <span class=\"token operator\">&#061;<\/span> response<span class=\"token punctuation\">.<\/span>choices<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span>message<\/p>\n<li>\u5728\u5de5\u5177\u62a5\u9519\u65f6&#xff0c;\u89e6\u53d1\u201c\u7194\u65ad\u526a\u679d\u201d&#xff0c;\u4e14\u5f53\u5927\u6a21\u578b\u5f3a\u884c\u8c03\u7528\u5df2\u7ecf\u88ab\u7194\u65ad\u7684\u5de5\u5177&#xff0c;\u76f4\u63a5\u62e6\u622a\u5e76\u4e25\u5389\u8b66\u544a<\/li>\n<p><span class=\"token comment\"># &#8230; \u524d\u9762\u7684\u4ee3\u7801\u4fdd\u6301\u4e0d\u53d8 &#8230;<\/span><br \/>\nis_tool_allowed <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">any<\/span><span class=\"token punctuation\">(<\/span>t<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;function&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;name&#039;<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;&#061;<\/span> func_name <span class=\"token keyword\">for<\/span> t <span class=\"token keyword\">in<\/span> current_tools<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">if<\/span> <span class=\"token keyword\">not<\/span> is_tool_allowed<span class=\"token punctuation\">:<\/span><br \/>\n    tool_result <span class=\"token operator\">&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u3010\u5de5\u5177\u8c03\u7528\u5931\u8d25\u3011\u4f60\u6ca1\u6709\u6743\u9650\u8c03\u7528 <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>func_name<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> \u5de5\u5177\u3002&#034;<\/span><\/span><br \/>\n<span class=\"token keyword\">else<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token comment\"># \u6267\u884c\u672c\u5730\u5de5\u5177&#xff0c;\u52a8\u6001\u5206\u53d1\u8c03\u7528<\/span><br \/>\n    tool_func <span class=\"token operator\">&#061;<\/span> available_tools<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span>func_name<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">try<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> tool_func<span class=\"token punctuation\">:<\/span><br \/>\n            tool_result <span class=\"token operator\">&#061;<\/span> tool_func<span class=\"token punctuation\">(<\/span><span class=\"token operator\">**<\/span>func_args<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">else<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            tool_result <span class=\"token operator\">&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u4e0d\u5b58\u5728\u540d\u4e3a <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>func_name<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> \u7684\u5de5\u5177&#034;<\/span><\/span><br \/>\n    <span class=\"token keyword\">except<\/span> Exception <span class=\"token keyword\">as<\/span> e<span class=\"token punctuation\">:<\/span><br \/>\n        error_msg <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">(<\/span>e<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token string\">&#034;403&#034;<\/span> <span class=\"token keyword\">in<\/span> error_msg <span class=\"token keyword\">or<\/span> <span class=\"token string\">&#034;\u767e\u5ea6\u53cd\u722c\u62e6\u622a&#034;<\/span> <span class=\"token keyword\">in<\/span> error_msg<span class=\"token punctuation\">:<\/span><br \/>\n            tool_result <span class=\"token operator\">&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u3010\u7cfb\u7edf\u5f3a\u5236\u7194\u65ad\u3011\u81f4\u547d\u9519\u8bef&#xff1a;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>error_msg<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">\u3002\u8be5\u7f51\u9875\u641c\u7d22\u6e20\u9053\u5df2\u6c38\u4e45\u5931\u6548&#xff0c;\u7981\u6b62\u91cd\u8bd5\u3002&#034;<\/span><\/span><br \/>\n            current_tools <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span>t <span class=\"token keyword\">for<\/span> t <span class=\"token keyword\">in<\/span> current_tools <span class=\"token keyword\">if<\/span> t<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;function&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;name&#039;<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">!&#061;<\/span> func_name<span class=\"token punctuation\">]<\/span><br \/>\n            <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;[\u7cfb\u7edf\u62e6\u622a] \u89e6\u53d1\u7194\u65ad&#xff01;\u5df2\u5265\u593a\u5927\u6a21\u578b\u5bf9 &#039;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>func_name<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#039; \u7684\u8c03\u7528\u6743\u9650&#xff01;&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">else<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            tool_result <span class=\"token operator\">&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u3010\u5de5\u5177\u6267\u884c\u5931\u8d25\u3011\u666e\u901a\u9519\u8bef&#xff1a;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>error_msg<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">\u3002\u4f60\u53ef\u4ee5\u5c1d\u8bd5\u66f4\u6362\u5173\u952e\u8bcd\u6216\u4fee\u6539\u53c2\u6570\u540e\u518d\u6b21\u8c03\u7528\u3002&#034;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u5de5\u5177\u6267\u884c\u7ed3\u679c&#xff1a;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>tool_result<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token comment\"># &#8230; \u5b58\u5165 chat_history \u7684\u4ee3\u7801\u4fdd\u6301\u4e0d\u53d8 &#8230;<\/span><\/p>\n<li>\u4e8c\u6b21\u8bf7\u6c42\u5927\u6a21\u578b\u65f6&#xff0c;\u5e94\u7528\u88ab\u9609\u5272\u7684\u6b66\u5668\u5e93<\/li>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u6b63\u5728\u5206\u6790\u5de5\u5177\u7ed3\u679c\u5e76\u751f\u6210\u540e\u7eed\u56de\u590d&#8230;&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u3010\u65b0\u589e\u903b\u8f91\u3011&#xff1a;\u5982\u679c\u6240\u6709\u5de5\u5177\u90fd\u88ab\u6ca1\u6536\u4e86&#xff0c;\u5fc5\u987b\u53bb\u6389 tools \u53c2\u6570&#xff0c;\u5426\u5219 API \u4f1a\u62a5\u9519<\/span><br \/>\napi_kwargs <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string\">&#034;model&#034;<\/span><span class=\"token punctuation\">:<\/span> Model_ID<span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;messages&#034;<\/span><span class=\"token punctuation\">:<\/span> chat_history<span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;timeout&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token number\">30<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">if<\/span> current_tools<span class=\"token punctuation\">:<\/span><br \/>\n    api_kwargs<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;tools&#034;<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> current_tools<br \/>\n    api_kwargs<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;tool_choice&#034;<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;auto&#034;<\/span><\/p>\n<p>second_resp <span class=\"token operator\">&#061;<\/span> client<span class=\"token punctuation\">.<\/span>chat<span class=\"token punctuation\">.<\/span>completions<span class=\"token punctuation\">.<\/span>create<span class=\"token punctuation\">(<\/span><span class=\"token operator\">**<\/span>api_kwargs<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u5237\u65b0 msg\u4e3a\u6700\u65b0\u7684\u6a21\u578b\u8f93\u51fa<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token keyword\">not<\/span> second_resp<span class=\"token punctuation\">.<\/span>choices<span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">raise<\/span> Exception<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u4e8c\u6b21\u8c03\u7528\u6a21\u578b\u8fd4\u56de\u7a7achoices&#xff0c;\u4e0a\u4e0b\u6587\u8fc7\u8f7d\u65e0\u6cd5\u751f\u6210\u56de\u590d&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\nmsg <span class=\"token operator\">&#061;<\/span> second_resp<span class=\"token punctuation\">.<\/span>choices<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span>message<\/p>\n<p>\u9884\u671f\u7ed3\u679c\u6d41\u7a0b&#xff1a;<\/p>\n<ul>\n<li>\u8c03\u7528 query_knowledge_base \u67e5\u8be2\u672c\u5730\u77e5\u8bc6\u5e93<\/li>\n<li>\u2192 \u672a\u67e5\u8be2\u5230\u5b8c\u6574\u7ed3\u679c<\/li>\n<li>\u2192 \u8c03\u7528 web_search \u8fdb\u884c\u8054\u7f51\u641c\u7d22<\/li>\n<li>\u2192 \u56e0\u7f51\u9875\u53cd\u722c\u866b\u65e0\u6cd5\u83b7\u5f97\u7ed3\u679c<\/li>\n<li>\u2192 LLM \u601d\u8003\u8ba4\u4e3a\u6b64\u8def\u4e0d\u901a\u65e0\u6cd5\u8054\u7f51\u641c\u7d22\/\u7cfb\u7edf\u5f3a\u5236\u7194\u65ad\u5220\u9664 web_search \u5de5\u5177<\/li>\n<li>\u2192 LLM \u4e0d\u518d\u5f3a\u884c\u8054\u7f51\u641c\u7d22&#xff0c;\u800c\u662f\u4f7f\u7528\u672c\u5730\u77e5\u8bc6\u5e93\u5df2\u6709\u4fe1\u606f\u56de\u7b54\u95ee\u9898\u3002<\/li>\n<\/ul>\n<h2>\u4e8c\u3001\u672c\u7bc7\u603b\u7ed3 &amp; \u4e0b\u671f\u9884\u544a<\/h2>\n<p>\u901a\u8fc7\u672c\u7bc7\u6539\u9020&#xff0c;\u6211\u4eec\u5f7b\u5e95\u89e3\u51b3\u4e86 Agent \u5de5\u5177\u8c03\u7528\u65e0\u8111\u91cd\u8bd5\u3001\u6b7b\u5faa\u73af\u5361\u6b7b\u7684\u95ee\u9898&#xff0c;\u8ba9\u667a\u80fd\u4f53\u5177\u5907\u4e86\u57fa\u7840\u7684\u81ea\u6211\u53cd\u601d\u4e0e\u6545\u969c\u6b62\u635f\u80fd\u529b\u3002\u4f46\u624b\u5199\u539f\u751f\u722c\u866b\u7a33\u5b9a\u6027\u6781\u5dee&#xff0c;\u6781\u6613\u88ab\u7f51\u7ad9\u53cd\u722c\u62e6\u622a&#xff0c;\u4ec5\u9002\u5408\u5165\u95e8\u5b66\u4e60&#xff0c;\u5b8c\u5168\u65e0\u6cd5\u9002\u914d\u7ebf\u4e0a\u751f\u4ea7\u73af\u5883\u3002<\/p>\n<p>\u4e0b\u4e00\u7bc7 Stage 2-\u7f51\u7edc\u641c\u7d22\u5de5\u5177\u4e0b\u7bc7&#xff0c;\u6211\u4eec\u5c06\u5b8c\u6210\u4ece\u73a9\u5177demo\u5230\u5de5\u4e1a\u7ea7\u843d\u5730\u7684\u5347\u7ea7&#xff0c;\u66ff\u6362\u5546\u7528\u4e13\u4e1a\u641c\u7d22API&#xff0c;\u540c\u65f6\u89e3\u51b3\u5927\u6a21\u578b\u8fed\u4ee3\u5f0f\u68c0\u7d22\u8fc7\u5ea6\u8c03\u7528\u5de5\u5177\u7684\u95ee\u9898&#xff0c;\u901a\u8fc7\u8f6f\u786c\u53cc\u5c42\u7ea6\u675f\u5b9e\u73b0\u5de5\u5177\u8c03\u7528\u53ef\u63a7\u5316&#xff0c;\u5b8c\u6210\u751f\u4ea7\u7ea7\u7f51\u7edc\u641c\u7d22\u5de5\u5177\u95ed\u73af\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u627f\u63a5\u4e0a\u7bc7&#xff0c;\u6211\u4eec\u642d\u5efa\u7684\u539f\u751f\u722c\u866b\u641c\u7d22\u5de5\u5177&#xff0c;\u867d\u7136\u5b9e\u73b0\u4e86\u8054\u7f51\u529f\u80fd&#xff0c;\u4f46\u5b58\u5728\u4e25\u91cd\u7684\u5de5\u7a0b\u77ed\u677f&#xff1a;\u5de5\u5177\u5185\u90e8\u81ea\u884c\u6355\u83b7\u5e76\u541e\u6389\u5f02\u5e38&#xff0c;\u5927\u6a21\u578b\u65e0\u6cd5\u611f\u77e5\u771f\u5b9e\u6545\u969c&#xff0c;\u53ea\u80fd\u673a\u68b0\u91cd\u590d\u65e0\u6548\u8c03\u7528&#xff0c;\u5b8c\u5168\u4e0d\u5177\u5907\u667a\u80fd\u4f53\u7684\u81ea\u4e3b\u601d\u8003\u80fd\u529b\u3002<br \/>\n\u672c\u7bc7\u805a\u7126 Agent \u6838\u5fc3\u667a\u80fd\u7279\u6027&#xff0c;\u843d\u5730 Error as Observation \u9519\u8bef\u5373\u89c2\u6d4b \u6838\u5fc3\u67b6\u6784\u3002\u91cd\u6784\u5de5\u5177\u5f02\u5e38\u5904\u7406\u903b\u8f91&#xff0c;\u5c06\u6240\u6709\u5de5\u5177\u62a5\u9519\u7edf\u4e00\u5c01\u88c5\u4e3a\u6807\u51c6\u5bf9\u8bdd\u4fe1\u606f\u5582<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[74,52,50],"topic":[],"class_list":["post-97027","post","type-post","status-publish","format-standard","hentry","category-server","tag-agent","tag-aigc","tag-50"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010\u624b\u6413 Agent \u7b2c2.2\u5173\u3011\u642d\u5efa Agent \u8fdb\u9636\u80fd\u529b\uff1a\u7f51\u7edc\u641c\u7d22\u5de5\u5177\uff08\u4e2d\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/97027.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u624b\u6413 Agent \u7b2c2.2\u5173\u3011\u642d\u5efa Agent \u8fdb\u9636\u80fd\u529b\uff1a\u7f51\u7edc\u641c\u7d22\u5de5\u5177\uff08\u4e2d\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u627f\u63a5\u4e0a\u7bc7&#xff0c;\u6211\u4eec\u642d\u5efa\u7684\u539f\u751f\u722c\u866b\u641c\u7d22\u5de5\u5177&#xff0c;\u867d\u7136\u5b9e\u73b0\u4e86\u8054\u7f51\u529f\u80fd&#xff0c;\u4f46\u5b58\u5728\u4e25\u91cd\u7684\u5de5\u7a0b\u77ed\u677f&#xff1a;\u5de5\u5177\u5185\u90e8\u81ea\u884c\u6355\u83b7\u5e76\u541e\u6389\u5f02\u5e38&#xff0c;\u5927\u6a21\u578b\u65e0\u6cd5\u611f\u77e5\u771f\u5b9e\u6545\u969c&#xff0c;\u53ea\u80fd\u673a\u68b0\u91cd\u590d\u65e0\u6548\u8c03\u7528&#xff0c;\u5b8c\u5168\u4e0d\u5177\u5907\u667a\u80fd\u4f53\u7684\u81ea\u4e3b\u601d\u8003\u80fd\u529b\u3002 \u672c\u7bc7\u805a\u7126 Agent \u6838\u5fc3\u667a\u80fd\u7279\u6027&#xff0c;\u843d\u5730 Error as Observation \u9519\u8bef\u5373\u89c2\u6d4b \u6838\u5fc3\u67b6\u6784\u3002\u91cd\u6784\u5de5\u5177\u5f02\u5e38\u5904\u7406\u903b\u8f91&#xff0c;\u5c06\u6240\u6709\u5de5\u5177\u62a5\u9519\u7edf\u4e00\u5c01\u88c5\u4e3a\u6807\u51c6\u5bf9\u8bdd\u4fe1\u606f\u5582\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/97027.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-28T14:16:28+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/97027.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/97027.html\",\"name\":\"\u3010\u624b\u6413 Agent \u7b2c2.2\u5173\u3011\u642d\u5efa Agent \u8fdb\u9636\u80fd\u529b\uff1a\u7f51\u7edc\u641c\u7d22\u5de5\u5177\uff08\u4e2d\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-28T14:16:28+00:00\",\"dateModified\":\"2026-08-28T14:16:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/97027.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/97027.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/97027.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u624b\u6413 Agent \u7b2c2.2\u5173\u3011\u642d\u5efa Agent \u8fdb\u9636\u80fd\u529b\uff1a\u7f51\u7edc\u641c\u7d22\u5de5\u5177\uff08\u4e2d\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010\u624b\u6413 Agent \u7b2c2.2\u5173\u3011\u642d\u5efa Agent \u8fdb\u9636\u80fd\u529b\uff1a\u7f51\u7edc\u641c\u7d22\u5de5\u5177\uff08\u4e2d\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/97027.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u624b\u6413 Agent \u7b2c2.2\u5173\u3011\u642d\u5efa Agent \u8fdb\u9636\u80fd\u529b\uff1a\u7f51\u7edc\u641c\u7d22\u5de5\u5177\uff08\u4e2d\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u627f\u63a5\u4e0a\u7bc7&#xff0c;\u6211\u4eec\u642d\u5efa\u7684\u539f\u751f\u722c\u866b\u641c\u7d22\u5de5\u5177&#xff0c;\u867d\u7136\u5b9e\u73b0\u4e86\u8054\u7f51\u529f\u80fd&#xff0c;\u4f46\u5b58\u5728\u4e25\u91cd\u7684\u5de5\u7a0b\u77ed\u677f&#xff1a;\u5de5\u5177\u5185\u90e8\u81ea\u884c\u6355\u83b7\u5e76\u541e\u6389\u5f02\u5e38&#xff0c;\u5927\u6a21\u578b\u65e0\u6cd5\u611f\u77e5\u771f\u5b9e\u6545\u969c&#xff0c;\u53ea\u80fd\u673a\u68b0\u91cd\u590d\u65e0\u6548\u8c03\u7528&#xff0c;\u5b8c\u5168\u4e0d\u5177\u5907\u667a\u80fd\u4f53\u7684\u81ea\u4e3b\u601d\u8003\u80fd\u529b\u3002 \u672c\u7bc7\u805a\u7126 Agent \u6838\u5fc3\u667a\u80fd\u7279\u6027&#xff0c;\u843d\u5730 Error as Observation \u9519\u8bef\u5373\u89c2\u6d4b \u6838\u5fc3\u67b6\u6784\u3002\u91cd\u6784\u5de5\u5177\u5f02\u5e38\u5904\u7406\u903b\u8f91&#xff0c;\u5c06\u6240\u6709\u5de5\u5177\u62a5\u9519\u7edf\u4e00\u5c01\u88c5\u4e3a\u6807\u51c6\u5bf9\u8bdd\u4fe1\u606f\u5582","og_url":"https:\/\/www.wsisp.com\/helps\/97027.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-28T14:16:28+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/97027.html","url":"https:\/\/www.wsisp.com\/helps\/97027.html","name":"\u3010\u624b\u6413 Agent \u7b2c2.2\u5173\u3011\u642d\u5efa Agent \u8fdb\u9636\u80fd\u529b\uff1a\u7f51\u7edc\u641c\u7d22\u5de5\u5177\uff08\u4e2d\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-28T14:16:28+00:00","dateModified":"2026-08-28T14:16:28+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/97027.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/97027.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/97027.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010\u624b\u6413 Agent \u7b2c2.2\u5173\u3011\u642d\u5efa Agent \u8fdb\u9636\u80fd\u529b\uff1a\u7f51\u7edc\u641c\u7d22\u5de5\u5177\uff08\u4e2d\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/97027","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=97027"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/97027\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=97027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=97027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=97027"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=97027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}