Edge computing in Internet of Things enhances application execution by retrieving cloud resources to the close prox- imity of resource-constrained end devices at the edge and by enabling task offloading from end devices to the edge. In this paper, edge computing platforms are extended into the data producing end devices, including wireless sensor network nodes and smart- phones, with mobile agents. Mobile agents operate as a multi-agent system on the opportunistic network of heterogeneous end devices, where the benefits include autonomous, asynchronous and the adaptive execution and relocation of application-specific tasks, while taking into account local resource availability. In addition to the vertical edge connectivity, mobile agents enable horizontal sharing of the information between end devices. Use cases are presented, where mobile agents address challenges in current edge computing platforms. An edge application is evaluated, where mobile agents as a multi-agent system process sensor data in a heterogeneous set of end devices, control the operation of the devices and share their results with system components. Mobile agents operate atop a REST-based mobile agent software framework that relies on embedded Web services for interop- erability. A real-world evaluation and large-scale simulations show that energy consumption is reduced significantly in the edge application execution.