Interesting tale I tell them.
I had not one, not two, but three agents and all were a huge help in different ways.
When I finished the book I wasn't sure what to do next. So after some research, I started submitting it to agents - actually many agents. I researched the agents, the genre's they represented and the titles they had sold. I focused on reading books in my genre and researched the agents that represented them. I read books written by agents and followed their guidance. The sum total result of my efforts was an ever expanding file of rejection letters. Some on very nice letterhead, some on very impersonal forms, but occasionally rejections with an encouraging note on what to tweak or improve.
Finally I landed an agent who went after the publishers with a conviction. After that contract ran its course, I started the process of searching for an agent again and the process above repeated. With another agent the process was similar to the first. Then one day I found myself with my third agent after a repeat of the same.
Fortunately along the way the the book kept getting improvement after improvement. Some were major overhauls, some minor tweaks. Ultimately it kept getting better. Overall I think that having several agents was tremendously helpful.
Now, I have also talked to people that have never had agent one and have had their book published. Some of these people self-published, but some did not. There are an increasing number of publishers out there that will allow authors to approach them in the fashion the author would approach an agent. There are ups and downs to this that whole books have been written on, but needless to say, it is possible to be published without an agent by going straight to the publisher. Keep in mind that the publishers that work this way are generally smaller, independent houses. Few if any of the major publishers deal with unsolicited manuscripts.
So the bottom line is that there is no clear cut answer to have an agent or not have an agent so long as you keep the process moving forward!