This bundles up all of the above and adds in error handling, early stopping, tracing, and other quality-of-life improvements that reduce safeguards you need to write.from langchain.agents import AgentExecutoragent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)Now let's test it out!agent_executor.invoke({"input": "how many letters in the word educa?"})    > Entering new AgentExecutor chain...    Invoking: `get_word_length` with `{'word': 'educa'}`    5    There are 5 letters in the word "educa".    > Finished chain.    'There are 5 letters in the word "educa".'This is great - we have an agent!
However, this agent is stateless - it doesn't remember anything about previous interactions.
This means you can't ask follow up questions easily.
Let's fix that by adding in memory.In order to do this, we need to do two things:Add a place for memory variables to go in the promptKeep track of the chat historyFirst, let's add a place for memory in the prompt.
We do this by adding a placeholder for messages with the key "chat_history".
The core idea of agents is to use an LLM to choose a sequence of actions to take.
The core idea of agents is to use an LLM to choose a sequence of actions to take. ->: This bundles up all of the above and adds in error handling, early stopping, tracing, and other quality-of-life improvements that reduce safeguards you need to write.from langchain.agents import AgentExecutoragent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)Now let's test it out!agent_executor.invoke({"input": "how many letters in the word educa?"})    > Entering new AgentExecutor chain...    Invoking: `get_word_length` with `{'word': 'educa'}`    5    There are 5 letters in the word "educa".    > Finished chain.    'There are 5 letters in the word "educa".'This is great - we have an agent!
However, this agent is stateless - it doesn't remember anything about previous interactions.
This means you can't ask follow up questions easily.
Let's fix that by adding in memory.In order to do this, we need to do two things:Add a place for memory variables to go in the promptKeep track of the chat historyFirst, let's add a place for memory in the prompt.
We do this by adding a placeholder for messages with the key "chat_history".