In a world of multi-stakeholder information and assets provision on top of millions of real-time interacting and communicating things, COSMOS aims at enhancing the sustainability of smart city applications by allowing IoT based systems to reach their full potential. COSMOS will enable things to evolve and act in a more autonomous way, becoming more reliable and smarter. Things will be able to learn based on others experiences, while situational knowledge acquisition and analysis will make things aware of conditions and events affecting their behaviour. Adaptive selection approaches will manage the uncertainty and volatility introduced due to real-world dynamics. COSMOS will integrate decentralized management mechanisms in IoT based systems allowing applications to exploit millions of things. Socially-enriched coordination will consider the role and participation scheme of things in and across networks. Management decisions and runtime adaptability will be based on things security, trust, administrative, location, relationships, information, and contextual properties. COSMOS will facilitate IoT based systems with end-to-end security and privacy, with hardware-coded security, approaches for security and privacy on storage and with the introduction of an innovative concept, the concept of Privelets for IoT services. COSMOS will deliver data and information management mechanisms to handle the exponentially increasing “born digital” data. Extended complex event processing and social media technologies will extract only the valuable knowledge from the information flows, while workload-optimized data object stores will facilitate efficient storage by also exploring the interplay between storage and analytics on networks of data objects. COSMOS enables smart city IoT applications to take full advantage of its technologies, through 3 representative scenarios: Smart Heat and Electricity Management (London), Eco-Context Awareness for Smart Public Transport (Madrid) and IoT Business Eco-System (Taipei).