Skip to content

Commit c3e0c73

Browse files
jeffhandleyCopilot
andauthored
Add a new Microsoft.Agents.AI.Templates package with an aiagents-webapi project template (#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>
1 parent 3168e4d commit c3e0c73

File tree

82 files changed

+2567
-44
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+2567
-44
lines changed

eng/build.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.Build.Traversal">
22
<ItemGroup>
33
<_SnapshotsToExclude Include="$(MSBuildThisFileDirectory)..\test\**\Snapshots\**\*.*proj" />
4-
<_GeneratedContentToExclude Include="$(MSBuildThisFileDirectory)..\test\**\TemplateSandbox\**\*.*proj" />
4+
<_GeneratedContentToExclude Include="$(MSBuildThisFileDirectory)..\test\**\ExecutionTemplateSandbox\**\*.*proj" />
55

66
<!-- We recursively add all of the projects inside the src directory, except for the exclusions above -->
77
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\src\**\*.csproj" />

src/ProjectTemplates/GeneratedContent.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
-->
1010
<_LocalChatTemplateVariant>aspire</_LocalChatTemplateVariant>
1111

12+
<_WebApiAgentRoot>$(MSBuildThisFileDirectory)Microsoft.Agents.AI.Templates\src\WebApiAgent\</_WebApiAgentRoot>
1213
<_ChatWithCustomDataContentRoot>$(MSBuildThisFileDirectory)Microsoft.Extensions.AI.Templates\src\ChatWithCustomData\</_ChatWithCustomDataContentRoot>
1314
<_McpServerContentRoot>$(MSBuildThisFileDirectory)Microsoft.Extensions.AI.Templates\src\McpServer\</_McpServerContentRoot>
1415
</PropertyGroup>
@@ -33,6 +34,8 @@
3334
Specifies external packages that get referenced in generated template content.
3435
-->
3536
<PropertyGroup>
37+
<TemplatePackageVersion_MicrosoftAgentsAI>1.0.0-preview.251104.1</TemplatePackageVersion_MicrosoftAgentsAI>
38+
<TemplatePackageVersion_MicrosoftAgentsAIHostingOpenAI>1.0.0-alpha.251104.1</TemplatePackageVersion_MicrosoftAgentsAIHostingOpenAI>
3639
<TemplatePackageVersion_Aspire>9.5.1</TemplatePackageVersion_Aspire>
3740
<TemplatePackageVersion_Aspire_Preview>9.5.1-preview.1.25502.11</TemplatePackageVersion_Aspire_Preview>
3841
<TemplatePackageVersion_AzureAIProjects>1.0.0</TemplatePackageVersion_AzureAIProjects>
@@ -59,6 +62,8 @@
5962
ArtifactsShippingPackagesDir=$(ArtifactsShippingPackagesDir);
6063

6164
<!-- Package version properties -->
65+
TemplatePackageVersion_MicrosoftAgentsAI=$(TemplatePackageVersion_MicrosoftAgentsAI);
66+
TemplatePackageVersion_MicrosoftAgentsAIHostingOpenAI=$(TemplatePackageVersion_MicrosoftAgentsAIHostingOpenAI);
6267
TemplatePackageVersion_Aspire=$(TemplatePackageVersion_Aspire);
6368
TemplatePackageVersion_Aspire_Preview=$(TemplatePackageVersion_Aspire_Preview);
6469
TemplatePackageVersion_AzureAIProjects=$(TemplatePackageVersion_AzureAIProjects);
@@ -90,6 +95,9 @@
9095
<GeneratedContent
9196
Include="$(_ChatWithCustomDataContentRoot)Directory.Build.props.in"
9297
OutputPath="$(_ChatWithCustomDataContentRoot)Directory.Build.props" />
98+
<GeneratedContent
99+
Include="$(_WebApiAgentRoot)WebApiAgent-CSharp\WebApiAgent-CSharp.csproj.in"
100+
OutputPath="$(_WebApiAgentRoot)WebApiAgent-CSharp\WebApiAgent-CSharp.csproj" />
93101
<GeneratedContent
94102
Include="$(_ChatWithCustomDataContentRoot)ChatWithCustomData-CSharp.Web\ChatWithCustomData-CSharp.Web.csproj.in"
95103
OutputPath="$(_ChatWithCustomDataContentRoot)ChatWithCustomData-CSharp.Web\ChatWithCustomData-CSharp.Web.csproj" />
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<PackageType>Template</PackageType>
5+
<TargetFrameworks>$(NetCoreTargetFrameworks)</TargetFrameworks>
6+
<Description>Project templates for Microsoft.Agents.AI.</Description>
7+
<PackageTags>dotnet-new;templates;ai;agent</PackageTags>
8+
9+
<Stage>preview</Stage>
10+
<PreReleaseVersionIteration>1</PreReleaseVersionIteration>
11+
<Workstream>AI</Workstream>
12+
<MinCodeCoverage>0</MinCodeCoverage>
13+
<MinMutationScore>0</MinMutationScore>
14+
15+
<IsPackable>true</IsPackable>
16+
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
17+
<IncludeContentInPack>true</IncludeContentInPack>
18+
<IncludeBuildOutput>false</IncludeBuildOutput>
19+
<IncludeSymbols>false</IncludeSymbols>
20+
<ContentTargetFolders>content</ContentTargetFolders>
21+
<EnableDefaultItems>false</EnableDefaultItems>
22+
<NoDefaultExcludes>true</NoDefaultExcludes>
23+
<NoPackageAnalysis>true</NoPackageAnalysis>
24+
</PropertyGroup>
25+
26+
<ItemGroup>
27+
<!--
28+
Reference the GenerateTemplateContent project so that template content gets generated prior
29+
to building this project.
30+
-->
31+
<ProjectReference
32+
Include="..\GenerateTemplateContent\GenerateTemplateContent.csproj"
33+
ReferenceOutputAssembly="false"
34+
PrivateAssets="all" />
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
<!-- Keep the exclude patterns below in sync with those in WebApiAgentTemplateSnapshotTests.cs -->
39+
<Content
40+
Include="src\WebApiAgent\**\*"
41+
Exclude="
42+
**\bin\**;
43+
**\obj\**;
44+
**\.vs\**;
45+
**\*.user;
46+
**\*.in;
47+
**\NuGet.config;
48+
**\Directory.Build.targets;
49+
**\Directory.Build.props;" />
50+
51+
<None Include="THIRD-PARTY-NOTICES.TXT" Pack="true" PackagePath="." />
52+
<Compile Remove="**\*" />
53+
</ItemGroup>
54+
55+
</Project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Microsoft.Agents.AI.Templates
2+
3+
Provides project templates for Microsoft.Agents.AI.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.NET Core uses third-party libraries or other resources that may be
2+
distributed under licenses different than the .NET Core software.
3+
4+
In the event that we accidentally failed to list a required notice, please
5+
bring it to our attention. Post an issue or email us:
6+
7+
dotnet@microsoft.com
8+
9+
The attached notices are provided for information only.
10+
11+
License notice for OllamaSharp
12+
------------------------------
13+
14+
https://github.com/awaescher/OllamaSharp
15+
16+
MIT License
17+
18+
Copyright (c) 2024 Andreas Wäscher
19+
20+
Permission is hereby granted, free of charge, to any person obtaining a copy
21+
of this software and associated documentation files (the "Software"), to deal
22+
in the Software without restriction, including without limitation the rights
23+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24+
copies of the Software, and to permit persons to whom the Software is
25+
furnished to do so, subject to the following conditions:
26+
27+
The above copyright notice and this permission notice shall be included in all
28+
copies or substantial portions of the Software.
29+
30+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36+
SOFTWARE.
37+
38+
License notice for openai-dotnet
39+
-------------------------
40+
41+
https://github.com/openai/openai-dotnet
42+
43+
The MIT License (MIT)
44+
45+
Copyright (c) 2024 OpenAI (https://openai.com)
46+
47+
48+
Permission is hereby granted, free of charge, to any person obtaining a copy
49+
of this software and associated documentation files (the "Software"), to deal
50+
in the Software without restriction, including without limitation the rights
51+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
52+
copies of the Software, and to permit persons to whom the Software is
53+
furnished to do so, subject to the following conditions:
54+
55+
The above copyright notice and this permission notice shall be included in
56+
all copies or substantial portions of the Software.
57+
58+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
59+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
60+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
61+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
62+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
63+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
64+
THE SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$schema": "https://json.schemastore.org/dotnetcli.host",
3+
"symbolInfo": {
4+
"Framework": {
5+
"longName": "framework"
6+
},
7+
"AiServiceProvider": {
8+
"longName": "provider",
9+
"shortName": ""
10+
},
11+
"ChatModel": {
12+
"longName": "chat-model",
13+
"shortName": ""
14+
},
15+
"UseManagedIdentity": {
16+
"longName": "managed-identity",
17+
"shortName": ""
18+
},
19+
"httpPort": {
20+
"isHidden": "true",
21+
"longName": "httpPort",
22+
"shortName": ""
23+
},
24+
"httpsPort": {
25+
"isHidden": "true",
26+
"longName": "httpsPort",
27+
"shortName": ""
28+
}
29+
},
30+
"usageExamples": [
31+
""
32+
]
33+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://json.schemastore.org/ide.host",
3+
"order": 1,
4+
"icon": "ide/agent-framework.ico",
5+
"displayOverviewPage": "",
6+
"symbolInfo": [
7+
{
8+
"id": "AiServiceProvider",
9+
"isVisible": true
10+
},
11+
{
12+
"id": "ChatModel",
13+
"isVisible": true
14+
},
15+
{
16+
"id": "UseManagedIdentity",
17+
"isVisible": true
18+
}
19+
]
20+
}

0 commit comments

Comments
 (0)