stop=["\nObservation:"],    allowed_tools=tool_names)from langchain.memory import ConversationBufferWindowMemorymemory=ConversationBufferWindowMemory(k=2)agent_executor = AgentExecutor.from_agent_and_tools(agent=agent, tools=tools, verbose=True, memory=memory)agent_executor.run("How many people live in canada as of 2023?")    > Entering new AgentExecutor chain...    Thought: I need to find out the population of Canada in 2023    Action: Search    Action Input: Population of Canada in 2023    Observation:The current population of Canada is 38,658,314 as of Wednesday, April 12, 2023, based on Worldometer elaboration of the latest United Nations data. I now know the final answer    Final Answer: Arrr, there be 38,658,314 people livin' in Canada as of 2023!    > Finished chain.    "Arrr, there be 38,658,314 people livin' in Canada as of 2023!"agent_executor.run("how about in mexico?")    > Entering new AgentExecutor chain...    Thought: I need to find out how many people live in Mexico.    Action: Search    Action Input: How many people live in Mexico as of 2023?    Observation:The current population of Mexico is 132,679,922 as of Tuesday, April 11, 2023, based on Worldometer elaboration of the latest United Nations data. Mexico 2020 ... I now know the final answer.    Final Answer: Arrr, there be 132,679,922 people livin' in Mexico as of 2023!    > Finished chain.    "Arrr, there be 132,679,922 people livin' in Mexico as of 2023!"PreviousCustom agent with tool retrievalNextCustom LLM Agent (with a ChatModel)Set up environmentSet up toolPrompt templateOutput parserSet up LLMDefine the stop sequenceSet up the AgentUse the AgentAdding MemoryCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
This notebook goes through how to create your own custom LLM agent.
This notebook goes through how to create your own custom LLM agent. ->: stop=["\nObservation:"],    allowed_tools=tool_names)from langchain.memory import ConversationBufferWindowMemorymemory=ConversationBufferWindowMemory(k=2)agent_executor = AgentExecutor.from_agent_and_tools(agent=agent, tools=tools, verbose=True, memory=memory)agent_executor.run("How many people live in canada as of 2023?")    > Entering new AgentExecutor chain...    Thought: I need to find out the population of Canada in 2023    Action: Search    Action Input: Population of Canada in 2023    Observation:The current population of Canada is 38,658,314 as of Wednesday, April 12, 2023, based on Worldometer elaboration of the latest United Nations data. I now know the final answer    Final Answer: Arrr, there be 38,658,314 people livin' in Canada as of 2023!    > Finished chain.    "Arrr, there be 38,658,314 people livin' in Canada as of 2023!"agent_executor.run("how about in mexico?")    > Entering new AgentExecutor chain...    Thought: I need to find out how many people live in Mexico.    Action: Search    Action Input: How many people live in Mexico as of 2023?    Observation:The current population of Mexico is 132,679,922 as of Tuesday, April 11, 2023, based on Worldometer elaboration of the latest United Nations data. Mexico 2020 ... I now know the final answer.    Final Answer: Arrr, there be 132,679,922 people livin' in Mexico as of 2023!    > Finished chain.    "Arrr, there be 132,679,922 people livin' in Mexico as of 2023!"PreviousCustom agent with tool retrievalNextCustom LLM Agent (with a ChatModel)Set up environmentSet up toolPrompt templateOutput parserSet up LLMDefine the stop sequenceSet up the AgentUse the AgentAdding MemoryCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.