课程: Build AI Agents and Chatbots with LangGraph

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Execute the basic ReAct agent

Execute the basic ReAct agent

- [Instructor] Let's execute the math agent we created in the previous video. We first create the input to the agent. We defined the messages with the user role. We can also alternatively use the Human Message function for this purpose. The question we ask is, "What is the sum of 2 and 3?" Next, we invoke the agent_graph with its inputs. The agent_graph will return the final step and all the intermediate steps in finding the answer. This is extracted from the agent state. It essentially provides a conversation between the human, the LLM, and the tools. First, we print the final answer by accessing the last message in the result list. Then, we print each step to look at how the agent executed the request, The pretty print function available in the message formats the message for easy rating. Let's review the results now. First, we see the final answer that is printed as, "The sum of 2 and 3 is 5." This is correct. Then, we walk through the list of messages that shows how the agent…

内容