Your agent is lying and I'm a retired realtor. The truth is you can have 1 name or multiple names on a mortgage application. Lenders need to verify employment, income, savings, investments, outstanding debts, debt to income ratio, credit history and credit score and tax returns.
After reviewing the above criteria, lenders will use this to qualify a buyer to purchase a home. Therefore, if 1 person's name is on the mortgage application and that person qualifies alone to buy the home, then no other names are needed on the mortgage application.
However, if that 1 person doesn't have sufficient income, has low credit scores, no tax returns, no savings, then yes, another name is needed to qualify to buy a home.
Finally, there is the price point of the home you want. If both of you are looking for a higher priced home and both of your incomes are needed to qualify, then both of you need to be on the mortgage application. If you are looking for a cheaper home, then only 1 person's name needs to be on the application.