Skip to content

Validate resolved agent definition kinds #9268

Description

@huimiu

Task

Ensure every resolved agent service definition is validated, regardless of its kind.

Background

In agentDefinitionFromStruct (cli/azd/extensions/azure.ai.agents/internal/project/agent_definition.go), inline agent definitions were not validated consistently:

  • Definitions with kind != hosted returned early and skipped validation entirely, so an invalid non-hosted definition could pass through silently.
  • For hosted definitions, a failure to marshal back to YAML was only logged at debug level instead of being surfaced, which meant validation could be quietly skipped.

Proposed change

  • Extract a shared validateAgentServiceDefinition helper that marshals the definition and runs ValidateAgentDefinition.
  • Run it for both hosted and non-hosted kinds.
  • Return a validation error on marshal failure instead of only logging.

Why

Inline definitions in azure.yaml should be held to the same validation rules as on-disk agent.yaml, so misconfigured entries are caught early with an actionable error rather than failing later.

Tracked by PR #9264.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ext-agentsazure.ai.agents extension

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions