This Copilot Agent ANSWERS Your EMAILS! Build it in Microsoft Copilot Studio By a Microsoft Engineer

Brief Summary

This video provides a comprehensive guide on building an autonomous AI agent using Microsoft Copilot Studio. The AI agent, named Inbot, automates the process of monitoring Outlook inboxes and responding to emails. The video covers everything from demonstrating its capabilities to step-by-step instructions on how to create, configure, and test the agent effectively.

  • Introduction to Inbot and its capabilities
  • Step-by-step guide on creating the agent
  • Tips on troubleshooting and fine-tuning

Intro

The video starts with an introduction to Inbot, an autonomous AI agent designed to monitor Outlook inboxes and automatically respond to queries. The host emphasizes that building this agent requires no coding and can save significant time in handling emails.

Demo of the Autonomous AI Agent

A demonstration showcases Inbot's functionality, highlighting how it can respond to various emails by using specified knowledge sources. The agent can be customized to adapt to specific preferences regarding tone and response format. Viewers are informed that the ease of building the agent allows them to learn about autonomous AI while personalizing it.

Requirements to Build the Autonomous AI Agent

To build Inbot, users need access to Microsoft Copilot Studio, preferably through a work or education account. The host provides methods to obtain a free trial for those without immediate access. Understanding the requirements is crucial for proceeding with the build.

Building the Autonomous AI Agent

The process of creating Inbot in Copilot Studio involves logging in and selecting templates or starting from scratch. Users must name the agent and provide detailed instructions on how it should respond to incoming emails based on knowledge sources. The emphasis is on customizing settings to ensure it meets specific needs.

Adding Knowledge Source to the Agent

In this chapter, the focus is on selecting and adding various knowledge sources, including public websites and SharePoint sites, to the agent. The host demonstrates how to input specific resources that Inbot will reference for accurate information related to potential email queries.

Adding the Action for the Agent

The next step involves defining actions that the agent will perform, specifically sending emails as replies. The host shows how to set up the necessary connectivity and permissions for the Office 365 Outlook send email action. Users are made aware of potential connectivity issues.

Adding the Trigger for the Agent

Here, the setup of triggers that initiate the agent upon receiving new emails is explained. Users learn how to create specific triggers for incoming emails to ensure Inbot activates under the desired circumstances, enhancing its functionality.

Fixing Gotcha #1

The host addresses a common issue where actions may appear unconnected during testing. A step-by-step resolution guide is provided, detailing how to manage connections and ensure the agent operates smoothly during tests.

Publishing the Agent

After completing the setup, users learn the importance of publishing the agent to finalize its build. The host shares cautionary notes regarding sharing published agents, particularly concerning security credentials.

Creating an Outlook Rule (to avoid a loop)

The tutorial describes how to create an Outlook rule to prevent response loops when Inbot replies to emails. This step ensures that emails handled by Inbot do not cause it to respond to its own replies, mitigating potential conflicts.

First Time Running the Agent (and fixing a common issue)

In the first run of the agent, a test email is sent with multiple queries to observe how Inbot initializes its responses. The host describes the results, highlighting the functioning of the knowledge sources and addressing an issue encountered during the test.

Second Time Running Agent (Success!)

The second run of Inbot demonstrates successful execution after fixing prior issues. The host provides details of the responses Inbot generated, showcasing its ability to retrieve and relay accurate information from its sources.

Further Testing the Agent

The video emphasizes the importance of continuous testing to ensure the agent works properly. Viewers are encouraged to experiment with the triggers and responses to enhance Inbot's performance and tailor it to personal preferences.

Fine Tuning the Agent

In this section, the video discusses several methods to fine-tune Inbot, including limiting triggers to specific senders and adjusting knowledge access settings. Emphasis is placed on saving and publishing changes made during this fine-tuning process.

Experimenting with Deep Reasoning

The final segment introduces deep reasoning capabilities in the AI agent as a preview feature. The host explains how to enable deep reasoning and modify instructions to utilize this advanced functionality effectively, encouraging experimentation with different configurations to optimize performance.

Summarize any YouTube video in seconds

Get summaries like this one for any video, in your language, with the free Summ app.

Download on the App Store
Get it on Google Play

Transcript

