Skip to content

[azure.ai.agents] azd ai agent init panics during agent.yaml parsing with interface conversion error #6679

Description

@charris-msft

Description

When running azd ai agent init -m <path-to-agent.yaml>, the command panics during YAML parsing with an interface conversion error. This happens before any Azure resources are accessed, immediately after reading the agent.yaml file.

Environment

Component Version
azd 1.23.3 (commit c53baf4)
azure.ai.agents extension 0.1.8-preview
OS Windows 11

Steps to Reproduce

  1. Install the azure.ai.agents extension: azd ext install azure.ai.agents
  2. Create an agent.yaml file (see below)
  3. Run: azd ai agent init -m "path/to/agent.yaml" --no-prompt

agent.yaml content

# yaml-language-server: $schema=https://raw.githubusercontent.com/microsoft/AgentSchema/refs/heads/main/schemas/v1.0/ContainerAgent.yaml

kind: hosted
name: lego-social-media-agent
description: |
    An AI-powered social media content generator for LEGO products.
metadata:
    authors:
        - LEGO Social Media Team
    example:
        - content: Generate a Twitter post about Star Wars LEGO sets
          role: user
    tags:
        - Social Media
        - Content Generation
protocols:
    - protocol: responses
      version: v1
environment_variables:
    - name: POSTGRES_SERVER
      value: ${POSTGRES_SERVER}
    - name: POSTGRES_DATABASE
      value: ${POSTGRES_DATABASE}

Error Output

Initializing AI agent project...

Reading agent.yaml from local file: D:\git\demos\zap1\SocialMediaAgentPython\agent.yaml
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 1 [running]:
azureaiagent/internal/pkg/agents/agent_yaml.ExtractAgentDefinition({0xc0002c8380, 0x376, 0x377})
        azureaiagent/internal/pkg/agents/agent_yaml/parse.go:50 +0x725
azureaiagent/internal/pkg/agents/agent_yaml.LoadAndValidateAgentManifest({0xc0002c8380, 0x376, 0x377})
        azureaiagent/internal/pkg/agents/agent_yaml/parse.go:23 +0xb0
azureaiagent/internal/cmd.(*InitAction).downloadAgentYaml(0xc000743b30, {0x7ff7ccafe300, 0xc00047a180}, {0xc000134080, 0x33}, {0x0, 0x0})
        azureaiagent/internal/cmd/init.go:1040 +0x1233
azureaiagent/internal/cmd.(*InitAction).Run(0xc000743b30, {0x7ff7ccafe300, 0xc00047a180})
        azureaiagent/internal/cmd/init.go:213 +0x219
azureaiagent/internal/cmd.newInitCommand.func1(0xc00030db08, {0xc00047a0f0?, 0x4?, 0x7ff7cc72f429?})
        azureaiagent/internal/cmd/init.go:150 +0x678
github.com/spf13/cobra.(*Command).execute(0xc00030db08, {0xc00047a090, 0x3, 0x3})
        github.com/spf13/cobra@v1.10.1/command.go:1015 +0xb02
github.com/spf13/cobra.(*Command).ExecuteC(0xc00030cf08)
        github.com/spf13/cobra@v1.10.1/command.go:1148 +0x465

Additional Notes

  • I also tested with a known-working agent.yaml from the copilot-hosted-agent sample and received the same error
  • The panic occurs in parse.go:50 during ExtractAgentDefinition, suggesting the YAML parser expects a specific structure that isn't being found
  • This is different from issue azd ai agent init - panic when initializing agent #6050 which panicked later in the flow (after model SKU selection)

Expected Behavior

The command should either:

  1. Successfully parse the agent.yaml and proceed with initialization, or
  2. Provide a helpful error message if the YAML format is invalid

Impact

This bug completely blocks the azd ai agent workflow for deploying hosted agents to Azure AI Foundry.

Metadata

Metadata

Labels

ext-agentsazure.ai.agents extension

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions