Agents wear all sorts of hats these days, but it's important to remember the first hat any agent wears (or should wear) and that's to sell books to publishers.
Which means self-publishing and traditional publishing diverge very fundamentally.
If you've published your book in any way, whether it's on your blog for free, as an ebook, or through a small press, you've essentially taken over the agent's job. Many do this to great satisfaction. Most, though, find themselves frustrated and feeling duped without representation.
Of course, some self-published authors get leveraged into traditional deals with publishers, but these are few and far between and the mechanics are complicated (more later this week). There is about a 1% chance that your self-publishing experience will look anything like John Locke's.
If you're hoping to be published traditionally, the best way to get there is traditionally. Query agents. Revise for agents. Attend conferences. Do research. Get an Agent. Get a Book Deal.
If you exhaust that avenue, and no one is smart enough to see you've written a bestseller, then self-publish (this is almost universally better than signing with a small press, believe it or not, because you keep ALL your rights--meaning you can sell them later if a big publisher is interested).
If you self-publish and then try to query agents, you will universally get "No" unless you've sold in excess of 5,000 copies. This is not an opinion of mine, it's the fact of the matter. An agent cannot leverage print rights on a self-published book without sales numbers to back it up. As a debut author, querying agents, you have no sales numbers and no one expects you to. You're a debut. But once you're published, even if you do it yourself, publishers need to see some $treet cred.