Why are you terminating the lease prior to occupancy? According to your lease agreement, which would be the governing document in this case and with the agreement in writing of the owner and owners agent agreeing to refund your deposit, your agent should not be able to keep any funds...commissions are typically paid by the owner after the contract is executed and all funds have cleared the bank.
Your funds should be returned to you in full if the owner and owners agent agree in writing. The commission would be payable from the owner to your agent, not by the renter/tenant.
Refer back to your contract. However, there may be a clause in your contract, and if signed by the owner, could make the owner responsible for paying the commission to your agent...even if you cancelled...
Also, did you sign a Buyer/Tenant/Agent representation/commission agreement? This agreement if signed could make you liable for paying commission to your agent.
Refer back to your executed contracts for clarity and if necessary, contact a real estate attorney for help.
All the best,