Welcome to this video on Build Interactive LLM Agents. In this video, you'll learn how to extract tool names and arguments for precise function calls. You'll learn how to build agent classes that manage the entire tool-calling process for smarter, context-aware responses. Now that you've built a foundation in setting up LLMs with basic tool integrations, it's time to take things a step further. Begin by setting up the actual question you want the model to answer. "What is 3 plus 2?" First, insert the user's question into the chat history so the model can see it as a part of the conversation context. Convert the plain text question into a HumanMessage, which is a symbol wrapper that tells LangChain, This text came from the user." It carries the user's input and marks it appropriately for the model during the conversation. To do this, import HumanMessage from LangChain core messages. Next, build the chat history. Take the query string, wrap it in a HumanMessage, and place it into a list called chat history. This list will hold all messages exchanged during the conversation, including user inputs, tool outputs, and model responses, ensuring that the model has complete context at every step. It's time to run the tool-enabled model. First, pass the complete chat history, which contains the user's question, into LLM with tools. At this point, the model reviews the conversation context, identifies the available tools, select the appropriate one, such as add function, and extract the parameters. Notice the model's output. Instead of a plain text response, an AIMessage is received containing a tool calls array. Focus only on the part of the message related to tool usage. This is the model's way of saying, "I want to call this function with these arguments." Next, extract the details of the tool call and manually execute the addition ourselves. Finally, append the AIMessage, including the tool call instruction, into chat_history so the next model invocation has access to both the user's original query and the model's previous output. Response1 is an AIMessage object. Let's take a quick look at its key details. Here's the tool call parameters. "Add" is the name of the tool the model wants to call. The function arguments are a JSON string that specifies the inputs to pass into the tool. For example, "A equals 3 and B equals 2." Here is a unique identifier for this tool call. It's used to link the response back to the request. This is if more than one tool is called. The type field specifies that this is a tool call, not a text or other output type. Now parse the tool parameters, execute the tool manually, and then send the result back to the LLM as part of the conversation. First, parse the add tool with arguments "A equals 3 and B equals 2" and feed them into the function. Then extract the model's tool-call instructions into a variable. You will get a list showing exactly which tools the LLM selected and with what arguments, ready to be inspected and manually invoked. Next you will extract the tool's name from the first entry by running this command. You will then pull out "AddTool," telling exactly which function to call next. Extract the parameters to pass the function using the args key, for example "A3 and B2." Finally extract the tool call "ID." This ID links the tool's result back to the model's original request, so the LLM knows which tool call the response belongs to. This is especially important when multiple tools are called at once. Use the tool map created earlier to call the function you need. The key is the tool name determined by the LLM stored in tool_1_name. In addition, use the tool parameters provided by the LLM stored in tool_1_args. The tool map returns the output generated via the tool, in this case "2 plus 3 equals 5." Finally, wrap the tool's output in a Tool Message by creating a Tool Message object. Finally, update the chat history by appending the new tool message to the chat history list. The history now contains the original HumanMessage, the AIMessage from the model, and the new ToolMessage with the tool's result. Begin by passing the updated chat history to the LLM with tools using the invoke method. The LLM will generate a final response using the tool's output, but format the answer naturally as a part of the conversation. You can create an agent class that encapsulates everything you did above. This class, ToolCallingAgent, binds tools to the LLM, manages chat history, extracts tool names and arguments, and handles tool calls. This structure captures the entire agentic process, from receiving a user query to returning the final response. Update the ToolCallingAgent object to handle the full tool-calling process automatically. The LLM parses the input text and determines the appropriate tool to call. The user input doesn't need to be perfect. Even imprecise queries such as "1 minus 2" can be understood. The agent identifies and executes the correct tool based on intent. In this video, you learned to structure user interactions for real-time, context-aware conversations by adding queries to the chat history. Extract tool names and arguments to precisely match user intent with the right tool calls. Parse complex tool instructions, including handling multiple tool calls and linking responses for seamless execution. Build and refine agent classes to automate the entire tool calling process, enabling LLMs to function as responsive, multi-step agents. Understand how these components work together to transform LLMs from passive responders into intelligent agents capable of making decisions and interacting with real-world data.