This paper presents an innovative multiagent system to support cooperative learning among students both in the real classrooms and in distance education. The system, called I-MINDS, consists of a group of intelligent agents. A teacher agent monitors the student activities and helps the teacher manage and better adapt to the class. A student agent, on the other hand, interacts with the teacher agent and other student agents to support cooperative learning activities behind-the-scene for a student. Two I-MINDS innovations are (a) agent-federated "buddy group" formation and (b) automated ranking of questions and responses. We have tested our I-MINDS prototype with experiment and control groups to evaluate the impact of I-MINDS in learning. The results are encouraging.