Build an Agent with AgentExecutor (Legacy)
This section will cover building with the legacy LangChain AgentExecutor. These are fine for getting started, but past a certain point, you will likely want flexibility and control that they do not offer. For working with more advanced agents, we'd recommend checking out LangGraph Agents or the migration guide
By themselves, language models can't take actions - they just output text. A big use case for LangChain is creating agents. Agents are systems that use an LLM as a reasoning engine to determine which actions to take and what the inputs to those actions should be. The results of those actions can then be fed back into the agent and it determines whether more actions are needed, or whether it is okay to finish.
In this tutorial, we will build an agent that can interact with multiple different tools: one being a local database, the other being a search engine. You will be able to ask this agent questions, watch it call tools, and have conversations with it.
Conceptsβ
Concepts we will cover are:
- Using language models, in particular their tool calling ability
- Creating a Retriever to expose specific information to our agent
- Using a Search Tool to look up things online
Chat History
, which allows a chatbot to "remember" past interactions and take them into account when responding to follow-up questions.- Debugging and tracing your application using LangSmith