And so with this, we now turn to the other category, the second category of agents. 因此，我们现在转向另一类，即第二类代理。
So by contrast with the workflow patterns with agents, the process is more open ended. 因此，与代理的工作流模式相比，该过程更加开放。
It's something that can keep going. 这是可以持续下去的事情。
It has feedback loops. 它有反馈循环。
It's typically a design that allows for information to come back and be processed multiple times. 它通常是一种允许信息返回并进行多次处理的设计。
And importantly, there's no fixed path through the design pattern. 重要的是，设计模式没有固定的路径。
It's not like there's a series of steps as we had in those prior patterns, but rather it's something 这不像我们之前的模式那样有一系列步骤，而是有一些东西
that's fluid and dynamic. 这是流动的和动态的。
And as as a result, it's something which can be much more powerful. 因此，它的功能会变得更加强大。
There's many more. 还有更多。
There's a much greater kind of problem that could be taken on by this sort of agent pattern, but it's 这种代理模式可以解决更大的问题，但它是
less predictable. 不太可预测。
And so there are absolutely concerns about robustness, about guardrails, about how do you get the 因此，绝对会担心鲁棒性、护栏以及如何获得
best out of this kind of flexibility, but still have a system that can run in production and be guaranteed 最好摆脱这种灵活性，但仍然有一个可以在生产中运行并得到保证的系统
to complete in a certain time and so on. 在一定时间内完成等等。
And this is the diagram that I would bring up, which is fairly generic kind of diagram that's just 这就是我要提出的图表，这是相当通用的图表，只是
meant to show that you have the inputs and outputs now shown as a human. 旨在表明您现在已将输入和输出显示为人类。
But but we don't really have output anymore. 但是我们真的没有输出了。
We have environment that's meant to reflect some, some sort of outside world that can be interacted 我们的环境旨在反映某种可以互动的外部世界
with, such as the lights that I wore around me, that the human can make a request that goes to an 诸如我周围佩戴的灯，人们可以向某个人提出请求
LM. LM。
The LM is able to take actions on the environment, as you can see, and the LM is able to get back 如您所见，LM 能够对环境采取操作，并且 LM 能够返回
information from the environment in some way. 以某种方式从环境中获取信息。
And then this is simply a repeating loop. 然后这只是一个重复循环。
The LM can continually make other actions and get back feedback, and at such time as it desires, it LM 可以不断地采取其他行动并获取反馈，并且在它需要的时候，它
can choose to stop. 可以选择停止。
And so this is the the the diagram. 这就是图表。
And there aren't more specific design patterns because it is in itself this sort of open ended design 并且没有更具体的设计模式，因为它本身就是这种开放式设计
pattern. 图案。
It's saying this is a it's almost a sort of meta design. 据说这几乎是一种元设计。
It's saying the the LM gets to choose its own design for how it's going to solve the problem. 据说LM可以选择自己的设计来解决问题。
And that's really it's it's quite hand-wavy, but that's the way to distinguish it. 确实是这样，它的手是波浪形的，但这就是区分它的方法。
If we look back at this pattern, I mean, this pattern arguably also could keep going forever. 如果我们回顾这种模式，我的意思是，这种模式可以说也可以永远持续下去。
It's not as if this has a fixed stop, but there's clearly more certainty about what's happening for 这似乎没有一个固定的止损点，但对于正在发生的事情显然更有确定性
what reason than with the agentic patterns, where it is more fluid by its nature. 与代理模式相比，它的原因是什么，代理模式本质上更具流动性。
So that's really the core idea behind the agent patterns, that there is much more flexibility that 这确实是代理模式背后的核心思想，即具有更多的灵活性
allows us to to be able to solve much more complex problems where Llms can really plot their own paths. 使我们能够解决更复杂的问题，其中 LLM 可以真正规划自己的路径。
But it does introduce some new issues, such as not knowing how long it will take before it will will 但它确实引入了一些新问题，例如不知道需要多长时间才能实现
complete its task, not knowing whether it will complete its task at all, not knowing what kind of 完成它的任务，不知道它是否会完成它的任务，不知道什么样的任务
quality outputs we will get, and not knowing how much it will cost. 我们将获得高质量的产出，但不知道它会花费多少。
These are all the kinds of challenges that agent developers like ourselves need to face, and they are 这些都是像我们这样的代理开发人员需要面对的各种挑战，而且它们是
the sorts of things that we will be tackling in the coming weeks. 我们将在未来几周内处理的各种事情。
And so if this feels a bit unsatisfying that the design patterns for workflows are so clear. 因此，如果这感觉有点不满意，那么工作流程的设计模式是如此清晰。
And now this looks just so loose. 现在这看起来太松了。
Then all I can say is, as we put this into practice, as we code different real agent environments, 那么我只能说，当我们将其付诸实践时，当我们编写不同的真实代理环境时，
this is going to become more and more concrete, and you're going to be able to you'll see this as second 这将变得越来越具体，你将能够将其视为第二个
nature before too long. 不久之后的自然。
Now let's just quickly say a few more words about some of the drawbacks that I alluded to a second ago 现在让我们快速多说几句我刚才提到的一些缺点
with using agent frameworks and agentic AI and design patterns. 使用代理框架、代理人工智能和设计模式。
So obviously there is this sense that you have an unpredictable path. 显然，你有一种不可预测的道路的感觉。
You don't actually know what order tasks will take place in or even what tasks will happen. 您实际上不知道任务将按什么顺序发生，甚至不知道将发生什么任务。
You don't know what the output will be. 你不知道输出会是什么。
There's no guarantees that you're going to get a great output. 无法保证您会获得出色的输出。
Now, this this whole Agentic architecture allows us to take on much bigger, harder problems than we've 现在，整个 Agentic 架构让我们能够解决比以前更大、更难的问题
ever been able to take on before. 以前曾经能够承担过。
But it does have this inherent uncertainty associated with giving Llms autonomy over how they tackle 但它确实存在这种固有的不确定性，即赋予法学硕士关于如何解决问题的自主权。
problems. 问题。
There's also unpredictable costs. 还有不可预测的成本。
I alluded to that as well a moment ago, but because you don't know how long it's going to take, you 我刚才也提到过这一点，但是因为你不知道要花多长时间，所以你
don't know how much it's going to cost in terms of running the APIs and potentially building up a big 不知道运行 API 和潜在构建一个大型应用程序需要花费多少成本
bill. 账单。
And so as a result, there's a couple of mitigations that are incredibly important, both of which we 因此，有一些非常重要的缓解措施，我们都采取了
will spend plenty of time on in the coming weeks. 在接下来的几周内将花费大量时间。
One of them is, of course, monitoring, being sure that you have the kinds of visibility into what's 当然，其中之一就是监控，确保您对正在发生的事情有一定的了解。
going on behind the scenes so you can understand what's going on with your models, with their interactions, 在幕后进行，以便您可以了解模型及其交互的情况，
particularly when you have potentially many agents all interacting. 特别是当您可能有许多代理都在交互时。
And we're going to see that with open AI SDK. 我们将通过开放的 AI SDK 看到这一点。
We're going to see that the trace, the ability to to watch different agents interacting. 我们将看到痕迹，观察不同代理交互的能力。
When we look at a graph, we're going to see Lang Smith their tooling. 当我们查看图表时，我们将看到 Lang Smith 他们的工具。
So we're going to see a lot of the ways that you can have this visibility into what is going on under 因此，我们将看到很多方法，让您可以了解下面发生的情况
the hood in your agent systems. 代理系统中的引擎盖。
And then guardrails. 然后是护栏。
Guardrails is the name for the kinds of protections that you can write in software that makes sure that Guardrails 是您可以在软件中编写的保护类型的名称，以确保
your models are doing what they should be doing, or that they're not sort of leaving some, some constraints, 你的模型正在做他们应该做的事情，或者他们没有留下一些限制，
some, some rails that you put in place. 一些，一些你放置的导轨。
And in fact, that quote that I put here comes straight from the OpenAI agents SDK, which has a ton 事实上，我在这里引用的这句话直接来自 OpenAI 代理 SDK，其中包含大量内容
of functionality dedicated to guardrails, and they say that it ensures they behave safely, consistently 专用于护栏的功能，他们说这可以确保他们的行为安全、一致
and within the boundaries that you wish. 并在您希望的范围内。
And so we will be building those guardrails ourselves in week two. 因此，我们将在第二周内自己建造这些护栏。
And with that, that does actually conclude the day. 至此，这一天就真正结束了。
Two lectures, as I promised you, it was shorter than day one. 正如我向你保证的，两堂课比第一天要短。
And I hope you didn't mind that we covered a lot of theory. 我希望您不介意我们涵盖了很多理论。
It's really interesting stuff, these gigantic design patterns. 这些巨大的设计模式真的很有趣。
I hope now you've got some clarity on what agents are and that there is ambiguity on this, but but 我希望现在您已经对什么是代理有了一定的了解，并且对此存在模糊性，但是但是
ways that you can talk about it and think about what it means to be autonomous and what it means to 你可以谈论它并思考自主意味着什么以及
be able to plot your own path. 能够规划自己的道路。
Let let an LLM decide the path that things will take. 让法学硕士来决定事情的发展方向。
And so with that, congratulations on completing day two and day three. 就这样，恭喜您完成了第二天和第三天的工作。
We're going to talk about orchestrating Llms. 我们将讨论编排法学硕士。
It's going to be more and more coding, more hands on, which will be fun. 将会有越来越多的编码、更多的实践，这会很有趣。
We're going to build with a lot of APIs and get ready for that. 我们将使用大量 API 进行构建并为此做好准备。
And after that we're going to move on to tools. 之后我们将继续讨论工具。
So I will see you next time. 那么我们下次再见。