Full transcript of “This Copilot Agent ANSWERS Your EMAILS! Build it in Microsoft Copilot Studio By a Microsoft Engineer”. Click a timestamp to open the video at that moment. Need another video? Use the YouTube transcript generator.

0:00 Today, we're using Microsoft Copilot Studio to build an autonomous AI agent that monitors your Outlook inbox and answers all the questions that you receive automatically. It's easy to build and requires no coding, and it will save you hours of tedious email work every day. Say hello to this little guy, Inbot, and goodbye to emails as you know them. This video is broken up into three sections. First, we're going to do a demo of what the agent can do. Then, I'm going to share with you the tools that you need to build it. And third, we're going to build it step by step in Copilot Studio. Welcome to Collaboration Simplified. My name is Shervin Chaffy and I work at Microsoft as a co-pilot principal technical specialist. During the day, I

0:46 work with Fortune 500 customers to build solutions like this. And I'm super excited to be able to share this with all of you today. [Music] Heat. Heat.

1:33 N. Pretty cool, huh? This agent can be a gamecher. And I'm surprised it's actually not a product, but that's okay because you can build it fairly easily. And the benefit is that you get to customize it the way you like, and you get to learn all about autonomous AI agents along the way. You can tell it how to respond, what tone to use, to be brief or detailed, what specific knowledge sources to use, to use your

2:18 secret stash of useful documents, SharePoint sites, or your go-to websites. You can also select when it's triggered for every email, or just select individuals. And by keeping it yours, you avoid any possible security issues. And as your job changes, you can edit the agents instructions or document sources to align with your new role. Okay, getting started with the requirements. First thing is you need Microsoft Copilot Studio. And some of you might have it. For those of you that don't, just search for Microsoft Copilot Studio. And I wanted to show you that you can basically get a free trial. So anyone that doesn't have it out there, go ahead and search for it. Click on free trial and basically get yourself an

3:05 account because this is a requirement for us to build this agent. And one of the things that you have to notice here is it says that you have to enter your work or your school email address. So if you have a personal account, you can't log into Copilot Studio. But here's another workaround. search for Microsoft Teams trial and we do actually have free trials for business and that's the type of account that you need right work or education. So I'm showing you basically a workaround is if you don't have a business account or business plan you can get a free trial and then you can use that to log into your free trial of Copilot Studio just so that you can get

3:50 started. So, this is a workaround for those of you who don't have access. For those of you that have access, fantastic. Go ahead and go for it, but there's a lot of people out there that want to get involved, but they don't have the tools. This is how you get them. Now, moving on to act the actual build. If you're enjoying this content so far, make sure to hit that like button and drop a comment as it really does help the channel. Thank you as always for your support. So, here we are in Copilot Studio. Just go to copilotstudio.microsoft.com. Log in. I've logged in here as Elon Musk because we're building this bot for him. Basically on the left hand side you can see this menu options of Copilot Studio. If you've never seen it, create agents

4:38 flows is new, but we're basically in the home tab. And because it's our first time creating an agent with Elon, then you can just create it from this homepage. When you select create an agent, you see all these different templates, which is Microsoft's way of helping you get started with different top-of- mind ways of creating agents. But I'm going to select new agent. When I select new agent, I can start to use natural language just to explain by typing what I want this agent to do. Or on the top right hand side, I can skip to configure where I have some elements or I can just create. I'm going to go ahead and just create this completely blank agent because we want to do more advanced things which are only available

5:24 when you create. Now that we've done that, if you notice on the top there are all these different menu items like knowledge and topics and actions. A lot of these we're going to cover, but right now we're just in the overview. And on the right hand side here, we're going to select edit. And this allows us to start configuring the agent. We we're gonna start off with the name, right? We're calling this the Inbot. And we're also going to change the icon to give it that little cute Inbot logo that I have. And I'm going to select this image. Save it. We got the name. We've got the image. And looks like it took everything just fine. So, we're good there. Next, we're going to move on to we're going to select edit again because it just saved

6:11 it. You have to select edit to edit the rest of these items like description. This is the the purpose of the agent and how it can help. So, we're going to put in this description which is basically it's an autonomous agent that helps with incoming emails in my inbox and it looks through all the questions, researches them against trusted knowledge sources, which we're going to specify a little later on. So, we got the description. Now, this is the big thing, right? This is the substance of it. the instructions of what this agent is going to do. When a unique email comes into my inbox, use the knowledge sources to research the questions that are in the email. Do not use knowledge sources other than the ones specified. Use this action to reply

