MAESTRO: Multi-Agent Environment Shaping through Task and Reward Optimization