The devices in an ad hoc network are expected to perform network functionalities by themselves due to the absence of proper networking infrastructure. Generally the routing is multi-hop as nodes may not be within the wireless transmission range of each other. This paper describes a system named A-GATE to support the high-level communication needs of agents in such a network. Agents are used to support the interoperability among devices and the system is capable of handling heterogeneity in agent platforms. A-GATE proposes a novel routing mechanism for locating the intended recipient of a message. The system aims to be self-organizing and self-configuring to suit the dynamic nature of ad hoc networks.