Adding Copilot Studio Client API and SPA Sample#59
Draft
svandenhoven wants to merge 12 commits intomicrosoft:mainfrom
Draft
Adding Copilot Studio Client API and SPA Sample#59svandenhoven wants to merge 12 commits intomicrosoft:mainfrom
svandenhoven wants to merge 12 commits intomicrosoft:mainfrom
Conversation
…hoven/Agents-for-net into sandervd/webclientsample
MattB-msft
reviewed
Jan 23, 2025
Member
|
Setting this to draft for the moment.. |
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.
Description
The Copilot Studio Client API and SPA Sample is an example application that demonstrates how a user can log in with their Entra ID account on a Single Page Application (SPA) built with React. This application utilizes a .NET API that leverages the Microsoft 365 Agents SDK. Through this setup, the API can interact with any Copilot Studio Agent, enabling the creation of conversations that can be accessed via a React SPA.
Architecture
graph TD A[React SPA] -->|1 Login| F[Entra ID] F -->|2 Access Token| A A -->|3 API Request with Access Token| B[Custom API] B -->|4 Request Access Token on behalf of user| F F -->|5 Access Token| B B -->|6 API Request with Access Token| C[CopilotStudio API] C -->|13 API Response| B B -->|14 API Response| A C -->|7 Call Agent| G[Copilot Agent] G -->|12 Agent Response| C G -.->|8 Query| D[Search Index] D -.->|9 Response| G G -.->|10 Query| E[OpenAI] E -.->|11 Response| G subgraph Optional Components direction TB D[Search Index] E[OpenAI] endTo Test
See in the README.md in folder "copilot_studio_client_api_and_spa" how to configure the sample to test it.
Changes
This pull request introduces a new sample API project,
CopilotStudioClientSampleAPI, which integrates with Microsoft Copilot Studio. The changes include adding new package dependencies, updating the solution file, and implementing the API's functionality.New Sample API Project:
Project Setup and Dependencies:
Directory.Packages.propsforMicrosoft.AspNetCore.Authentication.OpenIdConnect,Microsoft.Identity.Web,Microsoft.Identity.Web.DownstreamApi, andSwashbuckle.AspNetCore.CopilotStudioClientSampleAPI.csprojwith references to necessary packages and project dependencies.dotnet-tools.jsonto manage .NET tools for the project.Solution Configuration:
Microsoft.Agents.SDK.slnto include the newCopilotStudioClientSampleAPIproject. [1] [2] [3]API Implementation:
Chatcontroller inControllers/Chat.csto handle chat interactions with Copilot Studio.Conversation,ChatResponse,MessageRequest, andContentinModels/ChatResponse.csto structure API responses and requests.Program.csto set up services, authentication, and CORS policy.Documentation and Configuration:
README.mdfile outlining the project architecture, setup instructions, and configuration details.CopilotStudioClientSampleAPI.httpfor testing the API endpoints.