There’s no hard-and-fast rule. You don’t even need an agent to get your novel published. Independent and university presses publish amazing writers, and some people self-publish. You need an agent for countless other reasons, including protecting your intellectual property. Reputable journals or independent presses that get review and award attention can help build a consensus about your work before you go to an agent. But there are also writers who skip directly to getting an agent for their novel, selling it to a big house, without building a body of work beforehand. Frequently this work attracts an agent because it has clear commercial appeal. Regardless of your individual path, publishing professionals notice good writing and want to be a part of bringing it to the rest of the world. Approach an agent when you are confident your work reflects what you want it to, but wait until you have a complete draft or complete proposal.
How widely should a writer be published and how large a body of work should she accumulate before it is time to consider finding an agent?