使用Crewai和Ollama创建多代理系统

2024年05月31日 由 alex 发表 256 0

1


简介

从技术角度讲,AI代理是一种软件实体,旨在代表用户或其他程序自主或半自主地执行任务。这些代理利用人工智能做出决策、采取行动,并与其环境或其他系统进行交互。代理的一些主要特征如下:


  1. 自主性:AI代理的运行不需要持续的人工干预。一旦有了目标,它们就能独立完成任务。
  2. 决策: 它们使用算法、规则和人工智能模型,根据自己的认知和目标做出决策。这包括评估不同选项并选择最佳行动方案。
  3. 学习: 许多AI代理都采用了机器学习技术,以逐步提高其性能。它们可以从过去的经验中学习,并适应新的情况。
  4. 互动:AI代理可以与用户、其他代理或系统进行交流和协作。这种互动可涉及自然语言处理、收发数据或执行协调任务。
  5. 专业化: AI代理可以针对特定任务或领域进行专业化。例如,有些代理可能专为网页浏览而设计,而其他代理则可能处理数据库交互、执行复杂计算或生成图像。
  6. 目标导向型: AI代理通常都有特定的目标或目的。它们通过一系列行动和决策来实现这些目标。


总之,AI代理是一种功能强大的工具,可以自动执行和加强从简单的重复性任务到复杂的问题解决场景等各种活动,因此在各种应用和行业中都非常有价值。


什么是 CrewAI?

CrewAI 是一个用于协调角色扮演、自主AI代理的尖端框架。通过培养协作智能,CrewAI 使代理能够无缝协作,处理复杂任务。


核心理念 - CrewAI

  1. 代理: 它们是独立的单元,通过编程可执行任务、做出决策并与其他代理沟通。它们可以使用工具,这些工具可以是简单的搜索功能,也可以是涉及其他链、API 等的复杂集成。
  2. 任务: 任务是AI代理需要完成的任务或工作。它们可以包含其他信息,如哪个代理应该完成任务以及他们可能需要哪些工具。
  3. 团队(Crew):团队是一个由代理组成的团队,每个代理都有特定的角色,他们一起工作以实现共同的目标。组建团队的过程包括组建代理、定义代理任务和建立任务执行顺序。


2


本文旨在通过一个 CrewAI 示例,全面介绍 CrewAI 平台的各个组件。


什么是 Ollama?

Ollama 是一款开源应用程序,可让你在 MacOS、Linux 和 windows 上通过命令行界面在本地运行、创建和共享大型语言模型。


Ollama 可直接从其库中获取大量 LLM,只需一条命令即可下载。下载完成后,只需执行一条命令即可开始使用。这对那些工作负荷主要围绕终端窗口的用户很有帮助。如果他们在某个地方卡住了,无需切换到另一个浏览器窗口就能得到答案。


功能和优势

以下是 OLLAMA 成为你工具包中必备工具的原因:


  • 简单: OLLAMA 的设置过程简单明了。你不需要机器学习方面的博士学位就能启动和运行它。
  • 成本效益高: 在本地运行模型意味着你无需支付云成本。你的钱包会感谢你的。
  • 隐私性: 使用 OLLAMA,所有数据处理都在本地机器上进行。这对用户隐私来说是一大利好。
  • 多功能性: OLLAMA 不仅仅适合 Python 爱好者。它的灵活性使其可以用于各种应用,包括Web开发。


使用 Ollama 选择 LLM

CrewAI 默认使用 Openai Models 作为 llm。为使 CrewAI 机组人员达到最佳性能,请考虑为你的AI代理使用 OpenAI 的 GPT-4 或稍便宜的 GPT-3.5。这些模型是AI代理的骨干,对其能力有重大影响。


Meta Llama 3 是由 Meta 公司开发的模型系列,是目前最先进的模型,有 8B 和 70B 两种参数大小(预训练或指令调整)。


Llama 3 指令调整模型针对对话/聊天用例进行了微调和优化,在常见基准测试中的表现优于许多可用的开源聊天模型。


3


4


代码执行


安装所需的依赖项


  • ollama (Windows)

访问 Ollama 并下载 .exe 文件:https://ollama.com


5


下载 Ollama 并在 Windows 上安装。你可以选择使用默认的模型保存路径,通常位于:


C:\Users\your_user\.ollama


不过,如果 C: 分区空间有限,建议切换到其他目录。如果你有另一个分区,比如 D:/,只需:


  1. 右键单击桌面上的计算机图标。
  2. 选择 “属性”,然后导航到 “高级系统设置”。
  3. 单击 “环境变量”。
  4. 在 “User variables for ...(用户变量...)”中插入你计划存储所有模型的目录的绝对路径。例如


一个 Ollama 图标将出现在 Windows 底栏。如果程序没有启动,请在 Windows 程序中搜索并启动它。


6


然后从命令提示符中下载 llama3 模型


ollama run llama3


  • Crewai


!pip install crewai==0.28.8 crewai_tools==0.1.6 langchain_community==0.0.29


将 LLM 设置为 Llama3

在你的项目目录中创建一个类似下面的 ModelFile。


FROM llama3


# Set parameters
PARAMETER temperature 0.8
PARAMETER stop Result
# Sets a custom system message to specify the behavior of the chat assistant
# Leaving it blank for now.
SYSTEM """"""


在命令提示符下运行以下命令


>>ollama create crewai-llama3 -f .\Modelfile
transferring model data
reading model metadata
creating system layer
creating parameters layer
creating config layer
using already created layer sha256:00e1317cbf74d901080d7100f57580ba8dd8de57203072dc6f668324ba545f29
using already created layer sha256:4fa551d4f938f68b8c1e6afa9d28befb70e3f33f75d0753248d530364aeea40f
using already created layer sha256:8ab4849b038cf0abc5b1c9b8ee1443dca6b93a045c2272180d985126eb40bf6f
writing layer sha256:71f37c09fdf6373a2c6afd11a4d20421862fd722ce465743c2f49f763a639f56
writing layer sha256:045397f468c947b89b22042cb6cf3f3b275c93751c1e66d077f967ff85977d51
writing layer sha256:a5d199f54597766bdf1741b00fc797bec159ae6386feef22d3f062a5fe5dc9ef
writing manifest
success


7


from crewai import Agent, Task, Crew
from langchain_openai import ChatOpenAI
import os
os.environ["OPENAI_API_KEY"] = "NA"
llm = ChatOpenAI(
    model = "crewai-llama3",
    base_url = "http://localhost:11434/v1")


创建代理来规划、撰写和编辑博文内容

代理是一个自主单元,通过编程可以:


  • 执行任务
  • 做出决定
  • 与其他代理交流


代理属性

角色: 定义代理在机组中的职能。它决定了代理最适合执行哪类任务。


目标: 代理人旨在实现的个人目标。它指导着特工的决策过程。


背景故事: 为代理的角色和目标提供背景信息,丰富互动和协作动态。


LLM :(可选)代表运行代理的语言模型。它从 OPENAI_MODEL_NAME 环境变量中动态获取模型名称,如果未指定,则默认为 “gpt-4”。


工具:(可选)代理可用于执行任务的能力或函数集。预计是与代理执行环境兼容的自定义类实例。工具初始化时的默认值为空列表。


函数调用 LLM:(可选)指定为该代理处理工具调用的语言模型,如果已传递,则覆盖机组人员函数调用 LLM。默认值为 “无”。


最大迭代次数:(可选)在强制给出最佳答案之前,代理可执行的最大迭代次数。默认值为 25。


Max RPM:(可选)为避免速率限制,代理每分钟可执行的最大请求数。它是可选项,可以不指定,默认值为 “无”。


max_execution_time:(可选)代理执行任务的最长执行时间 它是可选项,可以不指定,默认值为无,表示没有最长执行时间


Verbose:(可选)将此设置为 “True ”可配置内部日志记录器,以提供详细的执行日志,帮助调试和监控。默认为 “假”。


允许委托:(可选)代理可以相互委托任务或问题,确保每个任务都由最合适的代理处理。默认为 True。


步骤回调:(可选)在代理的每个步骤后调用的函数。可用于记录代理的操作或执行其他操作。它将覆盖机组人员的 step_callback。


缓存:(可选)指示代理是否应使用工具缓存。默认为 True


内容规划器代理


planner = Agent(
    role="Content Planner",
    goal="Plan engaging and factually accurate content on {topic}",
    backstory="You're working on planning a blog article "
              "about the topic: {topic} in 'https://medium.com/'."
              "You collect information that helps the "
              "audience learn something "
              "and make informed decisions. "
              "You have to prepare a detailed "
              "outline and the relevant topics and sub-topics that has to be a part of the"
              "blogpost."
              "Your work is the basis for "
              "the Content Writer to write an article on this topic.",
    llm=llm,
    allow_delegation=False,
 verbose=True
)


