You need an agent when you have a finished book that’s ready to send around to publishers, and not a moment before then. By “finished,” I mean not just that you have a complete draft, but that you’ve made the book the strongest it can possibly be, to the best of your own abilities and to the satisfaction of your most trusted readers. Such a manuscript might be your second draft or your nineteenth, and might have taken you two years or twenty. It might be the first complete novel you’ve written or the third. Almost certainly, it has undergone substantial research, revision, enhancement, and paragraph-, page-, character- and chapter-hacking since the original draft.
I should also say that your manuscript is ready when you feel, in the core of your being, that it’s done. This is not the same as hoping that it might be done, or hoping that other people won’t see where you’ve held it together with cellophane tape, or thinking that it would be really, really wonderful to publish a book before the age of X or before X-and-such event occurs. (Though all of these are common kinds of wishful thinking for writers to experience—and harmless, when you understand what they are.) It’s just something you know, unshakably, the same way you know that the person you’re dating is the one you want to spend your life with, or the way you know you believe in God (if you do), or the way you love your parents and children. Anything short of that kind of knowing? You either need to keep working at the book or you need to let it rest and move on to the next thing.
Sometimes writers are tempted to send books to agents before they have this kind of sureness. Maybe sometimes this works out; I’ve never heard of someone getting a great agent for a book they felt kind of semi-okay about, but that doesn’t make it impossible. As a reasonable adult, however, I can say that you only get one chance to make a strong first impression. Doesn’t it seem like a good long-term plan to wait a month or a year to send the agent the best work possible? If she refuses it now, I doubt she’ll want to see it again after you’ve done the revision you should have done before sending it to her in the first place.