Skip to main content

代理

¥Agents

语言模型本身无法采取行动。 - 它们只输出文本。代理是负责执行高级任务的系统,它使用 LLM 作为推断引擎来决定采取哪些操作并执行这些操作。

¥By themselves, language models can't take actions - they just output text. Agents are systems that take a high-level task and use an LLM as a reasoning engine to decide what actions to take and execute those actions.

LangGraph 是 LangChain 的扩展,旨在创建高度可控和可定制的代理。我们建议你使用 LangGraph 来构建代理。

¥LangGraph is an extension of LangChain specifically aimed at creating highly controllable and customizable agents. We recommend that you use LangGraph for building agents.

请参阅以下资源了解更多信息:

¥Please see the following resources for more information:

旧代理概念:AgentExecutor

¥Legacy agent concept: AgentExecutor

LangChain 之前引入了 AgentExecutor 作为代理的运行时。虽然它是一个很好的起点,但在处理更复杂和定制化的代理时,它的局限性就显现出来了。因此,我们正在逐步淘汰 AgentExecutor,转而使用 LangGraph 中更灵活的解决方案。

¥LangChain previously introduced the AgentExecutor as a runtime for agents. While it served as an excellent starting point, its limitations became apparent when dealing with more sophisticated and customized agents. As a result, we're gradually phasing out AgentExecutor in favor of more flexible solutions in LangGraph.

从 AgentExecutor 过渡到 langgraph

¥Transitioning from AgentExecutor to langgraph

如果你目前正在使用 AgentExecutor,请不要担心!我们准备了一些资源来帮助你:

¥If you're currently using AgentExecutor, don't worry! We've prepared resources to help you:

  1. 对于仍然需要使用 AgentExecutor 的用户,我们提供了有关 如何使用 AgentExecutor 的全面指南。

    ¥For those who still need to use AgentExecutor, we offer a comprehensive guide on how to use AgentExecutor.

  2. 但是,我们强烈建议你迁移到 LangGraph,以提高灵活性和控制力。为了促进这一过渡,我们创建了一个详细的 迁移指南,以帮助你无缝地从 AgentExecutor 迁移到 LangGraph。

    ¥However, we strongly recommend transitioning to LangGraph for improved flexibility and control. To facilitate this transition, we've created a detailed migration guide to help you move from AgentExecutor to LangGraph seamlessly.