That depends on how you're calculating GDP. If you are summing up all expenditures or incomes, the paid work done by each AI would be counted. If you're counting production, meaning the value added, it probably wouldn't count since digging a hole only to fill it back in created no value.
GDP calculates the market value delivered. In this case of the labour. If someone is paying for the labour, GDP will be affected by the value of that labour. If the net output in terms of a product at the end is zero, then that does not erase the labour.
The only case where digging and filling a hole does not increase GDP is if the labour is not paid for.
EDIT: Basically, the two methods you list are the income or expenditure ways of calculating GDP, but in both cases consumption by employers is a factor, and so the payment for the labour increases the GDP irrespective of whether they also increase the final output.