Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
181084e
Reorganize samples
JimDaly Aug 5, 2025
f682252
Added python samples
rodrigobr-msft Aug 6, 2025
6ea0a2f
rename implement-semantic-kernel to semantic-kernel-multiturn
JimDaly Aug 6, 2025
2de03a4
rename folder
JimDaly Aug 6, 2025
55a28d9
Added reference to Empty Agent logging section in all Python READMEs
rodrigobr-msft Aug 6, 2025
f6aacf9
Merge branch 'sample-reorg' of https://github.com/microsoft/Agents in…
rodrigobr-msft Aug 6, 2025
43dc715
rename dotnet EmptyAgent sample to QuickStart sample
JimDaly Aug 6, 2025
b03f05f
Merge branch 'sample-reorg' of https://github.com/microsoft/Agents in…
JimDaly Aug 6, 2025
f852737
renamed dotnet WeatherAgent sample to SemanticKernelMultiturn.
JimDaly Aug 6, 2025
763d68c
fix link to SemanticKernelMultiturn project in dotnet\Samples.sln
JimDaly Aug 6, 2025
ba80479
Copilot fix of RetrievalBot project build errors
JimDaly Aug 6, 2025
1c237ae
Edits to README files
JimDaly Aug 6, 2025
7f87a71
Remove /en-us from links to learn.microsoft.com
JimDaly Aug 6, 2025
9eb3d25
ignore dotnet launchSettings.json
JimDaly Aug 6, 2025
2c94513
Manually removed launchSettings.json
Aug 6, 2025
d765362
Adjusted cd-samples.yml paths
Aug 7, 2025
743c3b0
Corrected cd-samples.yml task names
Aug 7, 2025
ec6f5d9
add empty-agent files to quickstart folder
JimDaly Aug 7, 2025
17669ae
Adhering to samples structure
rodrigobr-msft Aug 7, 2025
979419b
Slight adjustment to Further Reading section
rodrigobr-msft Aug 7, 2025
b9f69dd
Removed obo-authorization for Python for now
rodrigobr-msft Aug 7, 2025
de11dfd
Removed unused config variable in description of auto-signin
rodrigobr-msft Aug 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
42 changes: 20 additions & 22 deletions .github/workflows/cd-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js 22
uses: actions/setup-node@v4
with:
Expand All @@ -23,65 +23,63 @@ jobs:
run: npm ci

- name: Build dotnet Samples
working-directory: ./samples
working-directory: ./samples/dotnet
run: |
dotnet build


- name: Run lint
run: npm run lint

- name: Build Node Copilot Studio client sample
working-directory: ./samples/basic/copilotstudio-client/nodejs/
working-directory: ./samples/nodejs/copilotstudio-client/
run: |
npm ci
npm run build

- name: Build Node Copilot Studio client - React Webchat sample
working-directory: ./samples/basic/copilotstudio-webchat-react/
working-directory: ./samples/nodejs/copilotstudio-webchat-react/
run: |
npm ci
npm run build

- name: build Node Empty Agent
working-directory: ./samples/basic/empty-agent/nodejs/
- name: build Node QuickStart
working-directory: ./samples/nodejs/quickstart
run: |
npm ci
npm run build
- name: Build Node Cards bot
working-directory: ./samples/basic/cards/nodejs/

- name: Build Node Cards Agent
working-directory: ./samples/nodejs/cards/
run: |
npm ci
npm run build

- name: Build iamge Node Skill bot
working-directory: ./samples/complex/copilotstudio-skill/nodejs/
- name: Build iamge Node Skill Agent
working-directory: ./samples/nodejs/copilotstudio-skill/
run: |
npm ci
npm run build
- name: Build Node Weather Agent
working-directory: ./samples/basic/weather-agent/nodejs/

- name: Build Node langChain Agent
working-directory: ./samples/nodejs/langchain-multiturn/
run: |
npm ci
npm run build