6:56 only to me with detailed responses based on your research. format in HTML and professional manner and write it as if you were replying to the original email sender and send it to me immediately. So the way this is going to work is that the email is going to look like it's coming from me to me because the agent is acting on my behalf and sending it to me. I am designing it this way because I want to basically check the email versus having it be sent directly to the person who was sending it to me. That would be the future where you have full trust in how this autonomous agent works and it'll just send it straight off. But in this beginning stage, I just want to have the agent send it to me so I can

7:42 review and then I can send it on to the person who sent me the original email. That's why we're doing it this way. For each question, start with a new paragraph with and write a detailed response. Start by bolding a summary of the question and follow with the answer that you found. Then include a link to the source because I want to have references. The more verbose, detail, factual, and illustrative, the better. These are my instructions. You can say reply in a funny way, be brief, use bullets, create a table, whatever instructions you want to provide, you do. So, if you don't find the answer to the questions in the email in the knowledge sources, don't answer them. But do let me know which questions are unanswered. And at the bottom of the

8:28 email, let me know some good questions to ask the original email sender in order to discover more about their interest. Sign off your emails with regards followed by my name. All right. So, these are all the instructions that I've given it. So, if everything looks good here, you want to make sure that you go to the top right and you click save. You don't want to lose all your progress. So, make sure you click save. I think we're good. We're making good progress so far. And you can see when you save, it says processing your request. And then it says your request has been successfully completed. Golden. Let's keep going. Now, I do also want to point out that here it says orchestration. Use Genai to determine how to best respond to events. And I'm just going to enable

9:16 this. It's disabled. It's best if it's enabled. Adding the knowledge portion for the agent. Now we're at this stage. So if we scroll down and we go to the knowledge section, this is where we tell it all the different knowledge sources to use, right? Documents, SharePoint sites and so on. So select add knowledge on the top right hand side here. This opens up another window where you can use public websites, SharePoint sites, data versse. Now, because we're doing this for Elon and his company is Tesla, we're basically going to use a Tesla site because on the Tesla site, it has information about different models, their ranges, top speed, 0 to 60, all kinds of stuff that's not in other

10:01 places, but it's only on their website. And additionally, when you go under vehicles, there's information there about tradein, about the semi, so road map stuff. And so if somebody asks questions that are not in documents um then we go to the website. So basically we put the link in and the description is actually quite important because the agent goes by the description in terms of when to use this knowledge source. So we updated the description and now we're going to add it. So we're good. But remember always update the description and we're going to add more knowledge sources. So again, we're going to select the plus add. And now we're going to select a SharePoint

10:46 site to add. Now, Elon has a SharePoint site that talks about why customer service is new marketing, secret to how Elon juggles so many things. Hint hint, it's the Inbot. And in this SharePoint site, there's a document repository about all the different model EVs that he has. Now you can also access this by going on the top right hand side to this wheel the cog icon and then select site contents. This is all done in SharePoint right when you go to site contents there's different folders and there's a car manuals folder here with all the different car models that he has and the user manual. So here's the one for the Cybert truck and you can see that it's 315 pages. It talks about storage area

11:34 and autopilot and connectivity and driving. All the stuff that typical car manuals have. So, I'm going to go ahead and add this SharePoint site. I'm going to select browse. And if it doesn't come up, which is not coming up right away from picking your items on the bottom left, you select more places. And if Elon has access to this SharePoint site, which he does, then it shows up. So here's the Tesla SharePoint site along with all the folders. So we're going to select car manuals and then inside the car manuals we're going to select all the different files so that we can add them as knowledge sources. So those are all the same files that you saw in the SharePoint site that the agent now has access to. Now before we select add

12:23 again the description for each knowledge source is key. Here I'm putting a relatively generic description for all of them. Like this is the car manual for Cybert truck for Model 3 and so on. But the more verbose you are with the description, the better because if you have multiple knowledge sources, then the agent knows which one to use first and second and third and so on, right? So this is key. I I can't overemphasize that because if you're having issues with the knowledge sources that the agent is selecting, go back to your descriptions and be more more accurate and verbose in those. So now that we have all those, I'm going to go ahead and select add. And now we're adding a SharePoint site. We added a website. Now we're adding a SharePoint site. What

