Agents
What is an agent?β
Many LLM applications implement a particular control flow of steps before and / or after LLM calls. As an example, RAG performs retrieval of relevant documents to a question, and passes those documents to an LLM in order to ground the model's response. Instead of hard-coding a fixed control flow, we sometimes want LLM systems that can pick its own control flow to solve more complex problems!
This is one definition of an agent: an agent is a system that uses an LLM to decide the control flow of an application. There are many ways that an LLM can control application:
- An LLM can route between two potential paths
- An LLM can decide which of many tools to call
- An LLM can decide whether the generated answer is sufficient or more work is needed
LangGraphβ
As a result, there are many different types of agent architectures, which give an LLM varying levels of control. LangGraph is an extension of LangChain specifically aimed at creating highly controllable and customizable agents. The motivation of LangGraph is to help preserve high reliability as we give the agent more control over the application.
Legacy Agent Concept: AgentExecutorβ
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.
Transitioning from AgentExecutor to LangGraphβ
If you're currently using AgentExecutor
, don't worry! We've prepared resources to help you:
-
For those who still need to use
AgentExecutor
, we offer a comprehensive guide on how to use AgentExecutor. -
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.