{"id":92256,"date":"2026-08-09T21:24:50","date_gmt":"2026-08-09T13:24:50","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/92256.html"},"modified":"2026-08-09T21:24:50","modified_gmt":"2026-08-09T13:24:50","slug":"langchain-1-0-%e4%b8%ad%e9%97%b4%e4%bb%b6%e9%80%9a%e5%85%b3%e6%8c%87%e5%8d%97%ef%bc%9a%e4%bb%8e%e5%bc%82%e6%ad%a5%e5%9f%ba%e7%9f%b3%e5%88%b0%e7%94%9f%e4%ba%a7%e7%ba%a7%e4%b8%89%e5%a4%a7%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/92256.html","title":{"rendered":"LangChain 1.0 \u4e2d\u95f4\u4ef6\u901a\u5173\u6307\u5357\uff1a\u4ece\u5f02\u6b65\u57fa\u77f3\u5230\u751f\u4ea7\u7ea7\u4e09\u5927\u4ef6(\u5341\u4e00)"},"content":{"rendered":"<h3>&#x1f680; \u5f00\u7bc7&#xff1a;\u522b\u8ba9\u4f60\u7684Agent&#034;\u6392\u961f\u529e\u4e8b&#034;<\/h3>\n<p>\u5f88\u591a\u670b\u53cb\u5199\u667a\u80fd\u4f53&#xff0c;\u5f80\u5f80\u5361\u5728\u4e24\u6b65&#xff1a;<\/p>\n<table>\n<tr>\u95ee\u9898\u8868\u8c61\u6839\u56e0<\/tr>\n<tbody>\n<tr>\n<td>\u7a0b\u5e8f\u8dd1\u5f97\u6162<\/td>\n<td>\u4e0b\u8f7d3\u5f20\u56fe\u82b1\u4e866\u79d2<\/td>\n<td>\u540c\u6b65I\/O&#xff0c;CPU\u5728\u7b49&#xff0c;\u7ebf\u7a0b\u5728\u7761<\/td>\n<\/tr>\n<tr>\n<td>\u9879\u76ee\u6ca1\u6cd5\u4e0a\u7ebf<\/td>\n<td>\u5bf9\u8bdd\u7206\u4e0a\u4e0b\u6587\u3001\u5de5\u5177\u88ab\u6ee5\u7528\u3001\u51fa\u95ee\u9898\u6ca1\u65e5\u5fd7<\/td>\n<td>\u7f3a\u5c11\u4e2d\u95f4\u4ef6\u6cbb\u7406<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5f02\u6b65\u89e3\u51b3\u7b2c\u4e00\u4e2a\u95ee\u9898&#xff0c;\u4e2d\u95f4\u4ef6\u89e3\u51b3\u7b2c\u4e8c\u4e2a\u95ee\u9898\u3002<\/p>\n<p>\u4eca\u5929\u54b1\u4eec\u5c31\u628a\u540c\u6b65\/\u5f02\u6b65\u3001MCP\u3001\u4e2d\u95f4\u4ef6\u8fd9\u4e09\u4e2a\u786c\u9aa8\u5934&#xff0c;\u4e00\u6b21\u5543\u900f\u3002<\/p>\n<hr \/>\n<h3>&#x1f4e6; \u7b2c\u4e00\u90e8\u5206&#xff1a;\u5730\u57fa\u2014\u2014Python\u5f02\u6b65&#xff0c;\u4e0d\u662f&#034;\u591a\u7ebf\u7a0b&#034;\u7684\u5e73\u66ff<\/h3>\n<p>\u26a0\ufe0f\u00a0\u6838\u5fc3\u8ba4\u77e5&#xff1a;\u00a0\u5f02\u6b65\u662f\u5355\u7ebf\u7a0b\u4efb\u52a1\u8c03\u5ea6&#xff0c;\u4e0d\u662f\u5e76\u884c\u8ba1\u7b97\u3002<\/p>\n<h4>&#x1f538; \u540c\u6b65 &#061; \u6392\u961f\u529e\u4e8b<\/h4>\n<p>import time<br \/>\ntime.sleep(2)  # CPU\u5728\u8fd9\u5e72\u77aa\u773c&#xff0c;\u7ebf\u7a0b\u88ab\u963b\u585e<\/p>\n<p>\u4efb\u52a1\u6309\u987a\u5e8f\u6267\u884c&#xff0c;\u524d\u4e00\u4e2aI\/O\u6ca1\u5b8c&#xff0c;\u540e\u9762\u7684\u53ea\u80fd\u7b49\u7740\u3002<\/p>\n<h4>&#x1f538; \u5f02\u6b65 &#061; \u53eb\u53f7\u7cfb\u7edf<\/h4>\n<p>import asyncio<br \/>\nawait asyncio.sleep(2)  # \u91ca\u653e\u7ebf\u7a0b&#xff0c;CPU\u53bb\u5904\u7406\u5176\u4ed6\u4efb\u52a1<\/p>\n<p>\u63d0\u4ea4\u4efb\u52a1\u540e\u4e0d\u7528\u50bb\u7b49&#xff0c;I\/O\u5b8c\u6210\u4e86\u4f1a\u81ea\u52a8\u901a\u77e5\u4f60\u3002<\/p>\n<h4>&#x1f4ca; \u4e00\u56fe\u770b\u61c2\u533a\u522b<\/h4>\n<table>\n<tr>\u5bf9\u6bd4\u9879\u540c\u6b65\u5f02\u6b65<\/tr>\n<tbody>\n<tr>\n<td>\u6267\u884c\u65b9\u5f0f<\/td>\n<td>\u987a\u5e8f\u6267\u884c<\/td>\n<td>\u4efb\u52a1\u7a7f\u63d2<\/td>\n<\/tr>\n<tr>\n<td>CPU\u72b6\u6001<\/td>\n<td>\u7a7a\u95f2\u7b49\u5f85<\/td>\n<td>\u5fd9\u4e2a\u4e0d\u505c<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u573a\u666f<\/td>\n<td>CPU\u5bc6\u96c6\u578b<\/td>\n<td>I\/O\u5bc6\u96c6\u578b<\/td>\n<\/tr>\n<tr>\n<td>\u5178\u578b\u5e94\u7528<\/td>\n<td>\u6570\u5b66\u8ba1\u7b97<\/td>\n<td>\u722c\u866b\u3001API\u8c03\u7528<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f3af;\u00a0\u8bb0\u4f4f\u4e00\u53e5\u8bdd&#xff1a;\u00a0\u5f02\u6b65\u4e0d\u662f\u8ba9\u7a0b\u5e8f&#034;\u8dd1\u5f97\u66f4\u5feb&#034;&#xff0c;\u800c\u662f\u8ba9\u7a0b\u5e8f&#034;\u5fd9\u8d77\u6765\u4e0d\u95f2\u7740&#034;\u3002<\/p>\n<hr \/>\n<h3>&#x1f50c; \u7b2c\u4e8c\u90e8\u5206&#xff1a;MCP\u534f\u8bae\u2014\u2014Agent\u4e16\u754c\u7684&#034;USB\u63a5\u53e3&#034;<\/h3>\n<p>\u6709\u4e86\u5f02\u6b65\u8c03\u5ea6&#xff0c;\u63a5\u4e0b\u6765\u89e3\u51b3\u5de5\u5177\u600e\u4e48\u63a5\u7684\u95ee\u9898\u3002<\/p>\n<h4>\u4ee5\u524d\u600e\u4e48\u63a5\u5de5\u5177&#xff1f;<\/h4>\n<p># \u6bcf\u4e2a\u5de5\u5177\u90fd\u8981\u5199\u5b9a\u5236\u4ee3\u7801<br \/>\ndef call_weather_api(city):<br \/>\n    # \u5b9a\u5236HTTP\u8bf7\u6c42&#8230;<\/p>\n<p>def call_database_query(sql):<br \/>\n    # \u5b9a\u5236\u6570\u636e\u5e93\u8fde\u63a5&#8230;<\/p>\n<p>\u6362\u4e00\u4e2aAgent\u6846\u67b6&#xff0c;\u5168\u90e8\u91cd\u5199\u3002<\/p>\n<h4>\u73b0\u5728\u7528MCP<\/h4>\n<p>MCP &#061;\u00a0\u6a21\u578b\u4e0a\u4e0b\u6587\u534f\u8bae&#xff0c;\u6807\u51c6\u5316\u5de5\u5177\u7684\u5b9a\u4e49\u548c\u8c03\u7528\u3002<\/p>\n<p>from langchain_mcp_adapters.client import MultiServerMCPClient<\/p>\n<p>client &#061; MultiServerMCPClient({<br \/>\n    &#034;weather&#034;: {<br \/>\n        &#034;transport&#034;: &#034;streamable_http&#034;,<br \/>\n        &#034;url&#034;: &#034;http:\/\/localhost:8000\/mcp&#034;<br \/>\n    },<br \/>\n    &#034;math&#034;: {<br \/>\n        &#034;transport&#034;: &#034;stdio&#034;,<br \/>\n        &#034;command&#034;: &#034;python&#034;,<br \/>\n        &#034;args&#034;: [&#034;math_server.py&#034;]<br \/>\n    }<br \/>\n})<br \/>\ntools &#061; await client.get_tools()  # \u4e00\u628a\u68ad&#xff0c;\u5168\u91cf\u62c9\u53d6<\/p>\n<h4>MCP\u4e24\u79cd\u4f20\u8f93\u65b9\u5f0f<\/h4>\n<table>\n<tr>\u4f20\u8f93\u65b9\u5f0f\u9002\u7528\u573a\u666f\u7279\u70b9<\/tr>\n<tbody>\n<tr>\n<td>stdio<\/td>\n<td>\u672c\u5730\u5de5\u5177<\/td>\n<td>\u5b50\u8fdb\u7a0b\u62c9\u8d77&#xff0c;\u4f4e\u5ef6\u8fdf<\/td>\n<\/tr>\n<tr>\n<td>HTTP<\/td>\n<td>\u8de8\u670d\u52a1\u8c03\u7528<\/td>\n<td>\u7f51\u7edc\u66b4\u9732&#xff0c;\u53ef\u5206\u5e03\u5f0f\u90e8\u7f72<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f3af;\u00a0MCP\u6700\u5927\u4ef7\u503c&#xff1a;\u00a0\u5de5\u5177\u72ec\u7acb\u90e8\u7f72\u3001\u72ec\u7acb\u5347\u7ea7&#xff0c;Agent\u53ea\u7ba1\u8c03\u7528&#xff0c;\u89e3\u8026&#xff01;<\/p>\n<hr \/>\n<h3>&#x1f6e1;\ufe0f \u7b2c\u4e09\u90e8\u5206&#xff1a;\u4e2d\u95f4\u4ef6\u2014\u2014Agent\u7684&#034;\u751f\u4ea7\u7ea7\u62a4\u57ce\u6cb3&#034;&#xff08;\u91cd\u70b9&#xff09;<\/h3>\n<p>\u5982\u679c\u8bf4\u5f02\u6b65\u662f\u53d1\u52a8\u673a&#xff0c;MCP\u662f\u63a5\u53e3&#xff0c;\u90a3\u4e2d\u95f4\u4ef6\u5c31\u662f\u4fdd\u969c\u7cfb\u7edf\u7a33\u5b9a\u3001\u5408\u89c4\u3001\u53ef\u9760\u7684&#034;\u62a4\u57ce\u6cb3&#034;\u3002<\/p>\n<p>LangChain 1.0\u7684\u4e2d\u95f4\u4ef6\u5206\u4e09\u5927\u7c7b&#xff1a;<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502           \u4e2d\u95f4\u4ef6\u4e09\u5927\u4ef6                        \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502  1. \u9884\u7f6e\u4e2d\u95f4\u4ef6  \u2502  \u5f00\u7bb1\u5373\u7528&#xff0c;\u914d\u7f6e\u5c31\u884c        \u2502<br \/>\n\u2502  2. \u88c5\u9970\u5668\u4e2d\u95f4\u4ef6 \u2502  \u8f7b\u91cf\u7ea7\u5207\u9762&#xff0c;\u4e00\u4e2a\u6ce8\u89e3\u641e\u5b9a   \u2502<br \/>\n\u2502  3. \u7c7b\u4e2d\u95f4\u4ef6     \u2502  \u590d\u6742\u903b\u8f91&#xff0c;\u7ec4\u5408\u94a9\u5b50        \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<hr \/>\n<h4>&#x1f538; 1. \u9884\u7f6e\u4e2d\u95f4\u4ef6&#xff1a;\u5f00\u7bb1\u5373\u7528\u7684&#034;\u5b89\u5168\u9600&#034;<\/h4>\n<h5>\u2460 SummarizationMiddleware&#xff08;\u81ea\u52a8\u6458\u8981&#xff09;<\/h5>\n<p>\u5bf9\u8bdd\u4e00\u957f\u5c31\u7206\u4e0a\u4e0b\u6587\u7a97\u53e3&#xff1f;\u8fd9\u4e2a\u4e2d\u95f4\u4ef6\u81ea\u52a8\u538b\u7f29\u65e9\u671f\u5386\u53f2\u3002<\/p>\n<p>from langchain.agents.middleware import SummarizationMiddleware<\/p>\n<p>agent &#061; create_agent(<br \/>\n    model&#061;&#034;gpt-4&#034;,<br \/>\n    tools&#061;[&#8230;],<br \/>\n    middleware&#061;[SummarizationMiddleware(<br \/>\n        trigger&#061;(&#034;tokens&#034;, 1000),   # \u8d85\u8fc71000 token\u89e6\u53d1<br \/>\n        keep&#061;(&#034;messages&#034;, 5)         # \u4fdd\u7559\u6700\u8fd15\u6761<br \/>\n    )]<br \/>\n)<\/p>\n<p>\u539f\u7406&#xff1a;\u00a0\u524d15\u8f6e\u5bf9\u8bdd \u2192 \u538b\u7f29\u6210&#034;\u7528\u6237\u8be2\u95ee\u4e86\u9000\u8d27\u653f\u7b56&#034; \u2192 \u7701Token\u3001\u7701\u6210\u672c\u3002<\/p>\n<hr \/>\n<h5>\u2461 Human-in-the-loop&#xff08;\u4eba\u5de5\u5ba1\u6838&#xff09;<\/h5>\n<p>delete_file\u3001send_email\u8fd9\u7c7b\u64cd\u4f5c&#xff0c;\u5fc5\u987b\u4eba\u70b9\u5934\u624d\u80fd\u6267\u884c\u3002<\/p>\n<p>from langchain.agents.middleware import HumanInTheLoopMiddleware<\/p>\n<p>agent &#061; create_agent(<br \/>\n    model&#061;&#034;gpt-4&#034;,<br \/>\n    tools&#061;[dangerous_tool],<br \/>\n    middleware&#061;[HumanInTheLoopMiddleware(<br \/>\n        tools&#061;[&#034;dangerous_write&#034;],<br \/>\n        interrupt&#061;True<br \/>\n    )],<br \/>\n    checkpointer&#061;InMemorySaver()  # \u26a0\ufe0f \u5fc5\u987b\u6709&#xff0c;\u5426\u5219\u72b6\u6001\u4e22\u5931<br \/>\n)<\/p>\n<p>\u4e09\u79cd\u51b3\u7b56&#xff1a;<\/p>\n<table>\n<tr>\u51b3\u7b56\u6548\u679c<\/tr>\n<tbody>\n<tr>\n<td>\u2705 approve<\/td>\n<td>\u6279\u51c6\u6267\u884c<\/td>\n<\/tr>\n<tr>\n<td>\u270f\ufe0f edit<\/td>\n<td>\u4fee\u6539\u53c2\u6570\u540e\u6267\u884c<\/td>\n<\/tr>\n<tr>\n<td>\u274c reject<\/td>\n<td>\u62d2\u7edd\u6267\u884c&#xff0c;\u8fd4\u56de\u63d0\u793a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u26a0\ufe0f\u00a0\u8e29\u5751\u63d0\u9192&#xff1a;\u00a0HITL\u5fc5\u987b\u914d\u5408checkpointer&#xff0c;\u5426\u5219\u4e2d\u65ad\u540e\u65e0\u6cd5\u6062\u590d\u3002<\/p>\n<hr \/>\n<h4>&#x1f538; 2. \u88c5\u9970\u5668\u4e2d\u95f4\u4ef6&#xff1a;\u8f7b\u91cf\u7ea7&#034;\u5207\u9762&#034;<\/h4>\n<p>\u53ea\u60f3\u5728\u67d0\u4e2a\u8282\u70b9\u63d2\u4e00\u811a&#xff08;\u8bb0\u65e5\u5fd7\u3001\u6821\u9a8c\u8f93\u5165&#xff09;&#xff1f;\u4e00\u4e2a\u6ce8\u89e3\u641e\u5b9a\u3002<\/p>\n<h5>\u94a9\u5b50\u5206\u7c7b<\/h5>\n<table>\n<tr>\u7c7b\u578b\u88c5\u9970\u5668\u89e6\u53d1\u65f6\u673a<\/tr>\n<tbody>\n<tr>\n<td>\u8282\u70b9\u5f0f<\/td>\n<td>&#064;before_agent<\/td>\n<td>Agent\u6267\u884c\u524d<\/td>\n<\/tr>\n<tr>\n<td>\u8282\u70b9\u5f0f<\/td>\n<td>&#064;after_model<\/td>\n<td>\u6a21\u578b\u54cd\u5e94\u540e<\/td>\n<\/tr>\n<tr>\n<td>\u5305\u88f9\u5f0f<\/td>\n<td>&#064;wrap_tool_call<\/td>\n<td>\u5de5\u5177\u8c03\u7528\u524d\u540e<\/td>\n<\/tr>\n<tr>\n<td>\u4fbf\u6377\u5f0f<\/td>\n<td>&#064;dynamic_prompt<\/td>\n<td>\u52a8\u6001\u4fee\u6539\u63d0\u793a\u8bcd<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>\u5b9e\u6218&#xff1a;\u62e6\u622a\u654f\u611f\u8bcd<\/h5>\n<p>from langchain.agents.middleware import after_model<\/p>\n<p>&#064;after_model<br \/>\ndef block_sensitive_words(state, response):<br \/>\n    if &#034;BLOCKED_CN&#034; in response[&#034;output&#034;]:<br \/>\n        return {&#034;output&#034;: &#034;\u26a0\ufe0f \u68c0\u6d4b\u5230\u8fdd\u89c4\u5185\u5bb9&#xff0c;\u5df2\u7ec8\u6b62\u8f93\u51fa\u3002&#034;}<br \/>\n    return response<\/p>\n<hr \/>\n<h4>&#x1f538; 3. \u7c7b\u4e2d\u95f4\u4ef6&#xff1a;\u590d\u6742\u903b\u8f91\u7684&#034;\u6838\u6b66\u5668&#034;<\/h4>\n<p>\u9700\u8981\u7ec4\u5408\u591a\u4e2a\u94a9\u5b50\u3001\u7ef4\u62a4\u72b6\u6001&#xff1f;\u7ee7\u627fAgentMiddleware\u3002<\/p>\n<p>class LoggingMiddleware(AgentMiddleware):<br \/>\n    def before_agent(self, state, runtime):<br \/>\n        print(f&#034;[{time.time()}] Agent\u5f00\u59cb\u6267\u884c&#034;)<\/p>\n<p>    def after_agent(self, state, runtime):<br \/>\n        print(f&#034;[{time.time()}] Agent\u6267\u884c\u5b8c\u6bd5&#034;)<\/p>\n<p>\u5173\u952e\u89c4\u5219&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u2705 \u5fc5\u987b\u7ee7\u627fAgentMiddleware<\/p>\n<\/li>\n<li>\n<p>\u2705 \u65b9\u6cd5\u540d\u56fa\u5b9a&#xff1a;before_agent\u3001after_model\u7b49<\/p>\n<\/li>\n<li>\n<p>\u2705 \u6bcf\u6b21\u8c03\u7528\u8981new\u5bf9\u8c61&#xff0c;\u4e0d\u8981\u4f20\u7c7b<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h4>&#x1f504; \u4e2d\u95f4\u4ef6\u6267\u884c\u987a\u5e8f&#xff1a;&#034;\u6d0b\u8471\u6a21\u578b&#034;<\/h4>\n<p>\u591a\u4e2a\u4e2d\u95f4\u4ef6\u5171\u5b58\u65f6&#xff0c;\u6267\u884c\u987a\u5e8f\u662f\u5148\u5165\u540e\u51fa&#xff1a;<\/p>\n<p>\u6ce8\u518c&#xff1a;[A, B, C]<\/p>\n<p>\u6267\u884c\u6d41\u7a0b&#xff1a;<br \/>\nbefore_A \u2192 before_B \u2192 before_C \u2192 \u3010\u6838\u5fc3\u8c03\u7528\u3011 \u2192 after_C \u2192 after_B \u2192 after_A<\/p>\n<p>\u5b9e\u6218\u5efa\u8bae&#xff1a;<\/p>\n<table>\n<tr>\u4f18\u5148\u7ea7\u4e2d\u95f4\u4ef6\u7c7b\u578b\u7406\u7531<\/tr>\n<tbody>\n<tr>\n<td>\u6700\u5916\u5c42<\/td>\n<td>\u5b89\u5168\u7c7b&#xff08;HITL&#xff09;<\/td>\n<td>\u5148\u5b89\u68c0&#xff0c;\u540e\u5e72\u6d3b<\/td>\n<\/tr>\n<tr>\n<td>\u4e2d\u95f4\u5c42<\/td>\n<td>\u65e5\u5fd7\u7c7b<\/td>\n<td>\u8bb0\u5f55\u5b8c\u6574\u94fe\u8def<\/td>\n<\/tr>\n<tr>\n<td>\u6700\u5185\u5c42<\/td>\n<td>\u6027\u80fd\u7c7b&#xff08;Summarization&#xff09;<\/td>\n<td>\u6700\u540e\u4f18\u5316\u4e0a\u4e0b\u6587<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u26a0\ufe0f \u7b2c\u56db\u90e8\u5206&#xff1a;\u907f\u5751\u6307\u5357\u2014\u2014\u4e09\u4e2a\u81f4\u547d\u8bef\u533a<\/h3>\n<table>\n<tr>\u8bef\u533a\u6b63\u786e\u7406\u89e3\u540e\u679c<\/tr>\n<tbody>\n<tr>\n<td>\u5f02\u6b65&#061;\u591a\u7ebf\u7a0b<\/td>\n<td>\u5f02\u6b65\u662f\u5355\u7ebf\u7a0b\u8c03\u5ea6<\/td>\n<td>\u6df7\u7528\u6982\u5ff5&#xff0c;\u4ee3\u7801\u5199\u9519<\/td>\n<\/tr>\n<tr>\n<td>\u5f02\u6b65\u91cc\u7528\u540c\u6b65\u5e93<\/td>\n<td>async\u91cc\u4e0d\u80fd\u7528requests<\/td>\n<td>\u7ebf\u7a0b\u963b\u585e&#xff0c;\u5f02\u6b65\u5931\u6548<\/td>\n<\/tr>\n<tr>\n<td>\u4e2d\u95f4\u4ef6\u987a\u5e8f\u4e71\u653e<\/td>\n<td>HITL\u5fc5\u987b\u5728\u6700\u5916\u5c42<\/td>\n<td>\u5b89\u5168\u6f0f\u6d1e&#xff0c;\u654f\u611f\u64cd\u4f5c\u6f0f\u5ba1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f3af;\u00a0\u8bb0\u4f4f&#xff1a;\u00a0\u5f02\u6b65\u89e3\u51b3I\/O\u963b\u585e&#xff0c;\u4e2d\u95f4\u4ef6\u89e3\u51b3\u751f\u4ea7\u6cbb\u7406&#xff0c;\u5404\u53f8\u5176\u804c&#xff0c;\u522b\u6df7\u4e3a\u4e00\u8c08\u3002<\/p>\n<hr \/>\n<h3>&#x1f4dd; \u7ed3\u8bed<\/h3>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u662fLangChain\u7cfb\u5217\u7684\u7b2c\u4e00\u7bc7&#xff0c;\u6211\u4eec\u5398\u6e05\u4e86&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u2705\u00a0\u5f02\u6b65\u00a0\u2192 \u8ba9Agent\u4e0d\u95f2\u7740&#xff08;I\/O\u5bc6\u96c6\u573a\u666f&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u2705\u00a0MCP\u00a0\u2192 \u8ba9\u5de5\u5177\u6807\u51c6\u5316\u63a5\u5165&#xff08;\u89e3\u8026\u90e8\u7f72&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u2705\u00a0\u4e2d\u95f4\u4ef6\u00a0\u2192 \u8ba9Agent\u53ef\u6cbb\u7406&#xff08;\u5b89\u5168\u3001\u6210\u672c\u3001\u53ef\u89c2\u6d4b&#xff09;<\/p>\n<\/li>\n<\/ul>\n<p>\u4e0b\u6b21\u9884\u544a&#xff1a;\u00a0\u6211\u4eec\u804aLangSmith\u2014\u2014Agent\u7684&#034;\u76d1\u63a7\u4eea\u8868\u76d8&#034;\u3002\u600e\u4e48\u8ffd\u8e2a\u6bcf\u4e00\u6b21\u6a21\u578b\u8c03\u7528\u3001\u600e\u4e48\u5206\u6790Token\u6d88\u8017\u3001\u600e\u4e48\u5b9a\u4f4dAgent&#034;\u62bd\u98ce&#034;\u7684\u6839\u672c\u539f\u56e0\u3002<\/p>\n<hr \/>\n<p>&#x1f4ac;\u00a0\u4e92\u52a8\u8bdd\u9898&#xff1a;\u00a0\u4f60\u7684Agent\u4e0a\u751f\u4ea7\u4e86\u5417&#xff1f;\u9047\u5230\u8fc7\u54ea\u4e9b&#034;\u5751&#034;&#xff1f;HITL\u5bf9\u63a5\u524d\u7aef\u9875\u9762\u600e\u4e48\u641e&#xff1f;\u6b22\u8fce\u8bc4\u8bba\u533a\u4ea4\u6d41&#xff01;<\/p>\n<p>\u5982\u679c\u89c9\u5f97\u6709\u7528&#xff0c;\u70b9\u4e2a\u00a0&#x1f44d;\u00a0\u548c\u00a0\u2b50\u00a0&#xff0c;\u50ac\u66f4\u4e0b\u4e00\u671f&#xff01;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#x1f680; \u5f00\u7bc7&#xff1a;\u522b\u8ba9\u4f60\u7684Agent\\&#8221;\u6392\u961f\u529e\u4e8b\\&#8221;\u5f88\u591a\u670b\u53cb\u5199\u667a\u80fd\u4f53&#xff0c;\u5f80\u5f80\u5361\u5728\u4e24\u6b65&#xff1a;\u95ee\u9898\u8868\u8c61\u6839\u56e0\u7a0b\u5e8f\u8dd1\u5f97\u6162\u4e0b\u8f7d3\u5f20\u56fe\u82b1\u4e866\u79d2\u540c\u6b65I\/O&#xff0c;CPU\u5728\u7b49&#xff0c;\u7ebf\u7a0b\u5728\u7761\u9879\u76ee\u6ca1\u6cd5\u4e0a\u7ebf\u5bf9\u8bdd\u7206\u4e0a\u4e0b\u6587\u3001\u5de5\u5177\u88ab\u6ee5\u7528\u3001\u51fa\u95ee\u9898\u6ca1\u65e5\u5fd7\u7f3a\u5c11\u4e2d\u95f4\u4ef6\u6cbb\u7406\u5f02\u6b65\u89e3\u51b3\u7b2c\u4e00\u4e2a\u95ee\u9898&#xff0c;\u4e2d\u95f4\u4ef6\u89e3\u51b3\u7b2c\u4e8c\u4e2a\u95ee\u9898\u3002\u4eca\u5929\u54b1\u4eec\u5c31\u628a\u540c\u6b65\/\u5f02\u6b65\u3001MCP\u3001\u4e2d\u95f4\u4ef6\u8fd9\u4e09\u4e2a\u786c\u9aa8\u5934&#xff0c;\u4e00\u6b21\u5543\u900f\u3002&#x1f4e6; \u7b2c\u4e00\u90e8\u5206&#xff1a;\u5730\u57fa\u2014\u2014P<\/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":[10549,10550,10336,997,3212,668],"topic":[],"class_list":["post-92256","post","type-post","status-publish","format-standard","hentry","category-server","tag-ai","tag-10550","tag-10336","tag-langchain","tag-mcp","tag-668"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>LangChain 1.0 \u4e2d\u95f4\u4ef6\u901a\u5173\u6307\u5357\uff1a\u4ece\u5f02\u6b65\u57fa\u77f3\u5230\u751f\u4ea7\u7ea7\u4e09\u5927\u4ef6(\u5341\u4e00) - \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\/92256.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LangChain 1.0 \u4e2d\u95f4\u4ef6\u901a\u5173\u6307\u5357\uff1a\u4ece\u5f02\u6b65\u57fa\u77f3\u5230\u751f\u4ea7\u7ea7\u4e09\u5927\u4ef6(\u5341\u4e00) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"&#x1f680; \u5f00\u7bc7&#xff1a;\u522b\u8ba9\u4f60\u7684Agent&quot;\u6392\u961f\u529e\u4e8b&quot;\u5f88\u591a\u670b\u53cb\u5199\u667a\u80fd\u4f53&#xff0c;\u5f80\u5f80\u5361\u5728\u4e24\u6b65&#xff1a;\u95ee\u9898\u8868\u8c61\u6839\u56e0\u7a0b\u5e8f\u8dd1\u5f97\u6162\u4e0b\u8f7d3\u5f20\u56fe\u82b1\u4e866\u79d2\u540c\u6b65I\/O&#xff0c;CPU\u5728\u7b49&#xff0c;\u7ebf\u7a0b\u5728\u7761\u9879\u76ee\u6ca1\u6cd5\u4e0a\u7ebf\u5bf9\u8bdd\u7206\u4e0a\u4e0b\u6587\u3001\u5de5\u5177\u88ab\u6ee5\u7528\u3001\u51fa\u95ee\u9898\u6ca1\u65e5\u5fd7\u7f3a\u5c11\u4e2d\u95f4\u4ef6\u6cbb\u7406\u5f02\u6b65\u89e3\u51b3\u7b2c\u4e00\u4e2a\u95ee\u9898&#xff0c;\u4e2d\u95f4\u4ef6\u89e3\u51b3\u7b2c\u4e8c\u4e2a\u95ee\u9898\u3002\u4eca\u5929\u54b1\u4eec\u5c31\u628a\u540c\u6b65\/\u5f02\u6b65\u3001MCP\u3001\u4e2d\u95f4\u4ef6\u8fd9\u4e09\u4e2a\u786c\u9aa8\u5934&#xff0c;\u4e00\u6b21\u5543\u900f\u3002&#x1f4e6; \u7b2c\u4e00\u90e8\u5206&#xff1a;\u5730\u57fa\u2014\u2014P\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/92256.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-09T13:24:50+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=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/92256.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/92256.html\",\"name\":\"LangChain 1.0 \u4e2d\u95f4\u4ef6\u901a\u5173\u6307\u5357\uff1a\u4ece\u5f02\u6b65\u57fa\u77f3\u5230\u751f\u4ea7\u7ea7\u4e09\u5927\u4ef6(\u5341\u4e00) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-09T13:24:50+00:00\",\"dateModified\":\"2026-08-09T13:24:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/92256.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/92256.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/92256.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LangChain 1.0 \u4e2d\u95f4\u4ef6\u901a\u5173\u6307\u5357\uff1a\u4ece\u5f02\u6b65\u57fa\u77f3\u5230\u751f\u4ea7\u7ea7\u4e09\u5927\u4ef6(\u5341\u4e00)\"}]},{\"@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":"LangChain 1.0 \u4e2d\u95f4\u4ef6\u901a\u5173\u6307\u5357\uff1a\u4ece\u5f02\u6b65\u57fa\u77f3\u5230\u751f\u4ea7\u7ea7\u4e09\u5927\u4ef6(\u5341\u4e00) - \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\/92256.html","og_locale":"zh_CN","og_type":"article","og_title":"LangChain 1.0 \u4e2d\u95f4\u4ef6\u901a\u5173\u6307\u5357\uff1a\u4ece\u5f02\u6b65\u57fa\u77f3\u5230\u751f\u4ea7\u7ea7\u4e09\u5927\u4ef6(\u5341\u4e00) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"&#x1f680; \u5f00\u7bc7&#xff1a;\u522b\u8ba9\u4f60\u7684Agent\"\u6392\u961f\u529e\u4e8b\"\u5f88\u591a\u670b\u53cb\u5199\u667a\u80fd\u4f53&#xff0c;\u5f80\u5f80\u5361\u5728\u4e24\u6b65&#xff1a;\u95ee\u9898\u8868\u8c61\u6839\u56e0\u7a0b\u5e8f\u8dd1\u5f97\u6162\u4e0b\u8f7d3\u5f20\u56fe\u82b1\u4e866\u79d2\u540c\u6b65I\/O&#xff0c;CPU\u5728\u7b49&#xff0c;\u7ebf\u7a0b\u5728\u7761\u9879\u76ee\u6ca1\u6cd5\u4e0a\u7ebf\u5bf9\u8bdd\u7206\u4e0a\u4e0b\u6587\u3001\u5de5\u5177\u88ab\u6ee5\u7528\u3001\u51fa\u95ee\u9898\u6ca1\u65e5\u5fd7\u7f3a\u5c11\u4e2d\u95f4\u4ef6\u6cbb\u7406\u5f02\u6b65\u89e3\u51b3\u7b2c\u4e00\u4e2a\u95ee\u9898&#xff0c;\u4e2d\u95f4\u4ef6\u89e3\u51b3\u7b2c\u4e8c\u4e2a\u95ee\u9898\u3002\u4eca\u5929\u54b1\u4eec\u5c31\u628a\u540c\u6b65\/\u5f02\u6b65\u3001MCP\u3001\u4e2d\u95f4\u4ef6\u8fd9\u4e09\u4e2a\u786c\u9aa8\u5934&#xff0c;\u4e00\u6b21\u5543\u900f\u3002&#x1f4e6; \u7b2c\u4e00\u90e8\u5206&#xff1a;\u5730\u57fa\u2014\u2014P","og_url":"https:\/\/www.wsisp.com\/helps\/92256.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-09T13:24:50+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/92256.html","url":"https:\/\/www.wsisp.com\/helps\/92256.html","name":"LangChain 1.0 \u4e2d\u95f4\u4ef6\u901a\u5173\u6307\u5357\uff1a\u4ece\u5f02\u6b65\u57fa\u77f3\u5230\u751f\u4ea7\u7ea7\u4e09\u5927\u4ef6(\u5341\u4e00) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-09T13:24:50+00:00","dateModified":"2026-08-09T13:24:50+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/92256.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/92256.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/92256.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"LangChain 1.0 \u4e2d\u95f4\u4ef6\u901a\u5173\u6307\u5357\uff1a\u4ece\u5f02\u6b65\u57fa\u77f3\u5230\u751f\u4ea7\u7ea7\u4e09\u5927\u4ef6(\u5341\u4e00)"}]},{"@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\/92256","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=92256"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/92256\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=92256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=92256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=92256"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=92256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}