feat: implement agent template initialization and selection process#7052
Draft
therealjohn wants to merge 2 commits intoAzure:mainfrom
Draft
feat: implement agent template initialization and selection process#7052therealjohn wants to merge 2 commits intoAzure:mainfrom
therealjohn wants to merge 2 commits intoAzure:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prototype for #7050
The
azd initcommand presents users with a choice: "Scan current directory" or "Select a template."This pattern is familiar to
azdusers and provides a good onboarding experience.Currently,
azd ai agent init(without the-mflag) jumps directly into an "init from code" flowthat scaffolds a new agent from scratch. There is no way to browse and start from a sample template.
This feature adds an initial prompt to
azd ai agent initthat mirrors theazd initexperience,letting users choose between using their existing code or starting from a curated template.
Demo
UX Flow
Key UX Decisions
InitFromCodeAction(unchanged).list of agent templates.
sourceURL, not a separate field:agent.yamloragent.manifest.yaml→ agent manifest flow:the URL is used as the manifest pointer, reusing the
InitActioncode path (same as-m <url>).dispatched via
azd init -t <repo>workflow, which clones the full template (azure.yaml,infra/, source code, etc.).
-mis provided on the command line, the prompt is skipped entirely (existing behavior).Architecture
Template Data Source
Templates are defined in a JSON file hosted on GitHub:
therealjohn/awesome-azd(fork of Azure/awesome-azd)agent-templateswebsite/static/agent-templates.jsonhttps://aka.ms/foundry-agentsThis mirrors how
azd inituseshttps://aka.ms/awesome-azd/templates.jsonfor its template list,but with a custom schema tailored for agent templates.
JSON Schema
[ { "title": "Echo Agent", "description": "A custom AI agent that echoes user input. Useful for testing and learning.", "language": "python", "framework": "Agent Framework", "source": "https://github.com/microsoft-foundry/foundry-samples/blob/main/samples/python/hosted-agents/agent-framework/echo-agent/agent.yaml", "tags": ["example", "learning"] } ]titledescriptionlanguage"python"or"csharp"— used for filtering after language promptframework"Agent Framework","LangGraph", or"Custom"— shown as detail textsourcetagsTemplate Type Detection
The template type is not stored in the JSON — it is inferred from the
sourceURL at runtime:sourceends with/agent.yamlor/agent.manifest.yaml→ agent manifest template.The URL is passed to
downloadAgentYaml()via the existing-mflow.(e.g.,
Azure-Samples/my-agent-template) and dispatched viaazd init -t <repo>.This means the same JSON catalog can contain both types of templates without any schema changes.
Adding a full azd template is as simple as setting
sourceto the repo slug instead of an agent.yaml URL.Two Template Flows
Agent manifest flow (source ends with agent.yaml):
ensureAzureContext()— set up project, environment, subscription, locationInitAction.Run()→downloadAgentYaml()— download agent.yaml + sibling filesaddToProject()— register agent as a service in azure.yamlFull azd template flow (source is a repo slug):
azd init -t <repo>viaazdClient.Workflow().Run()Key Difference from
azd initTemplatesazd inittemplates are always full GitHub repositories cloned viaazd. Agent templates supporttwo modes: (1) agent manifest templates that point to
agent.yamlfiles inside shared repos likemicrosoft-foundry/foundry-samples, and (2) full azd templates that are standalone repos withazure.yaml,infra/, and source code — identical toazd inittemplates.Template Inventory
All templates come from
microsoft-foundry/foundry-samplesundersamples/{language}/hosted-agents/.