- name: Build Node poem Agent
working-directory: ./samples/basic/azureai-streaming-poem-agent/nodejs/
- name: Build Node StreamingResponse Agent
working-directory: ./samples/nodejs/azure-ai-streaming/
run: |
npm ci
npm run build

- name: Build Node auto signin
working-directory: ./samples/basic/authorization/auto-signin/nodejs
- name: Build Node auto signin Agent
working-directory: ./samples/nodejs/auto-signin/
run: |
npm ci
npm run build

- name: Build Node OBO
working-directory: ./samples/basic/authorization/obo-authorization/nodejs
- name: Build Node OBO Agent
working-directory: ./samples/nodejs/obo-authorization/
run: |
npm ci
npm run build

22 changes: 8 additions & 14 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# M365 Agents SDK Samples list
# Microsoft 365 Agents SDK Samples list

|Category | Name | Description | node | dotnet | python |
|---------|-------------|-------------|--------|--------|--------|
| Basic | Empty Agent | Simplest agent | [basic/empty-agent/nodejs](./basic/empty-agent/nodejs) | [basic/empty-agent/dotnet](./basic/empty-agent/dotnet) | TBD |
| Basic | AutoSignIn | Simple OAuth agent using Graph | [basic/authorization/auto-signin/nodejs](./basic/authorization/auto-signin/nodejs) | [basic/authorization/auto-signin/dotnet](./basic/authorization/auto-signin/dotnet) | TBD |
| Basic | OBOAuthorization | OBO to Copilot Studio Agent | [basic/authorization/obo-authorization/nodejs](./basic/authorization/obo-authorization/nodejs) | [basic/authorization/obo-authorization/dotnet](./basic/authorization/obo-authorization/dotnet) | TBD |
| Basic | Weather Agent | WeatherAgent with various orchestrator libs | [basic/weather-agent/nodejs](./basic/weather-agent/nodejs) | [basic/weather-agent/dotnet](./basic/weather-agent/dotnet) | TBD |
| Basic | Streaming Agent | Streams OpenAI responses | [basic/azureai-streaming-poem-agent/nodejs](./basic/azureai-streaming-poem-agent/nodejs) | [basic/azureai-streaming-poem-agent/dotnet](./basic/azureai-streaming-poem-agent/dotnet) | TBD |
| Basic | Copilot Studio Client | Console app to consume a Copilot Studio Agent | [basic/copilotstudio-client/nodejs](./basic/copilotstudio-client/nodejs) | [basic/copilotstudio-client/dotnet](./basic/copilotstudio-client/dotnet) | TBD |
| Basic | Copilot Studio Client - React Webchat | App to consume a Copilot Studio Agent integrated with a Webchat Client | [basic/copilotstudio-webchat-react](./basic/copilotstudio-webchat-react) | | |
| Basic | Copilot Studio Webclient | Webclient for Copilot Studio integration | [basic/copilotstudio-webclient](./basic/copilotstudio-webclient) | | |
| Basic | Cards Agent | Agent that uses rich cards to enhance conversation design | [basic/cards/nodejs](./basic/cards/nodejs) | | TBD |
| Compat | Multi-turn Prompt | Multi-turn dialog flow using prompts and state management | [compat/multi-turn-prompt/nodejs](./compat/multi-turn-prompt/nodejs) | | TBD |
| Complex | Copilot Studio Skill | Call the echo bot from a Copilot Studio skill | [complex/copilotstudio-skill/nodejs](./complex/copilotstudio-skill/nodejs) | [complex/copilotstudio-skill/dotnet](./complex/copilotstudio-skill/dotnet) | TBD |
This table contains links to the samples available for each language.

|Language | README |
|---------|-------------|
|.Net|[dotnet](dotnet/README.md)|
|JavaScript|[nodejs](nodejs/README.md)|
|Python|[python](python/README.md)|
67 changes: 0 additions & 67 deletions samples/Samples.sln

This file was deleted.

1 change: 1 addition & 0 deletions samples/dotnet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
launchSettings.json
12 changes: 12 additions & 0 deletions samples/dotnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Microsoft 365 .NET Agents SDK Samples list

|Name|Description|README|
|----|----|----|
|QuickStart/Empty Agent|Simplest agent|[quickstart](quickstart/README.md)|
|AutoSignIn|Simple OAuth agent using Graph|[auto-signin](auto-signin/README.md)|
|OBOAuthorization|OBO to Copilot Studio Agent |[obo-authorization](obo-authorization/README.md)|
|Implement Semantic Kernel|WeatherAgent with Semantic Kernel|[semantic-kernel-multiturn](semantic-kernel-multiturn/README.md)|
|Streaming Agent |Streams OpenAI responses|[azure-ai-streaming](azure-ai-streaming/README.md)|
|Copilot Studio Client|Console app to consume a Copilot Studio Agent|[copilotstudio-client](copilotstudio-client/README.md)|
|Copilot Studio Skill |Call the echo bot from a Copilot Studio skill |[copilotstudio-skill](copilotstudio-skill/README.md)|
|RetrievalBot Sample with Semantic Kernel|A simple Retrieval Agent that is hosted on an Asp.net core web service. |[RetrievalBot](RetrievalBot/README.md)|
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using Microsoft.Agents.M365Copilot.Beta;
using Microsoft.Agents.M365Copilot.Beta.Copilot.Retrieval;
using Microsoft.Kiota.Abstractions.Authentication;
using Microsoft.Kiota.Http.HttpClientLibrary;
using System.Text.Json.Nodes;
using Microsoft.Agents.M365Copilot.Beta;
using Microsoft.Agents.M365Copilot.Beta.Copilot.Retrieval;
Expand Down Expand Up @@ -45,15 +49,15 @@ public async Task<string> BuildRetrievalAsync(string userquery)
string accessToken = _app.Authorization.GetTurnToken("graph");
var tokenProvider = new StaticTokenProvider(accessToken);
var authProvider = new BaseBearerTokenAuthenticationProvider(tokenProvider);
var baseURL = "https://graph.microsoft.com/beta";
var apiClient = new AgentsM365CopilotBetaServiceClient(authProvider, baseURL);
var requestAdapter = new HttpClientRequestAdapter(authProvider);
requestAdapter.BaseUrl = "https://graph.microsoft.com/beta";
var apiClient = new BaseM365CopilotClient(requestAdapter);

