Successful coupling of service-oriented and agent-oriented architectures can produce applications that are self-adaptive in both behavior and structure over a long life span. In practice, this requires detecting and handling of changes to runtime requirements, consistency in reconfiguration, and separation of the controller from the application itself. To cope with these challenges, we propose a new framework for self-adaptive and dynamically reconfigurable smart applications. This framework is composed of loosely coupled base and controller layers. The base layer consists of a base application and base controller, while the controller layer consists of detector-classifier, inference, and evaluation sub-layers. The detector-classifier layer monitors and detects runtime events within the base application. In the inference layer, an adaptive driver agent creates new adaptation plans. The evaluation layer refines the plan currently in place and compares it with new adaptive plans. We simulated and evaluated the proposed framework behavior in a smart home environment.