The great variety of users of the services available on the internet raised the problem of finding flexible forms of presentation and interaction, which depend on the specific user's characteristics and needs. In this article we present an approach to adaptation, which exploits the reasoning capabilities of a rational agent. The key idea, which makes this approach orthogonal to personalization based on the "user model", is that the system adopts the user's intentions during the interaction. Then the system exploits its planning capabilities to dynamically generate a web site, adapted to the current user's needs. For the sake of understanding we also discuss a possible application of the approach to the construction of a virtual tutor.