In the whole world, the proportion of aged population is increasing day by day. To fulfill Confucius' philosophy of "treat others' elderly and youth as if they are our family members," we proposed an intelligent web-based agent which is able to conduct daily life conversation with the elders. Based on psychological theory, we classify the participants of the experiment into three types using K-means. A decision tree is trained based on the information gain during the process of classification. We also implemented a web-based software agent which is visually alive and is able to interact with the elders through visual and audio context. Such agent can be accessed virtually from any location on the planet and is able to have conversation and interaction with the elders to keep them from being bored. The trained decision tree serves as the brain of the web-based agent to classify the type of the elders as the conversation goes on and provide the appropriate questions or choices for the human-machine interaction. Through large-scale experiments we found that the combination of web-based agent and the trained decision tree works satisfactorily for the purpose of caregiving to the elderly.