For the ATRACO (Adaptive and Trusted Ambient Ecologies) project, we are interested in supporting the everyday life activities of human users who are living in intelligent environments. Ambient intelligence environments are complex, since they are populated by numerous and heterogeneous devices. These environments are also changing and uncertain, because humans are moving, network devices may break down, and new devices may appear, unexpectedly. In ATRACO, we adopt a service- and agent-based approach: agents, managers, and devices provide services. In addition, we use ontologies to describe these devices and services on different abstraction levels. In the scope of this project, we have developed a Planning Agent (PA) that integrates AI planning techniques and is responsible for determining the tasks to be executed in order to achieve a user goal. These tasks are associated with abstract services, and in this way, the PA contributes to the services composition that is a two-phase process.

In the first phase, at design time, the PA solves a planning problem that consists of the user goal to be achieved and the abstract services and devices currently available in the intelligent environment. For the generation of the planning problems, the PA queries the Ontology Manager (OM) and gets from it the list of available abstract services and devices that are relevant to the user goal. These planning problems are solved using Hierarchical Task Network and Partial-Order Causal-Link planning techniques. In the planning domains for ATRACO, the decomposition methods describe exhaustively the many ways to accomplish a user goal. Furthermore, there is no goal state in the description of the planning problems. As a consequence, the insertion of tasks during the planning process is not necessary, which reduces search space drastically. From the planning decisions taken to find solution plans, abstract service workflows, expressed in a BPEL-like language, are automatically generated by the PA and given to the Sphere Manager (SM).

In the second phase of the services composition process, the SM binds the abstract services and devices described in the workflows to the available concrete devices and agents in a dynamic way at execution time with the help of the OM. Then, the SM is in charge of executing and adapting the workflows. The SM can handle exception events, such as the breakdown of concrete devices that are bound. In such a case, the SM tries to rebind the corresponding abstract devices and services by querying the OM about alternative available concrete devices. If the rebinding fails, then a replanning process is started in which the PA solves a new planning problem from scratch, that is, the services composition reenters the first phase.