Biological organisms are open, adaptive systems that can respond to changes in environment in specific ways. Adaptation and response can be posed as an optimization problem, with a tradeoff between the benefit obtained from a response and the cost of producing environment-specific responses. Using recent results in stochastic thermodynamics, we formulate the cost as the mutual information between the environment and the stochastic response. The problem of designing an optimally performing network now reduces to a problem in rate distortion theoryâ€”a branch of information theory that deals with lossy data compression. We find that as the cost of unit information goes down, the system undergoes a sequence of transitions, corresponding to the recruitment of an increasing number of responses, thus improving response specificity as well as the net payoff. We derive formal equations for the transition points and exactly solve them for special cases. The first transition point, also called the *coding transition*, demarcates the boundary between a passive response and an active decision-making by the system. We study this transition point in detail, and derive three classes of asymptotic behavior, corresponding to the three limiting distributions of the statistics of extreme values. Our work points to the necessity of a union between information theory and the theory of adaptive biomolecular networks, in particular metabolic networks.