Which Came First? The Agent or the Publisher?
There are many chicken-or-the-egg scenarios in writing. You want to write and publish a book, but you need money, but to have money you need to write and publish a book.
Or the parallel:
You: I want to publish my book.
Agent/publisher: what is your sales record and how many books have you published?
You: This would be my first published book.
A/P: You need to publish a book...
For this latter example, it begs the question: which came first? The agent of the publisher?
The answer: Beats me.
The one fact in all of this is that the big publishers and some of the popular small publishers only accept agented manuscripts. But if agents are mostly looking for safe bets--huge platforms, strong prior sales record, publishing history--how do you break in?
The answer is along the lines of all of the above. Query agents because you never know. Go to where publishing representatives are and you can meet them without seeming like a stalker, because you never know.
But, there are many small, independent publishers (watch out for vanity presses in disguise) who will eagerly accept a well-written book by an author who can demonstrate the commitment and business savvy to make their book succeed.
Poets & Writers tools for writers lists these publishers, but you can also google for the best or most trusted, etc. and find what you are looking for.