{"id":16966,"date":"2025-01-02T12:59:54","date_gmt":"2025-01-02T04:59:54","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=16966"},"modified":"2025-01-02T12:59:54","modified_gmt":"2025-01-02T04:59:54","slug":"agentarium","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/pt\/agentarium\/","title":{"rendered":"Agentarium\uff1a\u7ba1\u7406\u548c\u534f\u8c03\u591a\u4e2aAI\u667a\u80fd\u4f53\u4e4b\u95f4\u7684\u4ea4\u4e92"},"content":{"rendered":"<p>Agentarium \u662f\u4e00\u4e2a\u5f3a\u5927\u7684 Python \u6846\u67b6\uff0c\u4e13\u95e8\u7528\u4e8e\u7ba1\u7406\u548c\u7f16\u6392 AI \u667a\u80fd\u4ee3\u7406\uff08Agent\uff09\u3002\u8fd9\u4e2a\u6846\u67b6\u63d0\u4f9b\u4e86\u7075\u6d3b\u76f4\u89c2\u7684\u65b9\u5f0f\u6765\u521b\u5efa\u3001\u7ba1\u7406\u548c\u534f\u8c03\u591a\u4e2a AI \u4ee3\u7406\u4e4b\u95f4\u7684\u4ea4\u4e92\u3002\u5b83\u91c7\u7528 Apache 2.0 \u8bb8\u53ef\u8bc1\u5f00\u6e90\uff0c\u652f\u6301 Python 3.10+ \u7248\u672c\u3002Agentarium \u7684\u6838\u5fc3\u4f18\u52bf\u5728\u4e8e\u5176\u5148\u8fdb\u7684\u4ee3\u7406\u7ba1\u7406\u7cfb\u7edf\u3001\u5065\u58ee\u7684\u4ea4\u4e92\u7ba1\u7406\u673a\u5236\u548c\u53ef\u6269\u5c55\u7684\u67b6\u6784\u8bbe\u8ba1\u3002\u901a\u8fc7\u7b80\u5355\u7684 API \u63a5\u53e3\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u5177\u6709\u4e0d\u540c\u89d2\u8272\u548c\u80fd\u529b\u7684 AI \u4ee3\u7406\uff0c\u5e76\u8ba9\u5b83\u4eec\u5728\u81ea\u5b9a\u4e49\u73af\u5883\u4e2d\u8fdb\u884c\u4e92\u52a8\u3002\u6846\u67b6\u8fd8\u63d0\u4f9b\u4e86\u68c0\u67e5\u70b9\u7cfb\u7edf\u7528\u4e8e\u4fdd\u5b58\u548c\u6062\u590d\u4ee3\u7406\u72b6\u6001\uff0c\u4ee5\u53ca\u901a\u8fc7\u4ee3\u7406\u4ea4\u4e92\u751f\u6210\u5408\u6210\u6570\u636e\u7684\u529f\u80fd\u3002<\/p>\n<p><a href=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/01779054d6d896c.svg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-16967\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/01779054d6d896c.svg\" alt=\"\" width=\"1089\" height=\"671\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li>\u9ad8\u7ea7\u4ee3\u7406\u7ba1\u7406\uff1a\u652f\u6301\u521b\u5efa\u548c\u7f16\u6392\u5177\u6709\u4e0d\u540c\u89d2\u8272\u548c\u80fd\u529b\u7684\u591a\u4e2a AI \u4ee3\u7406<\/li>\n<li>\u4ea4\u4e92\u7ba1\u7406\u7cfb\u7edf\uff1a\u63d0\u4f9b\u5f3a\u5927\u7684\u4ee3\u7406\u95f4\u4ea4\u4e92\u534f\u8c03\u673a\u5236<\/li>\n<li>\u68c0\u67e5\u70b9\u7cfb\u7edf\uff1a\u5b9e\u73b0\u4ee3\u7406\u72b6\u6001\u548c\u4ea4\u4e92\u7684\u4fdd\u5b58\u4e0e\u6062\u590d\u529f\u80fd<\/li>\n<li>\u6570\u636e\u751f\u6210\u80fd\u529b\uff1a\u901a\u8fc7\u4ee3\u7406\u4ea4\u4e92\u751f\u6210\u5408\u6210\u6570\u636e<\/li>\n<li>\u6027\u80fd\u4f18\u5316\u8bbe\u8ba1\uff1a\u4e13\u6ce8\u4e8e\u6548\u7387\u548c\u53ef\u6269\u5c55\u6027\u7684\u67b6\u6784<\/li>\n<li>\u7075\u6d3b\u73af\u5883\u914d\u7f6e\uff1a\u652f\u6301\u4f7f\u7528 YAML \u914d\u7f6e\u6587\u4ef6\u5b9a\u4e49\u81ea\u5b9a\u4e49\u73af\u5883<\/li>\n<li>\u53ef\u6269\u5c55\u67b6\u6784\uff1a\u6613\u4e8e\u6839\u636e\u7279\u5b9a\u9700\u6c42\u8fdb\u884c\u6269\u5c55\u548c\u5b9a\u5236<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<h3>1. \u5b89\u88c5\u6307\u5357<\/h3>\n<p>Agentarium \u7684\u5b89\u88c5\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u4e00\u884c\u547d\u4ee4\uff1a<\/p>\n<pre><code>pip install agentarium\r\n<\/code><\/pre>\n<p>\u786e\u4fdd\u60a8\u7684 Python \u7248\u672c\u5728 3.10 \u6216\u4ee5\u4e0a\u3002<\/p>\n<h3>2. \u57fa\u7840\u4f7f\u7528\u6559\u7a0b<\/h3>\n<h4>2.1 \u521b\u5efa\u548c\u4f7f\u7528\u57fa\u672c\u4ee3\u7406<\/h4>\n<pre><code>from agentarium import Agent\r\n# \u521b\u5efa\u4ee3\u7406\u5b9e\u4f8b\r\nagent1 = Agent(name=\"agent1\")\r\nagent2 = Agent(name=\"agent2\")\r\n# \u4ee3\u7406\u95f4\u5bf9\u8bdd\r\nagent1.talk_to(agent2, \"Hello, how are you?\")\r\nagent2.talk_to(agent1, \"I'm fine, thank you!\")\r\n# \u81ea\u4e3b\u884c\u4e3a\r\nagent1.act()  # \u4ee3\u7406\u81ea\u884c\u51b3\u5b9a\u4e0b\u4e00\u6b65\u884c\u52a8\r\n<\/code><\/pre>\n<h4>2.2 \u73af\u5883\u914d\u7f6e<\/h4>\n<p>\u521b\u5efa YAML \u914d\u7f6e\u6587\u4ef6\u6765\u8bbe\u7f6e\u73af\u5883\uff1a<\/p>\n<pre><code>llm:\r\nprovider: \"openai\"  # \u9009\u62e9 AI \u63d0\u4f9b\u5546\r\nmodel: \"gpt-4o-mini\"  # \u9009\u62e9\u6a21\u578b\r\naisuite:  # \u914d\u7f6e\u51ed\u8bc1\uff08\u53ef\u9009\uff09\r\nopenai:\r\napi_key: \"\u4f60\u7684API\u5bc6\u94a5\"\r\n<\/code><\/pre>\n<h4>2.3 \u4f7f\u7528\u68c0\u67e5\u70b9\u7cfb\u7edf<\/h4>\n<pre><code>from agentarium import Agent\r\nfrom agentarium.CheckpointManager import CheckpointManager\r\n# \u521b\u5efa\u68c0\u67e5\u70b9\u7ba1\u7406\u5668\r\ncheckpoint = CheckpointManager(\"demo\")\r\n# \u521b\u5efa\u4ee3\u7406\r\nalice = Agent.create_agent()\r\nbob = Agent.create_agent()\r\n# \u8bb0\u5f55\u4ea4\u4e92\r\nalice.talk_to(bob, \"What a beautiful day!\")\r\ncheckpoint.update(step=\"interaction_1\")\r\n# \u4fdd\u5b58\u72b6\u6001\r\ncheckpoint.save()\r\n<\/code><\/pre>\n<h3>3. \u9ad8\u7ea7\u529f\u80fd\u4f7f\u7528<\/h3>\n<h4>3.1 \u81ea\u5b9a\u4e49\u4ee3\u7406\u80fd\u529b<\/h4>\n<ul>\n<li>\u53ef\u4ee5\u901a\u8fc7\u7ee7\u627f Agent \u7c7b\u6765\u521b\u5efa\u5177\u6709\u7279\u5b9a\u80fd\u529b\u7684\u4ee3\u7406<\/li>\n<li>\u53ef\u4ee5\u5b9a\u5236\u4ee3\u7406\u7684\u51b3\u7b56\u903b\u8f91\u548c\u884c\u4e3a\u6a21\u5f0f<\/li>\n<li>\u652f\u6301\u6dfb\u52a0\u81ea\u5b9a\u4e49\u7684\u4ea4\u4e92\u65b9\u6cd5<\/li>\n<\/ul>\n<h4>3.2 \u6570\u636e\u751f\u6210\u4e0e\u7ba1\u7406<\/h4>\n<ul>\n<li>\u4f7f\u7528\u4ee3\u7406\u4ea4\u4e92\u751f\u6210\u8bad\u7ec3\u6570\u636e<\/li>\n<li>\u4fdd\u5b58\u548c\u5206\u6790\u4ea4\u4e92\u5386\u53f2<\/li>\n<li>\u5bfc\u51fa\u751f\u6210\u7684\u6570\u636e\u7528\u4e8e\u5176\u4ed6\u7528\u9014<\/li>\n<\/ul>\n<h4>3.3 \u6269\u5c55\u5f00\u53d1<\/h4>\n<p>\u5982\u679c\u60a8\u60f3\u4e3a\u9879\u76ee\u8d21\u732e\u4ee3\u7801\uff1a<\/p>\n<ol>\n<li>\u514b\u9686\u4ed3\u5e93<\/li>\n<li>\u521b\u5efa\u65b0\u5206\u652f (<code>git checkout -b feature\/\u65b0\u529f\u80fd<\/code>)<\/li>\n<li>\u8fdb\u884c\u4fee\u6539<\/li>\n<li>\u63d0\u4ea4\u66f4\u6539 (<code>git commit -m '\u6dfb\u52a0\u65b0\u529f\u80fd'<\/code>)<\/li>\n<li>\u63a8\u9001\u5230\u5206\u652f (<code>git push origin feature\/\u65b0\u529f\u80fd<\/code>)<\/li>\n<li>\u521b\u5efa Pull Request<\/li>\n<\/ol>\n<h3>4. \u6700\u4f73\u5b9e\u8df5<\/h3>\n<ul>\n<li>\u4e3a\u6bcf\u4e2a\u4ee3\u7406\u8bbe\u7f6e\u660e\u786e\u7684\u89d2\u8272\u548c\u804c\u8d23<\/li>\n<li>\u4f7f\u7528\u68c0\u67e5\u70b9\u7cfb\u7edf\u5b9a\u671f\u4fdd\u5b58\u91cd\u8981\u72b6\u6001<\/li>\n<li>\u5408\u7406\u914d\u7f6e\u73af\u5883\u53c2\u6570\u4ee5\u4f18\u5316\u6027\u80fd<\/li>\n<li>\u8bb0\u5f55\u548c\u76d1\u63a7\u4ee3\u7406\u95f4\u7684\u4ea4\u4e92\u8fc7\u7a0b<\/li>\n<li>\u5b9a\u671f\u5907\u4efd\u91cd\u8981\u7684\u914d\u7f6e\u548c\u6570\u636e<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Agentarium \u662f\u4e00\u4e2a\u5f3a\u5927\u7684 Python \u6846\u67b6\uff0c\u4e13\u95e8\u7528\u4e8e\u7ba1\u7406\u548c\u7f16\u6392 AI \u667a\u80fd\u4ee3\u7406\uff08Agent\uff09\u3002\u8fd9\u4e2a\u6846\u67b6\u63d0\u4f9b\u4e86\u7075\u6d3b\u76f4\u89c2\u7684\u65b9\u5f0f\u6765\u521b\u5efa\u3001\u7ba1\u7406\u548c\u534f\u8c03\u591a\u4e2a AI \u4ee3\u7406\u4e4b\u95f4\u7684\u4ea4\u4e92\u3002\u5b83\u91c7\u7528 Apache 2.0 \u8bb8\u53ef\u8bc1\u5f00\u6e90\uff0c\u652f\u6301 Python&#8230;<\/p>\n","protected":false},"author":1,"featured_media":61543,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[230,201],"class_list":["post-16966","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tool","tag-aikaiyuanxiangmu","tag-aizhinengti"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/16966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/comments?post=16966"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/16966\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/media\/61543"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/media?parent=16966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/categories?post=16966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/tags?post=16966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}