Skip to content

Commit 8693c2b

Browse files
adileiadileiclaudesinghvikra-micro
authored
Merge reorg/v1 into main (#493)
* Reorganize repo into 9 category folders Restructure 34 top-level folders into 9 categories: - authoring/ — solutions (PnP format) and snippets (topics, adaptive cards) - contact-center/ — engagement hub integrations and playbook templates - extensibility/ — A2A, MCP servers, M365 Agents SDK samples - guides/ — implementation guide and hands-on workshop - infrastructure/ — VNet support ARM templates - sso/ — Entra ID, Okta, and Chat API authentication - testing/ — functional (pytest) and load (JMeter) testing - ui/custom-ui/ — standalone chat frontends (Assistant UI, DirectLine JS, reasoning display) - ui/embed/ — platform embeds (ServiceNow, Power Apps PCF, SharePoint, minimizable widget) - EmployeeSelfServiceAgent/ — Workday/facilities topics (pending deprecation) New samples from upstream: account-contact-lookup, resume-job-finder, directline-js, pcf-canvas-app, servicenow-widget. Solution zips exploded into PnP structure with source code. Unified README format across all folders. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add cross-references to M365 Agents SDK samples Link related samples from microsoft/Agents repo in: - extensibility/agents-sdk/ (copilotstudio-client, copilotstudio-skill, multiagent) - ui/custom-ui/ (copilotstudio-webchat-react, copilotstudio-webclient) - sso/ (obo-authorization) - contact-center/ (GenesysHandoff) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add Just the Docs site with search, nav, and GitHub Pages deployment - Jekyll infrastructure: Gemfile, _config.yml, GitHub Actions workflow - Front matter on all ~80 README.md files for 3-level sidebar navigation - Client-side search via lunr.js (321 indexed entries) - Callout config (note/tip/important/warning/caution) replacing GitHub alert syntax - "Browse source on GitHub" button at top of each page - Copilot Studio logo and favicon - Normalized README casing, fixed internal links, Liquid escaping - Exclude patterns for source code, binaries, and build artifacts - Reorganized Contact Center nav (flat: Skill Handoff, Salesforce, ServiceNow) - Moved engagement playbook to Guides - Cross-reference tables (SSO page links to UI samples with auth) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add external sample pages, deprecation labels, and contributor instructions - External nav pages: Genesys Handoff, Copilot Studio Client/Skill, Multi-Agent, WebChat React, Web Client - Custom "View sample in M365 Agents SDK repo" button for external pages - Deprecated labels on Chat API, Multilingual Bot, Relay Bot - Contributor instructions in CLAUDE.md and .github/copilot-instructions.md - Flattened Contact Center nav, moved Engagement Playbook to Guides Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Remove chat-api sample, add MIGRATION.md with old/new location mapping Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix MIGRATION.md owners to original contributors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Remove engagement playbook (outdated PVA content) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix owners for Multilingual Bot, Search Species, Pytest Agents SDK Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Point site at microsoft.github.io, trigger workflow on main - _config.yml: url → microsoft.github.io, all links → microsoft/CopilotStudioSamples - pages.yml: trigger on main instead of reorg/v1 - Updated CLAUDE.md, copilot-instructions.md, MIGRATION.md references Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix internal links pointing to old folder locations - SharePoint Customizer: use relative links instead of absolute GitHub URLs - Workshop/Proctor: update blob paths from CopilotStudioWorkshop/ to guides/workshop/ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add Order Management with Enhanced Task Completion sample (#1) (#492) * Add samples browser link to resources table (#474) * Fix SharePoint customizer and contact center folder structure (#476) SharePoint: Replace deprecated SharePointSSOComponent with modern SharePointSSOAppCustomizer at root level (was nested as subfolder). Contact center: Move Salesforce and skill-handoff samples out of servicenow/ into their own top-level folders. Flatten double-nested ServiceNow/ServiceNow/ structure. * Fix RelayBot: Upgrade .Net target and Remove Obsolete BotFramework Adapter. (#475) * Upgrade .Net target and Remove Obsolete BotFramework Adapter. * update newtonsoft version * add missing tenant property in appsettings.json * upgrade the program file with top level statements. * update README.md for .net 10 * Update deprecated notice: clarify archived Bot Framework SDK, fix Copilot Studio naming --------- * Add dynamic MCP routing sample Demonstrates a Power Platform connector that routes MCP Streamable HTTP traffic to one of several MCP server instances selected via dropdown. Includes: - Multi-instance MCP server with path-based routing - Catalog REST server for instance discovery - Connector with x-ms-agentic-protocol and script.csx URL rewriter - One-step deploy scripts for bash and PowerShell * Use Mermaid diagram and fix Copilot Studio instructions * Fix Copilot Studio configuration instructions (#481) * Improve deploy script: colored output, name conflict handling, fixed paths (#482) - Numbered steps with colored status indicators - Server logs redirected to /tmp/ for clean output - Auto-retry with random suffix on connector name conflict - Fix paths for sample directory structure (connector/ not mcp-connector/) - Use built JS instead of ts-node - Require environment ID as argument (no hardcoded default) * Enable Mermaid diagram rendering in Jekyll site (#483) Just the Docs theme supports Mermaid natively via config. This enables ```mermaid code blocks to render as diagrams. * Add ESS team as codeowners for EmployeeSelfServiceAgent (#490) The @microsoft/ess-contributors team can now review and approve PRs that only touch EmployeeSelfServiceAgent/ without requiring repo maintainer review. * Add Eval Gate for Azure DevOps sample (#491) Copilot Studio Evaluation API as a CI/CD quality gate in Azure DevOps. Pipeline automatically runs evals on PR push, blocks merge if pass rate is below a configurable threshold, and publishes results to the ADO Tests tab. - eval-gate.mjs: standalone Node.js script (MSAL auth + PPAPI client) - eval-gate.yml: ADO pipeline (self-hosted + hosted agent options) - eval-config.json: environment config with pass threshold - Screenshots: passing gate, failing gate, pipeline logs, tests tab * Add Order Management MCP Demo with Enhanced Task Completion End-to-end sample demonstrating Copilot Studio agents with Enhanced Task Completion calling MCP servers for e-commerce order management and warehouse fulfillment, with a Gradio chat UI that renders tool calls and reasoning inline. Includes: - Two Node.js MCP servers (order-management: 5 tools, warehouse: 4 tools) - Power Platform connector definitions for both MCP servers - Exported solution with both agents (Orders Agent + Warehouse Agent) - Unpacked solution source for git-friendly review - Gradio chat frontend with inline tool rendering, file upload/download - Cross-platform scripts for setup, deployment, and connector management - Demo CSV for file upload scenario * Fix missing aiohttp dependency in chat-ui requirements The microsoft-agents-copilotstudio-client package requires aiohttp but doesn't declare it as a dependency. * Auto-deploy connectors on start, add demo screenshot - start.mjs now accepts --env flag to auto-deploy connectors after tunnels are ready (tries update first, falls back to create) - Updated README quick start to reflect single-command workflow - Added Gradio UI demo screenshot to assets * Simplify deployment: update connector hosts via Custom Connectors UI - Removed paconn dependency and auto-deploy logic from start.mjs - Updated README step 4: users edit connector Host field in Power Apps UI - Simplified start.mjs to just start servers + tunnels - Tested end-to-end: solution import → connector update → Gradio UI → tool calls succeed * Fix code review issues: token cache, debug logging, gitignore - Fix LocalTokenCache to use MSAL's serialize()/deserialize() API instead of directly accessing _cache dict (prevents token corruption) - Remove leftover debug request/response interception from warehouse server - Add .gitignore files for chat-ui (secrets, venv) and MCP servers (node_modules, dist) * Add app registration setup instructions to IMPORT.md Step-by-step guide for creating the Entra ID app registration needed by the Gradio chat UI's MSAL authentication. * Replace ASCII architecture diagram with Mermaid * Add Enhanced Task Completion context and experimental warning to README Links to official Microsoft docs, explains what ETC is and how it differs from standard generative orchestration, adds JTD warning callout. * Fix IMPORT.md: add Jekyll front matter, update instructions - Add Jekyll front matter so IMPORT.md renders as HTML (not raw markdown) - Update import steps to match actual workflow (single solution zip) - Fix README link to use stripped .md extension per Jekyll convention - Add screenshot reference to README * Polish Gradio UI design, restructure README and docs - Redesign chat UI: dark header with teal ETC badge, Plus Jakarta Sans font, green-bordered tool accordions, refined message bubbles and markdown rendering - Restructure README: rewrite What's Included as logical components (agents, MCP servers, chat UI, connectors), move architecture diagram to bottom, inline sample queries after Quick Start step 5 - Split IMPORT.md: move .env config and app registration to new SETUP.md, keep IMPORT.md focused on solution import + connections - Fix IMPORT.md step numbering and add note about clean environment connection creation - Update README step 2 to clarify connections must be created separately - Update screenshot showing tool calls and reasoning in action --------- Co-authored-by: adilei <adileibowiz@microsoft.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Vikram Singh <singhvikra@microsoft.com> --------- Co-authored-by: adilei <adileibowiz@microsoft.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Vikram Singh <singhvikra@microsoft.com>
1 parent 0a1ef49 commit 8693c2b

116 files changed

Lines changed: 3921 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
---
2+
title: Order Management with Enhanced Task Completion
3+
parent: MCP
4+
grand_parent: Extensibility
5+
nav_order: 3
6+
---
7+
8+
# Order Management with Enhanced Task Completion
9+
10+
{: .warning }
11+
> **Experimental feature.** Enhanced Task Completion is an experimental capability in Copilot Studio. See the [official documentation](https://github.com/microsoft/Agents/blob/main/docs/enhanced-task-completion.md) for current status and limitations.
12+
13+
An end-to-end sample demonstrating Copilot Studio agents with [**Enhanced Task Completion**](https://github.com/microsoft/Agents/blob/main/docs/enhanced-task-completion.md) calling MCP servers for e-commerce order management and warehouse fulfillment, with a **Gradio chat UI** that renders tool calls, reasoning, and file attachments inline.
14+
15+
## What is Enhanced Task Completion?
16+
17+
Enhanced Task Completion shifts Copilot Studio from a "plan-then-execute" model to an adaptive, conversational approach. Instead of selecting all tools upfront, the agent:
18+
19+
- **Reasons before acting** — asks clarifying questions and gathers context before calling tools
20+
- **Orchestrates tools dynamically** — recognizes dependencies between tool outputs, parallelizes independent calls, and adjusts strategy based on intermediate results
21+
- **Interleaves conversation and actions** — fluidly mixes questions, tool calls, and responses across multiple turns
22+
- **Recovers from failures** — retries or finds alternative approaches when tool calls fail
23+
24+
This sample demonstrates all of these capabilities through a realistic e-commerce customer service scenario where the agent chains 9 tools across two MCP servers and a connected agent to answer complex multi-part questions.
25+
26+
![Gradio Chat UI](./assets/gradio-ui.png)
27+
28+
## What's Included
29+
30+
### Orders Agent (Copilot Studio)
31+
32+
The primary agent with Enhanced Task Completion enabled. Handles customer inquiries by dynamically chaining tools from the Order Management MCP server. When a question involves inventory or fulfillment, it delegates to the Warehouse Agent as a connected agent.
33+
34+
### Warehouse Agent (Copilot Studio)
35+
36+
A connected agent invoked by the Orders Agent for warehouse and fulfillment queries. Calls tools from the Warehouse MCP server to check stock levels, track fulfillment pipeline stages, find alternative products, and look up restock dates.
37+
38+
### Order Management MCP Server (5 tools)
39+
40+
Node.js [Streamable HTTP](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http) server with interdependent tools for e-commerce order operations:
41+
42+
| Tool | Input | Purpose |
43+
|---|---|---|
44+
| `search_orders` | Customer name/email/order# | Entry point — find orders |
45+
| `get_order` | order_id | Full order details + line items |
46+
| `get_shipment` | order_id | Tracking info (shipped/delivered only) |
47+
| `request_return` | order_id, item_skus[], reason | Initiate a return |
48+
| `get_return_status` | return_id | Check return progress |
49+
50+
### Warehouse MCP Server (4 tools)
51+
52+
Node.js Streamable HTTP server with interdependent tools for warehouse and fulfillment:
53+
54+
| Tool | Input | Purpose |
55+
|---|---|---|
56+
| `check_stock` | SKU | Inventory levels + warehouse location |
57+
| `get_fulfillment_status` | order_id | Pipeline stage (received → shipped) |
58+
| `find_alternatives` | SKU | Similar products in stock |
59+
| `get_restock_date` | SKU | Next inbound shipment date |
60+
61+
### Gradio Chat UI
62+
63+
Python frontend that connects to the Orders Agent via the [Microsoft Agents SDK](https://github.com/microsoft/Agents-for-python) and renders the full Enhanced Task Completion activity protocol inline:
64+
65+
- **Reasoning steps** — agent thinking displayed as collapsible accordions
66+
- **Tool calls** — grouped with parameters, duration, and results
67+
- **Intermediate messages** — agent narration between tool call batches
68+
- **File upload/download** — CSV/text files sent as base64 attachments, agent-generated files offered for download
69+
- **MSAL auth** — interactive login with persisted token cache (sign in once)
70+
71+
### Custom Connectors
72+
73+
Power Platform connector definitions (Swagger + apiProperties) that expose each MCP server as an action in Copilot Studio. The connectors use the `x-ms-agentic-protocol: mcp-streamable-1.0` extension to enable native MCP tool discovery.
74+
75+
## Prerequisites
76+
77+
- Node.js 18+
78+
- Python 3.12+
79+
- [Dev Tunnels CLI](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started) (`devtunnel`)
80+
- A Power Platform environment with Copilot Studio
81+
- An Entra ID app registration with `CopilotStudio.Copilots.Invoke` permission
82+
83+
## Quick Start
84+
85+
### 1. Install dependencies
86+
87+
```bash
88+
node scripts/setup.mjs
89+
```
90+
91+
### 2. Import agents (first time only)
92+
93+
Import `agents/solution/OrderManagementMCPDemo.zip` into your environment via **make.powerapps.com > Solutions > Import**. After import, create connections for each MCP connector from the **Custom connectors** page (no auth — just click **Create**). See [Importing the Agent Solutions](./agents/IMPORT) for details.
94+
95+
### 3. Start MCP servers + tunnels
96+
97+
```bash
98+
node scripts/start.mjs
99+
```
100+
101+
This starts both MCP servers and creates anonymous dev tunnels. Note the tunnel URLs printed:
102+
103+
```
104+
Order Management MCP endpoint: https://xxxxx-3000.uks1.devtunnels.ms/mcp
105+
Warehouse MCP endpoint: https://xxxxx-3001.uks1.devtunnels.ms/mcp
106+
```
107+
108+
### 4. Update connector URLs
109+
110+
Each time you restart (tunnels get new URLs), update the custom connector hosts:
111+
112+
1. Go to **make.powerapps.com** > **Custom connectors**
113+
2. Find **"orders mcp"** > click **Edit** > update the **Host** field with the order tunnel host (e.g., `xxxxx-3000.uks1.devtunnels.ms`) > click **Update connector**
114+
3. Find **"warehouse server 3"** > click **Edit** > update the **Host** field with the warehouse tunnel host (e.g., `xxxxx-3001.uks1.devtunnels.ms`) > click **Update connector**
115+
116+
No need to republish the agents — the connectors are referenced dynamically.
117+
118+
### 5. Start the chat UI
119+
120+
Configure the `.env` file with your agent details (requires an Entra ID App Registration). See [Chat UI Setup](./SETUP) for step-by-step instructions.
121+
122+
```bash
123+
cp chat-ui/.env.sample chat-ui/.env
124+
# Edit chat-ui/.env — see SETUP.md for details
125+
node scripts/start-ui.mjs
126+
```
127+
128+
Open http://localhost:7860 and try one of these:
129+
130+
**Basic order lookup:**
131+
> Hi, I'm Sarah Mitchell. I ordered some Sony headphones recently but they arrived with a crackling sound in the left ear. I'd like to return them.
132+
133+
**Cross-server (orders + warehouse):**
134+
> I'm James Rivera. My Nintendo Switch order hasn't shipped yet. When can I expect it? If it's not available, what are my options?
135+
136+
**File upload — populate a CSV:**
137+
> Upload `chat-ui/data/demo-orders.csv` and ask: "Fill in all the empty columns for each order and return the completed CSV."
138+
139+
## Architecture
140+
141+
```mermaid
142+
graph TB
143+
User([fa:fa-user User]) -->|chat| GradioUI
144+
145+
subgraph Local Machine
146+
GradioUI["Gradio Chat UI<br/>Port 7860<br/><i>Reasoning, tool calls,<br/>file upload/download</i>"]
147+
OrderMCP["Order Management<br/>MCP Server<br/><b>5 tools</b> · Port 3000"]
148+
WarehouseMCP["Warehouse<br/>MCP Server<br/><b>4 tools</b> · Port 3001"]
149+
end
150+
151+
subgraph Copilot Studio
152+
OrdersAgent["Orders Agent<br/><i>Enhanced Task Completion</i>"]
153+
WarehouseAgent["Warehouse Agent<br/><i>connected agent</i>"]
154+
OrdersAgent -->|invokes| WarehouseAgent
155+
end
156+
157+
GradioUI -->|"Agents SDK<br/>(streaming)"| OrdersAgent
158+
OrdersAgent -->|"MCP Action<br/>(via connector)"| OrderMCP
159+
WarehouseAgent -->|"MCP Action<br/>(via connector)"| WarehouseMCP
160+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Chat UI Setup
3+
parent: Order Management with Enhanced Task Completion
4+
grand_parent: MCP
5+
nav_exclude: true
6+
---
7+
8+
# Chat UI Setup
9+
10+
The Gradio chat UI authenticates against Copilot Studio using MSAL interactive login. You need an Entra ID App Registration and a `.env` file with your agent details.
11+
12+
## App Registration
13+
14+
1. Go to **portal.azure.com** > **App registrations** > **New registration**
15+
2. Name: e.g., "MCP Demo Chat Client"
16+
3. Supported account types: **Single tenant**
17+
4. Redirect URI: **Public client/native** > `http://localhost`
18+
5. After creation, go to **API permissions** > **Add a permission** > **APIs my organization uses**
19+
6. Search for **CopilotStudio** > select **CopilotStudio.Copilots.Invoke** (delegated)
20+
7. Click **Grant admin consent**
21+
8. Copy the **Application (client) ID** — this is your `AGENTAPPID` below
22+
23+
## Configure `.env`
24+
25+
Copy `chat-ui/.env.sample` to `chat-ui/.env` and fill in:
26+
27+
```env
28+
COPILOTSTUDIOAGENT__ENVIRONMENTID=<your-environment-id>
29+
COPILOTSTUDIOAGENT__SCHEMANAME=<agent-schema-name>
30+
COPILOTSTUDIOAGENT__TENANTID=<your-tenant-id>
31+
COPILOTSTUDIOAGENT__AGENTAPPID=<app-registration-client-id>
32+
```
33+
34+
| Variable | Where to find it |
35+
|---|---|
36+
| `ENVIRONMENTID` | The GUID in your Power Platform URL, or **Settings** > **Session details** in Copilot Studio |
37+
| `SCHEMANAME` | Copilot Studio > open the Orders Agent > **Settings** > **Advanced** > **Schema name** |
38+
| `TENANTID` | Your Entra ID tenant ID (Azure Portal > **Microsoft Entra ID** > **Overview**) |
39+
| `AGENTAPPID` | The Application (client) ID from the App Registration above |
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Importing the Agent Solutions
3+
parent: Order Management with Enhanced Task Completion
4+
grand_parent: MCP
5+
nav_exclude: true
6+
---
7+
8+
# Importing the Agent Solutions
9+
10+
## Prerequisites
11+
12+
- A Power Platform environment with Copilot Studio
13+
- Admin or Maker role in the target environment
14+
15+
## Steps
16+
17+
### 1. Import the solution
18+
19+
The solution zip contains both agents, their custom connectors, and connection references — all in one package.
20+
21+
1. Go to [make.powerapps.com](https://make.powerapps.com)
22+
2. Select your target environment
23+
3. Navigate to **Solutions** > **Import solution**
24+
4. Upload `solution/OrderManagementMCPDemo.zip`
25+
5. Click **Next** through the details page
26+
6. If the import wizard shows a **Connections** page, click **New connection** for each connector (no auth needed — just click **Create**), then select the connections you just created
27+
7. Click **Import**
28+
29+
### 2. Create connections
30+
31+
After import, go to **Custom connectors** in the left nav. For each MCP connector (**orders mcp** and **warehouse server 3**), click **Create connection**. The MCP connectors have no authentication — just click **Create** with no credentials.
32+
33+
{: .note }
34+
> In a clean environment the import wizard may skip the Connections step entirely. Creating connections from the Custom connectors page ensures the agents can reach the MCP servers.
35+
36+
### 3. Publish agents
37+
38+
In Copilot Studio, open each agent and click **Publish** to make the latest version live.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<botcomponent_connectionreferenceset>
2+
<botcomponent_connectionreference botcomponentid.schemaname="cr26e_OrdersAgent.topic.ordersmcp" connectionreferenceid.connectionreferencelogicalname="cr26e_OrdersAgent.shared_new-5forders-20mcp-5fee08b8354fad177a.6be7a421f5184b9ebb376965cf6cd8b8">
3+
<iscustomizable>1</iscustomizable>
4+
</botcomponent_connectionreference>
5+
<botcomponent_connectionreference botcomponentid.schemaname="cr26e_Warehouseagent.topic.warehouseserver3" connectionreferenceid.connectionreferencelogicalname="cr26e_Warehouseagent.shared_new-5fwarehouse-20server-203-5fee08b8354fad177a.726ca1c1522e492082b8e68667e2267e">
6+
<iscustomizable>1</iscustomizable>
7+
</botcomponent_connectionreference>
8+
</botcomponent_connectionreferenceset>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
2.83 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"swagger":"2.0","info":{"title":"orders mcp","description":"my orders mcp server connector","version":"1.0.0"},"host":"x1kv1q93-3000.uks1.devtunnels.ms","basePath":"/","schemes":["https"],"paths":{"/mcp":{"post":{"responses":{"200":{"description":"Immediate Response"}},"x-ms-agentic-protocol":"mcp-streamable-1.0","operationId":"InvokeServer","summary":"orders mcp","description":"my orders mcp server connector"}}},"securityDefinitions":{},"security":[]}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)