Mobile-cloud computing (MCC) allows devices with resource and battery limitations to achieve computation-intensive tasks in real-time. While this new paradigm of computing seems beneficial for real-time mobile computing, existing MCC models mainly rely on keeping full clones of program code at remote sites and unstandardized/uninteroperable environments, hampering wider adoption. Moreover, the security risks arising from offloading data and code to an untrusted platform and the computational overhead introduced by complex security mechanisms stand as deterrents for adoption of MCC at large. In this paper, we present a context-dependent computation-offloading model for MCC, which is based on application segments packed into autonomous agents. This approach only requires isolated execution containers in the cloud to provide a runtime environment for the agents, and minimal involvement of the mobile platform during the computation process. The agents in the proposed model are able to protect themselves from tampering using integrity-checkpointing and an authenticated encryption-based communication mechanism. Experiments with two mobile applications demonstrate the effectiveness of the approach for high-performance, secure MCC. (C) 2018 Elsevier Ltd. All rights reserved.