构建高效代理
Over the past year, we've worked with dozens of teams building large language model (LLM) agents across industries. Consistently, the most successful implementations weren't using complex frameworks or specialized libraries. Instead, they were building with simple, composable patterns.
在过去的一年里,我们与跨行业的数十个团队合作,构建大型语言模型(LLM)代理。始终如一,最成功的实现并未使用复杂的框架或专门的库。相反,他们使用的是简单、可组合的模式。
In this post, we share what we’ve learned from working with our customers and building agents ourselves, and give practical advice for developers on building effective agents.
在这篇文章中,我们分享了与客户合作和自行构建代理的经验,并为开发人员提供了构建有效代理的实用建议。
What are agents?
什么是代理?
"Agent" can be defined in several ways. Some customers define agents as fully autonomous systems that operate independently over extended periods, using various tools to accomplish complex tasks. Others use the term to describe more prescriptive implementations that follow predefined workflows. At Anthropic, we categorize all these variations as agentic systems, but draw an important architectural distinction between workflows and agents:
“Agent”可以有多种定义。一些客户将代理定义为完全自主的系统,这些系统在长时间内独立运行,使用各种工具完成复杂任务。其他人则使用该术语来描述遵循预定义工作流程的更具指令性的实现。在Anthropic,我们将所有这些变体归类为代理系统,但在工作流程和代理之间做出重要的架构区分:
- Workflows are systems where LLMs and tools are orchestrated through predefined code paths.
- 工作流是通过预定义的代码路径来编排LLM和工具的系统。
- Agents, on the other hand, are systems where LLMs dynamically direct their own processes and tool usage, maintaining control over how they accomplish tasks.
- 代理,另一方面,是指LLM动态地指导其自身的过程和工具使用,保持对任务完成方式的控制的系统。
Below, we will explore both types of agentic systems in detail. In Appendix 1 (“Agents in Practice”), we describe two domains where customers have found particular value in using these kinds of systems.
下面,我们将详细探讨两种类型的代理系统。在附录1(“实践中的代理”)中,我们描述了客户在使用这些系统时发现特别有价值的两个领域。
When (and when not) to use agents
何时(以及何时不)使用代理
When building applications with LLMs, we recommend finding the simplest solution possible, and only increasing complexity when needed. This might mean not building agentic systems at all. Agentic system...