This function processes a chunk of data to check for agent messages. It iterates over the messages and checks for tool calls. If a tool call is found, it extracts the tool name and query, then prints ...