for those who are still wondering in 2023, you can parse the resource name using the client you're using (eg: batchjobserviceclient).
I'm using PHP so:
$parsed_resource_name = $batchJobServiceClient->parseName($batch_job_result->getMutateOperationResponse()->getAdGroupResult()->getResourceName());
// the parseName method will return an array containing all the variable segments (enclosed with {}) of a resource string (eg: customers/{customer_id}/adGroups/{ad_group_id})
// so to get the ad group id, you can do like this:
$parsed_resource_name['ad_group_id'];
Hope that helps.
Cheers,