feat(azure.ai.agents): show featured templates first in agent init#8075
Conversation
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
There was a problem hiding this comment.
Pull request overview
This PR updates the azd ai agent init interactive template selection flow in the azure.ai.agents extension to present a short, curated “featured” list first, with an explicit option to expand to the full catalog—addressing the UX request in #8073.
Changes:
- Adds “featured template” detection (
extensionTagscontainsexample) and partitions templates into featured vs. the rest. - Prompts users with featured templates first (with a default recommendation), plus a “See all templates...” option to expand to the full list.
- Adds unit tests for the new helper functions (
isFeatured,partitionFeatured,findRecommendedIndex).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go |
Implements featured-first partitioning, recommended default selection, and extracted select-prompt helper with “See all templates...” support. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers_test.go |
Adds coverage for featured detection/partitioning and recommended-default selection logic. |
184eb97 to
4ff7d69
Compare
wbreza
left a comment
There was a problem hiding this comment.
Supplemental Review — PR #8075
Supplementing trangevi's existing review. Findings below are new issues not previously flagged.
�� Doc Comment / Code Mismatch in partitionFeatured()
The doc comment for partitionFeatured() says agged "example" but the actual constant is eaturedTag = "template":
\\go
// partitionFeatured splits templates into featured (tagged "example") and
\
This is a second instance of the tag naming inconsistency trangevi flagged — worth fixing alongside that rename.
🟡 No Tests for the Core Feature Flow
The pure helper functions (isFeatured, isRecommended, partitionFeatured, indRecommendedIndex) are well-tested with table-driven tests. However, the PR's main feature — the featured-list → "See all" → full-list flow — has no test coverage:
- promptSelectTemplate() (the new reusable helper) — untested
- The "See all templates..." selection path (
il, nil return → caller falls through) — untested - Fallback conditions in promptAgentTemplate() (all-featured, no-featured) — untested at integration level
If mocking �zdClient is complex, consider at minimum testing the sentinel detection logic in isolation.
🟡 Note on Copilot's
ew() Suggestion
Copilot's earlier suggestion to use
ew() for defaultIdx doesn't cleanly apply here — defaultIdx is used both as a value (eatured[defaultIdx]) and as a pointer (&defaultIdx). The current pattern is the clearer approach for this case.
🟢 Minor Suggestions
- Edge case tests: Consider adding tests for empty inputs to isRecommended() (empty slice vs nil), indRecommendedIndex() (empty list), and partitionFeatured() (empty input).
- Intent comment: The if len(featured) > 0 && len(rest) > 0 condition implicitly handles the "all templates are featured" case by falling through. A brief comment would make this intentional behavior clearer.
✅ Verified Clean
- Index safety — Sentinel check prevents out-of-bounds on emplates when "See all" selected
- Nil pointer handling — All prompt responses properly guarded
- Sorting — slices.Clone prevents mutation; sort order correct
- Output pattern — mt.Println + output.WithHighLightFormat consistent with codebase
- Go conventions — Line length, import order, error wrapping all compliant
jongio
left a comment
There was a problem hiding this comment.
Logic is correct - index handling around the sentinel, partition, and fallback paths all check out. The extraction of promptSelectTemplate is a clean refactor that reduces duplication.
I agree with the tag naming feedback. The fact that three separate comments in the PR itself (line 287, line 327 doc, and the constant doc) all use different wording ("example", "featured", "template") for the same concept demonstrates the confusion clearly. A tag name that's distinct from the noun "template" would prevent this.
One additional observation: when the user chooses "See all templates...", the full list is shown without any default selection (defaultIdx: nil at line 322). This means the recommended tag has no effect in the expanded view. If you want the recommended template to remain pre-selected even after expanding, you'd need to find its index in allSorted and pass it through. Minor UX consideration - not blocking since the user explicitly chose to browse.
4ff7d69 to
2abddbc
Compare
…8073) Show templates tagged 'example' in a short featured list during 'azd ai agent init' template selection, with a 'See all templates...' option to expand to the full catalog. This replaces the previous behavior of dumping all templates in one alphabetical list. - Add isFeatured() method using extensionTags 'example' tag - Add partitionFeatured() to split templates into featured vs rest - Extract promptSelectTemplate() for reusable select prompt logic - Show featured list first with 'See all templates...' escape hatch - Fall through to full alphabetical list when user picks 'See all' Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2abddbc to
5e2239b
Compare
wbreza
left a comment
There was a problem hiding this comment.
Re-Review — Updated Commit (5e2239b)
Re-reviewing after author pushed updates addressing previous feedback.
✅ Previous Feedback Addressed
| Issue | Status |
|---|---|
| Tag renamed "template" → "featured" | ✅ Fixed |
| Doc comment mismatch ("example" → "featured") | ✅ Fixed |
| Recommended print message removed (UX concerns) | ✅ Removed |
| Full list now pre-selects recommended template | ✅ Added |
| Missing edge case tests (empty inputs) | ✅ Added |
| Label simplified to .Title | ✅ Clean |
🟢 Suggestion —
ew() Pattern
With the recommended message removed, defaultIdx and
ecommendedIdx are now only used as pointers. Per Go 1.26 conventions, these could use
ew():
// Instead of:
defaultIdx := findRecommendedIndex(featured)
// ... &defaultIdx
// Could be:
new(findRecommendedIndex(featured))Not blocking — just a style alignment with AGENTS.md conventions.
✅ Verified Clean
- Index safety, nil handling, sorting consistency all correct
- Sentinel check properly gates template access
- Doc comments now accurate
- Test coverage improved with edge cases
jongio
left a comment
There was a problem hiding this comment.
Addresses my previous feedback. The recommended default now carries through to the full list, tag naming is clear, and doc comments are accurate. Code logic is correct and well-tested.
|
/check-enforcer override |
Description
Closes #8073
Shows a curated list of starter templates first during
azd ai agent inittemplate selection, instead of dumping the full alphabetical catalog.Changes
featuredinextensionTagsare shown in a short curated list firstrecommendedinextensionTagsgets a(Recommended)suffix in its label and is pre-selected as the default - in both the curated list and the full catalogSee all templates...option at the bottom lets users expand to the full alphabetical catalogpromptSelectTemplate()is a reusable select prompt with optional default index and See all optionTag behavior
The curated list and default selection are driven entirely by
extensionTagsin the templates.json registry:featuredrecommended(Recommended)suffix to label and pre-selects the templateFallback behavior
featuredtagfeaturedtag but none haverecommendedrecommendedtagfeaturedtag (none without)(Recommended)label and pre-selection preservedExample output (Python)
Review feedback addressed
templatetofeaturedto avoid confusion (trangevi, jongio)(Recommended)label suffix (trangevi)