Skip to content

Conversation

@jeffhandley
Copy link
Member

@jeffhandley jeffhandley commented Nov 5, 2025

Introduces the new Microsoft.Agents.AI.Templates package that includes an aiagents-webapi project template. Snapshot tests and execution tests are added for verifying all of the currently supported options in the template.

❯ dotnet new aiagents-webapi -?
AI Agents Web API (C#)
Author: Microsoft
Description: A project template for creating an AI Agents Web API application.

Usage:
  dotnet new aiagents-webapi [options] [template options]

Options:
  -n, --name <name>       The name for the output being created. If no name is specified, the name of the output directory is used.
  -o, --output <output>   Location to place the generated output.
  --dry-run               Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False]
  --force                 Forces content to be generated even if it would change existing files. [default: False]
  --no-update-check       Disables checking for the template package updates when instantiating a template. [default: False]
  --project <project>     The project that should be used for context evaluation.
  -lang, --language <C#>  Specifies the template language to instantiate.
  --type <project>        Specifies the template type to instantiate.

Template options:
  -f, --framework <net10.0|net8.0|net9.0>              The target framework for the project.
                                                       Type: choice
                                                         net10.0  Target net10.0
                                                         net9.0   Target net9.0
                                                         net8.0   Target net8.0
                                                       Default: net10.0
  --provider <azureopenai|githubmodels|ollama|openai>  Type: choice
                                                         azureopenai   Uses Azure OpenAI service
                                                         githubmodels  Uses GitHub Models
                                                         ollama        Uses Ollama with the llama3.2 model
                                                         openai        Uses the OpenAI Platform
                                                       Default: githubmodels
  --use-managed-identity                               Use managed identity to access Azure services
                                                       Enabled if: (AiServiceProvider == "azureopenai")
                                                       Type: bool
                                                       Default: true
  --chat-model <chat-model>                            Model/deployment for chat completions. Example: gpt-4o-mini
                                                       Type: string

aiagents-webapi

Microsoft Reviewers: Open in CodeFlow

@jeffhandley jeffhandley self-assigned this Nov 5, 2025
@jeffhandley jeffhandley requested review from a team as code owners November 5, 2025 16:21
@jeffhandley jeffhandley added the area-ai-templates Microsoft.Extensions.AI.Templates label Nov 5, 2025
Copilot AI review requested due to automatic review settings November 5, 2025 16:21
Copy link
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 introduces the new Microsoft.Agents.AI.Templates package containing an aiagents-webapi project template for creating AI Agents Web API applications. The template supports multiple AI service providers (GitHub Models, OpenAI, Azure OpenAI, Ollama) with configurable options for authentication and models. The PR also refactors shared project template testing infrastructure to support both the new Agents templates and existing Extensions.AI templates.

Key changes:

  • New aiagents-webapi template package with multi-provider support and managed identity authentication
  • Refactored shared test infrastructure from Microsoft.Extensions.AI.Templates.Tests namespace to Microsoft.Shared.ProjectTemplates.Tests for reusability
  • Comprehensive snapshot and execution tests validating all template configuration options

Reviewed Changes

Copilot reviewed 72 out of 81 changed files in this pull request and generated 12 comments.

File Description
test/Shared/ProjectTemplates/*.cs Namespace refactoring from Extensions.AI to shared namespace for test infrastructure reusability
test/ProjectTemplates/Microsoft.Agents.AI.Templates.IntegrationTests/* New integration test project with snapshot and execution tests for aiagents-webapi template
src/ProjectTemplates/Microsoft.Agents.AI.Templates/* New template package containing aiagents-webapi template with multi-provider support
src/ProjectTemplates/GeneratedContent.targets Build configuration for generating template content with package version variables

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DeagleGross
Copy link
Member

Should this have an option to attach to Aspire? Aspire helps to nicely define for example integration with AzureOpenAI / Foundry like here

@jeffhandley
Copy link
Member Author

Should this have an option to attach to Aspire?

We'll add the Aspire option in a follow-up; might not land this week though.

Copy link
Member

@MackinnonBuck MackinnonBuck left a comment

Choose a reason for hiding this comment

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

Looks great so far - just some initial thoughts about the template infrastructure.

@Varorbc
Copy link
Contributor

Varorbc commented Nov 5, 2025

If it's only in one AI template, that would be even better.

Copy link
Member

@MackinnonBuck MackinnonBuck left a comment

Choose a reason for hiding this comment

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

Looks great!

@jeffhandley jeffhandley merged commit c3e0c73 into dotnet:main Nov 7, 2025
6 checks passed
@jeffhandley jeffhandley deleted the jeffhandley/webapi-agents-template branch November 7, 2025 00:33
joperezr pushed a commit to joperezr/extensions that referenced this pull request Nov 11, 2025
…pi project template (dotnet#7014)

* Initial Microsoft.Agents.AI.Templates structure

* Refine Microsoft.Agents.AI.Templates infrastructure

* Move project template infrastructure utilities into a shared folder

* Add the webapi-agents project template content with GitHub models

* Support parameterized AI Service Provider

* Rename to aiagents-webapi

* Support parameterized chatmodel and update docs with renames

* Add Snapshot tests

* Add aiagents-webapi snapshot tests

* Add aiagents-webapi execution tests (and component governance)

* Improve aiagents-webapi template parameters

* Apply suggestions from copilot code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Move shared ProjectTemplate infrastructure to not get included in Shared.Tests

* Fix the template sandbox / execution tests after moving infrastructure

* Ignore CA1716 warning about 'Shared' namespace in template tests

* Clean up template sandbox source/output

* Rename to "aiagent-webapi" and favor singular "Agent". Docs cleanup.

* Update templates dev doc to cover Microsoft.Agents.AI.Templates too

* Fix remaining template sandbox references with new paths

* Add a tool call in aiagent-webapi. Update workflow API usage for upcoming change.

Fix snapshots

* Exclude csproj.in file from template package

* Add a survey link to the aiagent-webapi template's generated readme

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
joperezr pushed a commit to joperezr/extensions that referenced this pull request Nov 11, 2025
- Use `Microsoft.Extensions.DataIngestion` in AI Chat Web template (dotnet#7023)
- Add a new Microsoft.Agents.AI.Templates package with an aiagents-webapi project template (dotnet#7014)
- Add Agent Framework DevUI into the aiagent-webapi template (dotnet#7026)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai-templates Microsoft.Extensions.AI.Templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants