How to Build an AI Agent in Copilot Studio from Scratch - FULL TUTORIAL
By Jonathan Edwards
Summary
## Key takeaways - **Build Agent via Copilot Chat**: Talk to Copilot in Copilot Studio to auto-fill description and instructions for a pizza order assistant by describing 'we own a pizza shop called slice slice baby we want to build a co-pilot agent to handle new customer orders'. [03:11] - **Disable Generic AI Knowledge**: Switch off 'allow the AI to use its own general knowledge' so the agent doesn't give generic answers but relies only on your uploaded knowledge sources like Word docs or websites. [07:05] - **Use Adaptive Cards from Copilot**: Generate Adaptive Card JSON code in Copilot Chat by prompting 'can you build me a Microsoft adaptive card for our pizza shop' for pizza base, cheese, size, and toppings without coding yourself. [23:22] - **Variables and Conditions Flowchart**: Save multiple choice responses as variables like 'collection or delivery', then use conditions to branch: if collection ask entity for 'collect time', if delivery capture 'street address'. [17:23] - **Power Automate Email Action**: Create a flow 'email to Chef' with inputs for pizza base, cheese, size, toppings, name; send Outlook email summarizing order, then output 'thank you for your pizza order' back to Copilot. [31:47] - **Publish Public Agent**: Set authentication to 'no authentication' for public access, then publish to Teams, demo websites, or custom sites after testing. [36:14]
Topics Covered
- Co-pilot Builds Itself
- Disable Generic AI Knowledge
- Flowcharts Power Conversations
- Co-pilot Generates Adaptive Cards
- Automate Orders to Email
Full Transcript
look we've got no food in the house yeah I'm just going to order a pizza is that all right what do you want pineapple on a pizza you lost your mind anyway I'm
going to rig him now hello slice slice baby Joe speaking oh hello I just wanted to order a pizza are you all right no
I'm not as it happens the front of the house has founding sick so I having to answer the phone take orders and met the pizzas I mean I mean do I look like Mr
tickle I'm sorry to hear that I feel kind of bad phoning with another order don't worry I've got to make enough dough to keep this place open pardon the
pun well actually as it happens I work in technology and I work with businesses to help them Implement Automation and AI to make them more efficient I mean just
an idea why don't we replace your front of house with a co-pilot agent sounds a bit fancy that and expensive we're just a little pizza shop no co-pilot is for
everyone I tell you what I'll stop by the P shop tomorrow and we'll build you a co-pilot agent okay we'll give it a go welcome to today's video our favorite
pizza place slice slice baby is having a few stuffing issues so in this video what we're going to do is build slice slice baby a co-pilot agent to help
customers order p pizzas once they order the pizza the order will be emailed directly to the chef looking forward to this one let's
go hiya how you doing that pizza last night by the way was fantastic pineapple on a pizza okay I get it anyway first of
all I'm going to show you how to build a co-pilot agent using something called co-pilot Studio okay this is the easy bit then we'll get stuck into the rest
okay let's jump over to my screen right now so I'm logged into my Microsoft 365 with just my standard user account okay it's got a co- pallet license attached
to it what I'm going to do is open another web page and I'm going to browse to this page here it's copet studio.
microsoft.com and this is copilot studio so this is the platform where you can build copala agents for your business now in the middle of the page you can
see it says explore agents and there's some pre-built agents here that Microsoft have added to help you get started for example there's an IT help
desk also at the top here you can start creating an agent by describing it towards the left hand side we've got a list of all our agents that we have already so I've got a Harry HR and I've
got a test agent I can click on create or from here I can click on new agent which I'll do now now there are a couple
of ways that we can start building our agent the first way is we can build our co-pilot agent by talking to co-pilot so
here look co-pilot is saying I'm here to help you build an agent describe what you want to do towards the top right hand corner I can skip past this if I want and just go straight to the
configuration screen which I'm not going to do I'm actually going to talk to co-pilot so I'm going to type here what type of agent we're wanting to build so
how about this we own a pizza shop called slice slice baby we want to build a co-pilot agent to handle new customer orders customers choose the type of Beats they want including the base
cheese and toppings the order is then emailed to our Chef that seems like a good start let's put that in there now you can see down the right hand side
co-pilot is kind of summarizing what we want okay and that's a decent summary now copal is saying great let's determine a name for your agent copal is
suggesting pizza order assistant I think that's decent so I will just type in here yes okay now we're on to refining more instructions for the pizza order
assistant I will just confirm this as well because I'm happy with that so now copal is asking if there's any publicly available websites that it can use as data sources now we're going to touch on
these later in the video so for now I'm just going to say no to that one okay it's all set up so at this point I'm just going to show this screen here skip
to configure and you can see this is just kind of a manual way of configuring our agent but what we did is we spoke to co-pilot and co-pilot has filled in all
these the description and the instructions for us I can also add an icon if I want so maybe a picture of a pizza might have been good now we're going to go through some of the in the
rest of this video but for now I'm going to create our co-pilot agent and there we are so this is our co-pilot agent along the top you can see the name of it we've got all these tabs and I'm going
to show you some of these in today's video and we've got this section down here towards the right hand side we've got an ability to test our agent so our agent has already said look and a pizza
order assistant kind of how can I help you and we can just test our agent throughout this video so what do we do next next I mean this is all very well but what does this AI thing know about
my business you know people sometimes call and they want to know what time we open what time we close do we deliver those kind of things co-pilot doesn't
know anything that's easy look in co-pilot Studio this is called knowledge what we have to do is we have to feed co-pilot studio with knowledge we can do
that using public websit SharePoint sites or even just uploading documents let me show you how to do that right now okay so we're now going to look at knowledge which is actually on this tab
here okay but before I do let's just start speaking to this co-pilot agent here okay so I can maybe ask you something like this can I order a
pizza okay co-pilot has come back to me and said yes you can what kind of pizza base do you want let me ask you another question do you deliver I've spelled deliver wrong but again copilot is
intelligent enough to know that meant deliver now the answers that this co-pilot agent had given me are all generic as the chef has just pointed out
how does this co-pilot agent know anything about my business okay let's just look at these answers again the
last sentence in each of these is this here AI generated content maybe incorrect okay that's just gone to
topics that's what it's saying to us now now if we go here to knowledge you can see that it's blank and I can add knowledge but there's a section here
look allow the AI to use its own general knowledge and that is enabled so basically we're letting this
co-pilot studio studio agent use its own knowledge that might be okay for some agents but in our case it's not okay now
if I switch this off click on continue okay that's now disabled Let me refresh this test Bay here okay so it's a fresh
prompt let me ask it the same question again can I order a pizza okay it's kind of looped back round do you deliver as
you can see now we've Switched Off the AI using its own general knowledge this co-pilot agent is a little bit silly it doesn't know anything and that's okay in
our example because that takes us nicely now onto the knowledge bit so I can add knowledge and as you can see here I can
point it at a public website so pretend my pizza shop has got a website and it's got lots of different information on that website about deliveries the types
of pizza we do our address our telephone number lots of information what I can do is simply put the public link of the website and then when this co-pilot
agent is answering queries it will look at that website as a data source we can also do it with SharePoint so if we've got a SharePoint document library with
lots of different documents in there we can point our co-pilot agent at that SharePoint site and the answers will come from that knowledge can also use a
data verse and we can also upload files now I've prepared a little file just for this video so let me open that word document now again guess who wrote this
I didn't write it co-pilot wrote it for me I just went to co-pilot chat and said I've got a pizza of shop called slice slice baby can you write me a bit of information about it so here's some
information it's very basic it's just one page but it's got our address our opening hours a bit about us details on collection deliveries and payment okay
so I'm going to use this as the knowledge so go back here and click on browse go to my desktop and you can see I've got that word document here okay
slice baby knowledge I'm just going to change this okay and put a proper description in here okay this document details a little bit about our pizza shop and details about collection
delivery and payments let's add that as our knowledge okay I can see this is added here but if I just go to the knowledge tab you can see the status of that is
still in progress so what I'm going to do is just pause this video and I'll come back when that's fully ingested into copilot Studio okay you can now see that this is
ready took a few minutes to do go back to the overview tab now let's ask our co-pilot agent a question that I know is in this document so we talk about deliveries we talk about uh slice slice
babies add dress so let's ask it those questions do you deliver there we go we offer a delivery service for our pizzas to all homes within a 5 mile radius okay
you can see the reference is slice slice baby dockx so it's taking that from there let's ask it another question what is your address and again it's comeback
one 123 Pizza Lane how on can it a pizza shop is on Pizza Lane okay I understand knowledge but I can't help thinking it still looks a bit AI it's like that
greeting it sounds like a robot I like my staff to speak to my customers in a much more friendly way can we change any of that oh yeah of course look the
greetings the saying hello things like that these are all what you call topics in co-pilot studio and those are built-in topics really easy to change
let me show you how to do that now okay as the chef has pointed out this is the kind of greeting hello I'm Pizza R assistant of virtual assistant this has all come from something called topics
which takes us nicely along the top tab here to topics and I will click on that now so with got all where we list all the topics come out of there we've got all where we can list all the topics
we've got custom and we've got the system ones so you can see here at the top there's something called conversation start so what I can do is click on there and that takes us to this
page here now you're going to see a lot of this throughout the video this is like a a flowchart and this is sometimes how we build the copilot agents you kind of build next actions in the form of a
flowchart and we we'll talk about it ledged in the video but for this here you can see exactly where this is coming from this is called the conversation
start if I click on here you can see hello I'm and then it's saying what the uh the bot name is so it's pizza order assistant a virtual assistant just so
you were and that's the greeting okay now we can obviously change this which I'll do now so I'll just get rid of some of this like that and I put something else in here okay I've just changed it
this I am here to help you order one of our delicious pizzas does what it says on the tin and then what I can do is save that and I can refresh this agent
in our test Bay and you can see our new conversation start is there so if I just go back to topics and this time just click on all you can see a list of topics here so we've got a range of
different topics okay for different things we can look here look at the bottom thank you if I just click into here you can see that if anybody say anything like this so co-pilot is
looking for these phrases thanks thank you thank you so much co-pilot will respond with this you're welcome okay that makes perfect sense and we're going to talk more about topics as we build
out our co-pilot agent but what generally happens is when we speak to this co-pilot agent co-pilot is looking for topics for things that we're asking
it okay now if it can't find a topic in here it will go here to conversation boosting it says here look unknown topic we're clicking here so what happens if
it can't find what we're talking about well it uses data sources what is our data source you've got it it's our
knowledge okay and at the minute our knowledge is obviously our Word document so we've uploaded a Word document for knowledge and we've changed the AI thing
so the greetings a bit better that's all very well and good but ordering pizza believe it or not it's a bit more nuanced than that if we're just uploading menus into knowledge and then
let people order from that it's going to be Carnage yeah look I understand that completely look when we're building a co-pilot agent we build it like designing a conversation between a
couple of people okay we use topics we've already looked at system topics but what we now need to do is build a new topic from the ground up called
Pizza ordering something like that so to start with what's the first question that you ask a customer when they call up for a pizza the first question is is
this pizza for collection or delivery if it's for collection I need to know what time they're collecting it if it's for delivery I need to know a delivery address okay let's build that topic
right now okay what we're going to do now is build out our first topic from scratch okay for our pizza ordering service before I do that I'm just going
to make a quick shout out to this setting here orchestration use gen to determine how best to respond to users and events this is disabled now I'm
going to leave it as disabled for this so what this is is basically it's making co-pilot more intelligent it's a feature that has just gone into General release
and I think it's going to be a great Improvement when we're building our co-pilot agents the reason I'm leaving it out of this is I want to just kind of teach you the basics first I think there's going to be a future video all
about this but I think it's a bit like learning to drive sometimes when I learned to drive I learned in a car when out to change gears and everything like that and today I know my son is learning
to drive and he's learning in a in a automatic car so we don't have to learn how to change gears but that knowledge I think is essential so that's what I'm trying to do here is give you the basic knowledge and in a couple of weeks we'll
come back and we'll talk about this then okay so without further Ado let's go into topics and I'm going to add a topic and I'm going to add it from blank but again
you can create it with a description to co-pilot but I'm going to do it manually okay then we've talked about phrases already okay so I add my phrases into
here so something like this pizza order might be a phrase another one that and I've just add Lots into here now okay that's enough for me I think you know we
can go on and on but I think for now we get the idea if anyone is using these types of phrases co-pilot will direct its response through this topic okay I'm
just going to change the name of this that's our pizza order topic now the first question that the chef wants an answer to Is is this order for
collection or delivery so what we'll do is click on here and then I'm going to ask a question because that's what we're doing okay so let me ask this question here here okay great we make delicious
pizzas can I ask is this order for collection or delivery and this is a multiple choice option and then I can put the options in here so I will do
that now firstly collection new Option delivery now at the bottom it says here save user response as far one so this is called a variable now what we can do is
we can use variables in lots of different ways but we can use it to save customer information and then we can read use that later in the agent so rather than calling it V one I'm going to click into here and I'm just going to
change the name of this so it makes sense to me okay collection or delivery let me just save that okay let's refresh
our test agent over here and let me ask if I can order a pizza again this isn't the exact phrase to what I've put in here okay but let's see if copal is
intelligent enough to know of course it is great we make delicious pizzas can I ask is this order for collection or delivery and you can see that my two
options are here so the user now has two choices we can type collection or delivery in here or I can just pull on there and type in collection now this is obviously not replying it's died because
there's nothing else here so we're in a good spot but what I need to do now is build this out okay so the next thing we're going to add is something called a
condition so it depends what they answer okay if they answer collection they're going to get a different response to if they answer delivery so let me show you
now I'll add a condition the variable is this one here so we're talking about that one collection or
delivery if that is equal to collection what's going to happen next well we're going to ask it another
question great so you're collecting your order what time do you want to collect your tasty pizza now okay this isn't a multiple
choice question is it what we want to do is click on here and change it and we're going to choose something called an
entity okay what is an entity so we're asking the person this question here what time do you want to
collect your Tasty Pizza the person could reply something like I will collect my pizza at 19900 hours
tomorrow or they might reply 12:00 24 for the 1st 8 2025 there's lots of different answers that they could give when it comes to
time so what identi what entities sorry are in copilot studio is co-pilot will look and it will suck out the information it needs so if the if the
user answers in a longwinded way copal is intelligent enough to just suck out the date and time okay hopefully that makes sense so again I'm going to change
this VAR here to collect time just so all make sense to me okay save that okay so this is building out nicely of course
there might answer delivery so let's let's add another condition the variable collection or delivery is equal
to delivery what we going to ask him again it's going to be another question okay okay great we will deliver your
Tasty Pizza in our Pizza Wagon can you confirm your address please so again this isn't multiple choice so is there an entity we can use okay we can create
our own entities and we'll we'll talk about that in future videos now if we scroll down you can see all the different entities that we could use and there is one actually called street
address now you might want to use that okay and that will extract it as a string or because we've talked about variables I'm just going to choose
another options here users entire response okay just to show you what else these can do then we'll go to the the variable again I'm going to rename that
to deliver time okay just so it makes more sense to me okay should we test our agent again see how we're getting on and see what happens pizza
please great we make delicious pizzas can I ask well it's for collection okay I am collecting
at um tomorrow again this isn't going anywhere so I'm not getting a response from that okay but you can see this is
working nicely let's just che check the delivery one piz order please delivery great what's your delivery address and we can type that in and you can see it's
working so now we've got to this bit what do we do next okay that's a good start I like that but the next set of questions they're a lot harder and I'm not sure your co-pilot agent is going to
be able to keep up firstly we ask them what kind of pizza base they want and then there's a choice of three answers and then what kind of cheese do on again
three answers oh and then we need to know what sici pizza it's going to be again three or four different answers how's your agent going to handle all that oh don't worry about it that's easy
we use something in co- piler agent called adaptive cards for that kind of thing do you want to show you that let's go okay so we're back in our pizza order
topic the next thing I want to do after we've answered these questions is add another question but this time we're going to ask this question with the help of an Adaptive card so that adds an
Adaptive card in there we click on that but then this happens now this looks to me like coding and I know I don't know about you but I don't understand coding
and lots of people don't understand coding so is this where this video Falls over well no it's not because another great use of co-pilot is to use cod
pilot to create coding for us now this all sounds complicated but let me just show you so I've got to build out some code here so if I just go back to
co-pilot chat and I'm going to type this in here oh there we go can you build me a Microsoft adaptive card for our pizza
shop the first question is to ask what type of pizza they want the choices are classic thin and crispy or stuff crust second question is to ask what kind of
cheese they want the options are this and the third question is about the size of the the pizza so let me ask copilot chat that oh my goodness we've got our
code for us copy that go back to our topic let me just delete these out of here and then paste that
in now you can see look look at this here we've got it I'm just going to click on Save I think this is brilliant by the way I get really excited about
things like this so that is our adaptive card so so let's go again and refresh this page pizza please
collection 8:00 okay please customize this pizza so I want classic I want mozzarella I want
11 in and then the user clicks on submit that's brilliant isn't it I tell you what I'm liking the look of this just concern I've got though what happens if
someone orders something by mistake I don't want people turning up saying that I've made the wrong pizza and blaming this AI thing I see what you mean I tell you what why don't we ask him another
question we'll repeat back what they've ordered and ask them to confirm if it's right or not in fact that gives me a chance to show you conditions in co-
palet Studio let's go okay so let's confirm with the user that the have got this right they've made no mistakes so we're going to ask them a question
okay and it's going to be multiple choice so let's type this in here so to confirm you've ordered base cheese size
is this correct now what we do here is we loop back the variables so we've talked about variables already okay so I can simply click on here insert variable
into here and what it does is it should bring all these out so the first one is pizza base cheese so depending what they answer it
will confirm it back to them then okay next bit is cheese next bit is size there we go is this correct well yeah it's a multiple choice so we've got
a new Option yes another option no okay let's change this because we like to change
our variable names confirm Choice okay that's fine so that they're confirming their order now let me show you something else
with that might be easy to start with no so what happens if it's no this is a condition and in fact we'll start with
yes collect time is equal to oh no wrong variable confirm choice is equal to
yes okay that is then going to filter to our next option I will add another condition here variable confirm Choice what if they say
no what happens if they've made a mistake here okay so click on no for that well what we can do here is add a
node so if there if it's if it's no we can go to topic management and we can take them back to
a different step and it's this step here okay so that is looking good let's see
how that works in reality okay refresh my page pizza
please collection 8:00 what do you want classic mozzarella 9 in so to confirm you have ordered base
classic cheese Mozzarella size 9 in now this is a bit messy we can clean this up in reality but just to show you is this correct now if I press yes at the moment it's not going anywhere but what I've
done here if it's equal to no what happens it takes me back here because they said this isn't right so it asked me again
okay again this is like a flowchart in action so that's how you can add kind of a a fallback a loop back to an earlier
question in your agent oh this is exciting next up it's my favorite bit I ask people to confirm what toppings they want on the piz sir this is where the
rubber makes the road there's nothing that you've shown me already though that's going to work any ideas oh easy we just use another adaptive card but when we're creating the code for that
we're quite specific in what we asked co-pilot to create let me show you okay let's add another adaptive card which is here click into that there and it's
going to want some codes again so let's go back to co-pilot chat and this time we're going to type in this can you make me a Microsoft adaptive car for pizza toppings multiple choice option and it
can choose from the f foll ing toppings okay so let's get copilot to write us some code and here it is okay looks good
to me so I will copy it from here okay copy that go back here and we're just going to that and
paste that in now you can see look we've got a multiple choice thing so click on Save and that is now built out so so
they then choose their toppings shall we have another little test I think we should okay Pizza
collection 8:00 okay I have classic I'll have mozzarella and I'll have a 9 in submit so to confirm okay I'm going to
say yes great choose your toppings we'll have these again there's nothing below this so submitting isn't going to make a
difference so what we'll do now is one final question ask a question this looks like an amazing Pizza finally what's your name we need someone's name again
this isn't multiple choice we'll click on here let's have a look down our entities person's name okay we'll change this as well that we have been and we'll
call this person's name click on Save do you know something I can't believe this I can't believe how easy this has been I've just got one concern though okay I
can't be logging into this co-pilot agent every two minutes checking when people have ordered how do I get to receive the orders is there an easy way yeah I tell you what in the kitchen have
you got an iPad or something like that great okay why don't we set the co-pilot agent up to email new orders to you so you can be in the kitchen and you can
just get them off your iPad unbelievable what we want to do now is automatically send an email to the chef now to do this we're going to go into the Realms of
automation power automate so we're going to add an action this is going to be a new power automate flow you can see I've already built this in my test environment just to show you so I'm going to go into here though and show
you from fresh okay we get this page here look what we're going to do so first let's name this email to Chef that's our flow run a flow from co-pilot
right we're going to add some inputs keep with me here Pizza base next
input jeez next input size of just call it size next input
toppings next input name okay so there's our inputs here we'll click on
here and we're going to add an action so if I just type in there email you can see look Office 365 email so I will click on that first of all
who's this email going to be sent to now if I had a a chef at email address obviously I put that in there but for the purpose of this test I'll just put my own email address in okay the subject
of the email new pizza order okay now we'll put some body okay new pizza order has
arrived okay Pizza base cheese size toppings now I'm going to add a bit more so I will put that in here
and clicking on the wrong one that this one here the name of the person what's the base choice so click
there click on this one here base and you'll see all this come together I promise you jeez okay now on to respond to co-pilot
add an output here we'll call this an output and then we will put okay thank you for your pizza order
and you know I'm happy with that save publish go back to our topic here okay so let's just see if this action is here
email to Chef it's here now we've got to go through here so what we got to do here is pizza base that one we got to fill these in cheese
type size of pizza toppings it's toppings and the name of the person have
I passed it person's name okay what we've got now is this era here so you do get some sometimes this is expecting a string and
we've given it a table okay so we're clicking to it and we need to apply a formula okay and then we just give it a formula now
what this does it just changes strings into tables Okay click on insert okay I'm going to save this now okay let's
test this in its entirety okay see if it works and here to help pizza order
please collection what time at 5:30 please we'll have a classic uh we'll
have a mozzarella base and we'll have a really big pizza okay yeah that is all correct yes oh let's choose our toppings how
exciting uh mushrooms and seafood that really goes together doesn't it click submit it looks like an amazing Pizza it is an amazing pizza and Jonathan is my
name okay now actually nothing's happened here because at the end you see I should have maybe put on at the end
thanks order confirmed so it looks a bit dead but let's go to Outlook and look new pizza order for Jonathan a new
pizza has arrived classic mozzarella 13 half inch there we go obviously we could have add something like you know delivery time collection time address onto our um email we didn't but I hope
you get the idea so the final thing would be to go to settings because we want to publish this okay first of all
though we go to security and we go to authentication at the moment you see this is a public agent so if we've got authenticated with Microsoft on there then that's not going
to work so for this one we would have have no authentication okay save that okay that was good to me that's fine and then we go to publish okay
that's probably the authentication is it yeah that's fine click on publish and then we've got these options here for publishing so we can publish it in teams demo websites for testing
custom websites we've got lots of different options for publishing so that is how to build a co-pilot agent for slice slice baby so there you have it I
hope you've enjoyed today's video in a fun way I've tried to show you that creating co-pilot agents is for any business I hope you enjoyed today's
video look forward see you again soon
Loading video analysis...