Skip to content

Lab MBA4 - Bring your agent to Copilot Chat

In this final lab, you’ll bring your custom engine agent into Copilot Chat by updating the agent's manifest. By enabling copilotAgents in the app manifest, you’ll make your AI-powered assistant available directly inside the Copilot experience.

Exercise 1: Bring your agent to Copilot Chat

Step 1: Update the manifest

Stop debugging

Close the previous debugging session before proceeding with this exercise.

Go to M365Agent/AppPackage/manifest.json, update the manifest schema and version as following:

"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.22/MicrosoftTeams.schema.json",
"manifestVersion": "1.22",

Replace bots section with the following that will also add copilotAgents in the manifest:

This block declares your agent as a custom engine agent for M365 Copilot. It tells Microsoft 365 to expose this agent in Copilot Chat and surface its command list in the conversation UI along with the conversation starters to help users get started quickly.

"bots": [ 
  { 
    "botId": "${{BOT_ID}}", 
    "scopes": [ 
      "personal", 
      "team", 
      "groupChat" 
    ], 
    "supportsFiles": false, 
    "isNotificationOnly": false, 
    "commandLists": [ 
      { 
        "scopes": [ "personal", "team", "groupChat" ], 
        "commands": [ 
          { 
            "title": "Emergency and Mental Health",
            "description": "What’s the difference between Northwind Standard and Health Plus when it comes to emergency and mental health coverage?" 
          }, 
          { 
            "title": "PerksPlus Details", 
            "description": "Can I use PerksPlus to pay for both a rock climbing class and a virtual fitness program?" 
          }, 
          { 
            "title": "Contoso Electronics Values", 
            "description": "What values guide behavior and decision making at Contoso Electronics?" 
          } 
        ] 
      } 
    ] 
  } 
], 
"copilotAgents": { 
  "customEngineAgents": [ 
    { 
      "id": "${{BOT_ID}}", 
      "type": "bot" 
    } 
  ] 
}, 

Hit Start or F5 to start debugging. Microsoft Teams will launch automatically. When Microsoft Teams open in your browser, ignore the app pop-up and select Apps > Manage your apps > Upload an app and then select Upload a custom app. In the File Explorer go to your project folder ...\ContosoHRAgent\M365Agent\appPackage\build select appPackage.local.zip.

The UI of Microsoft Teams when uploading an app, with the "Upload an app" command highlighted.

Your app will pop-up on Teams again, select Add. This time there will be an option to Open with Copilot, select Open with Copilot to test your agent on Copilot.

The UI of Microsoft Teams when the agents gets added, with the "Open with Copilot" command highlighted.

Select your ContosoHRAgentlocal from the list of agents in Copilot Chat. You can select one of the conversation starters to chat with your agent.

The agent hosted inside Microsoft 365 Copilot, showing the conversation starters configured in the application manifest.

Observe that your agent responds back with a similar behavior on Copilot Chat.

The agent hosted in Microsoft 365 Copilot providing the same feedback as the one provided in Microsoft Teams, including evidence of the counter to count the number of interactions with the user.

CONGRATULATIONS!

🎉 Congratulations! You've just built your first Custom Engine Agent using the Microsoft 365 Agents SDK and Azure AI Foundry!

In this lab, you learned how to:

  • Configure an AI agent in Azure AI Foundry using the Agent Playground
  • Upload enterprise documents to ground your agent’s responses
  • Scaffold a bot using the M365 Agents SDK in Visual Studio
  • Add Semantic Kernel and connect to Azure AI Agent Service
  • Integrate your bot with the Azure AI Foundry agent for real-time, grounded reasoning
  • Deploy and test your agent in Microsoft Teams and Copilot Chat

Resources