Thanks for your question.
It is legal for the agent to have a set of keys to the property; often they retain a set in case of an emergency. However, you have an overridding right to quiet enjoyment of the property over which you have a tenancy which means he cannot enter the property when they like (except in the case of emergency.
Check the tenancy agreement, you may see that there is a clause in the agreement whereby you agree to allow the landlord access for the purpose of viewings for prospective purchasers/tenants. A reasonable clause would most likely state that you permit the landlord to make those viewings within the last two months of the term and at reasonable times. If the clause is not subject to these two caveats then your right to quiet enjoyment probably overrides them and makes it unenforceable.
In these situations a practical approach is probably the better view. Check your agreement for the clause and refer to it when dealing with your landlord/agent. Contact them and state that you are happy for the photos/viewings to happen only at agreed times (eg. only between the hours of 6-7.30 on Wednesdays/Thursdays/Saturdays), it is in their interest for it to happen at times convenient to you since they will want the property in a marketable state.
In the final analysis it's best to come to a compromise, rather than digging your heels in on this issue only to find the landlord adopts an adversarial approach to other matters later.
If this has been useful please kindly click accept so that I may be rewarded for my time. It will be gratefully received and you will be free to ask follow up questions.