The agents automatically connect to the ActiveGates. However, you must make sure that they can establish a connection, that they can reach the ActiveGates. Please also check the prerequisites described in the documentation here.
You also need the proper token permissions - see also here in the prerequisites. You have to generate the token on the tenant. How to do that is described here. The necessary scope of the token is mentioned in the link to the prerequisites.
Because you want to use already existing ActiveGates, you can comment out the containerized ActiveGate in the custom resource file (e.g. for the Classic Full Stack) - see documentation here.
In the API URL you specify the URL to the cluster. E.g. like this: