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 Chaffee and I work at Microsoft
as a Copilot Principal Technical Specialist.
During the day, I 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.
Agent can be a game changer 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 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 agent's
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 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 at Copilot Studio just so that you can
get 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 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 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 home page 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 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're going
to 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 it. You have to select edit to edit the
rest of these items like description. This is
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 using 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 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 gonna work is
that the email is gonna 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 wanna 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 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 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 that are more verbose, detailed,
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 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 this is 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, Dataverse. 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, zero to 60, all kinds
of stuff that's not in other places, but it's
only on their website. additionally when you
go on their vehicles there's information there
about trade in about the semi so roadmap stuff
and so if somebody asks questions that are not
in documents 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 i'm 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 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
Cybertruck. And you can see that it's 315 pages.
It talks about storage area 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, 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 Cybertruck, 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 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 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 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
on our local folder so i have a bunch of earnings
reports from 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 send i
want to test out if you can go ahead and retrieve
this information from here so again it doesn't
have to just be files on your onedrive but they
can just be files on your local hard drive that
you upload so i'm going to select click browse
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
gonna go ahead and put some information about
the description for 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. You can select
See All to look at all of these, and you can
see that the PDFs are actually in 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 to select it. And from here, another
sticking point usually is the connectivity. This
is going to actually log in as you on the permissions.
And if you get this green checkbox, 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. 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 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 check box 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 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 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 the right
-hand side, for some reason, this action is not
connected, even though it showed as connected
before. 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 no one's going to be able
to see my 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 everybody has to create this for themselves
at this point. That's the only way I know how
to do it. 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 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 rules section
that when you select you can add 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 outside 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
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 me using the agent for the first
time and fixing the most common issue so here
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 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 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
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 email and inside here 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
a very common issue, waiting for users. 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 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'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 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 Workaround
for me. So I went to developer tools, which basically
opened 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 copilotstudio .microsoft
.com slash C2. So basically, if you go to that
developer page and do a control F to find that
search string, type in copilotstudio .microsoft
.com. slash 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 right click and copy this so copy
element and then 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 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 manager connection site where there is
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. checkbox which it finally did and when
that's good click submit and that's one of the
most common 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
questions answered, right? So if we go to Activity
tab 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 looked at, the trigger, and then the
email. And look here, in InBot, in the Outlook,
there's an email. And it says, great seeing you,
which is what I wrote him. And then it says,
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 that the agent was able to find in
the document sources. And again, if this isn't
exactly what you're looking for, this is your
opportunity to edit it before you send it to
the person that sent it. 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 or 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 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 don't know. And it's not
in the knowledge sources. So that was a good
test that it passed. And it signed off 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 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 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 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 limit the agent so that
it's only certain people. If it's only from this
person, from 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.
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 Gen AI 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 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 the 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 so in the instructions we're
going to go ahead and select edit and here we're
going to change the way we work things so here
when we're giving it some description of what
to do I'm going to erase this part that says
write a detailed response 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 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 risks that are identified, but it should
be okay 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 OpenAI 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 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 one.