Skip to content

[Agents Extension] Init from agent template#7147

Merged
rajeshkamal5050 merged 14 commits intomainfrom
trangevi/agent-template-init
Mar 23, 2026
Merged

[Agents Extension] Init from agent template#7147
rajeshkamal5050 merged 14 commits intomainfrom
trangevi/agent-template-init

Conversation

@trangevi
Copy link
Copy Markdown
Member

@trangevi trangevi commented Mar 13, 2026

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

Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 -t manifest 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.

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>
@trangevi
Copy link
Copy Markdown
Member Author

@copilot do a fresh review of this PR with the new changes

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

@trangevi I've opened a new pull request, #7252, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 init when -m/--manifest isn’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.

Signed-off-by: trangevi <trangevi@microsoft.com>
@rajeshkamal5050 rajeshkamal5050 merged commit 71ceb28 into main Mar 23, 2026
17 checks passed
github-actions bot added a commit to weikanglim/azure-dev that referenced this pull request Mar 23, 2026
…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>
github-actions bot added a commit to weikanglim/azure-dev that referenced this pull request Mar 24, 2026
- 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>
jongio pushed a commit to jongio/azure-dev that referenced this pull request Mar 27, 2026
* 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>
jongio pushed a commit to jongio/azure-dev that referenced this pull request Mar 27, 2026
* 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>
jongio pushed a commit to jongio/azure-dev that referenced this pull request Mar 27, 2026
* 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>
jongio pushed a commit to jongio/azure-dev that referenced this pull request Mar 27, 2026
* 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>
jongio pushed a commit to jongio/azure-dev that referenced this pull request Mar 27, 2026
* 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>
achauhan-scc pushed a commit to achauhan-scc/azure-dev that referenced this pull request Apr 2, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[agents extension] Create a new agent project from a list of templates [ai agent extension] Log better error when providing the wrong value for -p

4 participants