ATLaS: Agent Tuning via Learning Critical Steps