Flexible robotic device for spinal surgery