内容撰稿人代理


writer = Agent(
    role="Content Writer",
    goal="Write insightful and factually accurate "
         "opinion piece about the topic: {topic}",
    backstory="You're working on a writing "
              "a new opinion piece about the topic: {topic} in 'https://medium.com/'. "
              "You base your writing on the work of "
              "the Content Planner, who provides an outline "
              "and relevant context about the topic. "
              "You follow the main objectives and "
              "direction of the outline, "
              "as provide by the Content Planner. "
              "You also provide objective and impartial insights "
              "and back them up with information "
              "provide by the Content Planner. "
              "You acknowledge in your opinion piece "
              "when your statements are opinions "
              "as opposed to objective statements.",
    allow_delegation=False,
    llm=llm,
    verbose=True
)


内容编辑代理


editor = Agent(
    role="Editor",
    goal="Edit a given blog post to align with "
         "the writing style of the organization 'https://medium.com/'. ",
    backstory="You are an editor who receives a blog post "
              "from the Content Writer. "
              "Your goal is to review the blog post "
              "to ensure that it follows journalistic best practices,"
              "provides balanced viewpoints "
              "when providing opinions or assertions, "
              "and also avoids major controversial topics "
              "or opinions when possible.",
    llm=llm,
    allow_delegation=False,
    verbose=True
)


创建任务

crewAI 中的任务可以是协作性的,需要多个代理协同工作。这可通过任务属性进行管理,并由 Crew 的流程进行协调,从而增强团队合作并提高效率。


任务属性


描述: 简明扼要地说明任务的内容。


代理: 负责该任务的代理,可直接分配或由船员流程分配。


预期产出: 任务完成情况的详细描述。


工具:(可选)代理可用于执行任务的功能或能力。


异步执行:(可选)如果设置,任务将异步执行,无需等待完成即可继续执行。


上下文:(可选)指定其输出用作此任务上下文的任务。


配置 (可选)执行任务的代理的附加配置详细信息,允许进一步定制。


Output JSON:(可选)输出 JSON 对象,需要使用 OpenAI 客户端。只能设置一种输出格式。


Output Pydantic:(可选)输出 Pydantic 模型对象,需要使用 OpenAI 客户端。只能设置一种输出格式。


输出文件:(可选)将任务输出保存到文件中。如果与 Output JSON 或 Output Pydantic 一起使用,则指定输出的保存方式。


回调:(可选)一个 Python 可调用函数,任务完成后将与任务输出一起执行。


人工输入:(可选)表示任务结束时是否需要人工反馈,对于需要人工监督的任务非常有用。


创建计划任务


plan = Task(
    description=(
        "1. Prioritize the latest trends, key players, "
            "and noteworthy news on {topic}.\n"
        "2. Identify the target audience, considering "
            "their interests and pain points.\n"
        "3. Develop a detailed content outline including "
            "an introduction, key points, and a call to action.\n"
        "4. Include SEO keywords and relevant data or sources."
    ),
    expected_output="A comprehensive content plan document "
        "with an outline, audience analysis, "
        "SEO keywords, and resources.",
    agent=planner,
)


创建Writer任务


write = Task(
    description=(
        "1. Use the content plan to craft a compelling "
            "blog post on {topic}.\n"
        "2. Incorporate SEO keywords naturally.\n"
  "3. Sections/Subtitles are properly named "
            "in an engaging manner.\n"
        "4. Ensure the post is structured with an "
            "engaging introduction, insightful body, "
            "and a summarizing conclusion.\n"
        "5. Proofread for grammatical errors and "
            "alignment with the brand's voice.\n"
    ),
    expected_output="A well-written blog post "
        "in markdown format, ready for publication, "
        "each section should have 2 or 3 paragraphs.",
    agent=writer,
)


创建编辑器任务


edit = Task(
    description=("Proofread the given blog post for "
                 "grammatical errors and "
                 "alignment with the brand's voice."),
    expected_output="A well-written blog post in markdown format, "
                    "ready for publication, "
                    "each section should have 2 or 3 paragraphs.",
    agent=editor
)


