It is recognized in Ambient Intelligence that ambient devices should be modeled as intelligent autonomous components rather than passive information sources. The agent paradigm suits well for representation of both intelligent ambient devices and humans. However, modeling complex cognitive dynamics from which intelligent behavior of agents emerges is not trivial. In this paper a formal framework is proposed for declarative modeling of cognitive processes and behavior of agents in an ambient intelligence system. Models obtained by the framework are executable and can be used directly for simulation and analysis. The framework provides rich analysis possibilities of qualitative and quantitative properties, specified at local (agent) and global (system) levels. An application of the framework in the context of a subway evacuation case is described in the paper.