In a smart living environment, a person can use various intelligent devices to obtain his desired services at any time and any place. For convenience, most of these devices are small and of limited power and computation capacity. Therefore, an admired protocol should take these into consideration. In particular, identification and key agreement are basic mechanisms when a user wants to get a secure service from a server over the public networks. However, if the user's identity is transmitted in a plaintext, an adversary can intercept the information and use it to launch some attacks. In this paper, we propose a key agreement protocol with user anonymity based on elliptic curve discrete logarithm problem. In our protocol, the storage and computation costs are very low and the server does not maintain a password file for identifying the users. Therefore, our protocol is suitable for applying ubiquitous computing environments.