This paper presents CORTA, a software agent that designs personalized rehabilitation programs for homeless youth suffering from opioid addiction. Many rehabilitation centers treat opioid addiction in homeless youth by prescribing rehabilitation programs which are tailored to the underlying causes of addiction. To date, rehabilitation centers have relied on ad-hoc assessments and unprincipled heuristics to deliver rehabilitation programs to homeless youth suffering from opioid addiction, which greatly undermines the effectiveness of the delivered programs. CORTA addresses these challenges via three novel contributions. First, CORTA utilizes a first-of-its-kind real-world dataset collected from ~1400 homeless youth to build causal inference models which predict the likelihood of opioid addiction among these youth. Second, utilizing counterfactual predictions generated by our causal inference models, CORTA solves novel optimization formulations to assign appropriate rehabilitation programs to the correct set of homeless youth in order to minimize the expected number of homeless youth suffering from opioid addiction. Third, we provide a rigorous experimental analysis of CORTA along different dimensions, e.g., importance of causal modeling, importance of optimization, and impact of incorporating fairness considerations, etc. Our simulation results show that CORTA outperforms baselines by ~110% in minimizing the number of homeless youth suffering from opioid addiction.