Tiffany Souterre & Olivier Leplus - Coding a Multi-Agent Game Master with Strands Agents
About this talk
This talk explores the concept of creating a multi-agent role-playing game master using Strands, an SDK from AWS. The speakers, Tiffany Souter and Olivier Moussou, introduce tabletop role-playing games and explain the roles of players and the game master within these settings. They delve into advanced concepts involving large language models (LLMs) and how they can be transformed into intelligent agents capable of executing tasks through a structured protocol known as the Model Context Protocol (MCP). The session includes a live coding demonstration to create agents that can manage game mechanics, generate characters, and use external tools for functionality such as rolling dice, all while emphasizing the collaborative nature of these agents interacting with one another. By integrating these elements, the talk aims to demonstrate how AI can enhance traditional gaming experiences.
Full transcript
Um just before starting, just so I know who in this room doesn't know what tabletop role-playing games are. Everybody Oh, okay. A few hands. So, I'll still I'll still explain. Um maybe you've heard of Dungeons and Dragons. Um so, those are tabletop role-playing games. Basically, what they are is that um there is an entire universe or world that exists, for example, for Dungeons and Dragons, but it
could be any other game. And um what happened uh back in the days is that people would even today also people would gather in the same room, and every player would come with a character sheet, so you know exactly your character, your stats, like your inventory. all of the players have their character sheets, but they don't know anything about the campaign. And there's one person at the
table that is very important, is the game master. And the game master has the very complex responsibility for creating a gaming experience for the players. So, he's the one who's going to build a campaign. Uh he's going to build an entire story. Um he's going to bring the players to in a quest to whatever it could be, like slay a dragon or get to a treasure. And
today um in this presentation, we're going to show you how to build a multi-agent role-playing game master with Strands. Um so, I'm Tiffany Souter. I'm a senior developer advocate specialist in AML at AWS, and I'm with >> I'm Olivier Moussou, a senior developer advocate at AWS. >> Um so, before showing you how to build this live demo, um I will introduce you to a few concepts. Uh
I'm pretty sure you're familiar with it already, but just to make sure everybody is up to pace. So, what is an LLM? LLM stands for large language models. You might have heard of it. What they are specialized in a certain task, which is basically predicting the next token after a sequence of tokens or words. So, that sounds very simple, but if you train them on a vast
data set, they're capable of having conversations with you. They They are even capable of thinking and having a train of thought. And that's what make them very interesting for having a conversation. So, the first instance of an LLM that was famous was ChatGPT when it came broadly to the main public. And people started talking with ChatGPT and it was all very impressive and fun, but at some
point people were like, "But I want an assistant. I want to be able to chat with that LLM, but I also want that LLM to be able to do things for me. So, for example, if I want to book an appointment in my calendar, I want it to be able to book that slot for me. Or if I want to buy a train ticket, I want that
agent to be able to go on that website, book that ticket for me, take my credentials from my credit card if you're courageous enough. But any other kinds of thing I want wanted to be able to read my emails. And if you want an LLM to be able to do all of those things, you need to give them tools. So, that's what we call agents. Agents are
not just LLMs. They are capable of having conversation with you and understanding what you're saying, but also capable of taking actions on your behalf. So, they can do those things like go to your calendar, take appointments for you, read your emails. Pretty much anything you want. So, a tool can be anything. A tool can be an API call to a website. It could be a database. It
could be having um access to a knowledge base in your company. It could also be functions, lambdas, or any functions that you uh uh locally give it directly. Um to connect your agents to tools, you a protocol, which is called MCP. MCP stands for Model Context Protocol. And it's the way we standardize how agents communicate with tools. Um it doesn't sound revolutionary uh at the beginning, but
actually if you started giving tools to your LLMs before the era of MCP, you might have struggled with the fact that you had to maintain the way you would connect your agent to uh your tools. Also, this opened a new possibility, which is someone else, a third uh developer somewhere else in the world, can create a tool for me and serve it on the server, and I
could have my agent, and I won't have to build that tool. I would just have to connect my agent to that server MCP MCP server somewhere. And so, I could just be a client to that. And this opens a a whole realm of new possibilities. For example, if you are a company that is selling um plane tickets, airplane tickets, um you might want to have an MCP
server to which other agents could connect to, so they are able to buy tickets on your platform for you. um tools could be also other agents. So, you can connect your agents to tools via the MCP protocol. You can also connect your agents to other agents via the A2A protocol, which stands for agents to we need a different protocol just because the way they communicate with each
other is different. Agents exchange information as a tool just brings back a result, but we just needed a needed a standardization for this. So, just bear in mind that if you connect a tool to an agent, it's MCP. If you connect two agents together, then it's A2A. Um so, in the short time of this presentation, which will be about 45 minutes, we'll build this AI gaming experience
for you. Uh but, we're not going to do it the old way. We're going to use the Strengths Agents library, which is an SDK, to help you build those um multi-agency workflows in a matter of just a few lines of code. And uh so, that's the full architecture we're going to show you today. Um oops. I'm pushing on this button too much. Okay. So, what we'll build
today is that we'll have a player, and the player will be interacting only with one agent, which will be the game master. And the game master is the orchestrator. It will have to decide which tool it will use to create that gaming experience for you. So, it will access to different tools. The first one will be a dice roll server for running on an MCP server that
will connect to the agent, the game master agent. And the game master agent will also have access to two other agents. The first one will be the rule agent, which is the expert of all of the rules of the game. So, if you've already played Dungeons and Dragons, you might know that the rules of the game is like a PDF of of can be 100 of 200
to 400 pages long to read. So, what we did is that we vectorized the entirety of the rulebook and we put it in a knowledge base. So, the whenever the game master has a question about anything that could be legally done during the game, then it could ask the rule agent uh to verify the rules. And also, we have a character agent that will be connected to
a database. And um the role of the character agent is to basically note down everything about any character, the playable characters, but also the non-playable characters. So, whenever during the campaign, uh you as a game master need to create a new character on the fly because some of your players have decided to go in that tavern or go to that dungeon, and you have not really planned
for it, then you can build characters on the fly, and those can be created by the character agent, directly dropped into the database, and so you can retrieve all of those informations and your archives directly from that database. Um So, this is like very the beginning of the fundamentals of what you can do with an AI game master, but if you're already playing the game, you can
see how vastly complex this can grow. Um so, for the demo, um not for now yet cuz yeah. Okay, so I'll show you just very much in a few lines of code how you can build your first agent with Strands. Um so, you just have to from Strands, import uh agents, sorry. Yeah, sorry. Um and just from uh that class that you just imported from Strands, you
can instantiate your first agent. Very simply, just like this. And the only thing you need to do to send the first request to your agent is to say hello Barcelona. Um if I launch this what happens behind the scene is that strands will take care of everything for you uh taking the class agent and just taking that string at the bottom and sending it as a request
to your agent. Um also, you've seen I've not defined any model. What happens also behind the scene is that by default uh strands will look if you have any credentials on your AWS account and will uh tap on to Cloud 3.5 by default. >> 3.6, I think. >> 3.6 now? >> It changed. >> it if you want. >> Yeah. Um yeah, I could actually ask it. right
before >> Like the agent.model.config print it. >> Like this? >> Print it. >> Oh, yeah. I'm sorry. Print Yeah. I'm tired. I flew this morning. Please be be mindful of me. Uh yes. Okay. >> Oh, 4.6. >> 4.6. Okay. Um yeah, so that by default goes into your AWS account. Of course, strands has has been made to be provider agnostic. So, we know not everybody has an
an AWS account, which is completely fine. Um if you go to the strands documentation in the model provider um uh space right here, you'll see that you have access to a bunch of different models. Uh if for example, you're directly with an Anthropic model and you have your open uh your API key, you can directly put it here and uh start your model like this. If you
have OpenAI, for example, that could be also the same thing. Put your API key right there, and you can call any model you want. I know Olivier has Ollama. Uh if you know Ollama, uh it's models that you can have um locally on your computer. Um so, I'll just show you how to use like the Ollama model. Uh I'll just have to copy this instance of the
code. bring it here. >> Who doesn't know Ollama? Okay, so quickly, Ollama is a tool that you can just install. It's just like one command line on your terminal. And what it allows you is to do two things. The first one is to download uh models on your computer. So, you have like thousands of models on the Ollama website that are open source. Some of them are
like just a few kilobytes. Some hundreds of gigabytes. So, make sure what you download, like you have the space. And then, it gives you a API uh endpoint locally on localhost where you can call these models. So, you can run any model on your computer and just call them through like an API connectivity. So, you say like, "I have a server running on my computer, Ollama server."
And if you do That's a lot of things it says. >> But if you like do like Ollama list, you can see all the models that I have on my computer. So, I have like three models from like 3 megabytes to 2 gigabytes. But you can download like with just one line of code, Ollama add something, um thousands of them. >> Yes. So, um like really um
any model that you want to use, uh you can directly plug it to I'll I'll leave you to showing how to use the tools now. Cuz now we only have access to uh an agent. So, really we don't have an agent quite yet because we don't have tools. We just have the LLM connected to this API and then we're calling it. But we'll see how to use
tools. >> So you can see that basically it's three lines of code we can create like an agent connecting to an LLM. By default it goes to AWS, but you can see that with just like a few lines of code you create a model for any provider and then just tell your agent, instead of using the basic one, the default one, this one is using Ollama model,
but you can see that like Gemini, uh OpenAI, Anthropic, Mistral, everything can use them. Okay, uh let's um let's go back to like a simple simple example. So tick tick tick. All right. Okay, the good thing with LLMs is that they're like really smart. They've been trained on basically the whole internet, meaning if I ask them, "Write a book on I don't know. Quantum computing, for example."
It's going to do it. I don't know anything about quantum computing, but the LLM has been trained on a certain amount of data that it knows what it is and it can write a book about But LLMs are also not that smart sometimes. If I ask it like, "What time is it?" Very simple question that. I mean, that's something I can answer. Not quantum computing, but what
time is it? I can answer that. And if I ask that to an LLM, what it's going to tell me is going to say, "I don't have access to real-time information like the current time. You can check on your clock, ask Siri or Google Assistant for the current time." So basically this is very simple, but the LLM doesn't have access to that. And that's literally where tools
come into action because I can I can tell my LLM, "You don't know the time, but you can call a function that gives you the time." So that's what we call tools. And if you go on this Trans Agents documentation here, you have a tool section and in there you have a community tool package, which is a package you can install by it's a Trans Agents tools.
And it gives you access to a bunch of tool that the team thought they were like generic enough to put them in a package so you could you could use them. So you have like um tools to manage memory, to read files, write files, do shell cron tasks, use computer, it's going to like move your mouse for you, it's funny, execute code, do some HTTP requests, Slack
stuff, read image, generate images, calculation, current time. There's a tool for current time. That's a tool um I could need right now. So what I'm going to do is select a from strange tools and then I'm going to import the tool I want. In that case, I want to import current time. And I'm going to say I'm going to tell okay, I'm going to give it an
array of all the tools I'm going to give it access to. So here, I only need current time. And when I execute it now, what it happens is that it knows that it doesn't have access to the time, but it also knows that it had access to a tool current time that gives you access to the time. So he's going it's going to call the tool current
time and then give you the time. Uh the current time is 2:52. What time is it? >> 4:52. >> It's not 2:52. Let's say if I ask in Barcelona, it's going to say, "Okay, the current time." It's calling the tool again. And then it's going to say, "Okay, the time in Barcelona is 4:52 p.m." which should be the time right now. Uh the the way it works
is if you go here and you click on any of the tool um you have access to the source code. You go on GitHub and it gives you access to the source code. And you can see that current time is just a function that takes a time zone as a parameter. And what is important in a tool is the docstring. So basically, my LLM just has the
name of the function and access to the docstring and it's going to use the docstring of the function to know what each tool is doing and to know which one to call. So this one it says that it has access to a function that gets the current time in this ISO format. And you also saw that says that sees that it takes arguments. It takes a time
zone as a string, which is optional, and that has this format, UTC, US Pacific, European London, whatever. So, what is going to happen is that my agent is going to say, "Oh, I'm asking the time in Barcelona. I have access to a current time function that takes a time zone, optional, as this format. It knows that Barcelona is is on this time zone because that doesn't change,
so it's in the training set. It's going to call the current time function with the time in Barcelona, and it's going to reply with a the other Good? >> Which is really nice with if if your docstring is well written, then you give the chance to realize them to actually decide and and um like leverage the full power of uh of uh of uh thinking of your
LM. So, Claude 4.6, of course, is capable of knowing where the where what the time zone of Barcelona is. But for more complex questions, you can have different parameters and let your LM decide how to infer which parameter should be what. >> See we have time. I'm going to do like a another demo. You saw that Okay, coding time current time is easy. Uh who is using
like a coding assistant? Don't lie, come on. Who writes code? Um So, remember when we started using code assistant, you know, they were like pretty basic. They were just like writing code, writing file, and everything. That's something we can easily redo today. You know, if you saw when I was going through the tools of strange agents, we have one called file write. We have one called Python
repo. And these two tools allow me to write files, okay, and execute Python code. So, if I give my agent also access to these two tools, here, and I ask him, "Okay, um write a file with a function fib.py that generates the generates the first X iterations of the Fibonacci sequence. Okay? Then execute it. So, here I'm saying, "Okay, generate some code." Write it in a file,
and then execute it, which is basically what the first version of Copilot was doing back in the day. That looks That was so not long ago. Okay, now I execute that. What's going to happen is my name is going to generate the the code, easy. And then I ask him to write it in a file. So, he's going to call the file write tool. So, when we
call current time, current time is like harmless. Just getting the time. Writing a file can be harm- harmful potentially. So, by default it's asking you, "Is it okay to write something on the computer?" You can bypass that because in the CICD you don't want that. So, you have a an environmental variable that is going to bypass the the fact that they ask you. But, if I say
yes here, I'm going to say that it's going to generate a file here, fib.py, which I'm not going to go through it, but do like 0 1 runs to Okay, it's technically doing the Fibonacci sequence. Have a main function. Didn't ask for it, but that's good. And then I ask it, "Oh, then can you execute it?" And so, it's going to call the Python REPL tool that
is executing Python code. And again, that's that can be like quite dangerous. So, by default it's asking me, "Is it okay to run the tool?" I say yes. And then it's um executing the main function here, and then giving me like a whatever report of what I've been done with generated and executed the file. So, you can see that with few lines of code I managed to
recreate like a very basic coding assistant that can generate code, write it, it could read it, too, and execute it. Cool, right? Cool, but we're not here to rewrite Copilot. We're here to do some Dungeons and Dragons. That's also what you came from. You came for. So, I don't I don't want that I don't want that what I want is an agent that can for example like
a dice of six. Any idea what is going to answer if I ask that? Who can guess? No one? Oh, what is he going to say? Mhm? I heard things. It doesn't have any so yeah, anyone else? A number, which one? I'm going for four, okay? I need to pick one. Four. I'm so good. Okay, I'm 99% of the time it's going to answer four. That's how
I know it. And the thing is I don't know exactly, but I think that when the model has been trained, he's read a lot of roll dice results, whatever, and most of them must have been four because 99% of the time it answers four. >> We we have no idea why. >> I have no idea why, but >> We we we do it a lot and all
the time it's four. One day it will be something else and we like well >> Yeah, I will understand like I would just re-roll it. >> But yeah, it's almost always four and that's not what we want for a game. We want like a proper like >> random >> random from one to six. And we need a tool for that and well, I searched on the documentation
and the streams team didn't think that rolling dice is was generic enough to put in the package. um writing a function that roll dice is something that we all know how to write or we all know how to ask on the internet, right? Write a function that rolls a dice with a number of faces given as a string manage errors, write doc string. Okay. Good thing with
LLM that even if you like make a lot of mistakes when you write he understands. Okay. So, I have a function roll dice which has nothing to do with LLMs except that it was generated by an LLM. It has a doc string. It takes arguments faces the number of faces of the dice. Okay, import casting int sounds good to random and returns it. Okay, so I have
a basic function here. Well, we would be cool that to use that function as a tool for my agent. Something like you know, taking the function name and say, "Okay, now you're a tool." That would be great, right? Okay, it's not that simple but it's not very complicated actually. All I have to do is to also import tool here from strengths and then just add a decorator
tool in front of my function. And just by doing that, now my function is seen by my agent as a tool. And so if I execute it now what's happening is that it knows it doesn't know how to roll dice. Not going to trick me and then it says, "Oh, I'm calling the roll dice tool because I have access to it." And I say like, "You rolled
a five with a six-faced dice." Okay? And I can say, "Okay, roll 3D20." Like three dice of 20 faces. Now, I ask that and again it knows it doesn't know how to roll dice, but it's going to call three times the roll dice tool and give me like, "Ooh, nice table of results and even the total." Didn't ask for it, but thank you. So, you saw that
pretty easily we managed to create a tool and make it available to our LLM. Cool? >> Yes, so cool. >> Thank you. All right. Um there's a few reasons I wouldn't want to do my code like that. So, you can That works. But at some point you can put all your tools here in your agents. That would work. Uh just be careful if if you start to
have like a lot of tools, you to make sure that all the dog strings are different enough so your agent is not going to like not know which tool to call because the definition may be like quite similar. But there's two reasons why I wouldn't want to put my tool in my agents. The first one is that if someone else, I don't know, in Australia already created
a tool to roll dice, I wouldn't want to like recreate it. I would just want to use their tool. Second second reason is that I'm I'm a nice person. I'm going to write this roll dice tool and I want to give it to the rest of the world so other people can use it. And that's when, as Stephanie mentioned, MCP comes into into play. It's a standard
protocol that if someone put the tool behind an MCP server, I can use it on the same way I can put my tool behind an MCP server so any anybody can So what I'm going to do is I'm going to create an MCP server. I'm going to write a file MCP dice. Here we go. What I want to do is I want to say okay. This whole
thing here, I don't need that. I want my agent to basically know absolutely nothing but rely on the MCP server to roll the dice. I want literally my functions to be behind the MCP server. Now, uh, Strands agents is an SDK to create agents. It can create agents, connect to MCP servers, connect to other MCP servers, but it's not meant to create MCP servers, okay? Just for
agents to connect to them. Uh, so for that we're going to use another library which has nothing to do with Strands which is called Fast MCP, which is open source managed by a community, that allows you to do a lot of things with MCP including creating MCP servers. So I'm going to create an MCP server, Fast MCP, I'm going to give it a name. uh, roll dice
service. Don't care. And it's going to have a port. So, going to put it on 8080. And then when I have my MCP server, I'm run it. Now, when you run an MCP server, have you ever ever configured an MCP server? On your ID, sometimes you will say, "Oh, I want to add an MCP server so my coding agent can connect to it." You have this JSON
thing to add usually to MCP.json. No? Yes, a bit. A bit of yes, a bit of no. Okay. So, just so you know, there's like three different ways to connect to an MCP server. The first one is standard input-output, so it's running on the computer and it's stdio to connect to The second, which we see quite often. The second one is SSE, it's like service push messages.
Never seen any MCP server running on that, but it's possible. The third one is just streamable HTTP. So, basically like an HTTP string stream to connect to the MCP server. So, when you create it, you need to tell which uh which protocol it's going to use to connect to it. And so, to do that, I'm going to give it its transport. I'm going to say like a
streamable HTTP. So, I'm going to say that my MCP server is going to be accessible through an HTTP stream. Okay? And oh, last but not least, I have my MCP server here created, it's running, and I still need to transform my function into a tool. Fast MCP works a bit like strains, very easy. I'm just going to say I'm going to take MCP here, which is my
object, {dot} tool as a decorator on my uh function. And just by doing that, I have a function running behind an MCP Let's running. Let's run it. Okay. MCP Uh let's open it to see if it's working. Uh so, Fast MCP give you an endpoint on {forward slash} MCP. And you can see that Okay, I have an error because I didn't send a stream, but I have
my my MCP server up and running. All right? what we have to do, okay, I don't know why sometimes my terminal has this like vertical thing. Anyway, I have to be server with the roll dice tool running. Now, what I have to do is to tell my game master agent, you don't know how to roll a dice, but you have access to an MCP server who has
the tool to do it. So, what I'm going to do is I'm going to I'm going to import two things, an MCP client class and the from MCP client function because that's the protocol I'm going to use to connect to my MCP server. So, okay, let's create MCP dice No. object create MCP client uh is taking a um anonymous function and then I'm giving from MCP client
function and just add it give it the URL. So, by doing that, oops, doing that, I'm creating an MCP client object that is going to use the from MCP protocol to connect to my MCP server who could be running anywhere on the internet actually. Right now, it's on localhost. And when once I have that, all I have to do is to tell my agent, okay, you have
access to the tools of this MCP server, on which I could have like many tools actually. I only have one, but you could have like several tools on on your MCP server running. Should we try that? The demo is getting more and more like dangerous as we go. Okay, let's run that. So, now what is happening? Okay, a few things. You've seen that in my MCP here,
I had a Whoa, whoa, whoa, too fast, too fast. I have a list two requests. So, that's my agent according my MCP server saying, "Okay, what tools do you have and what do they do?" And then it received the response. It tick, tick, yeah, somewhere here. And then it's calling the tool request. So, it's calling my MCP server three times the call to request to call the
tools roll dice and then getting response. And if you go here, tick tick tick, you can see the same thing here. We have the two the three roll dice that haven't been executed on my agent, but on the MCP server, got the result, and write them down here. >> Just for precision, uh when can you show the uh MCP server right here? When it calls when it
calls the list uh tool request, uh what happens here is that what the server the MCP server sends to the agent are the docstrings of all of the tools. So, if you've not written any docstrings, I mean, it sometimes guesses from the name of the function, I mean, the best practice is to write a good docstring. Also, in the documentation, there is an entire chapter on how
to write your docstrings in the best way possible. My advice for you would be to give those best practices to an AI and ask it to write that docstring for you cuz they're so much better than us at doing that. >> Also, the total was 42, which is amazing. Very geeky. All right. So, we saw that we have an agent, we have an MCP server, we see
how they can communicate with each other. That's the first protocol we wanted to see, MCP. The second one was A2A. It's how we can have different agents collaborating with each other. So, let's say I want to create an agent to manage characters for my game. Going to create a new file. character.py And here I'm going to create another agent. Remember how you do that? >> Uh your
extension is wrong. >> Hm? >> The >> That's That's never going to work. >> Okay. Remember, I import strands. I create an agent. Now this time I'm not going to be the one calling the agent directly. It's going to be called by another agent. So I need to give it a bit more information here. I'm going to It's like a D&D character manager agent. I'm going to
give it a description. Uh says like, "Okay, you can create and manage D&D characters with a name, class, race, statistic, and background. And you can write and read uh the character files. Now in a normal project, you would use a database. I have 16 minutes left. I'm not going to set up a database, so for the demo, I'm going to use files to simulate a database to
read and write my character, okay? So remember in in the strands, whoops, tools, ah, I had the file read and a file write tool. So I'm going to use them to be able to give my agent the ability to read and write files. So I have my agent. And now what I need to do is to make this agent behind a server so my other agents can
call it using the A2A protocol. All right? Right now I just have an agent that I can call, but can't be called by another agent. import the A2A server class. And I'm going to create an object. And I'm going to give it the agent that is going to run. So that's this is my agent here. So I'm saying behind this server I have this agent And I'm
going to whoa, I'm going to give it a port. Um let's put it on 8081, this And once I have it, I'm going to say, "Okay, just run my A2A server." So by just doing these few lines, I put my agent behind an A2A server so any other agent can call it. And again, it's a solid protocol, so anyone can call your agent if you put it
on the internet. Okay, that's running. Let's run it. I have my agent character here. Up and running. That sounds good. let's go back to my game master. Here. Again, my game master doesn't know how to do anything, but needs to rely on the MCP server to roll dice and on the other agents to manage character, right? So, what I'm going to do I'm going to say, "Okay.
I'm going to import this class A2A client to provider. This is the provider that is going to be used to call other I'm going to create the A2A provider. Token provider. And what it takes this one is just a list of all the URLs of all the agents. So, I'm going to give it a an array of all the URLs and in my case I only have
this one. But basically, if you have agents you want to connect to, you just put all the URLs here. The difference between an agent because that's the question we have sometimes like, "When should I do an MCP server? When should I do another agent?" Um there's two differences. The first one is that an MCP server is just code, just a function. Another agent also has an LLM.
So, basically what I could have done is that like my character agent is using whatever OpenAI or other Anthropic LLM. So, you can have different LLM running on different agents. Because the cost of the token is different, because the time of the execution is different. And I say you don't need like a huge model to run this agent. You can put a different one. The other difference
that when your agent calls an MCP server, he knows all the tools on the MCP servers, he knows what they do, and he's going to call a tool. When your agent is calling another agent, he's just sending a prompt to this agent, letting it do its job. The other agents could be calling other agents, MCP servers, database. You don't know, you don't care. You send a prompt,
he's doing his thing, and giving you his response. Okay? Well, that's the main differences. Um I have my agents and what I So, I have my provider here. And what I need to do is say, "Okay, I'm going to give it the tools of the provider." The tools of the pro- the providers are not the tools of the other agents. They're the tools of the provider. One
of the tool may be like send a message to this agent. That's a tool from the provider. Before we continue, a good practice when you when you start to have like different MCP servers and other agents that I like to do is to uh give some guidance to my agent, which I usually do in the system prompt. The system prompt is basically the the identity card of
your agent. It's his identity. So, if for example here, we're going to say, "Okay, you are a Dungeons & Dragons game master. You have access to different tools and agents. Use them when you need them. I don't have to say, 'This is an MCP. This is an agent.' Doesn't matter. you can roll dice, you can create magic characters." I'm going to say, "Never answer by yourself. Don't
hallucinate. Use the tools um that you have access to." Okay? Let's try it. Demo. Okay, create a character named name a name. Steven? I heard Steven. Steven? Who is an elf of the night, who roll the dice to generate its characte- ristics, then save it in a file. Okay? So, here I'm asking to generate a character, roll the dice to generate the characteristics of Dungeons & Dragons,
and then save it in a file. And finger crossed, it's going to work. All right. So, what's happening here? You say, "Okay, I create Steven the elf. It's rolling a bunch of dice. Okay. And then you can see that he said, "Okay, let me start by discovering every baby agent for rolling dice for all characters mainly." He's calling the A2 at least discover agent, and that's one
of the tools of the provider. Okay? That's why he says after, "I found the D&D character management agent and rolled all the six characteristics. Here are the results. Strength 19, dexterity constitution, blah blah blah blah blah blah." Now, let me send all these to the character management agent to create um Steve. And that's another tool of the provider, A2A send messages. And that's sending a message to
the other agent which here received the message. Give me some warnings. Don't know. I I seem to write the character in a file. So, you can see that it's calling the write file tool. And eventually, in a second it should tell me that he needs my consent to write the file, right? Right? Oh, come on. Five. Uh come on. Can you write the file, please? Aha. Woo.
What happened to my computer? >> That was a long time. >> Yeah, it was long. So again, sending a message to the agent. The agent has a tool to write file. It's calling it, asking me if it's okay because again, we're writing file on my hard drive. I say yes. And normally, I should have a Steve elf of the night agent here. So, here it shows to
do like a JSON file. It depends. Sometimes it's a markdown, sometimes it's JSON. I didn't ask, but if you ask for markdown, it's going to do a markdown. CSV, it's going to do a CSV. Here's a JSON file with all the information of the class feature, of the spells, of equipment. Damn, there's a lot of Uh language, proficiency, personality, backstory. You can have the backstory of the
character, everything. They were generated, saved in a file, sent back to uh, game master here. >> If you want a specific output in a certain format, you can definitely, uh, define this with, uh, um, story output, which we'll show later, uh, in in the demo. Because that sounds like it creates like a little bit on the fly, but you can actually have control over the format of
the output. >> Yeah. Yeah, you can ask him. I mean, that was a very simple prompt, but usually you have a more complex one. We're going to see after, actually, what we can do. And in the same way, if I ask, "What can you tell me about the character Steven?" Steven. And I ask that, what is going to happen is that he's going to do the same,
he's going to say, "Okay, let me look up the character Steven for you. I will check first available agents to find the character." It's calling the tool of the provider, list the character of our agent, say, "I found the D&D character measure agent. Let me ask it about Steven." Sends a message to the agent. Here you can see that this time the agent is going to file
read because it says that he found a >> Oh, yeah, just one thing that's important. Here you see the get, uh, well, um, well-known agent card.json does in the protocol of the A2A. What goes with your agents is an agent card, which is the identity card of your agent. And when you create it and put a description or a system prompt, this is basically what your AI
game master will get is the description of your character agent and all of the other agents it has with the the agent card. So, just make sure that everything is inside of that >> If you If you're doing agents the old style without any SDK like, uh, Strands, you would have to write these JSON card for every agent, so the other agents can call them. >> So,
that's that's generated chance automatically for the A2A protocol. And so, that's it. Like it's really in the read the file read uh tool, reading the file, and then sending back all the details here to um the game master. Pretty cool, right? Yes, it's amazing. Thank you. All right. So, this is the live coding demo. You can see that we saw how to create an agent, create a
tool, put the tool behind an MCB server, how to have our agent coding the MCB server, how to create another agent putting behind an A2A server, making these agents work together. That's all the thing we did, actually. we only have 1 hour, but we actually went further with Tiffany when we created the project, and we have a more advanced Dungeons and Dragons. Let me actually I can't
open it. Where is it? Okay. What is it called? What is it called? >> Rogue show. >> No. >> Once upon a magic spell. >> Yeah, I don't know where I put it. Okay. Okay, let's see. Oh. Give me 1 minute. I'm going to find it. I want to show you Where is this? Once upon >> Simple. This one? >> Okay. So, this is a more like
complete version where you have the MCB server, which is running dice. This one is basically the same except that it can take a number of dice we want to roll, so we don't have to call it like different times. We have a character agent. The character agent, this one has a database uh instead of files. And what you can what what it does, actually, is that we
just like wrote uh functions like find character by name that we transform into And basically if you look at the code, the only line that actually matters is a search in the database. We have a list all character function that we transformed into a tool. There is just performing a db. Give me everything functional database. So what we did here is that we just wrapped any database
call into a function that we transform into a tool. So when I ask my agent, give me all the characters. It's going to say, "Oh, I have a I have a tool called list all characters. I'm going to call it. I don't know what it does, but I'm going to call it and then the function is just like querying the And you have the same for like
creating Uh where basically this is all the object creation but it just inserts something in the database. So just wrapping all these database function into uh tools. We have the rules agent which is I'm not going to go into details but is using like a a knowledge base where we put all the PDF of the rules. And I want to show you the game master. So the
game master is just the same thing we did except that it's behind a 5 10 CP servers. We can call it from a web interface. Um it has the MCP server with the MCP client same as we did. It has a bigger system prompt because we don't want it to hallucinate on dice which something does. And we have the um Hway client provider with the two rules
and character agents. And we have all agents here. The only thing we changed here is that we added a structural output model with these three output. And the the reason is that normally when you call an agent, you can see that it replies with you with like a huge chunk of text which you can't really use in a web interface. You want something that you can actually
use like And this is where you can say I want a structured output. Here I gave it like the story output. Story output is a class here. Where I say like it has a response which is a string, which is the narrative, basically the story. It has an action suggestion which is a list of string with our suggested actions that um my character can do in the
story. It has details which is like how did you came to this uh story everything. It has a dice roll which is a list of dice which is here, which is a list of dice that he had rolled potentially to uh do the action. And each dice output is a dice type D4, D6, whatever, the result of the roll, and the reason why we rolled the dice.
Okay? Okay, so here on the left I have my uh dice roll MCP server. I'm going to launch up and running. Here I have my character agent Here I have my rule agent. >> Did you close the other ones? Yeah, the other day I forgot to close the other ones and the ports were all conflicting anyway. And here is my game master agent which is running behind
behind a fast uh fast API. So I have a URL here. So let's go here. We did this cute uh interface and let's continue with Steven is a male. He is a halfling and he is a paladin. All right. Let's connect to my server and see what happens here. So here you see like my server uh received the request is >> Starting a campaign for the character.
>> It's starting to send messages to agents calling roll dice generating characters here. >> Dropping in the database. >> Yeah, inserted. So I guess it was inserted in the database. And then once the character is created, it's going to send it back to my um agent here, which is going to call the tool story output to transform this into a JSON that is going to be sent
back to uh my user interface in a second, right? So, you can see here actually, if you look at it, you have the dice output, you have the reasons, you have all the information there, the response, all that we had in the story output. If I go back here, you can see that all the dice didn't like it. >> Oh, no. >> I need to change that.
Okay, we have the dice that messed up a bit. But, you have the story, you have Steven, all the characteristics of the person is here. You have like, "Welcome, Steven, halfling paladin, servant of the light. You stand at the edge of Mosswhir Village just upon blah blah blah blah blah blah." We have the dice. Mm, I know. We have some uh action suggestions And so, I can
click on it. Let me open also the dev tools so you can see for the next uh thing. So, let's see we can follow the mysterious cloaked figure into the village. Uh and again, it's going to go there. It's rolling dice uh here again. Um >> It's asking the rule for a perception dice roll. >> Um so, you can see that the rule agent has been requested
for uh details on the rules of how this works. >> And again, oh, consequences. We rolled a three, apparently. I wasn't good. The rules going to tell us what happens. Uh again, the rules going to send back their message here. >> The end discretion here, it a three is a dramatic fail failure, and a good dream turns out into a narrative moment. That's funny. Sometimes you can
see the different agents like conspirating against you, or sometimes trying to create the an interesting story experience gaming experience for you. That's funny. >> If you go to the console here, in the network actually, oh, you can see that we have the the answer, the roll dice for the wisdom check thing and you can see that the the answer we got actually is a proper JSON thanks
to the the story output so we can actually use it in the in the web interface. And then you can just like play whatever, click on the suggestions or play on your own with the with the game master. So, we are reaching the end of this presentation. Thank you very much. You can find here samples for strains. >> Thanks. >> Thank you. One is quite One is
quite a surface surface of strains but you can do a lot of things like graphs, agents, swarms. >> So many different things. Um >> You also have testing uh if ever you want to do testing. We all do. Uh yeah. >> Go check the documentation. >> And the feedback form uh >> Thank you. If you have any question, we're running out of time but we will be
on the AWS booth so don't hesitate to come by and discuss.