{"id":106321,"date":"2026-09-17T07:16:23","date_gmt":"2026-09-16T23:16:23","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/106321.html"},"modified":"2026-09-17T07:16:23","modified_gmt":"2026-09-16T23:16:23","slug":"2026-ai-agent-%e5%85%a5%e9%97%a8%e5%ae%9e%e6%88%98%ef%bc%9a%e4%b8%8d%e7%94%a8-langchain%ef%bc%8c%e7%94%a8-python-%e6%89%8b%e5%86%99%e4%b8%80%e4%b8%aa%e4%bc%9a%e8%b0%83%e7%94%a8%e5%b7%a5%e5%85%b7","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/106321.html","title":{"rendered":"2026 AI Agent \u5165\u95e8\u5b9e\u6218\uff1a\u4e0d\u7528 LangChain\uff0c\u7528 Python \u624b\u5199\u4e00\u4e2a\u4f1a\u8c03\u7528\u5de5\u5177\u7684\u6700\u5c0f\u667a\u80fd\u4f53"},"content":{"rendered":"<h2><\/h2>\n<p>AI Agent&#xff0c;\u4e5f\u5c31\u662f AI \u667a\u80fd\u4f53&#xff0c;\u662f\u76ee\u524d\u4eba\u5de5\u667a\u80fd\u5e94\u7528\u5f00\u53d1\u4e2d\u7684\u70ed\u95e8\u65b9\u5411\u3002<\/p>\n<p>\u666e\u901a\u804a\u5929\u7a0b\u5e8f\u53ea\u80fd\u56de\u7b54\u95ee\u9898&#xff0c;\u800c Agent \u66f4\u5f3a\u8c03\u201c\u6267\u884c\u4efb\u52a1\u201d\u3002\u4f8b\u5982&#xff1a;<\/p>\n<ul>\n<li>\u67e5\u770b\u5f53\u524d\u65f6\u95f4<\/li>\n<li>\u5217\u51fa\u6587\u4ef6\u5939\u4e2d\u7684\u6587\u4ef6<\/li>\n<li>\u7edf\u8ba1\u4e0d\u540c\u7c7b\u578b\u6587\u4ef6\u7684\u6570\u91cf<\/li>\n<li>\u6839\u636e\u7528\u6237\u8981\u6c42\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177<\/li>\n<li>\u83b7\u53d6\u5de5\u5177\u6267\u884c\u7ed3\u679c\u5e76\u8fd4\u56de\u7b54\u6848<\/li>\n<\/ul>\n<p>\u5f88\u591a Agent \u6559\u7a0b\u4e00\u5f00\u59cb\u5c31\u4f7f\u7528 LangChain\u3001LangGraph \u7b49\u6846\u67b6&#xff0c;\u521d\u5b66\u8005\u5bb9\u6613\u88ab\u5927\u91cf\u6982\u5ff5\u548c\u4f9d\u8d56\u529d\u9000\u3002<\/p>\n<p>\u672c\u6587\u5148\u4e0d\u8c03\u7528\u5927\u6a21\u578b&#xff0c;\u4e5f\u4e0d\u4f7f\u7528\u7b2c\u4e09\u65b9\u6846\u67b6&#xff0c;\u53ea\u7528 Python \u6807\u51c6\u5e93\u624b\u5199\u4e00\u4e2a\u6700\u5c0f Agent \u96cf\u5f62&#xff0c;\u7406\u89e3\u667a\u80fd\u4f53\u6700\u57fa\u672c\u7684\u8fd0\u884c\u6d41\u7a0b\u3002<\/p>\n<h3>\u4e00\u3001Agent \u7684\u57fa\u672c\u5de5\u4f5c\u6d41\u7a0b<\/h3>\n<p>\u4e00\u4e2a\u7b80\u5355\u7684 Agent \u53ef\u4ee5\u62c6\u6210\u4ee5\u4e0b\u51e0\u4e2a\u90e8\u5206&#xff1a;<\/p>\n<p>\u63a5\u6536\u7528\u6237\u4efb\u52a1<br \/>\n    \u2193<br \/>\n\u5224\u65ad\u7528\u6237\u60f3\u505a\u4ec0\u4e48<br \/>\n    \u2193<br \/>\n\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177<br \/>\n    \u2193<br \/>\n\u6267\u884c\u5de5\u5177<br \/>\n    \u2193<br \/>\n\u8bfb\u53d6\u6267\u884c\u7ed3\u679c<br \/>\n    \u2193<br \/>\n\u628a\u7ed3\u679c\u8fd4\u56de\u7ed9\u7528\u6237<\/p>\n<p>\u4f8b\u5982&#xff0c;\u7528\u6237\u8f93\u5165&#xff1a;<\/p>\n<p>\u5e2e\u6211\u7edf\u8ba1\u6587\u4ef6\u7c7b\u578b<\/p>\n<p>Agent \u5224\u65ad\u8fd9\u662f\u4e00\u4e2a\u6587\u4ef6\u7edf\u8ba1\u4efb\u52a1&#xff0c;\u4e8e\u662f\u9009\u62e9&#xff1a;<\/p>\n<p>count_file_types<\/p>\n<p>\u5de5\u5177\u6267\u884c\u5b8c\u6210\u540e&#xff0c;Agent \u518d\u628a\u7edf\u8ba1\u7ed3\u679c\u8fd4\u56de\u7ed9\u7528\u6237\u3002<\/p>\n<p>\u672c\u6587\u5b9e\u73b0\u4e09\u4e2a\u5de5\u5177&#xff1a;<\/p>\n<li>\u67e5\u770b\u5f53\u524d\u65f6\u95f4\u3002<\/li>\n<li>\u67e5\u770b\u5de5\u4f5c\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u3002<\/li>\n<li>\u7edf\u8ba1\u4e0d\u540c\u7c7b\u578b\u6587\u4ef6\u7684\u6570\u91cf\u3002<\/li>\n<h3>\u4e8c\u3001\u5b8c\u6574\u4ee3\u7801<\/h3>\n<p>\u65b0\u5efa\u4e00\u4e2a Python \u6587\u4ef6&#xff1a;<\/p>\n<p>mini_agent.py<\/p>\n<p>\u590d\u5236\u4e0b\u9762\u7684\u5b8c\u6574\u4ee3\u7801&#xff1a;<\/p>\n<p>&#034;&#034;&#034;\u4e00\u4e2a\u53ea\u4f7f\u7528 Python \u6807\u51c6\u5e93\u5b9e\u73b0\u7684\u6700\u5c0f Agent \u96cf\u5f62\u3002&#034;&#034;&#034;<\/p>\n<p>import argparse<br \/>\nfrom collections import Counter<br \/>\nfrom datetime import datetime<br \/>\nfrom pathlib import Path<\/p>\n<p>class MiniAgent:<br \/>\n    &#034;&#034;&#034;\u6839\u636e\u7528\u6237\u8f93\u5165\u9009\u62e9\u5e76\u6267\u884c\u672c\u5730\u5de5\u5177\u3002&#034;&#034;&#034;<\/p>\n<p>    def __init__(self, workspace):<br \/>\n        self.workspace &#061; workspace.resolve()<\/p>\n<p>        if not self.workspace.is_dir():<br \/>\n            raise ValueError(&#034;\u5de5\u4f5c\u76ee\u5f55\u4e0d\u5b58\u5728\u6216\u8005\u4e0d\u662f\u6587\u4ef6\u5939\u3002&#034;)<\/p>\n<p>        self.tools &#061; {<br \/>\n            &#034;current_time&#034;: self.current_time,<br \/>\n            &#034;list_files&#034;: self.list_files,<br \/>\n            &#034;count_file_types&#034;: self.count_file_types,<br \/>\n        }<\/p>\n<p>    def current_time(self):<br \/>\n        &#034;&#034;&#034;\u8fd4\u56de\u5f53\u524d\u672c\u5730\u65f6\u95f4\u3002&#034;&#034;&#034;<\/p>\n<p>        return datetime.now().strftime(<br \/>\n            &#034;\u5f53\u524d\u65f6\u95f4&#xff1a;%Y-%m-%d %H:%M:%S&#034;<br \/>\n        )<\/p>\n<p>    def list_files(self):<br \/>\n        &#034;&#034;&#034;\u5217\u51fa\u5de5\u4f5c\u76ee\u5f55\u7b2c\u4e00\u5c42\u7684\u6587\u4ef6\u3002&#034;&#034;&#034;<\/p>\n<p>        files &#061; sorted(<br \/>\n            [<br \/>\n                item.name<br \/>\n                for item in self.workspace.iterdir()<br \/>\n                if item.is_file()<br \/>\n            ],<br \/>\n            key&#061;str.lower,<br \/>\n        )<\/p>\n<p>        if not files:<br \/>\n            return &#034;\u5f53\u524d\u76ee\u5f55\u4e2d\u6ca1\u6709\u6587\u4ef6\u3002&#034;<\/p>\n<p>        # \u9632\u6b62\u76ee\u5f55\u4e2d\u6587\u4ef6\u8fc7\u591a&#xff0c;\u53ea\u663e\u793a\u524d20\u4e2a<br \/>\n        visible_files &#061; files[:20]<\/p>\n<p>        result &#061; [&#034;\u5f53\u524d\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6&#xff1a;&#034;]<\/p>\n<p>        for number, file_name in enumerate(<br \/>\n            visible_files,<br \/>\n            start&#061;1,<br \/>\n        ):<br \/>\n            result.append(<br \/>\n                str(number) &#043; &#034;. &#034; &#043; file_name<br \/>\n            )<\/p>\n<p>        if len(files) &gt; 20:<br \/>\n            result.append(<br \/>\n                &#034;\u8fd8\u6709 &#034;<br \/>\n                &#043; str(len(files) &#8211; 20)<br \/>\n                &#043; &#034; \u4e2a\u6587\u4ef6\u6ca1\u6709\u663e\u793a\u3002&#034;<br \/>\n            )<\/p>\n<p>        return &#034;\\\\n&#034;.join(result)<\/p>\n<p>    def count_file_types(self):<br \/>\n        &#034;&#034;&#034;\u7edf\u8ba1\u5de5\u4f5c\u76ee\u5f55\u7b2c\u4e00\u5c42\u4e2d\u4e0d\u540c\u7c7b\u578b\u6587\u4ef6\u7684\u6570\u91cf\u3002&#034;&#034;&#034;<\/p>\n<p>        counter &#061; Counter()<\/p>\n<p>        for item in self.workspace.iterdir():<br \/>\n            if not item.is_file():<br \/>\n                continue<\/p>\n<p>            file_type &#061; item.suffix.lower()<\/p>\n<p>            if not file_type:<br \/>\n                file_type &#061; &#034;\u65e0\u6269\u5c55\u540d&#034;<\/p>\n<p>            counter[file_type] &#043;&#061; 1<\/p>\n<p>        if not counter:<br \/>\n            return &#034;\u5f53\u524d\u76ee\u5f55\u4e2d\u6ca1\u6709\u53ef\u4ee5\u7edf\u8ba1\u7684\u6587\u4ef6\u3002&#034;<\/p>\n<p>        sorted_results &#061; sorted(<br \/>\n            counter.items(),<br \/>\n            key&#061;lambda item: (-item[1], item[0]),<br \/>\n        )<\/p>\n<p>        result &#061; [&#034;\u6587\u4ef6\u7c7b\u578b\u7edf\u8ba1\u7ed3\u679c&#xff1a;&#034;]<\/p>\n<p>        for file_type, count in sorted_results:<br \/>\n            result.append(<br \/>\n                file_type &#043; &#034;&#xff1a;&#034; &#043; str(count) &#043; &#034; \u4e2a&#034;<br \/>\n            )<\/p>\n<p>        return &#034;\\\\n&#034;.join(result)<\/p>\n<p>    def decide(self, user_input):<br \/>\n        &#034;&#034;&#034;\u6839\u636e\u5173\u952e\u8bcd\u9009\u62e9\u5de5\u5177\u3002&#034;&#034;&#034;<\/p>\n<p>        text &#061; user_input.strip().lower()<\/p>\n<p>        if any(<br \/>\n            keyword in text<br \/>\n            for keyword in [&#034;\u65f6\u95f4&#034;, &#034;\u51e0\u70b9&#034;, &#034;\u65e5\u671f&#034;]<br \/>\n        ):<br \/>\n            return &#034;current_time&#034;<\/p>\n<p>        if (<br \/>\n            &#034;\u7edf\u8ba1&#034; in text<br \/>\n            and any(<br \/>\n                keyword in text<br \/>\n                for keyword in [&#034;\u6587\u4ef6&#034;, &#034;\u7c7b\u578b&#034;, &#034;\u6269\u5c55\u540d&#034;]<br \/>\n            )<br \/>\n        ):<br \/>\n            return &#034;count_file_types&#034;<\/p>\n<p>        if any(<br \/>\n            keyword in text<br \/>\n            for keyword in [&#034;\u67e5\u770b\u6587\u4ef6&#034;, &#034;\u5217\u51fa\u6587\u4ef6&#034;, &#034;\u6709\u54ea\u4e9b\u6587\u4ef6&#034;]<br \/>\n        ):<br \/>\n            return &#034;list_files&#034;<\/p>\n<p>        return None<\/p>\n<p>    def run(self, user_input):<br \/>\n        &#034;&#034;&#034;\u5b8c\u6210\u4e00\u6b21\u4efb\u52a1\u5224\u65ad\u548c\u5de5\u5177\u8c03\u7528\u3002&#034;&#034;&#034;<\/p>\n<p>        tool_name &#061; self.decide(user_input)<\/p>\n<p>        if tool_name is None:<br \/>\n            return (<br \/>\n                &#034;\u6682\u65f6\u65e0\u6cd5\u8bc6\u522b\u8fd9\u4e2a\u4efb\u52a1\u3002\\\\n&#034;<br \/>\n                &#034;\u4f60\u53ef\u4ee5\u5c1d\u8bd5\u8f93\u5165&#xff1a;\\\\n&#034;<br \/>\n                &#034;1. \u73b0\u5728\u51e0\u70b9&#xff1f;\\\\n&#034;<br \/>\n                &#034;2. \u67e5\u770b\u6587\u4ef6\\\\n&#034;<br \/>\n                &#034;3. \u7edf\u8ba1\u6587\u4ef6\u7c7b\u578b&#034;<br \/>\n            )<\/p>\n<p>        tool &#061; self.tools[tool_name]<\/p>\n<p>        try:<br \/>\n            tool_result &#061; tool()<br \/>\n        except OSError as error:<br \/>\n            return &#034;\u5de5\u5177\u6267\u884c\u5931\u8d25&#xff1a;&#034; &#043; str(error)<\/p>\n<p>        return (<br \/>\n            &#034;\u6267\u884c\u5de5\u5177&#xff1a;&#034; &#043; tool_name &#043; &#034;\\\\n&#034;<br \/>\n            &#043; tool_result<br \/>\n        )<\/p>\n<p>def main():<br \/>\n    parser &#061; argparse.ArgumentParser(<br \/>\n        description&#061;&#034;\u8fd0\u884c\u4e00\u4e2a\u6700\u5c0f Python Agent&#034;<br \/>\n    )<\/p>\n<p>    parser.add_argument(<br \/>\n        &#034;workspace&#034;,<br \/>\n        nargs&#061;&#034;?&#034;,<br \/>\n        default&#061;&#034;.&#034;,<br \/>\n        help&#061;&#034;\u5141\u8bb8 Agent \u8bfb\u53d6\u7684\u5de5\u4f5c\u76ee\u5f55&#034;,<br \/>\n    )<\/p>\n<p>    args &#061; parser.parse_args()<\/p>\n<p>    try:<br \/>\n        agent &#061; MiniAgent(<br \/>\n            Path(args.workspace)<br \/>\n        )<br \/>\n    except ValueError as error:<br \/>\n        print(&#034;\u542f\u52a8\u5931\u8d25&#xff1a;&#034; &#043; str(error))<br \/>\n        return 1<\/p>\n<p>    print(&#034;\u6700\u5c0f Python Agent \u5df2\u542f\u52a8\u3002&#034;)<br \/>\n    print(&#034;\u5de5\u4f5c\u76ee\u5f55&#xff1a;&#034; &#043; str(agent.workspace))<br \/>\n    print(&#034;\u8f93\u5165 exit \u53ef\u4ee5\u9000\u51fa\u7a0b\u5e8f\u3002&#034;)<\/p>\n<p>    while True:<br \/>\n        user_input &#061; input(&#034;\\\\n\u8bf7\u8f93\u5165\u4efb\u52a1&#xff1a;&#034;).strip()<\/p>\n<p>        if user_input.lower() in {<br \/>\n            &#034;exit&#034;,<br \/>\n            &#034;quit&#034;,<br \/>\n            &#034;\u9000\u51fa&#034;,<br \/>\n        }:<br \/>\n            print(&#034;Agent \u5df2\u9000\u51fa\u3002&#034;)<br \/>\n            break<\/p>\n<p>        if not user_input:<br \/>\n            print(&#034;\u8bf7\u8f93\u5165\u5177\u4f53\u4efb\u52a1\u3002&#034;)<br \/>\n            continue<\/p>\n<p>        print(agent.run(user_input))<\/p>\n<p>    return 0<\/p>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    raise SystemExit(main())<\/p>\n<h3>\u4e09\u3001\u8fd0\u884c Agent<\/h3>\n<p>\u5728 mini_agent.py \u6240\u5728\u76ee\u5f55\u6253\u5f00 PowerShell&#xff0c;\u6267\u884c&#xff1a;<\/p>\n<p>python mini_agent.py<\/p>\n<p>\u7a0b\u5e8f\u542f\u52a8\u540e\u4f1a\u663e\u793a&#xff1a;<\/p>\n<p>\u6700\u5c0f Python Agent \u5df2\u542f\u52a8\u3002<br \/>\n\u5de5\u4f5c\u76ee\u5f55&#xff1a;\u5f53\u524d\u76ee\u5f55\u7684\u5b8c\u6574\u8def\u5f84<br \/>\n\u8f93\u5165 exit \u53ef\u4ee5\u9000\u51fa\u7a0b\u5e8f\u3002<\/p>\n<p>\u8f93\u5165&#xff1a;<\/p>\n<p>\u73b0\u5728\u51e0\u70b9&#xff1f;<\/p>\n<p>Agent \u4f1a\u9009\u62e9\u65f6\u95f4\u5de5\u5177&#xff1a;<\/p>\n<p>\u6267\u884c\u5de5\u5177&#xff1a;current_time<br \/>\n\u5f53\u524d\u65f6\u95f4&#xff1a;2026-09-16 10:30:00<\/p>\n<p>\u5b9e\u9645\u65f6\u95f4\u4ee5\u7535\u8111\u8fd0\u884c\u65f6\u663e\u793a\u7684\u7ed3\u679c\u4e3a\u51c6\u3002<\/p>\n<h3>\u56db\u3001\u8ba9 Agent \u67e5\u770b\u6587\u4ef6<\/h3>\n<p>\u8f93\u5165&#xff1a;<\/p>\n<p>\u67e5\u770b\u6587\u4ef6<\/p>\n<p>Agent \u4f1a\u6267\u884c&#xff1a;<\/p>\n<p>list_files<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c\u7c7b\u4f3c&#xff1a;<\/p>\n<p>\u6267\u884c\u5de5\u5177&#xff1a;list_files<br \/>\n\u5f53\u524d\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6&#xff1a;<br \/>\n1. mini_agent.py<br \/>\n2. \u5de5\u4f5c\u8ba1\u5212.docx<br \/>\n3. \u4ea7\u54c1\u8d44\u6599.pdf<br \/>\n4. \u6570\u636e.csv<\/p>\n<p>\u4e3a\u4e86\u907f\u514d\u4e00\u6b21\u8f93\u51fa\u592a\u591a\u5185\u5bb9&#xff0c;\u7a0b\u5e8f\u6700\u591a\u663e\u793a\u524d20\u4e2a\u6587\u4ef6\u3002<\/p>\n<h3>\u4e94\u3001\u8ba9 Agent \u7edf\u8ba1\u6587\u4ef6\u7c7b\u578b<\/h3>\n<p>\u8f93\u5165&#xff1a;<\/p>\n<p>\u5e2e\u6211\u7edf\u8ba1\u6587\u4ef6\u7c7b\u578b<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c\u7c7b\u4f3c&#xff1a;<\/p>\n<p>\u6267\u884c\u5de5\u5177&#xff1a;count_file_types<br \/>\n\u6587\u4ef6\u7c7b\u578b\u7edf\u8ba1\u7ed3\u679c&#xff1a;<br \/>\n.pdf&#xff1a;3 \u4e2a<br \/>\n.txt&#xff1a;2 \u4e2a<br \/>\n.csv&#xff1a;1 \u4e2a<br \/>\n.docx&#xff1a;1 \u4e2a<br \/>\n\u65e0\u6269\u5c55\u540d&#xff1a;1 \u4e2a<\/p>\n<p>\u7a0b\u5e8f\u4f1a\u628a\u5927\u5199\u548c\u5c0f\u5199\u6269\u5c55\u540d\u5408\u5e76\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u56fe\u7247.PNG<br \/>\n\u622a\u56fe.png<\/p>\n<p>\u90fd\u4f1a\u88ab\u7edf\u8ba1\u4e3a&#xff1a;<\/p>\n<p>.png<\/p>\n<h3>\u516d\u3001\u6307\u5b9a\u9700\u8981\u5904\u7406\u7684\u6587\u4ef6\u5939<\/h3>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;Agent \u8bfb\u53d6\u7a0b\u5e8f\u5f53\u524d\u6240\u5728\u7684\u6587\u4ef6\u5939\u3002<\/p>\n<p>\u5982\u679c\u60f3\u5904\u7406\u5176\u4ed6\u76ee\u5f55&#xff0c;\u53ef\u4ee5\u5728\u542f\u52a8\u65f6\u586b\u5199\u6587\u4ef6\u5939\u8def\u5f84&#xff1a;<\/p>\n<p>python mini_agent.py &#034;D:\\\\\u5de5\u4f5c\u8d44\u6599&#034;<\/p>\n<p>\u8def\u5f84\u4e2d\u5305\u542b\u7a7a\u683c\u65f6&#xff0c;\u9700\u8981\u4f7f\u7528\u82f1\u6587\u53cc\u5f15\u53f7\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>python mini_agent.py &#034;D:\\\\2026 \u5e74\u9879\u76ee\u8d44\u6599&#034;<\/p>\n<p>Agent \u53ea\u8bfb\u53d6\u6307\u5b9a\u76ee\u5f55\u7b2c\u4e00\u5c42\u7684\u6587\u4ef6&#xff0c;\u4e0d\u4f1a\u4fee\u6539\u3001\u79fb\u52a8\u6216\u8005\u5220\u9664\u6587\u4ef6\u3002<\/p>\n<p>\u5904\u7406\u91cd\u8981\u8d44\u6599\u524d&#xff0c;\u5efa\u8bae\u5148\u4f7f\u7528\u6d4b\u8bd5\u6587\u4ef6\u5939\u8fd0\u884c\u3002<\/p>\n<h3>\u4e03\u3001\u4e3a\u4ec0\u4e48\u5b83\u53ef\u4ee5\u7b97\u4f5c Agent \u96cf\u5f62&#xff1f;<\/h3>\n<p>\u8fd9\u4e2a\u7a0b\u5e8f\u5df2\u7ecf\u5305\u542b\u4e86 Agent \u7684\u51e0\u4e2a\u57fa\u7840\u7ec4\u6210\u90e8\u5206\u3002<\/p>\n<h4>1. \u63a5\u6536\u4efb\u52a1<\/h4>\n<p>user_input &#061; input(&#034;\u8bf7\u8f93\u5165\u4efb\u52a1&#xff1a;&#034;)<\/p>\n<p>\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u63cf\u8ff0\u81ea\u5df1\u7684\u9700\u6c42\u3002<\/p>\n<h4>2. \u4efb\u52a1\u5224\u65ad<\/h4>\n<p>tool_name &#061; self.decide(user_input)<\/p>\n<p>decide() \u6839\u636e\u7528\u6237\u8f93\u5165\u5224\u65ad\u9700\u8981\u4f7f\u7528\u54ea\u4e2a\u5de5\u5177\u3002<\/p>\n<h4>3. \u5de5\u5177\u6ce8\u518c<\/h4>\n<p>self.tools &#061; {<br \/>\n    &#034;current_time&#034;: self.current_time,<br \/>\n    &#034;list_files&#034;: self.list_files,<br \/>\n    &#034;count_file_types&#034;: self.count_file_types,<br \/>\n}<\/p>\n<p>\u5de5\u5177\u540d\u79f0\u548c\u5b9e\u9645\u7684 Python \u51fd\u6570\u4fdd\u5b58\u5728\u5b57\u5178\u4e2d\u3002<\/p>\n<p>\u540e\u7eed\u589e\u52a0\u65b0\u5de5\u5177\u65f6&#xff0c;\u53ea\u9700\u8981\u7f16\u5199\u5bf9\u5e94\u51fd\u6570&#xff0c;\u518d\u628a\u5b83\u6ce8\u518c\u5230\u5b57\u5178\u4e2d\u3002<\/p>\n<h4>4. \u5de5\u5177\u8c03\u7528<\/h4>\n<p>tool &#061; self.tools[tool_name]<br \/>\ntool_result &#061; tool()<\/p>\n<p>Agent \u6839\u636e\u4efb\u52a1\u5224\u65ad\u7ed3\u679c\u8c03\u7528\u5bf9\u5e94\u5de5\u5177\u3002<\/p>\n<h4>5. \u8fd4\u56de\u6267\u884c\u7ed3\u679c<\/h4>\n<p>return (<br \/>\n    &#034;\u6267\u884c\u5de5\u5177&#xff1a;&#034; &#043; tool_name &#043; &#034;\\\\n&#034;<br \/>\n    &#043; tool_result<br \/>\n)<\/p>\n<p>\u5de5\u5177\u5b8c\u6210\u4efb\u52a1\u540e&#xff0c;Agent \u5c06\u7ed3\u679c\u6574\u7406\u5e76\u8fd4\u56de\u7ed9\u7528\u6237\u3002<\/p>\n<h3>\u516b\u3001\u5b83\u548c\u771f\u6b63\u7684\u5927\u6a21\u578b Agent \u6709\u4ec0\u4e48\u533a\u522b&#xff1f;<\/h3>\n<p>\u672c\u6587\u7a0b\u5e8f\u4f7f\u7528\u5173\u952e\u8bcd\u5224\u65ad\u4efb\u52a1&#xff1a;<\/p>\n<p>if &#034;\u65f6\u95f4&#034; in text:<br \/>\n    return &#034;current_time&#034;<\/p>\n<p>\u4f18\u70b9\u662f&#xff1a;<\/p>\n<ul>\n<li>\u4ee3\u7801\u7b80\u5355<\/li>\n<li>\u4e0d\u9700\u8981\u8054\u7f51<\/li>\n<li>\u4e0d\u9700\u8981\u7533\u8bf7 API Key<\/li>\n<li>\u4e0d\u4f1a\u4ea7\u751f\u6a21\u578b\u8c03\u7528\u8d39\u7528<\/li>\n<li>\u8fd0\u884c\u7ed3\u679c\u5bb9\u6613\u7406\u89e3\u548c\u68c0\u67e5<\/li>\n<\/ul>\n<p>\u7f3a\u70b9\u4e5f\u5f88\u660e\u663e&#xff1a;<\/p>\n<ul>\n<li>\u53ea\u80fd\u7406\u89e3\u63d0\u524d\u8bbe\u7f6e\u597d\u7684\u5173\u952e\u8bcd<\/li>\n<li>\u65e0\u6cd5\u5904\u7406\u590d\u6742\u8868\u8fbe<\/li>\n<li>\u4e0d\u4f1a\u81ea\u52a8\u62c6\u5206\u591a\u6b65\u9aa4\u4efb\u52a1<\/li>\n<li>\u4e0d\u5177\u5907\u4e0a\u4e0b\u6587\u8bb0\u5fc6<\/li>\n<li>\u4e0d\u4f1a\u6839\u636e\u7ed3\u679c\u7ee7\u7eed\u89c4\u5212<\/li>\n<\/ul>\n<p>\u771f\u6b63\u7684\u5927\u6a21\u578b Agent \u901a\u5e38\u4f1a\u8ba9\u6a21\u578b\u8d1f\u8d23\u7406\u89e3\u4efb\u52a1\u548c\u9009\u62e9\u5de5\u5177\u3002<\/p>\n<p>\u4f8b\u5982\u7528\u6237\u8f93\u5165&#xff1a;<\/p>\n<p>\u5148\u770b\u770b\u8fd9\u4e2a\u6587\u4ef6\u5939\u6709\u54ea\u4e9b\u6587\u4ef6&#xff0c;<br \/>\n\u518d\u7edf\u8ba1\u4e00\u4e0b\u54ea\u79cd\u6587\u4ef6\u6700\u591a\u3002<\/p>\n<p>\u5927\u6a21\u578b\u53ef\u80fd\u5c06\u4efb\u52a1\u62c6\u6210\u4e24\u6b65&#xff1a;<\/p>\n<p>\u7b2c\u4e00\u6b65&#xff1a;\u8c03\u7528 list_files<br \/>\n\u7b2c\u4e8c\u6b65&#xff1a;\u8c03\u7528 count_file_types<\/p>\n<p>\u8fd9\u4e5f\u662f\u672c\u6587\u7a0b\u5e8f\u540e\u7eed\u53ef\u4ee5\u7ee7\u7eed\u5347\u7ea7\u7684\u65b9\u5411\u3002<\/p>\n<h3>\u4e5d\u3001\u5982\u4f55\u589e\u52a0\u4e00\u4e2a\u65b0\u5de5\u5177&#xff1f;<\/h3>\n<p>\u4f8b\u5982&#xff0c;\u6211\u4eec\u60f3\u589e\u52a0\u201c\u7edf\u8ba1\u6587\u4ef6\u603b\u6570\u201d\u5de5\u5177\u3002<\/p>\n<p>\u9996\u5148\u7f16\u5199\u51fd\u6570&#xff1a;<\/p>\n<p>def count_all_files(self):<br \/>\n    count &#061; sum(<br \/>\n        1<br \/>\n        for item in self.workspace.iterdir()<br \/>\n        if item.is_file()<br \/>\n    )<\/p>\n<p>    return &#034;\u6587\u4ef6\u603b\u6570&#xff1a;&#034; &#043; str(count)<\/p>\n<p>\u7136\u540e\u6ce8\u518c\u5de5\u5177&#xff1a;<\/p>\n<p>self.tools &#061; {<br \/>\n    &#034;current_time&#034;: self.current_time,<br \/>\n    &#034;list_files&#034;: self.list_files,<br \/>\n    &#034;count_file_types&#034;: self.count_file_types,<br \/>\n    &#034;count_all_files&#034;: self.count_all_files,<br \/>\n}<\/p>\n<p>\u6700\u540e\u5728 decide() \u4e2d\u589e\u52a0\u5224\u65ad&#xff1a;<\/p>\n<p>if &#034;\u6587\u4ef6\u603b\u6570&#034; in text:<br \/>\n    return &#034;count_all_files&#034;<\/p>\n<p>\u8fd9\u6837 Agent \u5c31\u83b7\u5f97\u4e86\u4e00\u9879\u65b0\u7684\u80fd\u529b\u3002<\/p>\n<h3>\u5341\u3001\u5e38\u89c1\u95ee\u9898<\/h3>\n<h4>\u8f93\u5165\u4efb\u52a1\u540e\u63d0\u793a\u65e0\u6cd5\u8bc6\u522b<\/h4>\n<p>\u5f53\u524d\u7248\u672c\u4f9d\u9760\u5173\u952e\u8bcd\u5224\u65ad\u4efb\u52a1\u3002<\/p>\n<p>\u53ef\u4ee5\u5c1d\u8bd5\u8f93\u5165&#xff1a;<\/p>\n<p>\u73b0\u5728\u51e0\u70b9&#xff1f;<br \/>\n\u67e5\u770b\u6587\u4ef6<br \/>\n\u7edf\u8ba1\u6587\u4ef6\u7c7b\u578b<\/p>\n<h4>\u63d0\u793a\u5de5\u4f5c\u76ee\u5f55\u4e0d\u5b58\u5728<\/h4>\n<p>\u68c0\u67e5\u6587\u4ef6\u5939\u8def\u5f84\u662f\u5426\u6b63\u786e&#xff1a;<\/p>\n<p>python mini_agent.py &#034;D:\\\\\u5de5\u4f5c\u8d44\u6599&#034;<\/p>\n<p>\u4e0d\u8981\u628a\u5177\u4f53\u6587\u4ef6\u5f53\u6210\u5de5\u4f5c\u76ee\u5f55\u3002<\/p>\n<h4>\u6587\u4ef6\u7edf\u8ba1\u6570\u91cf\u4e0d\u6b63\u786e<\/h4>\n<p>\u672c\u6587\u53ea\u7edf\u8ba1\u6307\u5b9a\u6587\u4ef6\u5939\u7b2c\u4e00\u5c42\u7684\u6587\u4ef6&#xff0c;\u4e0d\u7edf\u8ba1\u5b50\u6587\u4ef6\u5939\u4e2d\u7684\u5185\u5bb9\u3002<\/p>\n<p>\u53e6\u5916&#xff0c;\u811a\u672c\u6587\u4ef6 mini_agent.py \u672c\u8eab\u4e5f\u4f4d\u4e8e\u5de5\u4f5c\u76ee\u5f55\u65f6&#xff0c;\u5b83\u4f1a\u88ab\u7edf\u8ba1\u4e3a\u4e00\u4e2a .py \u6587\u4ef6\u3002<\/p>\n<h4>\u4e2d\u6587\u8def\u5f84\u80fd\u4e0d\u80fd\u4f7f\u7528&#xff1f;<\/h4>\n<p>\u53ef\u4ee5\u3002<\/p>\n<p>\u5efa\u8bae\u4f7f\u7528\u5b8c\u6574\u8def\u5f84\u5e76\u6dfb\u52a0\u82f1\u6587\u53cc\u5f15\u53f7&#xff1a;<\/p>\n<p>python mini_agent.py &#034;D:\\\\\u4e2d\u6587\u8d44\u6599\u76ee\u5f55&#034;<\/p>\n<h3>\u5341\u4e00\u3001\u603b\u7ed3<\/h3>\n<p>\u672c\u6587\u6ca1\u6709\u76f4\u63a5\u4f7f\u7528\u590d\u6742\u6846\u67b6&#xff0c;\u800c\u662f\u901a\u8fc7 Python \u6807\u51c6\u5e93\u5b9e\u73b0\u4e86\u4e00\u4e2a\u6700\u5c0f Agent \u96cf\u5f62\u3002<\/p>\n<p>\u5b83\u5177\u5907\u4ee5\u4e0b\u80fd\u529b&#xff1a;<\/p>\n<ul>\n<li>\u63a5\u6536\u7528\u6237\u4efb\u52a1<\/li>\n<li>\u5224\u65ad\u4efb\u52a1\u7c7b\u578b<\/li>\n<li>\u9009\u62e9\u5de5\u5177<\/li>\n<li>\u6267\u884c\u5de5\u5177<\/li>\n<li>\u8fd4\u56de\u6267\u884c\u7ed3\u679c<\/li>\n<li>\u9650\u5236\u6587\u4ef6\u8bbf\u95ee\u8303\u56f4<\/li>\n<\/ul>\n<p>\u8fd9\u4e2a\u7248\u672c\u8fd8\u6ca1\u6709\u63a5\u5165\u771f\u6b63\u7684\u5927\u6a21\u578b&#xff0c;\u4f46\u5df2\u7ecf\u5c55\u793a\u4e86 Agent \u6700\u6838\u5fc3\u7684\u7ed3\u6784\u3002<\/p>\n<p>\u7406\u89e3\u8fd9\u5957\u6d41\u7a0b\u540e&#xff0c;\u4e0b\u4e00\u6b65\u53ef\u4ee5\u628a\u5173\u952e\u8bcd\u5224\u65ad\u66ff\u6362\u4e3a\u5927\u6a21\u578b&#xff0c;\u518d\u52a0\u5165&#xff1a;<\/p>\n<ul>\n<li>\u591a\u8f6e\u5bf9\u8bdd<\/li>\n<li>\u81ea\u52a8\u4efb\u52a1\u62c6\u5206<\/li>\n<li>\u8bb0\u5fc6\u529f\u80fd<\/li>\n<li>\u5927\u6a21\u578b API<\/li>\n<li>\u672c\u5730 Ollama \u6a21\u578b<\/li>\n<li>\u591a\u5de5\u5177\u8fde\u7eed\u8c03\u7528<\/li>\n<\/ul>\n<p>\u76f8\u6bd4\u4e00\u5f00\u59cb\u5c31\u4f7f\u7528\u590d\u6742\u6846\u67b6&#xff0c;\u5148\u624b\u5199\u4e00\u4e2a\u6700\u5c0f\u7248\u672c&#xff0c;\u66f4\u5bb9\u6613\u7406\u89e3 Agent \u5230\u5e95\u662f\u600e\u6837\u5de5\u4f5c\u7684\u3002<\/p>\n<p>\u672c\u6587\u4ee3\u7801\u7531 AI \u8f85\u52a9\u7f16\u5199\u3002\u8fd0\u884c\u65f6\u8bf7\u5148\u4f7f\u7528\u6d4b\u8bd5\u6587\u4ef6\u5939&#xff0c;\u4e0d\u8981\u76f4\u63a5\u5904\u7406\u91cd\u8981\u8d44\u6599\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AI Agent&#xff0c;\u4e5f\u5c31\u662f AI \u667a\u80fd\u4f53&#xff0c;\u662f\u76ee\u524d\u4eba\u5de5\u667a\u80fd\u5e94\u7528\u5f00\u53d1\u4e2d\u7684\u70ed\u95e8\u65b9\u5411\u3002\u666e\u901a\u804a\u5929\u7a0b\u5e8f\u53ea\u80fd\u56de\u7b54\u95ee\u9898&#xff0c;\u800c Agent \u66f4\u5f3a\u8c03\u201c\u6267\u884c\u4efb\u52a1\u201d\u3002\u4f8b\u5982&#xff1a;\u67e5\u770b\u5f53\u524d\u65f6\u95f4\u5217\u51fa\u6587\u4ef6\u5939\u4e2d\u7684\u6587\u4ef6\u7edf\u8ba1\u4e0d\u540c\u7c7b\u578b\u6587\u4ef6\u7684\u6570\u91cf\u6839\u636e\u7528\u6237\u8981\u6c42\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177\u83b7\u53d6\u5de5\u5177\u6267\u884c\u7ed3\u679c\u5e76\u8fd4\u56de\u7b54\u6848\u5f88\u591a Agent \u6559\u7a0b\u4e00\u5f00\u59cb\u5c31\u4f7f\u7528 LangChain\u3001LangGraph \u7b49\u6846\u67b6&#xff0c;\u521d\u5b66\u8005\u5bb9\u6613\u88ab\u5927\u91cf\u6982\u5ff5\u548c\u4f9d\u8d56\u529d\u9000\u3002\u672c\u6587\u5148\u4e0d\u8c03\u7528\u5927\u6a21\u578b&#xff0c;\u4e5f\u4e0d\u4f7f\u7528\u7b2c\u4e09<\/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":[11815,71,81,50,2983,395],"topic":[],"class_list":["post-106321","post","type-post","status-publish","format-standard","hentry","category-server","tag-11815","tag-ai-agent","tag-python","tag-50","tag-2983","tag-395"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>2026 AI Agent \u5165\u95e8\u5b9e\u6218\uff1a\u4e0d\u7528 LangChain\uff0c\u7528 Python \u624b\u5199\u4e00\u4e2a\u4f1a\u8c03\u7528\u5de5\u5177\u7684\u6700\u5c0f\u667a\u80fd\u4f53 - \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\/106321.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"2026 AI Agent \u5165\u95e8\u5b9e\u6218\uff1a\u4e0d\u7528 LangChain\uff0c\u7528 Python \u624b\u5199\u4e00\u4e2a\u4f1a\u8c03\u7528\u5de5\u5177\u7684\u6700\u5c0f\u667a\u80fd\u4f53 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"AI Agent&#xff0c;\u4e5f\u5c31\u662f AI \u667a\u80fd\u4f53&#xff0c;\u662f\u76ee\u524d\u4eba\u5de5\u667a\u80fd\u5e94\u7528\u5f00\u53d1\u4e2d\u7684\u70ed\u95e8\u65b9\u5411\u3002\u666e\u901a\u804a\u5929\u7a0b\u5e8f\u53ea\u80fd\u56de\u7b54\u95ee\u9898&#xff0c;\u800c Agent \u66f4\u5f3a\u8c03\u201c\u6267\u884c\u4efb\u52a1\u201d\u3002\u4f8b\u5982&#xff1a;\u67e5\u770b\u5f53\u524d\u65f6\u95f4\u5217\u51fa\u6587\u4ef6\u5939\u4e2d\u7684\u6587\u4ef6\u7edf\u8ba1\u4e0d\u540c\u7c7b\u578b\u6587\u4ef6\u7684\u6570\u91cf\u6839\u636e\u7528\u6237\u8981\u6c42\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177\u83b7\u53d6\u5de5\u5177\u6267\u884c\u7ed3\u679c\u5e76\u8fd4\u56de\u7b54\u6848\u5f88\u591a Agent \u6559\u7a0b\u4e00\u5f00\u59cb\u5c31\u4f7f\u7528 LangChain\u3001LangGraph \u7b49\u6846\u67b6&#xff0c;\u521d\u5b66\u8005\u5bb9\u6613\u88ab\u5927\u91cf\u6982\u5ff5\u548c\u4f9d\u8d56\u529d\u9000\u3002\u672c\u6587\u5148\u4e0d\u8c03\u7528\u5927\u6a21\u578b&#xff0c;\u4e5f\u4e0d\u4f7f\u7528\u7b2c\u4e09\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/106321.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-16T23:16:23+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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/106321.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/106321.html\",\"name\":\"2026 AI Agent \u5165\u95e8\u5b9e\u6218\uff1a\u4e0d\u7528 LangChain\uff0c\u7528 Python \u624b\u5199\u4e00\u4e2a\u4f1a\u8c03\u7528\u5de5\u5177\u7684\u6700\u5c0f\u667a\u80fd\u4f53 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-16T23:16:23+00:00\",\"dateModified\":\"2026-09-16T23:16:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/106321.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/106321.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/106321.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"2026 AI Agent \u5165\u95e8\u5b9e\u6218\uff1a\u4e0d\u7528 LangChain\uff0c\u7528 Python \u624b\u5199\u4e00\u4e2a\u4f1a\u8c03\u7528\u5de5\u5177\u7684\u6700\u5c0f\u667a\u80fd\u4f53\"}]},{\"@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":"2026 AI Agent \u5165\u95e8\u5b9e\u6218\uff1a\u4e0d\u7528 LangChain\uff0c\u7528 Python \u624b\u5199\u4e00\u4e2a\u4f1a\u8c03\u7528\u5de5\u5177\u7684\u6700\u5c0f\u667a\u80fd\u4f53 - \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\/106321.html","og_locale":"zh_CN","og_type":"article","og_title":"2026 AI Agent \u5165\u95e8\u5b9e\u6218\uff1a\u4e0d\u7528 LangChain\uff0c\u7528 Python \u624b\u5199\u4e00\u4e2a\u4f1a\u8c03\u7528\u5de5\u5177\u7684\u6700\u5c0f\u667a\u80fd\u4f53 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"AI Agent&#xff0c;\u4e5f\u5c31\u662f AI \u667a\u80fd\u4f53&#xff0c;\u662f\u76ee\u524d\u4eba\u5de5\u667a\u80fd\u5e94\u7528\u5f00\u53d1\u4e2d\u7684\u70ed\u95e8\u65b9\u5411\u3002\u666e\u901a\u804a\u5929\u7a0b\u5e8f\u53ea\u80fd\u56de\u7b54\u95ee\u9898&#xff0c;\u800c Agent \u66f4\u5f3a\u8c03\u201c\u6267\u884c\u4efb\u52a1\u201d\u3002\u4f8b\u5982&#xff1a;\u67e5\u770b\u5f53\u524d\u65f6\u95f4\u5217\u51fa\u6587\u4ef6\u5939\u4e2d\u7684\u6587\u4ef6\u7edf\u8ba1\u4e0d\u540c\u7c7b\u578b\u6587\u4ef6\u7684\u6570\u91cf\u6839\u636e\u7528\u6237\u8981\u6c42\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177\u83b7\u53d6\u5de5\u5177\u6267\u884c\u7ed3\u679c\u5e76\u8fd4\u56de\u7b54\u6848\u5f88\u591a Agent \u6559\u7a0b\u4e00\u5f00\u59cb\u5c31\u4f7f\u7528 LangChain\u3001LangGraph \u7b49\u6846\u67b6&#xff0c;\u521d\u5b66\u8005\u5bb9\u6613\u88ab\u5927\u91cf\u6982\u5ff5\u548c\u4f9d\u8d56\u529d\u9000\u3002\u672c\u6587\u5148\u4e0d\u8c03\u7528\u5927\u6a21\u578b&#xff0c;\u4e5f\u4e0d\u4f7f\u7528\u7b2c\u4e09","og_url":"https:\/\/www.wsisp.com\/helps\/106321.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-16T23:16:23+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/106321.html","url":"https:\/\/www.wsisp.com\/helps\/106321.html","name":"2026 AI Agent \u5165\u95e8\u5b9e\u6218\uff1a\u4e0d\u7528 LangChain\uff0c\u7528 Python \u624b\u5199\u4e00\u4e2a\u4f1a\u8c03\u7528\u5de5\u5177\u7684\u6700\u5c0f\u667a\u80fd\u4f53 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-16T23:16:23+00:00","dateModified":"2026-09-16T23:16:23+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/106321.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/106321.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/106321.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"2026 AI Agent \u5165\u95e8\u5b9e\u6218\uff1a\u4e0d\u7528 LangChain\uff0c\u7528 Python \u624b\u5199\u4e00\u4e2a\u4f1a\u8c03\u7528\u5de5\u5177\u7684\u6700\u5c0f\u667a\u80fd\u4f53"}]},{"@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\/106321","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=106321"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/106321\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=106321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=106321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=106321"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=106321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}