Your specific travel agency may need you to book 30 days in advance but, to book an actual tour, you only need to do that 3 working days in advance. At least that's what I did, as I arrived in Cusco without any reservations and booked a tour with a local shop and was on the Trail 4 days later. The 3 days is required so the government can approve your passport info and add you to the list of guests on the trail. There's checkpoints along the way etc...
Having said that, it's 'high season' time on the Inca Trail as it's winter and there's less rain. Also, University students are getting out of school and off to explore the world on packaged tours. At this time of year, I'd strongly suggest having a spot reserved, even if you do that through the internet and with a local tour group rather than through your travel agent.
If you want to be like me (the unplanned traveler), it's still very possible for you to slip into a few empty spots because tour groups in the city mix n' match their groups or whatever you want to call it. People will sign up with different companies and end up in the same trail group in order to fill empty spots. They "trade" customers sort of. And if someone doesn't show up for a reserved spot, bingo. You're in. Lots of people drop out in the time from when they booked to actually getting to Cusco.
Tourists can also end up spending a great deal more for almost the exact same thing depending on who they buy from and which tour company you choose. Outfits that show up in guidebooks have more demand, which usually equals higher prices. A British couple I met up with at the end of the trail paid $1000 USD each for basically the same tour as what I got (although they didn't have to carry their own packs). They just about fainted when I told them how much I paid.
I paid $180 USD (including sleepbag rental) at a local tour office on "gringo alley" in the heart of Cusco. There's plenty of them to choose from and it took about 10 mins to sign up for the tour and hand over my cash. No complaints about the tour (not serious anyway) and you can read about it in my travelpod. Another guy in my group paid $150 (bag included), which is the lowest price I heard about. Much better than the $330 that a popular outfit was asking and they didn't have any spots open anyway.
Can't remember the name of the outfit I went with but might be able to dig it up if you want it. Also, if you want any tips about taking the tour before you get there, I can tell you a couple things or like I said, read my travelpod or others that explain what will happen. Don't worry too much about spoiling it by seeing all the sights in advance. There aren't any photos I've seen that come close to actually being there.