start	end	text
0	6540	Next up we have roberto rodriguez, a security Researcher at the microsoft security ai and research Organization.
6660	11280	And in this presentation he will Share his research on lm-based ai agents.
11280	17460	The title of his talk is the rise of the plant of the Agents, lm-based ai agents and cloud security apis.
17460	19460	Please give roberto a warm welcome.
19860	20740	Awesome.
21100	21440	All right.
21440	22740	Thank you very much, everyone.
23320	26540	I'll try to be as loud as i can So you guys can all hear all the way in the back.
26540	26960	Nice.
26960	27580	Okay.
27580	32440	So today the topic, right, the rise of the plant of the agents.
32440	42160	So i hope that after this presentation you can actually Walk out of here with some tools, with some topics, i Guess, or context around how to build your own agents.
42460	51840	And i have found that they are actually super useful to Automate a lot of stuff that usually might take a couple of Scripts, a couple of work flows that you have to define.
51840	63040	So why not using lm-based applications in order to help Us, right, define all those work flows for security and this Could be, of course, for offense and for defense, right?
63200	77520	And before we start, i'm an ai cyber security enthusiast and Everything i say today, everything that i'm going to Share is my own research and it doesn't represent microsoft at All.
77540	79860	I just want to make sure that's clear.
79980	84060	So with that being said, let's start with the topics.
84060	101320	First we're going to talk about some of the use cases that i see Lms being used at the moment and some generative ai, all the Way to start diving into water agents, how microsoft security Graph apis, it's a good use case to start thinking about how to Use these applications,
101320	106700	and at the end, how we can build a Microsoft graph api lm-based agent.
107700	129700	So when we think about use cases, in the workplace, i see A lot of different people that are trying to summarize content, Trying to provide additional context of scripts, trying to Define some type of chatbots or conversational agents so that Analysts can have this guided response experience.
129800	143020	And we also see people using lms to extract context from Unstructured data and try to put it in a way so that it is easy To search or easy to get more context and even enhance your Analysis, right?
143020	161480	think about taking all the Notes that you have in an incident response or maybe as a Red teamer, you have a lot of different things that you want To do, and those are mapped to tools so you can actually get a Lot of context out of all of this unstructured data and be Able to use lms to build that knowledge graph for you,
161480	161860	right?
161860	182600	And then at the end, the search and retrieval capabilities, a Lot of companies are also trying to use the concept of Retrieval , augmented generation to take all these manuals, data, Unstructured data too, notes, et cetera, so that it could be Easy to search by just trying to find similar or relevant Documents to your question.
182600	187040	And we are going to talk about That in a little bit, but this is what i see a lot, like Companies trying to do.
187200	190540	And, of course, today, the Concept of workflows, right?
190540	196360	how can we use agents and Agenting workflows, which is something that it is actually Picking up right now.
198520	204940	So the main concept in here is That we are trying to enhance these lms that we are working With.
205120	209160	And what that means is that We are not only trying just to ask questions, right?
209160	217940	We are trying to provide additional context based on our Use cases, right, based on our organization, our own teams, Our own engagements, et cetera.
217940	221140	And that's called knowledge Enhanced lms.
221220	238030	And in terms that you might Have already heard, this is the concept of retrieval, Augmented generation, how you can expose an lm to additional Knowledge by pointing to some type of source knowledge and be Able to enhance the conversation that you have with it.
238030	239050	So think about that.
239050	256330	If there is any private data, Anything that only your company knows or your team knows, you Are able to expose that lm to that type of data so that you Can ask questions and have that context as part of your Question as well so that you shape the answer in a better Way.
258130	280430	The basic flow of a rack process Is actually taking your documents, being able to split All that information in chunks, being able to generate Embeddings, which means numerical representations of Those documents, and then have them store in a vector database Where then you can actually have some type of retrieval process Where when you ask a question,
280430	291490	your question then gets Embedded, so it is transformed into a numerical Representation, and then you can actually search for any Similar documents in your database.
291590	306130	Once you do that, then your question will have additional Context, and then the llm will be able to answer in a better Way because it was able to have additional information that Probably it was not trained with or it was not aware with, right?
306130	308490	Think about llms have constraints, right?
308490	319310	They only know about the data that they were trained with, and If their training data was up to 2023, then that's all they Know, so they don't have context of what's going on right now, right?
319310	324350	So this is one basic technique to enhance the llm knowledge.
325510	334170	So the idea is to be able to now take this concept of rag, for Example, and that could be a tool.
334170	346130	That could be something that you can use with other multiple Tools for your own engagements, and the concept of agents is how Can we expose this application to these different tools?
346130	350270	Everything that has to do with data has to have an interface to Communicate, right?
350270	365630	so this is like the basic Concept of saying let's take all these workflows that we are Defining to expose llms to more data and let's pair it with an Agent that it will be able to help us choose what tools to use Depending on the question.
367910	387570	So now we get into the concept of Llm-based autonomous agents, which the concept of an agent, Think about as anything that can act on its own, and when it Comes to an ai agent, it is an artificial intelligence, i guess It could be a script, it could be a model that is capable to Reason,
387570	398430	and it's going to use, in this case, tools to be ordered To expose itself to the world and be able to interact with the World and be able to validate their actions, et cetera.
398430	408470	So an llm-based agent, it's an ai agent that is using llms in Order to help with the reasoning of what's actually going on at The moment.
408470	417150	If i want to execute an action, i Can use the llm to help me choose the right tool for the Specific task, for example, right?
417170	425410	and the idea is that llms Are great since they understand the language very well, right?
425410	434470	They understand actually feelings in text, so it is Easier to say, can you think on step-by-step, for example, Right?
434470	435430	what can i do in here?
435430	437330	Can you plan in natural language?
437330	438850	and that's pretty much what we Do.
438850	454530	If you ask me how to do Something at work, i would explain to you in natural Language, in specific steps, so llms have the same capability, And that's what agents, llm-based agents use in order to Enhance its own autonomous system.
454530	460630	So we are going beyond just your typical you interacting With a chat bot.
460770	464650	Now we have an llm that is Going to capture the question.
464710	481990	It is going to reason over the Question, and if you expose this agent to tools, it will be Able to choose the right tool once again to execute, and the Reason why it does that is because we want to expose the Llm to the world, to the actual physical world,
481990	482630	right?
482630	496130	And then every time these tools get executed, then the Observations, the results, are going to be passed to the llm, And if there is more to do, it is going to continue going Through this iterative process, okay?
496130	500670	That's the basic idea of an llm-based agent.
500810	513710	So as i mentioned before, a reasoning engine is pretty much Trying to think in natural language logically based on the Problem, and this is, of course, not 100 Bulletproof.
513710	525710	It actually has some, still, it is very Fragile, but still it could help you if you scope your tools And the context, you could actually get some good Responses from an llm.
527510	548390	So one of the first, i would Say, techniques was something called chain of thought, which Just by saying, can you, this is how i did a similar exercise, Just by providing examples in the prompt, it is actually able To follow some type of process to be able to solve a problem.
548390	551030	But right now, it's not being exposed to anything, right?
551030	561890	It's just us telling an llm, you can do this, this is how it Was done before, maybe you can solve the same issue with this Type of, you know, workflow already defined for you.
561890	564990	So chain of thought was one of the first techniques.
566230	572150	And reasoning is not enough, so what that means is we need to Expose this to the world.
572550	582030	So going to the next slide, there Was this technique that came out in 2022, which is called react, Which is reasoning and actions, or act.
582230	599130	So when you reason and act, what that means is that you can Actually pair some of these techniques to say, i want you to Think step by step, but every time you want to take a step, I'm going to stop you right there, tell me which tool you Want me to execute,
599130	607350	and i will do it for you, and once i Execute it, i'm going to pass the results back to you, and That's how we continue the conversation.
607350	615230	That's the basic concept of react, and the idea is to follow This pattern of thought, action, and observation.
615370	618290	Thought, you're going to think about what it is you need to do.
618650	628150	Actions, it's what is available for you to take, and then i will Execute it for you, and i will pass the observation back to You, and we continue this conversation.
628530	647810	This is super interesting because this, of course, was not Defined by the security community, but i'm actually Trying to test how we can bring the oda loops, right, oda loops Into this type of framework, because i think that it actually Has a similar context than something that was created by,
647810	650870	Let's say, researchers or applied scientists in the world.
653030	661270	So i hope that this now makes a little bit more sense when we Say reasoning and actions and what techniques can be used to Actually do this.
662830	668470	Now, when we talk about Tooling, execution of tools, there's a couple of ways that You can do it.
668470	678050	One way is to actually use The concept of function calling from llms, and that's a way, for Example, an example in here is from open ai.
678050	682190	You can actually pass a function signature.
682190	685130	So think about a python function that you define.
685130	702890	You can actually pass the name, the description, the doc Strings, the type hints, the parameters, and you can actually Have it as a specific json schema format that then you can Pass to models like, for example, open ai gpt 4 or gpt 3.5.
702910	711670	You can actually pass that information, and that's the way How you are passing a tool to an llm to choose or tell you how To use it.
713750	726550	And the way how it works, if You've never done it before, is you define your prompt, and you Define the tools that you want to send to the llm to help you Choose, depending on your question.
726610	740810	So in this case, we're sending the message, we're sending Tools, the llm is replying back, saying, for your question, you Need to run the tool, get weather, and these are the Arguments that you need to pass, right, the parameters and the Values.
740810	744010	So remember, llms do not Execute actions.
744010	751330	They just tell you how to Execute the actions based on your question and the type of Tools that it has available.
751610	768870	Once you execute the action, Then you can pass the response back to the llm, and the cool Thing about function calling, especially from open ai, is that You can actually have, they provide an id for the tool that Is being suggested to you, so when you send it back,
768870	771710	you're Sending the response with the same tool id.
772030	777550	And if there is multiple tools to execute, then it knows that There is more now to execute.
777550	781590	Thank you for executing this First tool, let's move to the next one, right?
781590	803370	And then at the end, the llm will respond back with a more Friendly, natural way to talk, right, because when we execute Tools, sometimes we are calling apis, so the response might be A json object, or it might just be just a couple of words, so You still need the llm to help you understand what it is that Happens,
803370	807010	so that it turns into, like, a more friendly Conversation.
807870	818210	And there are models, like, Once again, open ai models, and also on traffic models, you can Actually use a lot of these function calling capabilities.
818210	822130	But, of course, not every single llm has that.
822130	841670	So one technique is to actually pass the tools, the Descriptions of the tools, and then pray, pray for the llm to Provide the arguments of your function and the name of your Function in a structured way so that you could actually use it.
841670	857410	So the difference with function calling is that function calling Is managed by the llm service, versus when you want to get Some type of functions back to you so that you can execute them, It's going to be managed by you, and usually will be done Through the prompt,
857410	863950	and that's a little painful, but a lot of Llms are getting better at actually outputting json.
864030	881470	There is also people in the industry that are using yaml Instead of json, and also xml, because it's easier, i guess, It's more forgiving than actually having a json object That needs to be perfect json, right?
883450	884390	All right.
884390	901310	So now we move to, now that we Understand what llm-based ai agents are, so hopefully this Makes sense, is how do we expose the tools that we have to some Type of system that is capable to reason over my question, and It's going to allow me to simply say,
901310	906450	hey, which tool is Should i actually use for this specific use case, right?
906450	914850	So that's the basic concept of using one llm-based ai agent for An agentic approach.
918070	926250	So now let's move to the Multi-agent world, right?
926250	936010	so we talked about that you can Have one agent, you can have multiple tools, and you can use It to execute things for you, and it will reason over your Tools.
936010	958530	But let's be honest, a lot of The things that we do might require multiple tools, might Require maybe different types of models, so one idea is to use Multi-agents where you could actually specialize one agent For a specific task, and you can expose that agent for very Scoped tooling.
958530	979450	So think about if you have a Sock analyst or a thread intel analyst or just an re analyst, They will have different tools, they might have different access, So think about as multi-agents as a way to define agents as Microservices that could be exposed to a problem or multiple Tasks,
979450	994870	and they will be able to solve it either as a very Deterministic workflow or as reasoning over all of them and Just trying to figure out who is supposed to be running the First task or the second task or the third task, right?
994870	998990	That's the concept of multi-agents in here.
999890	1004050	And this takes us to the concept of agentic workflows.
1004970	1017310	A workflow, it's a way to orchestrate tasks, and usually This might be super simple to you, but these concepts are Actually new for the agentic world where you need to execute A task.
1017610	1020210	You might want to keep the State of the task.
1020350	1024130	You might want to pass the Output of one task to the next one.
1024710	1030030	And that actually needs to be defined by multiple systems.
1030030	1042330	For example, there is one that i'm using right now which is Called dapper, which is distributed application run time And it's something that you can use to orchestrate a lot of the Different tasks that you can run in a specific engagement.
1043430	1044750	So what does it mean?
1044750	1049090	so usually when you have a Workflow , like this is what it looks like.
1049090	1051530	Now we're getting into microsoft graph apis, right?
1051530	1067870	If somebody says can you create an app, add a secret, grant Permissions, and then please authenticate as the app and then Read mail, usually you have to go through the api and figure Out exactly how that's being done if, of course, you're using The microsoft graph api,
1067870	1068530	right?
1068630	1091130	so think about this is every Single attack path or every single workflow that might work In your organization, you will have to do this exercise and you Might have to know the api very well or you might be doing some Debugging just to figure out what apis are being called Underneath when you're using either the portal or you're Using another tool,
1091130	1094870	right, that you want to just simply build a Wrapper around it, right?
1095770	1102890	the agentic workflow will look Like something like this where you don't have to know about The apis.
1103190	1119370	You just need to expose an Agent that understands or has some type of access to the api Specifications and then you're able to ask the question to the Agent just to make sure that they are capable to understand And answer your question.
1119450	1133170	So in this case, if the user Says i want to do all these three tasks, an agent is Supposed to be splitting the tasks and maybe calling the Right agent to execute one thing at a time.
1133170	1139990	And once again, you Can make this very deterministic or you can simply say, figure It out, right?
1139990	1148570	and the way how this figure it out means is Every single agent has a task and a description in natural Language.
1148570	1164830	So technically, the orchestrator will be able to Read every single agent's purpose and goal and also some Of the tools that it has available and be able to make a Decision what is the right agent that i need to execute, right?
1164850	1170210	So i like this better because i don't have to think about the Api as much, right?
1170930	1180270	and there are a couple of Agentic patterns that exist right now that are very simple And also very famous but not so much in the security field.
1180270	1198890	They're very famous in other fields where you could say, for Example, i want to define a sequential workflow to write a Paper where the first task is maybe let's search something, Let's read something, let's summarize something, and then Let's write something,
1198890	1199130	right?
1199130	1203630	so you can do a lot of that or Come up with the best marketing strategy.
1203630	1205730	You can do that with a Workflow , right?
1205730	1211930	but in security, i haven't seen so many Workflows or agentic patterns being used yet.
1212170	1216230	So you have the sequential, which is pretty deterministic, Right?
1216230	1234850	you really want to understand Exactly how everything is going to be executed, and then you Have the concept of a conversational group chat, which Means that when the question or the prompt enters the agentic Workflow, there is an orchestrator that will start Communicating with the other agents once again,
1234850	1237210	saying, hey, I want you to execute this.
1237210	1238890	Let me know what's going on.
1238890	1245570	When something gets back, you can pass it to the other agent And so on and try to figure out how to actually solve the Problem.
1246610	1258070	There are tools that exist Already in the community, such as autogen, and this is open Source, and it's something that you can use and actually define This type of agentic patterns, right?
1258070	1265690	So highly recommend to look into autogen and be able to see What makes sense for your use case.
1265710	1270270	Something very simple, such as just, let's go to the next one.
1270430	1288570	Something as simple as this, for example, where you have a Sequential , right, agent a is talking to all of them, which Means that agent a is the orchestrator having conversations With every single agent, and the output of one of the first Tasks , right,
1288570	1292950	the first task is going to be passed to the next One, and the next one, and the next one.
1292950	1309290	So think about right now, in your organization or in your Own research area, what, i guess, what workflows exist and How can you start automating a lot of this, or how can you Involve the agent in these workflows?
1309290	1316430	Because you might say, why do i need an agent where i can just Write my scripts in this way and that's all it takes?
1316430	1332490	Well, there will be some nuances, like things that you Cannot control sometimes that might be helpful to have an Llm that will be able to understand that, oh, there is a Problem , maybe this could be fixed by this other agent, or Maybe this agent requires more context,
1332490	1337350	more data, so let's Probably execute other workflows or other tools.
1337350	1343030	That's the value of having the llm-based agents in this type Of concept .
1345050	1365590	And finally , the group chat, as i mentioned before, this is Also from origin, and you can see how agent b gets picked, Gets the message, and then all the messages that were Intercepted by b are actually being sent to the other ones as Well, so it can broadcast exactly what's going on to the Other ones,
1365590	1371330	because, remember, it is a conversation across Llm-based applications, right, agents.
1373950	1391350	So when we talk about microsoft graph api, we all know that it Is the gateway to microsoft 365 data, the gateway to a lot of Different services, and we use it a lot for incidents, right, Because we can get context from alerts, we can get context from Incidents,
1391350	1410190	artifacts, et cetera, but at the same time, you get Folks like graph runner, which are actually using, right, these APIs to craft specific workflows, very deterministic Workflows, so if you go to the github repo, you're going to see Exactly how they chain multiple apis,
1410190	1428670	and that's awesome, right, Because it kind of helps us to maybe also test how our Multi-agent framework can do and maybe discover the same type Of workflows that are, that exist in graph runner, we could Actually have it without writing any type of code the same way How they have it,
1428670	1433270	right, because if you see in the code, It's like a very long script.
1433650	1441870	If you have agents with the Right apis, you could actually be able to solve some of the Modules that they already have available, right?
1443790	1449350	So now let's dive into what does that mean from agent and Microsoft graph api.
1449410	1460150	The first idea was we have a Prompt where we could actually get some of the microsoft graph Open api specifications.
1460550	1467210	We can pass it in the prompt and Say, hey, i'm trying to do x, let's say create a user.
1467450	1479490	Then you will pass all the user, i guess, specifications apis And you expect the llm to tell you this is the api and these Are the parameters and the values that you need to use in Order to create the user.
1479810	1481130	That was the basics.
1481250	1489410	And then you can have the access tokens being part of the Tooling and simply the tool will communicate with the Microsoft graph api.
1489410	1491930	But that's not sustainable, Right?
1491930	1501390	because if you look into the Microsoft graph api, it's a very large, it's like hundreds and Hundreds and hundreds of lines of specifications and Definitions.
1502530	1504210	And this is an example.
1504210	1514430	If you go to this github repo, you will be able to see most of The end points that exist for the microsoft graph api in its Open api specification.
1514650	1515250	Okay?
1515430	1536210	Now, what you can do now instead, this is something that I'm doing right now, is maybe what i can do is i can use the Concept of retrieval augmented generation and put all the Hundreds and hundreds of definitions into a vector Database and then i can have a tool that says,
1536210	1549710	hey, i want to Create a user, we expect this rag tool to go to the vector Database and says your question is very similar to these five Apis.
1549910	1560510	So now we can retrieve five Apis from hundreds of apis and be able to pass them to another Tool that is going to execute those apis, pretty much.
1560510	1566810	And that's the whole concept of using agents combined with a Rag tool.
1566810	1577030	This is why it was so important to mention it at the Beginning because we're trying to mix all these concepts that Are used by other use cases, but we're using it in this context.
1578510	1580510	So, what does that look like?
1580630	1582510	let's go directly to the code.
1582990	1592750	I'm going to run it if i have time, but i'm going to just Explain to you exactly how this works, that way you have an Idea, but this is going to be, this is a project that i'm Releasing today as well.
1593570	1602410	It needs some cleaning in the Documentation, but the idea is how we can define all these Agents in a more structured way.
1602590	1616990	So the first thing we do, we Import our libraries, we define our llm client, because Remember, all these agents are going to use an llm behind it, Right, for the reasoning and all of that.
1616990	1624470	Then i define my header, pretty much, i pass an application With a client secret.
1624870	1646090	This is going to be in my Environment variables file, and then we're able to capture the Token, and now we can do something as let's point to the Users, open api specifications, and then we're able to parse All the multiple end points that exist in the microsoft graph Specification,
1646090	1649190	and you can see this is only one example.
1649190	1655770	Pretty much think about this as an application that understands The api very well.
1656050	1663430	If you ask me to create an Application or a user, i know very specific parameters, but i Don't know what else i can do with this api, right?
1663430	1668870	There is a lot of things that we're missing from a security Research perspective, in my opinion.
1669670	1677910	And as you can see, the users api specification has 236 things That you can do with it, and i didn't know about it.
1678450	1690770	All i knew is how to create a user, how to get mail folders From the user end points, so that gives you an idea that i Rather have something that can actually go through hundreds and Hundreds of apis, right?
1691390	1699990	then i define my agent, and the Agent is going to have a persona, because i want to scope A little bit what it is that it can do for me.
1700110	1706950	So if i ask it about the weather, it's going to say, no, I'm a microsoft graph api security researcher as well.
1706950	1709370	I don't talk to you about the weather, right?
1709430	1715650	You define the agent, i'm sorry, the llm client, and then you Pass the specifications.
1716770	1728890	What this is going to do, it's Going to download all the api specs and put them into a vector Database in the right format just to retrieve that Information and then be able to execute it.
1730410	1732270	Let's go directly to here.
1732430	1739130	So the first thing that i want To say is test if the rack tool actually works.
1739330	1744470	So i pass a question, get information about a user with Idx.
1744670	1750830	If i run that, it's going to Give me a couple of documents right here.
1751170	1758190	It's going to tell me that these five apis in here can Actually be used for my task.
1758430	1760970	And if i look into one of them, It's this one right here.
1761270	1766370	If i want to get information About a user, i would use the get user api.
1766430	1769870	But that was in the hundreds of apis in there.
1770190	1777030	And then even though you might see that there are some apis That don't make sense, the idea is that this is just one step.
1777390	1790310	The next step is to say, i'm going to take my five apis now And i'm going to ask the llm, once again, based on my Question, which ones of these five are actually related to my Question.
1790410	1799730	And remember, language models, Especially large language models, they do have a very Good understanding, statistical understanding of words in Paragraph and text.
1799730	1807050	So i would trust this one a Little bit better to pick out of five, to pick the one that i Need to execute.
1808110	1810050	We go all the way down.
1810050	1813430	And then i just run the agent right now.
1814390	1824250	And i don't know if you can see this, but the idea is that my Agent is going to start executing the concept of get me The apis.
1824530	1830390	Once you find the api, i want You to, let's just go here, i want you to execute it.
1830830	1836410	And one of my tools is to actually execute apis, like a Very dynamic function.
1836410	1852230	So now you can see that the Apis, okay, based on the open api specs, you need to hit this Path, which, by the way, is a path template, so you need to Pass it some type of property or parameter into the path.
1852310	1855810	And the parameter that you need to use is the user id.
1856070	1860250	All of this done by the llm, right?
1860250	1863810	And by picking the right apis from the vector database.
1864290	1875510	I don't know if you guys think it's cool, but it's super cool To be able to just automate this whole process by having the Right workflows, right, the right steps to execute it.
1875970	1885890	And then execute it, executes it, and then all the way down It says, all right, the information about the user is Display name, student 01, and so on.
1885890	1894990	So it gives you all the information That it was able to capture when it executed, when i executed The api and i passed the response back to the llm, right?
1896290	1909570	And the last thing, which is just the multi-agent example, This is something that i was running right now, and it kind Of, like, failed a little bit, but i'll still explain it, and That's it, and that's the last slide of the presentation.
1909570	1930570	But the tool that i was telling you about, it's a tool that is Going to allow us to define agents, and if i go all the way To the actual interesting part in here, we will be able to say Let's define the workflow, let's define the activities that I want to execute,
1930570	1950230	and i can assign those activities to Specific agents, and then i will be able to now include Multiple agents into my workflow, and right now i'm Testing the deterministic workflow, but at the same time We can also make it very autonomous and decide, make one Agent decide what to do next.
1950230	1959010	So we're taking the example from Before, we're just extending it so that we can cover more apis, Because i don't want to have one agent with thousands of apis.
1959010	1968790	I want to have an agent that understands users, groups, Applications, security, and be able to collaborate and do Everything together.
1970770	1975450	And that tool is going to be Released today, so that's the link over there.
1975450	1981950	It's name is flokey, because it's a builder, we're trying to Make it part of a flow, so flokey kind of makes sense for Me.
1981950	1983270	Thank you very much, everyone.
1983270	1985850	I hope you enjoyed this talk, and you can use it.
1986310	1987170	Thank you.