13:10 else can we do here? So if we select plus add for knowledge and we're going to add another source which are basically documents that we drag and drop, right? Just files that maybe are are on our local folder. So I have a bunch of earnings reports from uh fiscal year 2024 that are PDF files that basically have sections about forward-looking statements or outlook. And I want to put that in there because in this email that I sent, I want to test out if it can go ahead and retrieve this information from here. So again, it doesn't have to just be files on your one drive, but they can just be files on your local hard drive that you upload. So we're going to select click browse,

13:57 select all these files, and then just select open so we can add them. Again, same thing, right? The descriptions is key. So before I select add, I'm going to go ahead and put some information about the description. For the sake of making it brief in this video, I'm putting um rather short descriptions, but again be as verbose as possible. So we're going to put all the descriptions in here. And when this looks good, then on the bottom right, we're going to select add and then add these knowledge sources to the agent. So we have three types, right? websites, SharePoint sites, and documents that we've uploaded. And you can select see all to look at all of these. And you can see that the PDFs are actually in

14:43 progress, but pretty soon they'll be uploaded and be ready for use by the agent as well. Now, going back to the overview, now we're going to add the agent action, which is sending an email. So, if we scroll down here, you'll see that it says Office 365 Outlook send an email v2 in the description. We're referencing the action in the description, which is key. So, in the action section, when we select add an action, we're going to have to search for that specific action, which is the Office 365 send an email. And when we type that in the search, if you look on the top right hand side, it's right there. send an email v2. That's the one we want. So, we're going

15:30 to select it. And from here, another sticking point usually is the connectivity. This is going to actually log in as you uh on the permissions. And if you get this green check box, then you're golden. And if you don't, then you have an issue. So, you saw I was logged in as Elon. And here in terms of everything else, I'm doing nothing, leaving it all as default. So hopefully you shouldn't have any issues because I'm not making any changes. It's all default. So we're going to add that action. With that action added, the next step is adding the trigger, which is looking for incoming emails as an event. So right below actions is triggers. And here we're going to go ahead and do the

16:15 plus add trigger. And in this featured section, you can see there's 11 triggers. But if you select all on the top left hand side, you can see more triggers. And I believe there's 90 of them. Now you can either search for this email one or just scroll down. And if we scroll down here on the right hand side when a new email arrives, V3, Office 365 or Outlook 365. Here it is. And again, the key here is that it successfully logs in and you get that green checkbox. So it's logging in and for me everything was logged in fine and it actually logs in as Elon and here you can see that you can fine-tune this trigger but we can have a

17:02 look at it later as well. So you can make it so that it gets triggered not for every single email but from email for select people. When this looks good, we're going to create the trigger which is actually creating a Power Automate flow on the back end but you don't have to worry about that. It's just doing that automatically on the back end. So, we got the action, we got the trigger, we did the instructions. Now, there's a common gotcha and I this happened before. So, I want to help you guys fix it. So, when you test your agent on the right hand side, you click the three dots and you go to manage connections. And when you go there, you'll notice on on the right hand side, for some reason, this action is not connected even though it showed

17:47 as connected before. So, you might run into this just like I did. And if you did, follow these steps. When you get that green check box, it'll go from not connected to connected. So, this is a common issue that people ran into in the first video. I wanted to address it. Don't forget to publish the agent, right? because we we did all this stuff, but it's kind of like in draft form. So, on the top right hand side, you have to select publish. And when you select that, I actually got a couple of warnings, which can be a significant issue if you're sharing this agent with other people. But my thing is that this is my own personal agent, so no one's going to be able to edit it. Um, no one's going to be able to see my

18:33 credentials because it's just mine. I'm not sharing it with anyone. So, with that in mind, I'm going to go ahead and publish it. But for those of you who want to create this and send it out to the masses, my instructions to you are uh everybody has to create this for themselves at this point. That's the only way I know how to do it. Okay? Better better safe than sorry than to share it with other people and they get to use your credentials. Now, we're going to create a rule in Outlook to avoid a loop. So, we're going to open up Outlook because what happens is if if uh if this responds to an email, it'll just create a loop. On the top right hand side in Outlook, you click this cog icon. And here there's a uh rules section that when you select you can add

