Abstract We study the length of agreements in a market in which infinitely-lived firms contract with agents that live for two periods. Firms differ in the expected values of their projects, as do workers in their abilities to manage projects. Worker effort is not contractible and worker ability is revealed during the relationship. The market dictates the trade-off between sorting and incentives. Short- and long-term contracts often coexist: The best firms always use short-term contracts to hire high-ability senior workers, firms with less profitable projects use short-term contracts to save on the cost of hiring junior workers, whereas intermediate firms use long-term agreements to provide better incentives to their workers. We relate our results to the optimal assignment literature that follows Becker (1973).