try
{
var response = await apiClient.Copilot.Retrieval.PostAsync(new RetrievalPostRequestBody()
{
QueryString = userquery,
DataSource = RetrievalDataSource.SharePoint,
FilterExpression = "(path:\"https://<tenantname>.sharepoint.com/sites/\")", // replace <tenantname> with your tenant name
ResourceMetadata = [string.Empty],
MaximumNumberOfResults = 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.using System.Threading.Tasks;
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq;
using System.Threading;
using Microsoft.Kiota.Abstractions.Authentication;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ This Agent Sample is intended to introduce you to the Copilot Retrieval API Grou
## Prerequisites

- [.NET](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) version 8.0
- [Dev Tunnels](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started)
- [Dev Tunnels](https://learn.microsoft.com/azure/developer/dev-tunnels/get-started)
- [Bot Framework Emulator](https://github.com/Microsoft/BotFramework-Emulator/releases) for Testing Web Chat.
- Download and install Visual Studio (I have 2022 version).
- You need Azure subscription to create Azure Bot Service. Follow the steps here – Link TBD
- Have Git available on your computer [Git - Installing Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- You also need Copilot licenses enabled in your tenant for calling the Retrieval API. And actually deploying the Agent to Copilot
- If you have a Copilot tenant, make sure your admin can install the app package from MAC (admin.microsoft.com). This requires admin level access and is the only way to upload Agentic applications to Copilot.
- If you do not want or can’t get a Copilot tenant, but have a Dev Tenant, you can still use this sample and deploy your Agent to your Teams channel or chat or meeting. Here are the steps for this - [Upload your custom app - Teams | Microsoft Learn](https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/apps-upload). This process doesn’t require Admin level access. Just ensure that your admin has allowed users to upload apps to Teams store. [Manage custom app policies and settings - Microsoft Teams | Microsoft Learn](https://learn.microsoft.com/en-us/microsoftteams/teams-custom-app-policies-and-settings).
- If you do not want or can’t get a Copilot tenant, but have a Dev Tenant, you can still use this sample and deploy your Agent to your Teams channel or chat or meeting. Here are the steps for this - [Upload your custom app - Teams | Microsoft Learn](https://learn.microsoft.com/microsoftteams/platform/concepts/deploy-and-publish/apps-upload). This process doesn’t require Admin level access. Just ensure that your admin has allowed users to upload apps to Teams store. [Manage custom app policies and settings - Microsoft Teams | Microsoft Learn](https://learn.microsoft.com/microsoftteams/teams-custom-app-policies-and-settings).
- You will not be able to use the Copilot Retrieval APIs if you don't have a Copilot Tenant.
- You also need to be a SharePoint administrator and should be able to create a SPO site and add a sample document from which you want to retrieve relevant information using the Copilot Retrieval API. Once you upload your document(s), give the API a couple of hours to index so that it can return relevant information. You can upload the document 'Contoso sessions at Microsoft Build Conference 2025.docx' in SharePoint Documents folder to ask it the sample queries listed below.

Expand All @@ -36,7 +36,7 @@ This Agent Sample is intended to introduce you to the Copilot Retrieval API Grou
1. With Credential Free (Keyless):

This is a secure way to authenticate to Azure resources without needing to store credentials in your code. Your Azure user account is assigned the "Cognitive Services OpenAI User" role, which allows you to access the OpenAI resource.
Follow this guide [Role-based access control for Azure resources](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/role-based-access-control) to assign the "Cognitive Services OpenAI User" role to your Azure user account and Managed Identities.
Follow this guide [Role-based access control for Azure resources](https://learn.microsoft.com/azure/ai-services/openai/how-to/role-based-access-control) to assign the "Cognitive Services OpenAI User" role to your Azure user account and Managed Identities.

Then you just need to configure Azure OpenAI Endpoint and DeploymentName in the appsettings.json file

Expand Down Expand Up @@ -129,9 +129,9 @@ If you type a message and hit enter, or the send arrow, you should receive a mes
1. Set the **TenantId** to the Tenant Id where your application is registered.
1. Set the **Audience** to the AppId of the bot identity.

> Storing sensitive values in appsettings is not recommend. Follow [AspNet Configuration](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-9.0) for best practices.
> Storing sensitive values in appsettings is not recommend. Follow [AspNet Configuration](https://learn.microsoft.com/aspnet/core/fundamentals/configuration/?view=aspnetcore-9.0) for best practices.

1. Run `dev tunnels`. Please follow [Create and host a dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) and host the tunnel with anonymous user access command as shown below:
1. Run `dev tunnels`. Please follow [Create and host a dev tunnel](https://learn.microsoft.com/azure/developer/dev-tunnels/get-started?tabs=windows) and host the tunnel with anonymous user access command as shown below:
> NOTE: Go to your project directory and open the `./Properties/launchSettings.json` file. Check the port number and use that port number in the devtunnel command (instead of 3978).

```bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<LangVersion>latest</LangVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
</PropertyGroup>

<ItemGroup>
Expand All @@ -16,7 +18,7 @@
</ItemGroup>

<ItemGroup>
<Using Include="Xunit" />
<ProjectReference Include="..\..\src\Microsoft.Agents.M365Copilot.Beta\Microsoft.Agents.M365Copilot.Beta.csproj" />
</ItemGroup>

</Project>
Loading