19:19 a new rule. So, we're going to add a new rule and we're going to call it the inbot rule. And basically as a condition every time an email comes from me because inbot acts on behalf of me. So whenever a new email comes from me Elon I'm going to have an action where the email is moved to a folder. So it's it goes out of the inbox. It goes to the inbot folder. And then I'm going to save it. So that way we don't have emails coming in uh creating a loop which can be an issue as well. So you'll see that the inbot folder is there now and the rule is going to run every time an email comes from

20:04 me using the agent for the first time and fixing the most common issue. So here you you you're seeing an email that I send as a test. So, I'm sending email an email to Elon with a ton of different questions about his cars and about his finances and how his company is doing and even a question that shouldn't be uh isn't in the knowledge sources. So, the instructions say don't answer a question about like the fish taco on the bottom there. So, tons of different questions in there, but it's a test to see if it's going to be able to use the different knowledge sources, and you'll see if it does or not in just a little bit because we have insight to all of that. So, this email is coming from me going to Elon.

20:51 I'm going to go ahead and click send here. And looking at Elon's Outlook, he gets the email, right? So, the email from me goes to his inbox. And there it is. Now, what we're going to do is we're going to select the activity tab because I want to see if there's uh this trigger is automatically being triggered because this new email came in. So, when I click refresh, you see that it just actually showed up, right? So, the trigger automatically uh got into action and you can see when a new email comes in, knowledge sources send an email. And when you expand when a new email comes in, you can actually see my email, you can see the guts of my

21:36 email. And inside here, the the all the paragraphs, the questions I sent were right there. So that got hit. Okay. And then the knowledge sources, everything that got searched over from an input side. And then on the output, you can see that it went to the website to the SharePoint site and the files that I uploaded. So it did a really good job. and then this email connector. But here's the very common issue waiting for user. So if you're out there having this issue, I'll show you how to solve it because what happens is that nothing actually gets sent by the agent. So the inbot folder is empty. Okay, so there is a problem. But how do we fix this problem waiting for user? Go to activity map and select transcript from this

22:24 activity page that we're in. When you select transcript, you'll see an error message and it says additional permissions are required. And there's a connect button here, which doesn't seem to work. So, no matter how many times I click this, it doesn't work. So, here's what I had to find out. And I I I'm suspecting this is a bug that gets fixed. But when you hover over it, you can actually see the site that you're supposed to go to. So um my thing is on your browser this is Edge by the way click the three dots on the top right and go to more tools and select developer tools. This is the way I found a workaround for me. So I went to developer tools which basically opened

23:10 up this other tool inside edge that I'm using and now I can see the guts of the website and this connect goes to copilot studio.microsoft.com/c2. So basically if you go to that developer uh page and do a controlF to find that search string type in copilotstudio.microsoft.com/c2 so you can find it in all that all the text that's in that page right so it finds it and I can see there that this is a this is the entire link so next thing you got to do is you got to rightclick and copy Copy this. So, copy element and then

23:56 open up a notepad and basically get rid of everything except that URL that you need. So, everything before and everything after get rid of. You can always go ahead and just type it out on your computer, but I I thought this was easier for me. But whatever works, right? Just get this URL, open up a browser, type it in or copy and paste it in, and this takes you to this magical manage your connection site where there is u an action that's not connected again. And so that's why it's failing. And so you got to go ahead and get that connection to give you the green check box, which it finally did. And when that's good, click submit. And that's one of the most common

24:42 issues. I hope that helps a lot of people out there. And I think this should get fixed over time. Now, using the agent for the second time, success. This is awesome because we fixed all these issues. So, I'm going to go ahead and resend an email again to Elon. And now going to Elon's Outlook. You can see that the email comes in. And again this agent should get triggered and ultimately send the response with all the um questions answered right. So if we go to activity tab on in copilot studio and do a refresh you can see that this second email has come in and when we select it you'll see all the different sections in here. All these different knowledge sources that were um

25:29 looked at the the trigger and then the email. And look here in Inbot in the Outlook, uh there's an email and it says, "Great seeing you," which is what I wrote him. And then it says, uh it's got all the questions in bold, which is the instructions that I gave. And then followed by the answers from the knowledge sources. Again, this is going to Elon as a safety mechanism, so it doesn't go directly to the person that sent it to you, but everything is answered here, which is awesome. And you can see that the level of detail um that the agent was able to find in the document sources. And again, if this isn't exactly what you're looking for,

