Skip to content

azd ai agent extension - 404 error if you create the same project twice #8360

@banrahan

Description

@banrahan

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

  1. azd ai agent init in a directory, e.g., ~/agents/agent01
  2. azd provision in that directory
  3. azd down in that directory and do a purge
  4. delete the directory and recreate it with the same path
  5. azd provision
  6. azd ai agent run
  7. azd ai agent invoke --locally "hi"
  8. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/provisioningBicep/Terraform/ADE provisioningbugSomething isn't workingext-agentsazure.ai.{agents,connections,inspector,projects,routines,skills,toolboxes} extensions

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions