As for the leak in patent agency, you can sign a confidentiality agreement with the agent.
Of course, both sides must have enough integrity, otherwise there is no way to cooperate.
As for the disclosure before the application, this question is relatively simple. It can be notarized when signing a contract with a patent agency. The contents of notarization include the contents of the agreement and the contents of the patent, so that even if someone applies for a patent before you, you have a fair proof that the patent belongs to you (the application time of others is after you authorize an agent and before you apply). I suggest you handle this matter honestly. The only thing I can give you advice is to pay more money to the patent company, and you should actively cooperate with him. It is best to entrust all the materials to be written and submitted on the same day, and you have been with him all the time in this process, so he has no chance to leak.
Another suggestion is also expensive, that is, divide your patent into two parts. When you apply for a basic patent for the first time, don't design your patent core, and then apply for a second perfect patent after submitting the materials, so that even if he leaks the information for the first time, you can not entrust him for the second time. These two patents are relatively good for you.