This question already has an answer here:
I'm looking for a book series in which a girl meets aliens. She was the only person on Earth to have met aliens.
One of them was an intelligent purple ball that I think could morph into other shapes, but I could be wrong. She helped them (possibly by fighting aliens or something) and when she was sent to some sort of alien training academy they made her a robot to temporarily take her place on Earth.