Its mandatory. Payable to the inland revenue not the landlord or agent, though often the agent will sort the stamp duty out for you and you have to pay them, but they should give you the certificate of stamp duty from the inland revenue as proof of payment.
Be aware that stamp duty is also payable when you renew a rental contract even if you are not moving residence.
What can I say the government has to make money somehow.