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.
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:kind != hostedreturned early and skipped validation entirely, so an invalid non-hosted definition could pass through silently.Proposed change
validateAgentServiceDefinitionhelper that marshals the definition and runsValidateAgentDefinition.Why
Inline definitions in
azure.yamlshould be held to the same validation rules as on-diskagent.yaml, so misconfigured entries are caught early with an actionable error rather than failing later.Tracked by PR #9264.