A magnetically controlled pump is implanted into the brain of a patient and delivers a plurality of medicating agents at a controlled rate corresponding to the specific needs of the patient. The current invention comprises a flexible double walled pouch that is formed from two layers of polymer. The pouch is alternately expanded and contracting by magnetic solenoid. When contracted, a medicating agent is pushed out of the pouch through a plurality of needles. When the pouch is expanded, surrounding cerebral fluid is drawn into the space between the double walls of the pouch from which it is drawn through a catheter to an analyzer. Cerebral fluid drawn from the patient is analyzed. The operation of the apparatus and hence the treatment is remotely controlled based on these measurements and displayed through an external controller.