You do not need an agent. I just optioned a screenplay with no agent. I paid a lawyer to look over the agreement (it was 10 pages) to make sure I wasn't given away too much.
What helps, is to have a producer, or a wanna be producer who believes in you or who believes in your writing. Writers are typically introverted, and we find it quite difficult to sell our ideas or sell ourselves, at least I do. It helps if you have someone who is willing to take your work and show it around. That might be an agent - but most agents aren't going to waste their time with an unknown - there are exceptions but typically not.
Agents take 10% - I'm not sure that's actual law, but it's close. Now, if you come across someone who is willing to help you sell your work and they want more - it's up to you. I agreed to give someone 33% because they convinced me they had a buyer all lined up and the extra 23% seemed worth it - it didn't work out, and I own that material again - no harm no foul.
You could look into getting a manager but again - similar to an agent, they will take 10% and might help.
Basically the best advice would be to write as many scripts as possible, vary the genre to show you are flexible, because for the most part your career will consist of writing assignments and not necessarily selling your own spec material.
If you come across someone looking to buy your script, you can always reach out to an agent and ask them to look over the agreement and give them 10% - for the most part they will probably ask to see what else you got.