26:15 this is your opportunity to edit it before you send it to the person that uh sent you the email initially. But I think it'll save you a ton of time in research because it also provides the references at the bottom that you can check. Now, what I have found is that because this is Gen AI, no two responses are the same. So, sometimes the responses are better, sometimes they're not as good, sometimes the the references, the reference links are good good ones, sometimes they're not. So, you have to really experiment with your instructions and your knowledge sources and your descriptions to get this to be spot-on. But this is kind of like the

27:00 beginning of what I think can be a very very useful tool. And you can see that fish taco one it had no idea. So, it said I I don't know. And it it's not in all the sources. So, that was a good test that it passed and it signed off as as as Elon so that he can just copy and paste it if he wanted to. Now, let's do a little bit more agent testing using test triggers because you might want to do this. Now, on the top right hand side, if you select the three dots, you can select test trigger. So, this actually opens up as and has access to the different emails that were sent in as triggers that triggered the agent. And you can select which whichever one you want. So I selected the first one and you can see the agent stepping

27:47 through all these different activities like checking the knowledge sources, sending an email. So if you get stuck somewhere and you want to test something, you can go ahead and test it in this uh in this manner and it'll actually generate that email and send it to your email as well. Now again you can see here the responses are different. It seems that they're a little bit lighter, not as detailed, and that's just the way Gen AI works. No two responses are going to be the same. Let's do a little bit of fine-tuning for the agent. Now, first thing we're going to look at here is on the allow the AI to use general knowledge. I had that checked. So the

28:33 large language models have their own knowledge, but if we want to just contain it to the documents that we upload, turn that off. And I had that on before, so that might have been part of the problem. The other one that I've kind of preached about many times is be more verbose with your descriptions of the documents and the knowledge sources. So I did that there. And then also from a trigger aspect, we talked about how this agent gets triggered for everything, but you can also go to show all here and go to from and um limit the agent so that it's only certain people. If it's only from this person, from

29:19 Shervin for example, I want the agent to get triggered, not for every single person. So you can fine-tune the trigger, which was a common question as well. But don't forget to publish, right? So after you make all these changes, make sure you save, make sure you publish. Uh, and one last thing, we're going to do some experimenting with deep reasoning, which is in preview. So in the settings on the top right hand side, select that. And then notice that there's a Gen AI element on the left hand side. When we select that, you have some genai options, but on the bottom it says use deep reasoning models which is in preview and it takes you to this documentation link which is actually a very good document because

30:05 there was a few things I didn't know about this. It's not just about turning it on which it explains how to do it. We just did it. That was easy enough. But it says agents don't use deep reasoning automatically or for all tasks in this step. To use deep reasoning, tell the agent to use reason in the agent instructions and it gives an example in the white box right below where basically in step number five it says use the data use reason to provide. So you have to use the word use reason and then it kicks it off. So once we've enabled it on the right hand side there you have to remember to save and that turns on deep reasoning but not necessarily uses it.

30:52 So in the instructions we're going to go ahead and select edit and here we're going to change the way we word things. So here when we're giving you some description of what to do, I'm going to erase this part that says write a detailed this response and say and instead say use reason to provide a response. So that should kick off the deep reasoning model and we can experiment. You can experiment with this. It's in it's in public preview. The documentation is out there. Don't forget to save. So we're going to go ahead and save it. And then also remember to publish it. And again, because this is just ours, there's some uh risks that are identified, but they it should be okay

31:38 because it's just for us. So, we're going to test it. Test the trigger. Use one of the emails that I've been sending in and see if it uses. If it does use it, you'll see reason with Azure Open AAI in preview. So, you know, it's actually working. And so, in this case, it did some deep reasoning. in terms of the knowledge sources and answering the questions. You can see the guts of it here. And so experiment with it and see, you know, how well this works for you. If you want to have this on or if you want to turn it off and wait for it to become generally available. So, here is the response with deep reasoning. You can kind of take a quick look, compare it to the other ones that we've gotten. And that's a wrap. I

32:25 hope you found this video useful and I'd love to hear about your experiences with your own autonomous AI agents answering your emails. Hit the like button, drop a comment, and I'll catch you on the next

Share

More video summaries