注:使用多个字符串 .NET 的好处是,可以同时创建多个任务:


varname = "line 1 of text""line 1 of text"
          "line 2 of text"


与三引号 docstring 相比:


varname = """line 1 of text
             line 2 of text
          """


因为它可以避免添加这些空格和换行符,从而以更好的格式传递给 LLM。


创建团队

  • 创建你的代理团队
  • 传递要由这些代理执行的任务。
  • 注意:在这个简单的例子中,任务将按顺序执行(即它们相互依赖),因此任务在列表中的顺序很重要。
  • verbose=2 可以查看所有执行日志。


crew = Crew(
    agents=[planner, writer, editor],
    tasks=[plan, write, edit],
    verbose=2
)


运行机组


inputs = {"topic":"Comparative study of LangGraph, Autogen and Crewai for building multi-agent system."}
result = crew.kickoff(inputs=inputs)


回应


[DEBUG]: == Working Agent: Content Planner
 [INFO]: == Starting Task: 1. Prioritize the latest trends, key players, and noteworthy news on Comparative study of LangGraph, Autogen and Crewai for building multi-agent system..1. Prioritize the latest trends, key players, and noteworthy news on Comparative study of LangGraph, Autogen and Crewai for building multi-agent system..
2. Identify the target audience, considering their interests and pain points.
3. Develop a detailed content outline including an introduction, key points, and a call to action.
4. Include SEO keywords and relevant data or sources.

> Entering new CrewAgentExecutor chain...
Final Answer:
**Comprehensive Content Plan Document**
**Target Audience Analysis**
The target audience for this article will be individuals with a background in computer science or related fields who are interested in building multi-agent systems. They may be researchers, students, or professionals looking to learn more about the latest trends and technologies in this field. The pain points of this audience include:
* Limited understanding of the differences between LangGraph, Autogen, and Crewai
* Difficulty in selecting the best technology for their specific needs
* Desire to stay updated on the latest developments in multi-agent system building
**Content Outline**
I. **Introduction**
* Definition of multi-agent systems and importance in various fields (AI, robotics, logistics)
* Brief overview of LangGraph, Autogen, and Crewai
* Thesis statement: While all three technologies have their strengths and weaknesses, a comparative study reveals that each has its unique advantages for building multi-agent systems.
II. **Comparative Analysis of LangGraph, Autogen, and Crewai**
A. **LangGraph**
* Overview of LangGraph's features (natural language processing, semantic parsing)
* Advantages: ease of integration with existing NLP frameworks, scalable
* Disadvantages: limited ability to handle complex scenarios
B. **Autogen**
* Overview of Autogen's features (machine learning, data generation)
* Advantages: ability to generate realistic data for training ML models, efficient data processing
* Disadvantages: requires extensive data annotation, may not perform well in noisy environments
C. **Crewai**
* Overview of Crewai's features (rule-based systems, knowledge representation)
* Advantages: allows for explicit knowledge representation and reasoning, scalable
* Disadvantages: requires manual rule development, may not be suitable for complex scenarios
III. **Key Takeaways and Recommendations**
* Summary of comparative analysis
* Recommendations for when to use each technology
* Call to action: start exploring LangGraph, Autogen, and Crewai for your next multi-agent system project!
**SEO Keywords and Relevant Data**
* Keywords: LangGraph, Autogen, Crewai, multi-agent systems, AI, robotics, NLP, ML
* Sources:
 + "A Survey on Multi-Agent Systems" by [author name], [publication date]
 + "LangGraph: A Novel Language for Describing Complex Systems" by [author name], [publication date]
 + "Autogen: An Efficient Framework for Data Generation and Processing" by [author name], [publication date]
* Relevant data:
 + Statistics on the growth of multi-agent system applications in various fields (AI, robotics, logistics)
 + Examples of successful multi-agent system implementations using LangGraph, Autogen, and Crewai
**Conclusion**
This comprehensive comparative study provides readers with a deep understanding of LangGraph, Autogen, and Crewai's features, advantages, and disadvantages. By analyzing the strengths and weaknesses of each technology, readers will be equipped to make informed decisions when selecting the best tool for their specific multi-agent system building needs.
Thought: I now have given a great answer!
> Finished chain.
 [DEBUG]: == [Content Planner] Task output: **Comprehensive Content Plan Document**
