you only have to make sure that both can communicate over the needed ports. If you have an SQL-server hosting your epo-DB, this one should be reachable aswell.
This is all you have to do. The AH will automatically register in the epo.
You then will only have to setup your desired configuration on how the clients should contact which Handler (epo itself or the seperate agenthandler). When the clients update their policy next time they will communicate as desired.
While installing it asks you to provide DB address and ePO address. Once you provide it validates the connection, AH communicates over port 8444 by default. If connection is established it continues with the installation and gets registered in the ePO.
Go to menu->configuration->agent handlers
here create assignment based on the location with the priority of agent handler closer to clients.
Name the assignment with respect to locations and in that have the AH which is closed to the workstations on top priority.
AH is just like ePO, only thing is you cannot logon and manage policies.
Usually all your clients first priority should be AH. AH checks/uploads/deploys policies to clients independently from the DB.
last option should be EPO.