Many social dilemmas involve decisions made by firms. We design a laboratory experiment that represents firms' principal-agent problem and includes an inter-firm social dilemma and stochastic agent performance. Agents' unobservable effort affects the likelihood of a bad outcome occurring, such as a regulatory violation. This harms the agent's principal but can also damage others, thus creating an inter-firm social dilemma. In our baseline treatment, we omit the agency problem, and principals make their "firm's" effort decision directly. In the second treatment, principals can only offer an unconditional wage contract to their agent, although a noncontractual (ex-post) bonus can be paid. In a third treatment, principals can condition wages on the stochastic outcome, and a fourth treatment combines the conditional wage with a noncontractual bonus. We find that principals use a combination of a conditional wage and the noncontractual (ex-post) bonus to help overcome the agency problem and incentivize agents to choose higher effort. Fixed wage, unconditional contracts lead to significantly lower effort levels, even when augmented with bonuses. Similarly, conditional contracts on their own also perform poorly. Only the combination of conditional wage contracts and discretionary bonuses is effective in limiting agency risk to address the inter-firm social dilemma problem.