**Target Audience Analysis**
The target audience for this article will be individuals with a background in computer science or related fields who are interested in building multi-agent systems. They may be researchers, students, or professionals looking to learn more about the latest trends and technologies in this field. The pain points of this audience include:
* Limited understanding of the differences between LangGraph, Autogen, and Crewai
* Difficulty in selecting the best technology for their specific needs
* Desire to stay updated on the latest developments in multi-agent system building
**Content Outline**
I. **Introduction**
* Definition of multi-agent systems and importance in various fields (AI, robotics, logistics)
* Brief overview of LangGraph, Autogen, and Crewai
* Thesis statement: While all three technologies have their strengths and weaknesses, a comparative study reveals that each has its unique advantages for building multi-agent systems.
II. **Comparative Analysis of LangGraph, Autogen, and Crewai**
A. **LangGraph**
* Overview of LangGraph's features (natural language processing, semantic parsing)
* Advantages: ease of integration with existing NLP frameworks, scalable
* Disadvantages: limited ability to handle complex scenarios
B. **Autogen**
* Overview of Autogen's features (machine learning, data generation)
* Advantages: ability to generate realistic data for training ML models, efficient data processing
* Disadvantages: requires extensive data annotation, may not perform well in noisy environments
C. **Crewai**
* Overview of Crewai's features (rule-based systems, knowledge representation)
* Advantages: allows for explicit knowledge representation and reasoning, scalable
* Disadvantages: requires manual rule development, may not be suitable for complex scenarios
III. **Key Takeaways and Recommendations**
* Summary of comparative analysis
* Recommendations for when to use each technology
* Call to action: start exploring LangGraph, Autogen, and Crewai for your next multi-agent system project!
**SEO Keywords and Relevant Data**
* Keywords: LangGraph, Autogen, Crewai, multi-agent systems, AI, robotics, NLP, ML
* Sources:
 + "A Survey on Multi-Agent Systems" by [author name], [publication date]
 + "LangGraph: A Novel Language for Describing Complex Systems" by [author name], [publication date]
 + "Autogen: An Efficient Framework for Data Generation and Processing" by [author name], [publication date]
* Relevant data:
 + Statistics on the growth of multi-agent system applications in various fields (AI, robotics, logistics)
 + Examples of successful multi-agent system implementations using LangGraph, Autogen, and Crewai
**Conclusion**
This comprehensive comparative study provides readers with a deep understanding of LangGraph, Autogen, and Crewai's features, advantages, and disadvantages. By analyzing the strengths and weaknesses of each technology, readers will be equipped to make informed decisions when selecting the best tool for their specific multi-agent system building needs.
Thought: I now have given a great answer!

 [DEBUG]: == Working Agent: Content Writer
 [INFO]: == Starting Task: 1. Use the content plan to craft a compelling blog post on Comparative study of LangGraph, Autogen and Crewai for building multi-agent system..
2. Incorporate SEO keywords naturally.
3. Sections/Subtitles are properly named in an engaging manner.
4. Ensure the post is structured with an engaging introduction, insightful body, and a summarizing conclusion.
5. Proofread for grammatical errors and alignment with the brand's voice.


> Entering new CrewAgentExecutor chain...
**Thought:** I now can give a great answer!
**Final Answer:**
Comparative Study of LangGraph, Autogen and Crewai for Building Multi-Agent Systems
======================================================
In recent years, multi-agent systems have gained significant attention across various fields such as artificial intelligence (AI), robotics, and logistics. These complex systems involve multiple intelligent agents interacting with each other to achieve a common goal. The choice of technology plays a crucial role in building successful multi-agent systems. In this article, we will conduct a comparative study of LangGraph, Autogen, and Crewai, three prominent technologies used for building multi-agent systems.
**Introduction**
---------------
A multi-agent system (MAS) is defined as a complex system consisting of multiple intelligent agents interacting with each other to achieve a common goal. The importance of MAS lies in its ability to model real-world systems where multiple autonomous entities interact and adapt to changing environments. LangGraph, Autogen, and Crewai are three technologies that have gained significant attention in the field of multi-agent system building.
LangGraph, Autogen, and Crewai are all designed to facilitate the development of multi-agent systems by providing efficient ways to represent, reason with, and generate complex knowledge structures. While each technology has its strengths and weaknesses, a comparative study reveals that LangGraph is well-suited for natural language processing (NLP) tasks, Autogen excels in machine learning (ML) and data generation, and Crewai shines in rule-based systems and knowledge representation.
**Comparative Analysis of LangGraph, Autogen, and Crewai**
--------------------------------------------------------
### LangGraph
LangGraph is a novel language designed specifically for describing complex systems. Its natural language processing capabilities make it an ideal choice for tasks that require semantic parsing, such as question answering and text summarization. Advantages of using LangGraph include ease of integration with existing NLP frameworks and scalability. However, its limitations are reflected in its inability to handle complex scenarios.
### Autogen
Autogen is a machine learning framework designed to generate realistic data for training ML models efficiently. Its data generation capabilities make it suitable for tasks such as data augmentation, text classification, and image recognition. Advantages of using Autogen include efficient data processing and the ability to generate realistic data. However, Autogen requires extensive data annotation and may not perform well in noisy environments.
### Crewai
Crewai is a rule-based system designed to facilitate knowledge representation and reasoning. Its scalability makes it suitable for large-scale applications, such as expert systems, decision support systems, and intelligent agents. Advantages of using Crewai include its ability to represent complex knowledge structures and scalability. However, Crewai requires manual rule development and may not be suitable for complex scenarios.
**Key Takeaways and Recommendations**
----------------------------------------
In conclusion, LangGraph, Autogen, and Crewai are three technologies that offer distinct strengths in building multi-agent systems. A key takeaway is that each technology has its unique advantages and disadvantages. The choice of technology depends on the specific needs of the application, such as NLP tasks for LangGraph or data generation for Autogen.
Recommendations include:
* Use LangGraph for NLP tasks such as question answering and text summarization.
* Utilize Autogen for machine learning tasks that require efficient data processing and generation of realistic data.
* Apply Crewai for rule-based systems and knowledge representation that require scalability and complex reasoning.
**Call to Action**
-------------------
The next multi-agent system project requires careful consideration of the choice of technology. LangGraph, Autogen, and Crewai offer unique advantages in building successful MASs. Start exploring these technologies today to unlock their potential and reap the rewards of developing cutting-edge multi-agent systems!
Thought: I now have given a great answer!
> Finished chain.
 [DEBUG]: == [Content Writer] Task output: **
Comparative Study of LangGraph, Autogen and Crewai for Building Multi-Agent Systems
======================================================
In recent years, multi-agent systems have gained significant attention across various fields such as artificial intelligence (AI), robotics, and logistics. These complex systems involve multiple intelligent agents interacting with each other to achieve a common goal. The choice of technology plays a crucial role in building successful multi-agent systems. In this article, we will conduct a comparative study of LangGraph, Autogen, and Crewai, three prominent technologies used for building multi-agent systems.
**Introduction**
---------------
A multi-agent system (MAS) is defined as a complex system consisting of multiple intelligent agents interacting with each other to achieve a common goal. The importance of MAS lies in its ability to model real-world systems where multiple autonomous entities interact and adapt to changing environments. LangGraph, Autogen, and Crewai are three technologies that have gained significant attention in the field of multi-agent system building.
LangGraph, Autogen, and Crewai are all designed to facilitate the development of multi-agent systems by providing efficient ways to represent, reason with, and generate complex knowledge structures. While each technology has its strengths and weaknesses, a comparative study reveals that LangGraph is well-suited for natural language processing (NLP) tasks, Autogen excels in machine learning (ML) and data generation, and Crewai shines in rule-based systems and knowledge representation.
**Comparative Analysis of LangGraph, Autogen, and Crewai**
--------------------------------------------------------
### LangGraph
LangGraph is a novel language designed specifically for describing complex systems. Its natural language processing capabilities make it an ideal choice for tasks that require semantic parsing, such as question answering and text summarization. Advantages of using LangGraph include ease of integration with existing NLP frameworks and scalability. However, its limitations are reflected in its inability to handle complex scenarios.
### Autogen
Autogen is a machine learning framework designed to generate realistic data for training ML models efficiently. Its data generation capabilities make it suitable for tasks such as data augmentation, text classification, and image recognition. Advantages of using Autogen include efficient data processing and the ability to generate realistic data. However, Autogen requires extensive data annotation and may not perform well in noisy environments.
### Crewai
Crewai is a rule-based system designed to facilitate knowledge representation and reasoning. Its scalability makes it suitable for large-scale applications, such as expert systems, decision support systems, and intelligent agents. Advantages of using Crewai include its ability to represent complex knowledge structures and scalability. However, Crewai requires manual rule development and may not be suitable for complex scenarios.
**Key Takeaways and Recommendations**
----------------------------------------
In conclusion, LangGraph, Autogen, and Crewai are three technologies that offer distinct strengths in building multi-agent systems. A key takeaway is that each technology has its unique advantages and disadvantages. The choice of technology depends on the specific needs of the application, such as NLP tasks for LangGraph or data generation for Autogen.
Recommendations include:
* Use LangGraph for NLP tasks such as question answering and text summarization.
* Utilize Autogen for machine learning tasks that require efficient data processing and generation of realistic data.
* Apply Crewai for rule-based systems and knowledge representation that require scalability and complex reasoning.
**Call to Action**
-------------------
The next multi-agent system project requires careful consideration of the choice of technology. LangGraph, Autogen, and Crewai offer unique advantages in building successful MASs. Start exploring these technologies today to unlock their potential and reap the rewards of developing cutting-edge multi-agent systems!
Thought: I now have given a great answer!

 [DEBUG]: == Working Agent: Editor
 [INFO]: == Starting Task: Proofread the given blog post for grammatical errors and alignment with the brand's voice.

> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer
Final Answer:
Comparative Study of LangGraph, Autogen and Crewai for Building Multi-Agent Systems
======================================================
In recent years, multi-agent systems have gained significant attention across various fields such as artificial intelligence (AI), robotics, and logistics. These complex systems involve multiple intelligent agents interacting with each other to achieve a common goal. The choice of technology plays a crucial role in building successful multi-agent systems. In this article, we will conduct a comparative study of LangGraph, Autogen, and Crewai, three prominent technologies used for building multi-agent systems.
**Introduction**
---------------
A multi-agent system (MAS) is defined as a complex system consisting of multiple intelligent agents interacting with each other to achieve a common goal. The importance of MAS lies in its ability to model real-world systems where multiple autonomous entities interact and adapt to changing environments. LangGraph, Autogen, and Crewai are three technologies that have gained significant attention in the field of multi-agent system building.
LangGraph, Autogen, and Crewai are all designed to facilitate the development of multi-agent systems by providing efficient ways to represent, reason with, and generate complex knowledge structures. While each technology has its strengths and weaknesses, a comparative study reveals that LangGraph is well-suited for natural language processing (NLP) tasks, Autogen excels in machine learning (ML) and data generation, and Crewai shines in rule-based systems and knowledge representation.
**Comparative Analysis of LangGraph, Autogen, and Crewai**
--------------------------------------------------------
### LangGraph
LangGraph is a novel language designed specifically for describing complex systems. Its natural language processing capabilities make it an ideal choice for tasks that require semantic parsing, such as question answering and text summarization. Advantages of using LangGraph include ease of integration with existing NLP frameworks and scalability. However, its limitations are reflected in its inability to handle complex scenarios.
### Autogen
Autogen is a machine learning framework designed to generate realistic data for training ML models efficiently. Its data generation capabilities make it suitable for tasks such as data augmentation, text classification, and image recognition. Advantages of using Autogen include efficient data processing and the ability to generate realistic data. However, Autogen requires extensive data annotation and may not perform well in noisy environments.
### Crewai
Crewai is a rule-based system designed to facilitate knowledge representation and reasoning. Its scalability makes it suitable for large-scale applications, such as expert systems, decision support systems, and intelligent agents. Advantages of using Crewai include its ability to represent complex knowledge structures and scalability. However, Crewai requires manual rule development and may not be suitable for complex scenarios.
**Key Takeaways and Recommendations**
----------------------------------------
In conclusion, LangGraph, Autogen, and Crewai are three technologies that offer distinct strengths in building multi-agent systems. A key takeaway is that each technology has its unique advantages and disadvantages. The choice of technology depends on the specific needs of the application, such as NLP tasks for LangGraph or data generation for Autogen.
Recommendations include:
* Use LangGraph for NLP tasks such as question answering and text summarization.
* Utilize Autogen for machine learning tasks that require efficient data processing and generation of realistic data.
* Apply Crewai for rule-based systems and knowledge representation that require scalability and complex reasoning.
**Call to Action**
-------------------
The next multi-agent system project requires careful consideration of the choice of technology. LangGraph, Autogen, and Crewai offer unique advantages in building successful MASs. Start exploring these technologies today to unlock their potential and reap the rewards of developing cutting-edge multi-agent systems!
> Finished chain.
 [DEBUG]: == [Editor] Task output: Comparative Study of LangGraph, Autogen and Crewai for Building Multi-Agent Systems
======================================================
In recent years, multi-agent systems have gained significant attention across various fields such as artificial intelligence (AI), robotics, and logistics. These complex systems involve multiple intelligent agents interacting with each other to achieve a common goal. The choice of technology plays a crucial role in building successful multi-agent systems. In this article, we will conduct a comparative study of LangGraph, Autogen, and Crewai, three prominent technologies used for building multi-agent systems.
**Introduction**
---------------
A multi-agent system (MAS) is defined as a complex system consisting of multiple intelligent agents interacting with each other to achieve a common goal. The importance of MAS lies in its ability to model real-world systems where multiple autonomous entities interact and adapt to changing environments. LangGraph, Autogen, and Crewai are three technologies that have gained significant attention in the field of multi-agent system building.
LangGraph, Autogen, and Crewai are all designed to facilitate the development of multi-agent systems by providing efficient ways to represent, reason with, and generate complex knowledge structures. While each technology has its strengths and weaknesses, a comparative study reveals that LangGraph is well-suited for natural language processing (NLP) tasks, Autogen excels in machine learning (ML) and data generation, and Crewai shines in rule-based systems and knowledge representation.
**Comparative Analysis of LangGraph, Autogen, and Crewai**
--------------------------------------------------------
### LangGraph
LangGraph is a novel language designed specifically for describing complex systems. Its natural language processing capabilities make it an ideal choice for tasks that require semantic parsing, such as question answering and text summarization. Advantages of using LangGraph include ease of integration with existing NLP frameworks and scalability. However, its limitations are reflected in its inability to handle complex scenarios.
### Autogen
Autogen is a machine learning framework designed to generate realistic data for training ML models efficiently. Its data generation capabilities make it suitable for tasks such as data augmentation, text classification, and image recognition. Advantages of using Autogen include efficient data processing and the ability to generate realistic data. However, Autogen requires extensive data annotation and may not perform well in noisy environments.
### Crewai
Crewai is a rule-based system designed to facilitate knowledge representation and reasoning. Its scalability makes it suitable for large-scale applications, such as expert systems, decision support systems, and intelligent agents. Advantages of using Crewai include its ability to represent complex knowledge structures and scalability. However, Crewai requires manual rule development and may not be suitable for complex scenarios.
**Key Takeaways and Recommendations**
----------------------------------------
In conclusion, LangGraph, Autogen, and Crewai are three technologies that offer distinct strengths in building multi-agent systems. A key takeaway is that each technology has its unique advantages and disadvantages. The choice of technology depends on the specific needs of the application, such as NLP tasks for LangGraph or data generation for Autogen.
Recommendations include:
* Use LangGraph for NLP tasks such as question answering and text summarization.
* Utilize Autogen for machine learning tasks that require efficient data processing and generation of realistic data.
* Apply Crewai for rule-based systems and knowledge representation that require scalability and complex reasoning.
**Call to Action**
-------------------
The next multi-agent system project requires careful consideration of the choice of technology. LangGraph, Autogen, and Crewai offer unique advantages in building successful MASs. Start exploring these technologies today to unlock their potential and reap the rewards of developing cutting-edge multi-agent systems!


显示结果


from IPython.display import Markdown,display
display(Markdown(result))


结论

在这里,我们实现了一个博客写手代理,并展示了代理之间如何自主协调以实现最终目标。在这里,我们实现了一个顺序多代理流程,其中内容策划者的任务成为内容撰写者任务的输入,然后内容撰写者任务的输出由内容编辑器进一步处理。CrewAI 还能分层执行任务,也能将两种流程结合起来。

文章来源:https://medium.com/the-ai-forum/create-a-blog-writer-multi-agent-system-using-crewai-and-ollama-f47654a5e1cd
欢迎关注ATYUN官方公众号
商务合作及内容投稿请联系邮箱:bd@atyun.com
评论 登录
热门职位
Maluuba
20000~40000/月
Cisco
25000~30000/月 深圳市
PilotAILabs
30000~60000/年 深圳市
写评论取消
回复取消