We describe a general mechanism for adaptation in multiagent systems in which agents modify their behavior based on their memory of past events. These behavior changes can be elicited by environmental dynamics or arise as response to the actions of other agents. The agents use memory to estimate the global state of the system from individual observations and adjust their actions accordingly. We also present a mathematical model of the dynamics of collective behavior in such systems and apply it to study adaptive coalition formation in electronic marketplaces. In adaptive coalition formation, the agents are more likely to join smaller coalitions than larger ones while there are many small coalitions. The rationale behind this is that smaller coalitions are necessary to nucleate larger ones. The agents remember the sizes of coalition they encountered and use them to estimate the mean coalition size. They decide whether to join a new coalition based on how close its size is to the mean c...