🗒️跟着吴恩达学AI多智能体-10/17-定义良好的任务的关键要素
00 分钟
2024-6-5
2024-6-29
type
status
date
summary
slug
tags
category
password
URL
icon
<Multi AI Agent Systems with crewAI>是吴恩达大佬与CrewAI的创始人兼CEO合作新开的一门课程,该课程的目标是通过理论和实际案例,让学员掌握构建智能体系统的技能,最终能自主构建复杂的智能体团队。该课程是以视频教学的形式进行的,为了便于大家快速学习,我这边提供了图文形式。官方链接放在了左下角,大家点击原文链接即可查看官方视频课程。该课程共分为17节,本文是第十节,后续我会每天更新一节,大家有问题可以随时私信或者写在评论区。以下是第十节的图文内容。
 

课程内容

notion image
好的,我们刚刚组建了一个非常棒的团队。到现在,你可能已经感到非常兴奋,我也同样如此。但我们还可以更进一步。在这节课中,我们将构建一个多智能体系统,它将帮助我们策划一个活动。想一想聚会或会议,无论它是什么。这些智能体将帮助我们找到场地,进行策划,围绕餐饮服务进行规划,以及所有与之相关的事情。那么,让我们开始吧,看看它是什么样子。欢迎来到我们的下一课。在这节课中,我们将讨论任务。我对这个话题非常兴奋。我们已经讨论了很多内容,这是另一个我们可以深入探讨的绝佳主题,因为归根结底,如果你考虑你的智能体,它们正在执行任务。因此,任务是多智能体系统的基石。所以当你谈论任务时,我想回顾一下我们几节课前讨论的内容,即管理者类比。
notion image
你可能会记得我们讨论过,这个管理者心智框架用于创建智能体,你把自己置于管理者的角度,思考你将雇佣哪些人来完成一系列任务或你试图完成的工作。然后你用这个作为起点来定义智能体的角色、目标和背景故事。因此,你需要非常清楚地了解你试图实现的目标是什么,你还需要非常清楚地了解实现这个目标的过程是什么。有了这个想法,你将清楚地了解你会雇佣哪些人,那些将是你的智能体。
但现在,我想在这个类比的基础上进行构建。我想扩展这个心智模型,让你思考你的任务。因为每当你雇佣某人做某事时,你也会开始思考你将如何将工作委派给他们。特别是如果是一个初级人员,你想确保你会将工作委派给他们。特别是如果是一个初级人员,你想确保你非常明确地说明你期望他们做什么以及预期的结果是什么。所以我会说你为了构建出色的智能体,你应该添加我期望我的团队成员执行的任务。你可以用这个来创建任务。并且每当你创建任务时,你至少需要记住两件事。一,任务的清晰描述。二,设定清晰简洁的期望。
再次回到我们的类比,让我们想象你刚刚雇佣了一个初级工程师加入你的团队,你被指派为指导这个人。这是他们工作的第一天。你想给他们一个具体的任务来工作。你想非常真实地解释那个任务。然后你想确保你说出了你期望他们做什么。所以,Query AI在某种程度上迫使你这样思考,因为Query AI确保它强制你为每个创建的任务设置至少两个属性。描述和预期结果。这被用来构建更好的内部提示。但这也适用于任何其他框架。如果你在解释任务是什么以及你期望你的智能体做什么方面多走一步,你会得到更好的结果。
notion image
除此之外,任务上还可以设置很多其他事情。Query AI提供了很多超参数,你可以使用,比如设置上下文,或者设置回调,或者用特定任务工具覆盖智能体工具,强制人工输入,有点像确保在智能体完成工作之前,它停下来问你对它的感觉如何,以便你可以给出进一步的指令。我们还可以讨论异步执行这些任务或将它们的结果输出为PyDentech对象或JSON对象,甚至输出为文件或并行运行这些任务。所以你可以看到,当我们谈论任务时,有很多选择。你将需要根据你的多智能体系统的复杂性考虑所有这些。Crew提供了所有这些选项,你也会在其他框架中找到很多这样的选项。也许不是全部,也许形式不同,但归根结底,这一切都是关于你如何设置你的智能体以成功地超级高效地执行它们的任务。有了这个想法,让我们快速进入代码。
原文内容:
Okay, so we just built an amazing crew. By now, you're probably getting excited and I am as well. But we can take a step further. In this lesson, we're going to build a multi-agent system that's going to be able to help us plan an event. Think about a meetup or a conference, whatever it might be. These agents are going to help us to find a venue, do the planning, planning around the catering, and everything that comes with that. So let's jump into it and see what that looks like. Welcome to our next lesson. In this lesson, we're going to be talking about tasks. I'm super excited about this one. We talked about so many things already, and this is another great topic for us to dig into, because at the end of the day, if you think about your agents, they are performing tasks. So tasks are a cornerstone on multiple agent systems as well. So when you talk about tasks, I want to bring back something that we talked about a few lessons ago, the manager analogy. You might remember that we discussed that this manager mental framework to create agents, where you put yourself into a manager's shoes and you think about what would be the people that you would hire in order to do a series of tasks or the job that you're trying to accomplish. And then you kind of use that as a starting point to define what will be the roles, the goals, and the backstory of your agents. So you need to have a very good understanding of what is the goal that you're trying to accomplish, and you also need to have a very clear understanding of what is the process throughout to achieve this goal. So with that in mind, you're gonna have a clear understanding of the people that it would hire, and those will be your agents. But now, I want to build on top of this analogy. I want to expand this mental model to how you think about your tasks. Because whenever you hire someone to do something, you also cease to think about how you're going to delegate work to them. Especially if it's more of a junior person, you want to make sure that you're going to delegate work to them. Especially if it's more of a junior person, you want to make sure that you're very explicit about what you expect that they do and what is the expected result. So I would say for you to build great agents, you should add tasks I expect individuals on my team to do. And you can use that to create the tasks. And whenever you're creating a task, again, you need to have at least two things top of mind. One, a clear description of what is the task. And two, set a clear and concise expectation. Again, to go back to our analogy, let's think that you just hired a junior engineer to work on your team and you're tasked with coaching this person. It's their first day on the job. You want to give them a specific task to work on. You want to explain that task very truthfully. And then you want to make sure that you say what you expect them to do. to make sure that you say what you expect them to do. So, query AI kind of forces you to think that way because query AI makes sure that it's mandatory for you to set at least two attributes on every task that you create. The description and the expected outcome. And that is used to build better internal prompts. But that also applies to any other framework out there. You will get better results if you go the extra mile on explaining what is a task and what you expect your agent to do. Other than that, there's a bunch of other things that you can set on the task. Query AI offers a bunch of hyper-parameters that you could use, like setting a context, for a bunch of hyper-parameters that you could use, like setting a context or setting a callback or overriding the agent tools with specific task tools, force human input, kind of like making sure that before the agent finishes the work, it stops and asks you how you feel about it so you can give further instructions. Also, we can talk about execution these tasks asynchronously or outputting their results as PyDentech objects or JSON objects or even outputting them as a file or running these tasks in parallel. So you can see how there is a bunch of options when we're talking about tasks in here. And you're going to need to take all that into account depending on how complex your multi-agent system is. Crew offer all these options and you're going to find a bunch of them in other frameworks as well. Maybe not all of them and maybe in a different shapes and forms, but in the end of the day it's all about how you can set up your agents for success to perform their tasks super efficiently. So with that in mind, let's jump into code real quick.
上一篇
跟着吴恩达学AI多智能体-11/17-自动化事件策划
下一篇
跟着吴恩达学AI多智能体-9/17-工具开发总结