[Agents Extension] Init from agent template#7147
Conversation
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
There was a problem hiding this comment.
Pull request overview
Adds an interactive “start from a template” initialization flow to the azure.ai.agents extension, while refactoring the existing manifest-based init logic into a shared helper.
Changes:
- Extract common manifest initialization logic into
runInitFromManifest. - Add template-catalog fetching, interactive selection, and post-
azd init -tmanifest discovery. - Add unit tests for template type detection, template fetching (via test helper), and manifest discovery.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
cli/azd/extensions/azure.ai.agents/internal/cmd/init.go |
Refactors manifest init into a helper and adds a new interactive branching flow (from code vs template). |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go |
Implements template catalog retrieval, init-mode/language/template prompts, and manifest search. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers_test.go |
Adds tests for EffectiveType and findAgentManifest, plus HTTP-fetch parsing via a test helper. |
You can also share your feedback on Copilot code review. Take the survey.
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go
Outdated
Show resolved
Hide resolved
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go
Show resolved
Hide resolved
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go
Show resolved
Hide resolved
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
…to proceed Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
|
@copilot do a fresh review of this PR with the new changes |
There was a problem hiding this comment.
Pull request overview
Adds an interactive “init without manifest” experience for the azure.ai.agents extension, allowing users to initialize from existing code or choose from a curated catalog of agent templates, and refactors shared Foundry/model/env setup logic for reuse across init flows.
Changes:
- Introduces template-catalog helpers (fetch/filter/select) and wires them into
azd ai agent initwhen-m/--manifestisn’t provided. - Refactors Foundry project, environment, subscription/location, and model deployment helper logic into shared helper functions used by both init flows.
- Updates init flows/messages (e.g., next steps guidance, placeholder logging) and adds unit tests for new helper behaviors.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/extensions/azure.ai.agents/internal/pkg/agents/registry_api/helpers.go | Removes noisy “no placeholders” logging from template injection helper. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init.go | Adds “init from template” flow, introduces shared runInitFromManifest, and defers model configuration decisions via configureModelChoice. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_models.go | Switches Foundry deployment enumeration to shared helpers; adds a “no matching deployments” decision prompt. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go | Refactors env/subscription/location/model selection to use shared helpers; tweaks messaging. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go | New helper module for template catalog retrieval, template type detection, init-mode prompt, and manifest discovery. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers_test.go | Adds tests for template type detection, catalog fetch helper, manifest discovery, and directory emptiness. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers.go | New shared module for Foundry project parsing/selection, env var setup, subscription/location setup, and deployment resolution. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers_test.go | Adds tests for Foundry project ARM ID parsing. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers.go
Show resolved
Hide resolved
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go
Show resolved
Hide resolved
Signed-off-by: trangevi <trangevi@microsoft.com>
…view Documents PR Azure#7147 which adds template selection flow to azd ai agent init. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Update cli/version.txt to 1.23.12 (released 2026-03-24) - Add 1.23.12 changelog entry: revert -e flag regression, telemetry fixes (Azure#7276) - Add 1.23.11 changelog entry: --timeout flag, Copilot init improvements, security fixes, CopilotService gRPC extension (Azure#7221) - Update azure.ai.agents to 0.1.18-preview - Add 0.1.18-preview changelog: azd ai agent init from template (Azure#7147/Azure#7256) - Add 0.1.17-preview changelog: banner, container settings (Azure#7225) - Add 0.1.16-preview changelog: files command group, security hardening, breaking change to show/monitor commands (Azure#7190) - Create cli/azd/extensions/azure.ai.agents/AGENTS.md with contributor guidance, error handling conventions, and release preparation steps (Azure#7111/Azure#7225) - Update azure.ai.models to 0.0.5-preview - Add 0.0.5-preview changelog: improved 403 error handling (Azure#7279) - Add Error Handling in Extensions section to extensions-style-guide.md (Azure#7111) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Init from template Signed-off-by: trangevi <trangevi@microsoft.com> * Refactor Signed-off-by: trangevi <trangevi@microsoft.com> * Rename helper file Signed-off-by: trangevi <trangevi@microsoft.com> * Shortcut prompt if the directory is empty Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> * Some general init experience changes Signed-off-by: trangevi <trangevi@microsoft.com> * Select options for CPU and Memory Signed-off-by: trangevi <trangevi@microsoft.com> * Change message based on provided project Signed-off-by: trangevi <trangevi@microsoft.com> * Refactoring to allow for code reuse between init and init from code Signed-off-by: trangevi <trangevi@microsoft.com> * Instead of just creating a new deployment by default, prompt for how to proceed Signed-off-by: trangevi <trangevi@microsoft.com> * Lint fixes Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> --------- Signed-off-by: trangevi <trangevi@microsoft.com>
* Init from template Signed-off-by: trangevi <trangevi@microsoft.com> * Refactor Signed-off-by: trangevi <trangevi@microsoft.com> * Rename helper file Signed-off-by: trangevi <trangevi@microsoft.com> * Shortcut prompt if the directory is empty Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> * Some general init experience changes Signed-off-by: trangevi <trangevi@microsoft.com> * Select options for CPU and Memory Signed-off-by: trangevi <trangevi@microsoft.com> * Change message based on provided project Signed-off-by: trangevi <trangevi@microsoft.com> * Refactoring to allow for code reuse between init and init from code Signed-off-by: trangevi <trangevi@microsoft.com> * Instead of just creating a new deployment by default, prompt for how to proceed Signed-off-by: trangevi <trangevi@microsoft.com> * Lint fixes Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> --------- Signed-off-by: trangevi <trangevi@microsoft.com>
* Init from template Signed-off-by: trangevi <trangevi@microsoft.com> * Refactor Signed-off-by: trangevi <trangevi@microsoft.com> * Rename helper file Signed-off-by: trangevi <trangevi@microsoft.com> * Shortcut prompt if the directory is empty Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> * Some general init experience changes Signed-off-by: trangevi <trangevi@microsoft.com> * Select options for CPU and Memory Signed-off-by: trangevi <trangevi@microsoft.com> * Change message based on provided project Signed-off-by: trangevi <trangevi@microsoft.com> * Refactoring to allow for code reuse between init and init from code Signed-off-by: trangevi <trangevi@microsoft.com> * Instead of just creating a new deployment by default, prompt for how to proceed Signed-off-by: trangevi <trangevi@microsoft.com> * Lint fixes Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> --------- Signed-off-by: trangevi <trangevi@microsoft.com>
* Init from template Signed-off-by: trangevi <trangevi@microsoft.com> * Refactor Signed-off-by: trangevi <trangevi@microsoft.com> * Rename helper file Signed-off-by: trangevi <trangevi@microsoft.com> * Shortcut prompt if the directory is empty Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> * Some general init experience changes Signed-off-by: trangevi <trangevi@microsoft.com> * Select options for CPU and Memory Signed-off-by: trangevi <trangevi@microsoft.com> * Change message based on provided project Signed-off-by: trangevi <trangevi@microsoft.com> * Refactoring to allow for code reuse between init and init from code Signed-off-by: trangevi <trangevi@microsoft.com> * Instead of just creating a new deployment by default, prompt for how to proceed Signed-off-by: trangevi <trangevi@microsoft.com> * Lint fixes Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> --------- Signed-off-by: trangevi <trangevi@microsoft.com>
* Init from template Signed-off-by: trangevi <trangevi@microsoft.com> * Refactor Signed-off-by: trangevi <trangevi@microsoft.com> * Rename helper file Signed-off-by: trangevi <trangevi@microsoft.com> * Shortcut prompt if the directory is empty Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> * Some general init experience changes Signed-off-by: trangevi <trangevi@microsoft.com> * Select options for CPU and Memory Signed-off-by: trangevi <trangevi@microsoft.com> * Change message based on provided project Signed-off-by: trangevi <trangevi@microsoft.com> * Refactoring to allow for code reuse between init and init from code Signed-off-by: trangevi <trangevi@microsoft.com> * Instead of just creating a new deployment by default, prompt for how to proceed Signed-off-by: trangevi <trangevi@microsoft.com> * Lint fixes Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> --------- Signed-off-by: trangevi <trangevi@microsoft.com>
* Init from template Signed-off-by: trangevi <trangevi@microsoft.com> * Refactor Signed-off-by: trangevi <trangevi@microsoft.com> * Rename helper file Signed-off-by: trangevi <trangevi@microsoft.com> * Shortcut prompt if the directory is empty Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> * Some general init experience changes Signed-off-by: trangevi <trangevi@microsoft.com> * Select options for CPU and Memory Signed-off-by: trangevi <trangevi@microsoft.com> * Change message based on provided project Signed-off-by: trangevi <trangevi@microsoft.com> * Refactoring to allow for code reuse between init and init from code Signed-off-by: trangevi <trangevi@microsoft.com> * Instead of just creating a new deployment by default, prompt for how to proceed Signed-off-by: trangevi <trangevi@microsoft.com> * Lint fixes Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> --------- Signed-off-by: trangevi <trangevi@microsoft.com>
Adds handling to prompt the user when they don't provide a manifest, to select to either use code in the current directory, or select from a curated list of agent templates.
fixes #7050