{"id":20327,"date":"2026-02-10T10:41:35","date_gmt":"2026-02-10T02:41:35","guid":{"rendered":"https:\/\/92it.top\/?p=20327"},"modified":"2026-02-10T10:41:35","modified_gmt":"2026-02-10T02:41:35","slug":"langchain-agent%e5%bc%80%e5%8f%91_%e7%b3%bb%e5%88%9710","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=20327","title":{"rendered":"LangChain Agent\u5f00\u53d1_\u7cfb\u521710"},"content":{"rendered":"\n<p>\u8f6c\u8f7d\uff1a\u5c0f\u7ea2\u4e66 AI\u4ea7\u54c1\u8d75\u54e5<\/p>\n\n\n\n<p><strong>\u524d\u8a00\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u8fd9\u662f LangChain \u7cfb\u5217\u7b14\u8bb0\u7684\u7b2c\u5341\u7bc7\u3002\u5982\u679c\u8bf4 <strong>RAG<\/strong> \u89e3\u51b3\u4e86\u5927\u6a21\u578b\u8bb0\u6027\u4e0d\u597d\u7684\u95ee\u9898\uff0c\u90a3\u4e48 <strong>Agent<\/strong> \u89e3\u51b3\u7684\u5c31\u662f\u5927\u6a21\u578b\u624b\u811a\u7b28\u62d9\u548c\u4e0d\u4f1a\u601d\u8003\u7684\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u5f88\u591a\u4ea7\u54c1\u7ecf\u7406\u5728\u770b\u5b8c RAG \u90a3\u4e00\u7bc7\u540e\u4f1a\u89c9\u5f97\uff1a\u201c\u8fd9\u4e0d\u5c31\u662f\u4e2a\u9ad8\u7ea7\u641c\u7d22\u5f15\u64ce\u5417\uff1f\u201d \u4f46\u5f53\u4f60\u771f\u6b63\u770b\u61c2\u4e86 Agent\uff0c\u4f60\u4f1a\u611f\u5230\u540e\u80cc\u6709\u51b7\u98ce\u5439\u8fc7 \u2014\u2014 \u8fd9\u4e1c\u897f\u672a\u6765\u6709\u53ef\u80fd\u66ff\u4ee3\u4eba\u7c7b\u5c97\u4f4d\u7684\u3002<\/p>\n\n\n\n<p>\u5728 LangChain \u7684\u8bed\u5883\u4e0b\uff0c<strong>Agent<\/strong> \u662f\u4e00\u4e2a\u4f7f\u7528 LLM \u6765\u51b3\u5b9a\u91c7\u53d6\u4ec0\u4e48\u884c\u52a8\u4ee5\u53ca\u6309\u4ec0\u4e48\u987a\u5e8f\u91c7\u53d6\u884c\u52a8\u7684\u7cfb\u7edf\u3002\u4e4b\u524d\u7684 Chain\uff08\u94fe\uff09\u662f\u786c\u7f16\u7801\u7684\u5e8f\u5217\uff1a\u6b65\u9aa4 A \u2192 \u6b65\u9aa4 B \u2192 \u6b65\u9aa4 C\u3002\u4ea7\u54c1\u7ecf\u7406\u548c\u5f00\u53d1\u5728\u4ee3\u7801\u91cc\u628a\u6d41\u7a0b HardCoding \u4e86\u3002<\/p>\n\n\n\n<p>\u800c Agent \u662f\u52a8\u6001\u7684\u63a8\u7406\u5f15\u64ce\uff1a\u5b83\u81ea\u5df1\u770b\u60c5\u51b5\u3002\u4e5f\u8bb8\u662f A \u2192 B\uff0c\u4e5f\u8bb8\u662f A \u2192 A \u2192 C \u2192 B\u3002<\/p>\n\n\n\n<p>\u4eca\u5929\u54b1\u7ee7\u7eed\u804a\u5b9e\u64cd\u7684\u4e1c\u897f\uff0c\u76f4\u63a5\u7528 LangChain \u4ece\u96f6\u5f00\u53d1\u4e00\u4e2a Agent\u3002\u6211\u4f1a\u5e26\u4f60\u901a\u8fc7\u4ee3\u7801\u770b\u770b\u5b83\u662f\u548b\u8fd0\u4f5c\u7684\uff0c\u4ee5\u53ca\u5728\u4ea7\u54c1\u8bbe\u8ba1\u4e2d\u5fc5\u987b\u6ce8\u610f\u7684\u5173\u952e\u70b9\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e00\u3001Agent \u7684\u6838\u5fc3\u601d\u60f3\uff1a\u4ece \u201c\u94fe\u201d \u5230 \u201c\u4f53\u201d\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5728\u6211\u4eec\u804a\u6280\u672f\u7ec6\u8282\u4e4b\u524d\uff0c\u6211\u4eec\u5f97\u5728\u6982\u5ff5\u5c42\u9762\uff0c\u7406\u89e3 Chain \u548c Agent \u7684\u6839\u672c\u533a\u522b\u3002<\/p>\n\n\n\n<ul>\n<li><strong>Chain\uff08\u94fe\uff09<\/strong>\uff1a\u662f\u4e00\u4e2a\u56fa\u5b9a\u7684\u3001\u9884\u8bbe\u7684\u6d41\u6c34\u7ebf\u3002\u4f60\u4e8b\u5148\u5b9a\u4e49\u597d\u7b2c\u4e00\u6b65\u505a\u4ec0\u4e48\uff0c\u7b2c\u4e8c\u6b65\u505a\u4ec0\u4e48\uff0c\u7b2c\u4e09\u6b65\u505a\u4ec0\u4e48\u3002\u5b83\u7684\u6267\u884c\u8def\u5f84\u662f\u786e\u5b9a\u7684\u3002\u4f8b\u5982\uff0c<code>Prompt \u2192 LLM \u2192 Output Parser<\/code>\u3002<\/li>\n\n\n\n<li><strong>Agent\uff08\u667a\u80fd\u4f53\uff09<\/strong>\uff1a\u662f\u4e00\u4e2a\u52a8\u6001\u7684\u3001\u81ea\u4e3b\u7684\u51b3\u7b56\u7cfb\u7edf\u3002\u4f60\u53ea\u7ed9\u5b83\u4e00\u4e2a\u6700\u7ec8\u76ee\u6807\u548c\u4e00\u5806\u53ef\u7528\u7684\u5de5\u5177\u3002\u81f3\u4e8e\u5148\u7528\u54ea\u4e2a\u5de5\u5177\uff0c\u540e\u7528\u54ea\u4e2a\u5de5\u5177\uff0c\u62ff\u5230\u7ed3\u679c\u540e\u4e0b\u4e00\u6b65\u600e\u4e48\u529e\uff0c\u5b8c\u5168\u7531 Agent \u81ea\u5df1\u5faa\u73af\u5f80\u590d\u5730\u51b3\u5b9a\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u8fd9\u4e2a \u201c\u5faa\u73af\u5f80\u590d\u5730\u51b3\u5b9a\u201d \u7684\u8fc7\u7a0b\uff0c\u5c31\u662f Agent \u7684\u7075\u9b42\u3002\u8fd9\u4e2a\u7075\u9b42\uff0c\u5728 LangChain\uff08\u4ee5\u53ca\u5927\u591a\u6570 Agent \u6846\u67b6\uff09\u4e2d\uff0c\u88ab\u4e00\u4e2a\u53eb\u505a ReAct \u7684\u8457\u540d\u601d\u60f3\u6240\u4e3b\u5bfc\u3002<\/p>\n\n\n\n<p><strong>\ud83d\udd39ReAct: Agent \u7684 \u201c\u601d\u8003 &#8211; \u884c\u52a8\u201d \u5faa\u73af<\/strong><\/p>\n\n\n\n<p><strong>ReAct<\/strong> \u662f \u201cReasoning and Acting\u201d \u7684\u7f29\u5199\uff0c\u5373\u63a8\u7406\u4e0e\u884c\u52a8\u3002\u5b83\u590d\u523b\u4e86\u4eba\u7c7b\u89e3\u51b3\u95ee\u9898\u65f6\u7684\u601d\u8003\u8fc7\u7a0b\u3002\u5f53\u9762\u5bf9\u4e00\u4e2a\u4efb\u52a1\u65f6\uff0cAgent \u4f1a\u8fdb\u5165\u4e00\u4e2a\u5faa\u73af\uff0c\u6bcf\u4e00\u6b65\u90fd\u5305\u542b\u4e09\u4e2a\u6838\u5fc3\u8981\u7d20\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>Thought\uff08\u601d\u8003\uff09<\/strong>\uff1aAgent \u9996\u5148\u4f1a\u5bf9\u81ea\u5df1\u8bf4\uff1a\u201c\u6211\u73b0\u5728\u9762\u4e34\u4ec0\u4e48\u95ee\u9898\uff1f\u6211\u7684\u76ee\u6807\u662f\u4ec0\u4e48\uff1f\u6211\u624b\u5934\u6709\u54ea\u4e9b\u5de5\u5177\uff1f\u6839\u636e\u5f53\u524d\u60c5\u51b5\uff0c\u6211\u4e0b\u4e00\u6b65\u5e94\u8be5\u505a\u4ec0\u4e48\uff1f\u201d \u8fd9\u4e00\u6b65\u662f LLM \u5728\u8fdb\u884c\u81ea\u6211\u5bf9\u8bdd\u548c\u63a8\u7406\u3002<\/li>\n\n\n\n<li><strong>Action\uff08\u884c\u52a8\uff09<\/strong>\uff1a\u57fa\u4e8e\u601d\u8003\uff0cAgent \u51b3\u5b9a\u8c03\u7528\u4e00\u4e2a\u5177\u4f53\u7684\u5de5\u5177\uff0c\u5e76\u786e\u5b9a\u8c03\u7528\u8fd9\u4e2a\u5de5\u5177\u9700\u8981\u4ec0\u4e48\u53c2\u6570\u3002\u4f8b\u5982\uff0c\u51b3\u5b9a\u8c03\u7528 <code>search<\/code> \u5de5\u5177\uff0c\u53c2\u6570\u662f \u201cLangChain \u662f\u4ec0\u4e48\u201d\u3002<\/li>\n\n\n\n<li><strong>Observation\uff08\u89c2\u5bdf\uff09<\/strong>\uff1aAgent \u6267\u884c\u4e86\u884c\u52a8\uff08\u8c03\u7528\u4e86\u5de5\u5177\uff09\uff0c\u5e76\u5f97\u5230\u4e86\u4e00\u4e2a\u7ed3\u679c\u3002\u8fd9\u4e2a\u7ed3\u679c\u5c31\u662f \u201c\u89c2\u5bdf\u201d\u3002\u4f8b\u5982\uff0c\u641c\u7d22\u5f15\u64ce\u8fd4\u56de\u4e86\u4e00\u6bb5\u5173\u4e8e LangChain \u7684\u7ef4\u57fa\u767e\u79d1\u4ecb\u7ecd\u3002\n<ul>\n<li><span style=\"background-color: rgba(0, 0, 0, 0); font-family: ui-sans-serif, system-ui, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 16px; white-space-collapse: collapse; color: initial;\">\u62ff\u5230\u8fd9\u4e2a <\/span><code style=\"background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; font-size: 16px; white-space-collapse: collapse; color: initial; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; line-height: 24px; display: inline; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal;\">Observation<\/code><span style=\"background-color: rgba(0, 0, 0, 0); font-family: ui-sans-serif, system-ui, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 16px; white-space-collapse: collapse; color: initial;\"> \u4e4b\u540e\uff0cAgent \u5e76\u4e0d\u4f1a\u7ed3\u675f\u3002\u5b83\u4f1a\u5e26\u7740\u8fd9\u4e2a\u65b0\u7684\u4fe1\u606f\uff0c\u91cd\u65b0\u8fdb\u5165\u4e0b\u4e00\u4e2a\u5faa\u73af\uff0c\u5f00\u59cb\u65b0\u4e00\u8f6e\u7684 <\/span><code style=\"background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; font-size: 16px; white-space-collapse: collapse; color: initial; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; line-height: 24px; display: inline; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal;\">Thought<\/code><span style=\"background-color: rgba(0, 0, 0, 0); font-family: ui-sans-serif, system-ui, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 16px; white-space-collapse: collapse; color: initial;\">\uff1a<\/span><div style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 16px; line-height: 24px; white-space-collapse: collapse; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\"><\/div><\/li>\n\n\n\n<li><ul style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 16px; line-height: 24px; white-space-collapse: collapse; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\"><li style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; line-height: 24px; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\"><span style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-weight: 700; line-height: 24px; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\">Thought\uff08\u65b0\u4e00\u8f6e\uff09<\/span>\uff1a\u201c\u597d\u4e86\uff0c\u6211\u5df2\u7ecf\u77e5\u9053 LangChain \u662f\u4e00\u4e2a AI \u5f00\u53d1\u6846\u67b6\u4e86\u3002\u4f46\u662f\u7528\u6237\u7684\u95ee\u9898\u662f\u2018\u5982\u4f55\u7528\u5b83\u5f00\u53d1 Agent\u2019\u3002\u6211\u624b\u5934\u7684\u4fe1\u606f\u8fd8\u4e0d\u591f\u3002\u4e0b\u4e00\u6b65\uff0c\u6211\u5e94\u8be5\u641c\u7d22\u2018LangChain Agent \u5f00\u53d1\u6559\u7a0b\u2019\u3002\u201d<\/li><\/ul><\/li>\n\n\n\n<li><ul style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 16px; line-height: 24px; white-space-collapse: collapse; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\"><li style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; line-height: 24px; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\"><span style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-weight: 700; line-height: 24px; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\">Action\uff08\u65b0\u4e00\u8f6e\uff09<\/span>\uff1a\u8c03\u7528 <code style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; font-size: 16px; line-height: 24px; display: inline; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;\">search<\/code> \u5de5\u5177\uff0c\u53c2\u6570\u662f \u201cLangChain Agent \u5f00\u53d1\u6559\u7a0b\u201d\u3002<\/li><\/ul><\/li>\n\n\n\n<li><ul style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 16px; line-height: 24px; white-space-collapse: collapse; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\"><li style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; line-height: 24px; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\"><span style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-weight: 700; line-height: 24px; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\">Observation\uff08\u65b0\u4e00\u8f6e\uff09<\/span>\uff1a\u5f97\u5230\u4e86\u4e00\u7bc7\u6559\u7a0b\u94fe\u63a5\u3002<\/li><\/ul><\/li>\n\n\n\n<li><ul style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 16px; line-height: 24px; white-space-collapse: collapse; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\"><li style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; line-height: 24px; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\">\u2026\u2026 \u8fd9\u4e2a\u5faa\u73af\u4f1a\u4e00\u76f4\u6301\u7eed\u4e0b\u53bb\uff0c\u76f4\u5230 Agent \u5728\u67d0\u4e00\u6b21\u7684 <code style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; font-size: 16px; line-height: 24px; display: inline; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;\">Thought<\/code> \u4e2d\u8ba4\u4e3a\uff1a\u201c\u6211\u5df2\u7ecf\u6536\u96c6\u5230\u4e86\u8db3\u591f\u7684\u4fe1\u606f\uff0c\u53ef\u4ee5\u56de\u7b54\u7528\u6237\u7684\u539f\u59cb\u95ee\u9898\u4e86\u3002\u201d \u8fd9\u65f6\uff0c\u5b83\u624d\u4f1a\u751f\u6210\u6700\u7ec8\u7684\u7b54\u6848\uff0c\u5e76\u7ed3\u675f\u5faa\u73af\u3002<\/li><\/ul><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p><div style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 16px; line-height: 24px; white-space-collapse: collapse; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background: none 0% 0% \/ auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);\">\u8fd9\u5c31\u662f Agent \u5389\u5bb3\u7684\u5730\u65b9\uff1a\u5b83\u628a\u4e00\u4e2a\u5927\u95ee\u9898\uff0c\u901a\u8fc7 LLM \u7684\u81ea\u6211\u63a8\u7406\uff0c\u5206\u89e3\u6210\u4e86\u4e00\u7cfb\u5217\u53ef\u6267\u884c\u7684\u5c0f\u6b65\u9aa4\uff0c\u5e76\u5229\u7528\u5de5\u5177\u53bb\u9010\u4e2a\u5b8c\u6210\u3002<\/div><\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u6784\u6210 Agent \u7684\u4e09\u5927\u6838\u5fc3\u7ec4\u4ef6<\/strong><\/p>\n\n\n\n<p>\u73b0\u5728\u6211\u4eec\u77e5\u9053\u4e86 Agent \u7684\u5de5\u4f5c\u539f\u7406\u3002\u5728 LangChain \u4e2d\uff0c\u8981\u7ec4\u88c5\u4e00\u4e2a Agent\uff0c\u4f60\u9700\u8981\u4e09\u4e2a\u4e1c\u897f\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>LLM\uff08\u5927\u8111\uff09<\/strong>\uff1a\u8fd9\u4e0d\u662f\u4efb\u4f55 LLM \u90fd\u884c\u3002\u8fd9\u4e2a LLM \u5fc5\u987b\u8db3\u591f\u806a\u660e\uff0c\u80fd\u591f\u8fdb\u884c\u6709\u6548\u7684\u591a\u6b65\u63a8\u7406\uff0c\u5e76\u4e14\u8981\u7ecf\u8fc7\u4e13\u95e8\u7684\u5fae\u8c03\uff0c\u80fd\u5f88\u597d\u5730\u7406\u89e3\u5de5\u5177\u8c03\u7528\u7684\u6307\u4ee4\u3002GPT5\u3001Claude 4 \u7cfb\u5217\u662f\u76ee\u524d\u7684\u9996\u9009\u3002<\/li>\n\n\n\n<li><strong>Tools\uff08\u624b\u811a\uff09<\/strong>\uff1a\u4e00\u4e2a\u5de5\u5177\u7684\u5217\u8868\u3002\u5b83\u53ef\u4ee5\u662f\u4efb\u4f55\u4e1c\u897f\uff1a\u4e00\u4e2a\u641c\u7d22\u5f15\u64ce\u3001\u4e00\u4e2a\u8ba1\u7b97\u5668\u3001\u4e00\u4e2a\u6570\u636e\u5e93\u67e5\u8be2\u63a5\u53e3\u3001\u4e00\u4e2a\u53d1\u9001\u90ae\u4ef6\u7684 API\uff0c\u751a\u81f3\u662f\u53e6\u4e00\u4e2a Chain\u3002\u4f60\u7ed9 Agent \u63d0\u4f9b\u7684\u5de5\u5177\uff0c\u51b3\u5b9a\u4e86\u5b83\u80fd\u529b\u7684\u8fb9\u754c\u3002<\/li>\n\n\n\n<li><strong>Agent Executor\uff08\u4e2d\u67a2\u795e\u7ecf\u7cfb\u7edf\uff09<\/strong>\uff1a\u8fd9\u662f LangChain \u63d0\u4f9b\u7684\u4e00\u4e2a\u6838\u5fc3\u63a7\u5236\u5668\u3002\u5b83\u8d1f\u8d23\u628a LLM \u548c Tools \u7c98\u5408\u5728\u4e00\u8d77\uff0c\u5fe0\u5b9e\u5730\u6267\u884c\u4e0a\u9762\u6240\u8bf4\u7684 ReAct \u5faa\u73af\u3002\u5b83\u4f1a\u628a\u7528\u6237\u7684\u8f93\u5165\u548c\u5386\u53f2\u8bb0\u5f55\u4ea4\u7ed9 LLM\uff0c\u5f97\u5230 LLM \u7684<code>Thought<\/code>\u548c<code>Action<\/code>\uff0c\u7136\u540e\u53bb\u8c03\u7528\u5bf9\u5e94\u7684<code>Tool<\/code>\uff0c\u518d\u628a<code>Observation<\/code>\u53cd\u9988\u7ed9 LLM\uff0c\u5468\u800c\u590d\u59cb\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e8c\u3001\u5b9e\u6218\u63a8\u6f14\uff1a\u6784\u5efa\u4f60\u7684\u7b2c\u4e00\u4e2a \u201c\u7814\u7a76\u5458\u201d Agent\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u7406\u8bba\u8bf4\u5b8c\u4e86\uff0c\u6211\u4eec\u7acb\u523b\u52a8\u624b\u3002\u6211\u4eec\u5c06\u6784\u5efa\u4e00\u4e2a\u7b80\u5355\u7684<strong>\u7814\u7a76\u5458 Agent<\/strong>\uff0c\u5b83\u7684\u76ee\u6807\u662f\u56de\u7b54\u4e00\u4e2a\u9700\u8981\u7ed3\u5408<strong>\u641c\u7d22<\/strong>\u548c<strong>\u8ba1\u7b97<\/strong>\u624d\u80fd\u89e3\u51b3\u7684\u95ee\u9898\u3002<\/p>\n\n\n\n<p><strong>\u76ee\u6807\u4efb\u52a1<\/strong>\uff1a\u201c\u76ee\u524d\u82f9\u679c\u516c\u53f8\u7684\u80a1\u4ef7\u662f\u591a\u5c11\uff1f\u5982\u679c\u6211\u7528 10000 \u7f8e\u5143\uff0c\u80fd\u4e70\u591a\u5c11\u80a1\uff1f\u201d<\/p>\n\n\n\n<p>\u8fd9\u4e2a\u95ee\u9898\uff0c\u5355\u4e00\u7684 LLM \u65e0\u6cd5\u56de\u7b54\uff0c\u56e0\u4e3a\u5b83\u4e0d\u77e5\u9053\u5b9e\u65f6\u7684\u80a1\u4ef7\uff08\u9700\u8981\u641c\u7d22\uff09\uff0c\u4e5f\u53ef\u80fd\u7b97\u4e0d\u51c6\u9664\u6cd5\uff08\u9700\u8981\u8ba1\u7b97\uff09\u3002\u8fd9\u6b63\u662f Agent \u7684\u7528\u6b66\u4e4b\u5730\u3002<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u7b2c\u4e00\u6b65\uff1a\u51c6\u5907\u5de5\u5177\u7bb1\uff08Tools\uff09<\/strong><\/p>\n\n\n\n<p>\u6211\u4eec\u9700\u8981\u4e24\u4e2a\u5de5\u5177\uff1a\u4e00\u4e2a\u641c\u7d22\u5f15\u64ce\uff0c\u4e00\u4e2a\u8ba1\u7b97\u5668\u3002LangChain \u7684<code>langchain-community<\/code>\u548c<code>langchain-openai<\/code>\u7b49\u5e93\u91cc\uff0c\u5df2\u7ecf\u5185\u7f6e\u4e86\u5f88\u591a\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7684\u5de5\u5177\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from langchain_community.tools import TavilySearchResults\nfrom langchain.tools import tool\n\n# \u5de5\u5177\u4e00\uff1a\u641c\u7d22\u5f15\u64ce\n# Tavily\u662f\u4e00\u4e2a\u4e13\u4e3aLLM Agent\u4f18\u5316\u7684\u641c\u7d22\u5f15\u64ce\uff0c\u6548\u679c\u6bd4\u4f20\u7edf\u641c\u7d22\u597d\u3002\n# \u4f60\u9700\u8981\u4e00\u4e2aTavily API Key\uff0c\u5e76\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\n# \u6216\u8005\uff0c\u4f60\u4e5f\u53ef\u4ee5\u7528DuckDuckGo\u7b49\u514d\u8d39\u5de5\u5177\uff1afrom langchain_community.tools.ddg_search import DuckDuckGoSearchRun\nsearch_tool = TavilySearchResults()\n\n# \u5de5\u5177\u4e8c\uff1a\u8ba1\u7b97\u5668\n# \u6211\u4eec\u7528 @tool \u88c5\u9970\u5668\u5feb\u901f\u521b\u5efa\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u8ba1\u7b97\u5668\u5de5\u5177\n@tool\ndef calculator(expression: str) -> float:\n    \"\"\"\u5f53\u9700\u8981\u8fdb\u884c\u6570\u5b66\u8ba1\u7b97\u65f6\uff0c\u4f7f\u7528\u6b64\u5de5\u5177\u3002\u8f93\u5165\u5e94\u8be5\u662f\u4e00\u4e2a\u53ef\u4ee5\u88abPython `eval()` \u51fd\u6570\u6267\u884c\u7684\u6709\u6548\u6570\u5b66\u8868\u8fbe\u5f0f\u3002\"\"\"\n    # \u6ce8\u610f\uff1a\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f7f\u7528eval()\u6709\u5b89\u5168\u98ce\u9669\uff0c\u8fd9\u91cc\u4ec5\u4e3a\u6f14\u793a\n    try:\n        return eval(expression)\n    except Exception as e:\n        return f\"\u8ba1\u7b97\u9519\u8bef: {e}\"\n\n# \u628a\u5de5\u5177\u653e\u5165\u5217\u8868\ntools = [search_tool, calculator]<\/pre>\n\n\n\n<p>\ud83d\udca1 <strong>\u4ea7\u54c1\u540c\u5b66 insight<\/strong>\uff1a<code>calculator<\/code> \u5de5\u5177\u7684<strong>\u6587\u6863\u5b57\u7b26\u4e32<\/strong>\u975e\u5e38\u5173\u952e\u3002\u5b83\u544a\u8bc9\u4e86 Agent\uff0c\u4ec0\u4e48\u65f6\u5019\u8be5\u7528\u8fd9\u4e2a\u5de5\u5177\uff0c\u4ee5\u53ca\u8f93\u5165\u5e94\u8be5\u662f\u4ec0\u4e48\u683c\u5f0f\uff0c\u8fd9\u91cc\u4e00\u5b9a\u8981\u8ba4\u771f\u7f16\u5199\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u7b2c\u4e8c\u6b65\uff1a\u9009\u62e9\u5927\u8111 (LLM) \u5e76\u8bbe\u8ba1 Prompt<\/strong><\/p>\n\n\n\n<p>\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u652f\u6301\u5de5\u5177\u8c03\u7528\u7684\u5f3a\u5927 LLM\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from langchain_openai import ChatOpenAI\n\nllm = ChatOpenAI(model=\"gpt-4o\", temperature=0)<\/pre>\n\n\n\n<p>\u63a5\u4e0b\u6765\u662f Prompt \u7684\u8bbe\u8ba1\u3002Agent \u7684 Prompt \u6bd4\u666e\u901a\u7684 Prompt \u8981\u590d\u6742\u4e00\u4e9b\uff0c\u5b83\u901a\u5e38\u5305\u542b\u51e0\u4e2a\u7279\u6b8a\u7684\u53d8\u91cf\uff08\u4e0b\u9762\u4f8b\u5b50\u4e2d\u7684<code>agent_scratchpad<\/code>\uff09\uff0c\u7531<code>AgentExecutor<\/code>\u5728\u8fd0\u884c\u65f6\u81ea\u52a8\u586b\u5145\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder\n\n# \u8fd9\u662fLangChain\u4e3aReAct Agent\u8bbe\u8ba1\u7684\u4e00\u4e2a\u6807\u51c6Prompt\u7ed3\u6784\nprompt = ChatPromptTemplate.from_messages([\n    (\"system\", \"\u4f60\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u7814\u7a76\u52a9\u624b\u3002\"),\n\n(\"user\", \"{input}\"),\n# MessagesPlaceholder\u662fAgent\u601d\u8003\u548c\u89c2\u5bdf\u8fc7\u7a0b\u7684\"\u6682\u5b58\u533a\"\u3002\n# AgentExecutor\u4f1a\u628a\u6bcf\u4e00\u6b65\u7684Thought, Action, Observation\u90fd\u586b\u5728\u8fd9\u91cc\u3002\nMessagesPlaceholder(variable_name=\"agent_scratchpad\"),\n])<\/pre>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u7b2c\u4e09\u6b65\uff1a\u7ec4\u88c5\u5e76\u8fd0\u884c Agent Executor<\/strong><\/p>\n\n\n\n<p>\u73b0\u5728\uff0c\u628a\u5927\u8111\u3001\u624b\u811a\u548c Prompt \u7c98\u5408\u5728\u4e00\u8d77\uff0c\u521b\u5efa Agent\uff0c\u5e76\u628a\u5b83\u4ea4\u7ed9 \u201c\u4e2d\u67a2\u795e\u7ecf\u7cfb\u7edf\u201d<code>AgentExecutor<\/code>\u6765\u9a71\u52a8\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from langchain.agents import create_openai_tools_agent, AgentExecutor\n\n# 1. \u521b\u5efaAgent\n# `create_openai_tools_agent`\u662fLangChain\u63d0\u4f9b\u7684\u5de5\u5382\u51fd\u6570\uff0c\n# \u5b83\u80fd\u5c06LLM\u3001\u5de5\u5177\u548cPrompt\u7ec4\u5408\u6210\u4e00\u4e2a\u9075\u5faaOpenAI\u5de5\u5177\u8c03\u7528\u89c4\u8303\u7684Agent\u3002\nagent = create_openai_tools_agent(llm, tools, prompt)\n\n# 2. \u521b\u5efaAgent Executor\n# `verbose=True`\u662f\u4f60\u7684\"\u900f\u89c6\u773c\u955c\"\uff0c\u80fd\u8ba9\u4f60\u770b\u5230Agent\u6bcf\u4e00\u6b65\u7684\u601d\u8003\u8fc7\u7a0b\uff01\n\nagent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)\n\n# 3. \u8fd0\u884c\uff01\nquestion = \"\u76ee\u524d\u82f9\u679c\u516c\u53f8\u7684\u80a1\u4ef7\u662f\u591a\u5c11\uff1f\u5982\u679c\u6211\u752810000\u7f8e\u5143\uff0c\u80fd\u4e70\u591a\u5c11\u80a1\uff1f\"\nresponse = agent_executor.invoke({\"input\": question})\n\nprint(\"\\n--- Agent\u7684\u6700\u7ec8\u56de\u7b54 ---\")\nprint(response[\"output\"])<\/pre>\n\n\n\n<p><strong>Agent \u7684\u5185\u90e8\u5fc3\u58f0\uff08verbose=True \u7684\u8f93\u51fa\u89e3\u8bfb\uff09<\/strong><\/p>\n\n\n\n<p>\u5f53\u4f60\u8fd0\u884c\u4e0a\u9762\u7684\u4ee3\u7801\uff0c\u4f60\u4f1a\u770b\u5230\u4e00\u6bb5 Agent \u7684\u5185\u5fc3\u72ec\u767d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">> Entering new AgentExecutor chain...<br><br>Thought: The user wants to know the current stock price of Apple (AAPL) and how many shares they can buy with $10,000.<br>I need to perform two steps:<br>1. Find the current stock price of Apple. I can use the search tool for this.<br>2. Calculate the number of shares. I will need the stock price from step 1 and the user's amount ($10,000). I can use the calculator tool for this.<br><br>First, I'll search for the stock price.<br><br>Action:<br>{<br>  \"tool\": \"tavily_search_results_json\",<br>  \"tool_input\": {<br>    \"query\": \"current stock price of Apple Inc. (AAPL)\"<br>  }<br>}<br><br>Observation: [{\"url\": \"...\", \"content\": \"As of the latest data, Apple Inc. (AAPL) is trading at approximately 273.40.\"}]<br><br>Thought: Great, I have the current stock price, which is 273.40.<br>Now I need to calculate how many shares can be bought with $10,000.<br>The calculation is 10000 \/ 273.40.<br>I will use the calculator tool for this.<br><br>Action:<br>{<br>  \"tool\": \"calculator\",<br>  \"tool_input\": {<br>    \"expression\": \"10000 \/ 273.40\"<br>  }<br>}<br><br>Observation: 36.57573335200009<br><br>Thought: I have performed both steps.<br>1. The stock price is 273.40.<br>2. With $10,000, one can buy approximately 36.57 shares.<br>I can now provide the final answer to the user.<br><br>Final Answer: \u6839\u636e\u6700\u65b0\u6570\u636e\uff0c\u82f9\u679c\u516c\u53f8\uff08AAPL\uff09\u7684\u5f53\u524d\u80a1\u4ef7\u7ea6\u4e3a 273.40 \u7f8e\u5143\u3002\u752810000\u7f8e\u5143\uff0c\u60a8\u5927\u7ea6\u53ef\u4ee5\u8d2d\u4e70 36.57 \u80a1\u3002<\/pre>\n\n\n\n<p>\ud83d\udca1 <strong>\u4ea7\u54c1\u540c\u5b66 insight<\/strong>\uff1a\u8fd9\u6bb5\u65e5\u5fd7\uff0c\u662f\u4f60\u7406\u89e3\u3001\u8c03\u8bd5\u548c\u4f18\u5316 Agent \u7684\u6700\u5b9d\u8d35\u8d44\u6599\u3002\u5b83\u6e05\u6670\u5730\u5c55\u793a\u4e86 Agent \u662f\u5982\u4f55\u5c06\u4e00\u4e2a\u590d\u6742\u4efb\u52a1\u5206\u89e3\u3001\u5e76\u6309\u90e8\u5c31\u73ed\u5730\u6267\u884c\u7684\u3002\u5f53 Agent \u884c\u4e3a\u4e0d\u7b26\u5408\u9884\u671f\u65f6\uff0c\u7b2c\u4e00\u4ef6\u4e8b\u5c31\u662f\u6765\u590d\u76d8\u8fd9\u4efd \u201c\u601d\u60f3\u65e5\u5fd7\u201d\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e09\u3001LangChain \u4e2d\u7684 Agent \u7c7b\u578b\uff1a\u4e0d\u6b62\u4e00\u79cd\u601d\u8003\u6a21\u5f0f\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u6211\u4eec\u4e0a\u9762\u4f7f\u7528\u7684\u662f\u57fa\u4e8e OpenAI \u5de5\u5177\u8c03\u7528\u80fd\u529b\u7684 Agent\uff0c\u8fd9\u662f\u76ee\u524d\u4e3b\u6d41\u4e14\u6700\u7a33\u5b9a\u7684\u65b9\u5f0f\u3002\u4f46 LangChain \u7684\u5386\u53f2\u4e0a\uff0c\u4ee5\u53ca\u4e3a\u4e86\u9002\u5e94\u4e0d\u540c\u7684 LLM\uff0c\u8fd8\u63d0\u4f9b\u4e86\u5176\u4ed6\u51e0\u79cd Agent \u7c7b\u578b\u3002\u4f5c\u4e3a\u4ea7\u54c1\u7ecf\u7406\uff0c\u4f60\u4e0d\u9700\u8981\u638c\u63e1\u5b83\u4eec\u7684\u5b9e\u73b0\u7ec6\u8282\uff0c\u4f46\u9700\u8981\u4e86\u89e3\u5b83\u4eec\u7684\u8bbe\u8ba1\u601d\u60f3\u548c\u9002\u7528\u573a\u666f\u3002<\/p>\n\n\n\n<ol>\n<li><strong>OpenAI Tools Agent<\/strong>\uff1a\u6211\u4eec\u521a\u624d\u7528\u7684\u5c31\u662f\u3002\u5b83\u4f9d\u8d56\u6a21\u578b\u672c\u8eab\u5f3a\u5927\u7684\u3001\u5185\u7f6e\u7684\u5de5\u5177\u8c03\u7528\u80fd\u529b\u3002LLM \u4f1a\u8fd4\u56de\u4e00\u4e2a\u7279\u6b8a\u7684 JSON \u7ed3\u6784\uff0c\u660e\u786e\u6307\u51fa\u8981\u8c03\u7528\u54ea\u4e2a\u5de5\u5177\u548c\u7528\u4ec0\u4e48\u53c2\u6570\u3002\u8fd9\u662f\u76ee\u524d\u6784\u5efa Agent \u7684\u9996\u9009\uff0c\u56e0\u4e3a\u5b83\u6700\u53ef\u9760\u3002<\/li>\n\n\n\n<li><strong>XML Agent<\/strong>\uff1a\u4e3b\u8981\u4e3a Claude \u8fd9\u7c7b\u6a21\u578b\u8bbe\u8ba1\u3002\u5b83\u7684\u5de5\u4f5c\u65b9\u5f0f\u7c7b\u4f3c\uff0c\u53ea\u662f\u6a21\u578b\u8fd4\u56de\u7684\u662f\u4e00\u4e2a XML \u683c\u5f0f\u7684\u6307\u4ee4\uff0c\u800c\u4e0d\u662f JSON\u3002<\/li>\n\n\n\n<li><strong>ReAct Agent<\/strong>\uff1a\u8fd9\u662f\u66f4\u53e4\u5178\u7684\u4e00\u79cd Agent\u3002\u5b83\u4e0d\u4f9d\u8d56\u6a21\u578b\u5185\u7f6e\u7684\u5de5\u5177\u8c03\u7528\u529f\u80fd\u3002\u76f8\u53cd\uff0c\u5b83\u8981\u6c42 LLM \u5728\u5b83\u7684 <code>Thought<\/code> \u540e\u9762\uff0c\u81ea\u5df1\u751f\u6210\u4e00\u6bb5\u7279\u5b9a\u683c\u5f0f\u7684\u6587\u672c\uff0c\u6bd4\u5982 <code>Action: search[query]<\/code>\u3002\u7136\u540e\uff0c<code>AgentExecutor<\/code> \u9700\u8981\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u53bb\u89e3\u6790\u8fd9\u6bb5\u6587\u672c\uff0c\u6765\u5f04\u660e\u767d LLM \u60f3\u5e72\u561b\u3002\n<ul>\n<li>\u4f18\u70b9\uff1a\u5b83\u5bf9 LLM \u7684\u8981\u6c42\u66f4\u4f4e\uff0c\u7406\u8bba\u4e0a\u4efb\u4f55\u4e00\u4e2a\u8db3\u591f\u806a\u660e\u7684 LLM \u90fd\u80fd\u901a\u8fc7 Prompt \u5f15\u5bfc\u6765\u4f7f\u7528\u3002<\/li>\n\n\n\n<li>\u7f3a\u70b9\uff1a\u56e0\u4e3a\u4f9d\u8d56\u6587\u672c\u89e3\u6790\uff0c\u6240\u4ee5\u6bd4\u8f83\u8106\u5f31\u3002\u5982\u679c LLM \u7684\u8f93\u51fa\u683c\u5f0f\u7a0d\u6709\u504f\u5dee\uff0c\u89e3\u6790\u5c31\u4f1a\u5931\u8d25\uff0cAgent \u5c31\u4f1a\u5361\u4f4f\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Self-Correction Agent (\u81ea\u6211\u4fee\u6b63 Agent)<\/strong>\uff1a\u8fd9\u662f\u4e00\u4e2a\u66f4\u9ad8\u7ea7\u7684\u4e1c\u897f\u3002Agent \u5728\u6267\u884c\u5b8c\u4e00\u6b65\u540e\uff0c\u4e0d\u4ec5\u4f1a\u89c2\u5bdf\u7ed3\u679c\uff0c\u8fd8\u4f1a\u5bf9\u81ea\u5df1\u521a\u624d\u7684\u884c\u52a8\u8fdb\u884c\u6279\u5224\u6027\u53cd\u601d\u3002\u6bd4\u5982\uff0c\u5b83\u641c\u7d22\u5b8c\u540e\uff0c\u4f1a\u60f3\uff1a\u201c\u6211\u521a\u624d\u7684\u641c\u7d22\u8bcd\u662f\u4e0d\u662f\u592a\u5bbd\u6cdb\u4e86\uff1f\u6211\u5e94\u8be5\u7528\u66f4\u5177\u4f53\u7684\u5173\u952e\u8bcd\u518d\u641c\u4e00\u6b21\u3002\u201d \u8fd9\u79cd Agent \u901a\u5e38\u4f1a\u5305\u542b\u4e00\u4e2a\u6279\u8bc4\u5bb6\uff08Critic\uff09\u7684\u89d2\u8272\uff0c\u8ba9 Agent \u7684\u51b3\u7b56\u8fc7\u7a0b\u66f4\u68d2\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u9009\u62e9\u54ea\u79cd Agent\uff0c\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e\u4f60\u9009\u62e9\u7684 LLM\u3002\u5982\u679c\u4f60\u7528\u7684\u662f OpenAI \u6216 Anthropic \u7684\u6700\u65b0\u6a21\u578b\uff0c\u90a3\u4e48\u5c31\u7528\u5b83\u4eec\u5bf9\u5e94\u7684\u5b98\u65b9\u5de5\u5177\u8c03\u7528 Agent\u3002\u5982\u679c\u7528\u7684\u662f\u67d0\u4e9b\u5f00\u6e90\u6a21\u578b\uff0c\u4f60\u53ef\u80fd\u5c31\u9700\u8981\u9000\u56de\u5230\u66f4\u57fa\u7840\u7684 ReAct \u6a21\u5f0f\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u56db\u3001Agent \u5f00\u53d1\u4e2d\u7684\u5751\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u8fd9\u91cc\u603b\u7ed3\u4e09\u4e2a\u6700\u5178\u578b\u7684\uff0c\u4ea7\u54c1\u7ecf\u7406\u5728\u9a8c\u6536\u65f6\u4e00\u5b9a\u8981\u6ce8\u610f\u3002<\/p>\n\n\n\n<p><strong>\ud83d\udd391. \u9677\u5165\u6b7b\u5faa\u73af<\/strong><\/p>\n\n\n\n<p><strong>\u73b0\u8c61<\/strong>\uff1aAgent \u53cd\u590d\u8c03\u7528\u540c\u4e00\u4e2a\u5de5\u5177\uff0c\u6216\u8005\u5728\u4e24\u4e2a\u5de5\u5177\u4e4b\u95f4\u53cd\u590d\u6a2a\u8df3\uff0c\u76f4\u5230 Token \u8017\u5c3d\u6216\u89e6\u53d1\u8d85\u65f6\u3002<\/p>\n\n\n\n<p><strong>\u539f\u56e0<\/strong>\uff1a<\/p>\n\n\n\n<ul>\n<li>\u5de5\u5177\u8fd4\u56de\u7684\u7ed3\u679c\u592a\u6a21\u7cca\uff0cAgent \u6ca1\u770b\u61c2\uff0c\u4e8e\u662f\u51b3\u5b9a\u518d\u67e5\u4e00\u6b21\u3002<\/li>\n\n\n\n<li>Prompt \u6ca1\u5199\u597d\uff0c\u6ca1\u6709\u544a\u8bc9 Agent \u4f55\u65f6\u5e94\u8be5\u505c\u6b62\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>\u89e3\u6cd5<\/strong>\uff1a<\/p>\n\n\n\n<ul>\n<li>\u8bbe\u7f6e\u6700\u5927\u8fed\u4ee3\u6b21\u6570\uff1a\u5728 <code>AgentExecutor<\/code> \u4e2d\u8bbe\u7f6e <code>max_iterations<\/code>\uff0c\u901a\u5e38\u8bbe\u4e3a 5 \u5230 10\u3002<\/li>\n\n\n\n<li>\u4f18\u5316\u5de5\u5177\u7684\u8fd4\u56de\u503c\uff1a\u5de5\u5177\u8fd4\u56de\u7684\u4e0d\u4ec5\u4ec5\u662f\u6570\u636e\uff0c\u6700\u597d\u5e26\u4e0a\u63cf\u8ff0\u3002\u4f8b\u5982\u4e0d\u8981\u53ea\u8fd4\u56de <code>404<\/code>\uff0c\u8981\u8fd4\u56de <code>\u9519\u8bef\uff1a\u672a\u627e\u5230\u6570\u636e\uff0c\u8bf7\u68c0\u67e5\u62fc\u5199\u6216\u5c1d\u8bd5\u5176\u4ed6\u67e5\u8be2\u6761\u4ef6<\/code>\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd392. \u683c\u5f0f\u89e3\u6790\u9519\u8bef<\/strong><\/p>\n\n\n\n<p><strong>\u73b0\u8c61<\/strong>\uff1a\u6a21\u578b\u60f3\u8c03\u7528\u5de5\u5177\uff0c\u4f46\u751f\u6210\u7684 JSON \u683c\u5f0f\u5c11\u4e86\u4e2a\u62ec\u53f7\uff0c\u6216\u8005\u53c2\u6570\u7c7b\u578b\u4e0d\u5bf9\uff08\u628a\u6570\u5b57\u53d8\u6210\u4e86\u5b57\u7b26\u4e32\uff09\u3002<\/p>\n\n\n\n<p><strong>\u539f\u56e0<\/strong>\uff1a<\/p>\n\n\n\n<ul>\n<li>\u9009\u7528\u7684\u6a21\u578b\u4e0d\u591f\u806a\u660e\uff08\u5982 Llama 3 8B\uff09\uff0c\u6216\u8005\u53c2\u6570\u7ed3\u6784\u592a\u590d\u6742\u3002<\/li>\n\n\n\n<li>\u5c3d\u91cf\u7528 Pydantic \u5f3a\u7c7b\u578b\u5b9a\u4e49\u5de5\u5177\u53c2\u6570\u3002<\/li>\n\n\n\n<li>\u5728 <code>AgentExecutor<\/code> \u4e2d\u5f00\u542f <code>handle_parsing_errors=True<\/code>\u3002\u8fd9\u6837\u5f53\u89e3\u6790\u5931\u8d25\u65f6\uff0cLangChain \u4f1a\u81ea\u52a8\u628a\u9519\u8bef\u4fe1\u606f\u5582\u56de\u7ed9\u6a21\u578b\uff0c\u8ba9\u6a21\u578b\u81ea\u6211\u4fee\u6b63\u91cd\u8bd5\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd393. \u4e0a\u4e0b\u6587\u8d85\u9650 (Context Window Exceeded)<\/strong><\/p>\n\n\n\n<p><strong>\u73b0\u8c61<\/strong>\uff1a\u4efb\u52a1\u8dd1\u4e86\u4e00\u534a\uff0c\u62a5\u9519 \u201cToken limit reached\u201d\u3002<\/p>\n\n\n\n<p><strong>\u539f\u56e0<\/strong>\uff1a<code>agent_scratchpad<\/code> \u91cc\u8bb0\u5f55\u4e86\u6bcf\u4e00\u6b21\u5de5\u5177\u8c03\u7528\u7684\u8f93\u5165\u548c\u8f93\u51fa\u3002\u5982\u679c\u6709\u4e00\u4e2a\u5de5\u5177\u8fd4\u56de\u4e86 5000 \u5b57\u7684\u6587\u6863\uff0c\u641e\u4e2a\u4e24\u8f6e\uff0cToken \u5c31\u7206\u4e86\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u6cd5<\/strong>\uff1a<\/p>\n\n\n\n<ul>\n<li>\u5de5\u5177\u8f93\u51fa\u622a\u65ad\uff1a\u5728\u81ea\u5b9a\u4e49\u5de5\u5177\u5185\u90e8\uff0c\u9650\u5236\u8fd4\u56de\u503c\u7684\u957f\u5ea6\u3002\u5982\u679c\u5185\u5bb9\u592a\u957f\uff0c\u53ea\u8fd4\u56de\u6458\u8981\uff0c\u6216\u8005\u8fd4\u56de \u201c\u5185\u5bb9\u592a\u957f\uff0c\u8bf7\u5206\u6bb5\u8bfb\u53d6\u201d\u3002<\/li>\n\n\n\n<li>\u8bb0\u5fc6\u6e05\u7406\uff1a\u5b9a\u671f\u6e05\u7406\u65e9\u671f\u7684\u601d\u8003\u6b65\u9aa4\uff0c\u53ea\u4fdd\u7559\u6700\u8fd1\u7684 N \u6b65\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e94\u3001\u5bf9 AI \u4ea7\u54c1\u7ecf\u7406\u8bf4\u51e0\u53e5\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\ud83d\udd395.1. AI \u4ea7\u54c1\u7ecf\u7406\u5728 Agent \u5f00\u53d1\u4e2d\u7684\u6838\u5fc3\u4ef7\u503c<\/strong><\/p>\n\n\n\n<p>\u770b\u5230\u8fd9\u91cc\uff0c\u4f60\u53ef\u80fd\u4f1a\u89c9\u5f97 Agent \u7684\u5f00\u53d1\u975e\u5e38\u6280\u672f\u5316\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u4e00\u4e2a Agent \u7684\u6210\u8d25\uff0c\u4ea7\u54c1\u7ecf\u7406\u5728\u5176\u4e2d\u626e\u6f14\u7740\u81f3\u5173\u91cd\u8981\u7684\u3001\u4e0d\u53ef\u66ff\u4ee3\u7684\u89d2\u8272\u3002\u6211\u4eec\u4e0d\u80fd\u53ea\u662f \u201c\u9700\u6c42\u63d0\u51fa\u8005\u201d\uff0c\u800c\u662f \u201c\u7cfb\u7edf\u8bbe\u8ba1\u5e08\u201d\u3002<\/p>\n\n\n\n<p>\u4f60\u7684\u6838\u5fc3\u5de5\u4f5c\uff0c\u4f53\u73b0\u5728\u4ee5\u4e0b\u56db\u4e2a\u65b9\u9762\uff1a<\/p>\n\n\n\n<ul>\n<li><strong>1. \u5de5\u5177\u7684\u7b56\u5212\u4e0e\u8bbe\u8ba1<\/strong>\n<ul>\n<li>Agent \u7684\u80fd\u529b\u8fb9\u754c\uff0c\u5b8c\u5168\u7531\u4f60\u4e3a\u5b83\u9009\u62e9\u7684\u5de5\u5177\u51b3\u5b9a\u3002\u4f60\u7684\u9996\u8981\u5de5\u4f5c\uff0c\u5c31\u662f\u601d\u8003\uff1a\u201c\u4e3a\u4e86\u5b8c\u6210\u8fd9\u4e2a\u5b8f\u5927\u7684\u4e1a\u52a1\u76ee\u6807\uff0c\u6211\u7684 Agent \u9700\u8981\u5177\u5907\u54ea\u4e9b\u539f\u5b50\u80fd\u529b\uff1f\u201d<\/li>\n\n\n\n<li>\u4f60\u8981\u548c\u5f00\u53d1\u56e2\u961f\u4e00\u8d77\uff0c\u76d8\u70b9\u516c\u53f8\u73b0\u6709\u7684 API\uff0c\u6216\u8005\u8bbe\u8ba1\u65b0\u7684 API\uff0c\u7136\u540e\u5c06\u5b83\u4eec\u5c01\u88c5\u6210 Agent \u53ef\u4ee5\u7406\u89e3\u7684 Tool\u3002<\/li>\n\n\n\n<li>\u5bf9\u4e8e\u6bcf\u4e2a\u5de5\u5177\uff0c\u4f60\u5fc5\u987b\u4eb2\u81ea\u64b0\u5199\u6216\u5ba1\u6838\u5b83\u7684<code>description<\/code>\uff08\u8fd9\u4e00\u70b9\u81f3\u5173\u91cd\u8981\uff09\u3002\u8fd9\u4e2a\u63cf\u8ff0\uff0c\u5c31\u662f Agent \u7684\u5de5\u5177\u4f7f\u7528\u8bf4\u660e\u4e66\uff0c\u662f\u4f60\u5411 AI \u63d0\u9700\u6c42\u7684\u6700\u76f4\u63a5\u65b9\u5f0f\u3002\u4e00\u4e2a\u6a21\u7cca\u7684\u63cf\u8ff0\uff0c\u4f1a\u5bfc\u81f4 Agent \u5728\u5173\u952e\u65f6\u523b\u9009\u62e9\u56f0\u96be\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<ul>\n<li><strong>2. \u7cfb\u7edf\u63d0\u793a\u7684\u8bbe\u8ba1<\/strong>\n<ul>\n<li>Agent \u7684\u7cfb\u7edf\u63d0\u793a\uff0c\u5c31\u662f\u8fd9\u4e2a\u667a\u80fd\u4f53\u7684\u5e95\u5c42\u5b9a\u4e49\u3002\u5b83\u5b9a\u4e49\u4e86 Agent \u7684\u8eab\u4efd\u3001\u6027\u683c\u3001\u7ec8\u6781\u76ee\u6807\u3001\u884c\u4e3a\u51c6\u5219\uff0c\u4ee5\u53ca\u5728\u9047\u5230\u56f0\u96be\u65f6\u7684\u5904\u7406\u7b56\u7565\u3002<\/li>\n\n\n\n<li>\u6bd4\u5982\uff0c\u4f60\u53ef\u4ee5\u89c4\u5b9a\uff1a\u201c\u4f60\u662f\u4e00\u4e2a\u6781\u5176\u6ce8\u91cd\u6210\u672c\u7684\u52a9\u624b\uff0c\u5728\u8c03\u7528\u4efb\u4f55\u6602\u8d35\u7684\u5de5\u5177\u524d\uff0c\u5fc5\u987b\u5148\u7528\u514d\u8d39\u5de5\u5177\u786e\u8ba4\u5fc5\u8981\u6027\u3002\u201d \u6216\u8005\uff0c\u201c\u4f60\u5fc5\u987b\u65f6\u523b\u4fdd\u62a4\u7528\u6237\u9690\u79c1\uff0c\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\u90fd\u4e0d\u80fd\u7d22\u8981\u6216\u8bb0\u5f55\u4e2a\u4eba\u8eab\u4efd\u4fe1\u606f\u3002\u201d<\/li>\n\n\n\n<li>\u8fd9\u4efd\u300a\u8bf4\u660e\u4e66\u300b\u7684\u64b0\u5199\uff0c\u662f\u7eaf\u7cb9\u7684\u4ea7\u54c1\u8bbe\u8ba1\u5de5\u4f5c\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<ul>\n<li><strong>3. \u5931\u8d25\u6848\u4f8b\u7684\u5206\u6790\u4e0e\u8fed\u4ee3<\/strong>\n<ul>\n<li>Agent \u4e00\u5b9a\u4f1a\u72af\u9519\u3002\u5b83\u53ef\u80fd\u4f1a\u9009\u9519\u5de5\u5177\uff0c\u53ef\u80fd\u4f1a\u9677\u5165\u6b7b\u5faa\u73af\uff0c\u53ef\u80fd\u4f1a\u9519\u8bef\u5730\u89e3\u6790\u5de5\u5177\u7684\u8f93\u51fa\u3002<\/li>\n\n\n\n<li>\u4f60\u7684\u5de5\u4f5c\uff0c\u5c31\u662f\u548c\u5f00\u53d1\u4e00\u8d77\uff0c\u4e00\u5934\u624e\u8fdb LangSmith \u7684\u65e5\u5fd7\u91cc\uff0c\u53bb\u590d\u76d8\u90a3\u4e9b\u5931\u8d25\u7684 Trace\u3002\u4f60\u5f97\u9605\u8bfb Agent \u7684\u65e5\u5fd7\uff0c\u627e\u5230\u5b83\u5728\u54ea\u4e00\u6b65\u72af\u4e86\u9519\u8bef\u3002<\/li>\n\n\n\n<li>\u662f\u56e0\u4e3a\u5de5\u5177\u63cf\u8ff0\u6709\u6b67\u4e49\uff1f\u8fd8\u662f\u7cfb\u7edf\u63d0\u793a\u6709\u6f0f\u6d1e\uff1f\u8fd8\u662f LLM \u672c\u8eab\u80fd\u529b\u4e0d\u8db3\uff1f\u627e\u5230\u6839\u56e0\uff0c\u7136\u540e\u8fed\u4ee3\u4f60\u7684\u5de5\u5177\u63cf\u8ff0\u6216\u7cfb\u7edf\u63d0\u793a\uff0c\u5c31\u662f\u4f60\u9a71\u52a8 Agent \u4e0d\u65ad\u8fdb\u5316\u7684\u6838\u5fc3\u65b9\u6cd5\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<ul>\n<li>4. \u5b9a\u4e49\u6210\u529f\u7684\u6807\u51c6\uff1a\u5982\u4f55\u8861\u91cf\u4e00\u4e2a Agent \u7684\u597d\u574f\uff1f\u6700\u7ec8\u7b54\u6848\u7684\u6b63\u786e\u6027\u53ea\u662f\u5176\u4e2d\u4e4b\u4e00\u3002\u4f60\u8fd8\u9700\u8981\u5b9a\u4e49\u4e00\u7cfb\u5217\u8fc7\u7a0b\u6307\u6807\uff1a\n<ul>\n<li><strong>\u4efb\u52a1\u5b8c\u6210\u7387 (Task Completion Rate)<\/strong>\uff1a\u5728\u591a\u5c11\u6bd4\u4f8b\u7684\u60c5\u51b5\u4e0b\uff0cAgent \u80fd\u591f\u72ec\u7acb\u5b8c\u6210\u4efb\u52a1\u800c\u4e0d\u9700\u8981\u4eba\u5de5\u5e72\u9884\uff1f<\/li>\n\n\n\n<li><strong>\u6267\u884c\u6b65\u6570 (Number of Steps)<\/strong>\uff1a\u5b8c\u6210\u4e00\u4e2a\u4efb\u52a1\u5e73\u5747\u9700\u8981\u591a\u5c11\u6b65\uff1f\u6b65\u6570\u8d8a\u5c11\uff0c\u901a\u5e38\u610f\u5473\u7740\u6548\u7387\u8d8a\u9ad8\uff0c\u6210\u672c\u8d8a\u4f4e\u3002<\/li>\n\n\n\n<li><strong>\u5de5\u5177\u9009\u62e9\u51c6\u786e\u7387 (Tool Selection Accuracy)<\/strong>\uff1aAgent \u9009\u62e9\u5de5\u5177\u7684\u51b3\u7b56\u662f\u5426\u603b\u662f\u6700\u4f18\u7684\uff1f<\/li>\n\n\n\n<li><strong>\u6210\u672c\u6548\u76ca (Cost-Effectiveness)<\/strong>\uff1a\u5b8c\u6210\u4e00\u6b21\u4efb\u52a1\u7684\u5e73\u5747 API \u8c03\u7528\u6210\u672c\u662f\u591a\u5c11\uff1f<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd395.2. \u4ea7\u54c1\u7ecf\u7406\u7684\u8bbe\u8ba1\u5fc3\u6cd5<\/strong><\/p>\n\n\n\n<p>\u5f00\u53d1 Agent \u4e0d\u4ec5\u4ec5\u662f\u5199\u4ee3\u7801\uff0c\u66f4\u591a\u7684\u662f\u8bbe\u8ba1\u8ba4\u77e5\u6d41\u7a0b\u3002\u4f5c\u4e3a PM\uff0c\u4f60\u5728\u5199 Agent \u7684 PRD \u65f6\uff0c\u4e0d\u8981\u53ea\u5199 \u201c\u5b9e\u73b0\u4e00\u4e2a\u67e5\u8be2\u52a9\u624b\u201d\u3002\u4f60\u8981\u5b9a\u4e49\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>\u5de5\u5177\u8fb9\u754c<\/strong>\uff1a\u660e\u786e Agent \u80fd\u5e72\u4ec0\u4e48\uff0c\u4e0d\u80fd\u5e72\u4ec0\u4e48\u3002\u7ed9\u5de5\u5177\u7684 Description \u8d8a\u6e05\u6670\uff0cAgent \u8d8a\u806a\u660e\u3002<\/li>\n\n\n\n<li><strong>\u9519\u8bef\u515c\u5e95<\/strong>\uff1a\u5f53 Agent \u67e5\u4e0d\u5230\u6570\u636e\u65f6\uff0c\u662f\u76f4\u63a5\u56de\u590d \u201c\u4e0d\u77e5\u9053\u201d\uff0c\u8fd8\u662f\u5f15\u5bfc\u7528\u6237\u6362\u4e2a\u95ee\u6cd5\uff1f<\/li>\n\n\n\n<li><strong>\u6743\u9650\u63a7\u5236<\/strong>\uff1a\u6d89\u53ca\u4fee\u6539\u6570\u636e\uff08\u589e\u5220\u6539\uff09\u7684\u64cd\u4f5c\uff0c\u5fc5\u987b\u52a0\u5165 Human-in-the-loop\uff08\u4eba\u7c7b\u786e\u8ba4\uff09\u73af\u8282\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u603b\u7ed3\uff1a\u6b22\u8fce\u6765\u5230 \u201c\u667a\u80fd\u4f53\u4e3a\u738b\u201d \u7684\u65f6\u4ee3\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>LangChain \u7684 Agent \u5f00\u53d1\u5176\u5b9e\u5c31\u662f <strong>\u201cPrompt \u5de5\u7a0b + \u5de5\u5177\u51fd\u6570\u5f00\u53d1 + \u5faa\u73af\u63a7\u5236\u201d<\/strong> \u7684\u7ec4\u5408\u3002<\/p>\n\n\n\n<p>\u73b0\u5728\u7684 Agent \u8fd8\u5904\u4e8e \u201c\u5b9e\u4e60\u751f\u201d \u9636\u6bb5\uff0c\u4f60\u5fc5\u987b\u7ed9\u5b83\u660e\u786e\u7684<strong>\u624b\u518c\uff08Prompt\uff09<\/strong>\u3001\u8d81\u624b\u7684<strong>\u5de5\u5177\uff08Tools\uff09\u548c\u4e25\u683c\u7684\u76d1\u7763\uff08Guardrails\uff09<\/strong>\uff0c\u5b83\u624d\u80fd\u4ece\u4e00\u4e2a\u53ea\u4f1a\u804a\u5929\u7684 Chatbot\uff0c\u8fdb\u5316\u6210\u771f\u6b63\u80fd\u89e3\u51b3\u95ee\u9898\u7684\u6570\u5b57\u5458\u5de5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\uff1a\u5c0f\u7ea2\u4e66 AI\u4ea7\u54c1\u8d75\u54e5 \u524d\u8a00\ud83d\udd16 \u8fd9\u662f LangChain \u7cfb\u5217\u7b14\u8bb0\u7684\u7b2c\u5341\u7bc7\u3002\u5982\u679c\u8bf4 RAG \u89e3\u51b3\u4e86\u5927\u6a21\u578b\u8bb0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/20327"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20327"}],"version-history":[{"count":5,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/20327\/revisions"}],"predecessor-version":[{"id":20332,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/20327\/revisions\/20332"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}