Skip to content

feat(azure.ai.agents): show featured templates first in agent init#8075

Merged
Nathandrake229 merged 1 commit into
mainfrom
naman/featured-agent-templates-8073
May 8, 2026
Merged

feat(azure.ai.agents): show featured templates first in agent init#8075
Nathandrake229 merged 1 commit into
mainfrom
naman/featured-agent-templates-8073

Conversation

@Nathandrake229
Copy link
Copy Markdown
Contributor

@Nathandrake229 Nathandrake229 commented May 6, 2026

Description

Closes #8073

Shows a curated list of starter templates first during azd ai agent init template selection, instead of dumping the full alphabetical catalog.

Changes

  • Curated list: Templates tagged featured in extensionTags are shown in a short curated list first
  • Recommended label: The template tagged recommended in extensionTags gets a (Recommended) suffix in its label and is pre-selected as the default - in both the curated list and the full catalog
  • See all templates...: A See all templates... option at the bottom lets users expand to the full alphabetical catalog
  • Extracted helper: promptSelectTemplate() is a reusable select prompt with optional default index and See all option

Tag behavior

The curated list and default selection are driven entirely by extensionTags in the templates.json registry:

Tag Purpose
featured Includes the template in the curated starter list
recommended Adds (Recommended) suffix to label and pre-selects the template

Fallback behavior

Scenario Behavior
No templates have featured tag Full alphabetical list shown (old behavior, no curated list)
Templates have featured tag but none have recommended Curated list shown, first template is pre-selected
Multiple templates have recommended tag First one (alphabetically) is pre-selected
All templates have featured tag (none without) Full alphabetical list shown (curated list = full list adds no value)
User selects "See all templates..." Full alphabetical list shown with (Recommended) label and pre-selection preserved

Example output (Python)

? Select a starter template: Basic Agent (Responses) (Agent Framework) (Recommended)

  Filter: Type to filter list

  > Basic Agent (Responses) (Agent Framework) (Recommended)
    Basic Agent (Invocations) (Agent Framework)
    Agent with Local Tools (Responses) (Agent Framework)
    See all templates...

Review feedback addressed

  • Renamed tag from template to featured to avoid confusion (trangevi, jongio)
  • Replaced separate print line with (Recommended) label suffix (trangevi)
  • Fixed stale doc comments referencing old tag names (trangevi, wbreza)
  • Added edge case tests for empty inputs (wbreza)
  • Added intent comment for all-featured fallthrough behavior (wbreza)
  • Recommended tag pre-selection now works in "See all" view too (jongio)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

📋 Prioritization Note

Thanks for the contribution! The linked issue isn't in the current milestone yet.
Review may take a bit longer — reach out to @rajeshkamal5050 or @kristenwomack if you'd like to discuss prioritization.

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

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 (extensionTags contains example) 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.

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go Outdated
@Nathandrake229 Nathandrake229 force-pushed the naman/featured-agent-templates-8073 branch 2 times, most recently from 184eb97 to 4ff7d69 Compare May 6, 2026 15:15
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go Outdated
Copy link
Copy Markdown
Contributor

@wbreza wbreza left a comment

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

@jongio jongio left a comment

Choose a reason for hiding this comment

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

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.

@Nathandrake229 Nathandrake229 force-pushed the naman/featured-agent-templates-8073 branch from 4ff7d69 to 2abddbc Compare May 7, 2026 03:28
…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>
@Nathandrake229 Nathandrake229 force-pushed the naman/featured-agent-templates-8073 branch from 2abddbc to 5e2239b Compare May 7, 2026 19:07
@Nathandrake229 Nathandrake229 enabled auto-merge (squash) May 7, 2026 19:07
Copy link
Copy Markdown
Contributor

@wbreza wbreza left a comment

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

@jongio jongio left a comment

Choose a reason for hiding this comment

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

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.

@trangevi
Copy link
Copy Markdown
Member

trangevi commented May 8, 2026

/check-enforcer override

@Nathandrake229 Nathandrake229 merged commit 8a7551b into main May 8, 2026
21 of 25 checks passed
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.

show specific samples in azd ai agent init

5 participants