Skip to content

[Bug] azure.ai.agent host does not persist agent.yaml environment_variables into the deployed agent version #9247

Description

@qiaozha

Summary

With the azure.ai.agent host (azure.ai.agents beta.5), the "Registering agent environment variables" step is effectively a no-op: the environment_variables declared in agent.yaml are not embedded into the deployed agent version's definition.

What happens

Our hosted Foundry agent crashes on boot:

AZURE_APPCONFIG_ENDPOINT env var is required
-> 424 session_not_ready
-> /agent/chat returns 500

even though AZURE_APPCONFIG_ENDPOINT is declared in agent.yaml. The deployed version simply doesn't carry the env.

Related: azure.yaml ${VAR} interpolation for image: is resolved at project-load (before predeploy), so we also can't point image: at the freshly-built immutable tag. (Filed separately.)

Current workaround

agent-postdeploy.ts -> ensureAgentAppConfigEnv() uses the Foundry data-plane API:

  1. GET .../agents/<name>/versions/@latest
  2. if image != AGENT_DEPLOYED_IMAGE or environment_variables.AZURE_APPCONFIG_ENDPOINT is missing -> POST a new version cloning the definition, pinning the image, embedding env
  3. idempotent — no-op when already correct

Ask

The azure.ai.agent host should actually persist agent.yaml environment_variables (and the pinned image) into the deployed version's definition. That would let us delete ensureAgentAppConfigEnv.


Context: encountered while deploying a multi-component AI/chat service (App Service + Function App + Logic App + Foundry hosted agent) end-to-end with azd provision/deploy in Azure/azure-sdk-tools tools/sdk-ai-bots/deployment. We currently work around this with a TypeScript hook.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions