Describe the bug
After you init and provision you get a 404 error about the project not being found when you try to locally run and invoke (it also happens if you deploy and invoke remotely).
To Reproduce
- azd ai agent init in a directory, e.g., ~/agents/agent01
- azd provision in that directory
- azd down in that directory and do a purge
- delete the directory and recreate it with the same path
- azd provision
- azd ai agent run
- azd ai agent invoke --locally "hi"
- 404 error
The reason
These two pieces of code look to be the culprit, the hash that is appended to the ai-account string is always the same if the location and agent name is the same, e.g., there is not time or anything. This is likely an edge case, but at the very least provision is failing too silently in this case.
var resourceToken = uniqueString(subscription().id, resourceGroup().id, location)
name: !empty(existingAiAccountName) ? existingAiAccountName : 'ai-account-${resourceToken}'
location: location
The solution:
Provision shouldn't fail silently if it can't create the ai account. Also, I think we should generate the ai-account hash at init time with a salt and store it in the azure or agent yaml. Right now it is always constructed at run time because it never changes.
Describe the bug
After you init and provision you get a 404 error about the project not being found when you try to locally run and invoke (it also happens if you deploy and invoke remotely).
To Reproduce
The reason
These two pieces of code look to be the culprit, the hash that is appended to the ai-account string is always the same if the location and agent name is the same, e.g., there is not time or anything. This is likely an edge case, but at the very least provision is failing too silently in this case.
var resourceToken = uniqueString(subscription().id, resourceGroup().id, location)name: !empty(existingAiAccountName) ? existingAiAccountName : 'ai-account-${resourceToken}' location: locationThe solution:
Provision shouldn't fail silently if it can't create the ai account. Also, I think we should generate the ai-account hash at init time with a salt and store it in the azure or agent yaml. Right now it is always constructed at run time because it never changes.