1 00:00:00,000 --> 00:00:06,540 Next up we have roberto rodriguez, a security Researcher at the microsoft security ai and research Organization. 2 00:00:06,660 --> 00:00:11,280 And in this presentation he will Share his research on lm-based ai agents. 3 00:00:11,280 --> 00:00:17,460 The title of his talk is the rise of the plant of the Agents, lm-based ai agents and cloud security apis. 4 00:00:17,460 --> 00:00:19,460 Please give roberto a warm welcome. 5 00:00:19,860 --> 00:00:20,740 Awesome. 6 00:00:21,100 --> 00:00:21,440 All right. 7 00:00:21,440 --> 00:00:22,740 Thank you very much, everyone. 8 00:00:23,320 --> 00:00:26,540 I'll try to be as loud as i can So you guys can all hear all the way in the back. 9 00:00:26,540 --> 00:00:26,960 Nice. 10 00:00:26,960 --> 00:00:27,580 Okay. 11 00:00:27,580 --> 00:00:32,440 So today the topic, right, the rise of the plant of the agents. 12 00:00:32,440 --> 00:00:42,160 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. 13 00:00:42,460 --> 00:00:51,840 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. 14 00:00:51,840 --> 00:01:03,040 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? 15 00:01:03,200 --> 00:01:17,520 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. 16 00:01:17,540 --> 00:01:19,860 I just want to make sure that's clear. 17 00:01:19,980 --> 00:01:24,060 So with that being said, let's start with the topics. 18 00:01:24,060 --> 00:01:41,320 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, 19 00:01:41,320 --> 00:01:46,700 and at the end, how we can build a Microsoft graph api lm-based agent. 20 00:01:47,700 --> 00:02:09,700 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. 21 00:02:09,800 --> 00:02:23,020 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? 22 00:02:23,020 --> 00:02:41,480 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, 23 00:02:41,480 --> 00:02:41,860 right? 24 00:02:41,860 --> 00:03:02,600 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. 25 00:03:02,600 --> 00:03:07,040 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. 26 00:03:07,200 --> 00:03:10,540 And, of course, today, the Concept of workflows, right? 27 00:03:10,540 --> 00:03:16,360 how can we use agents and Agenting workflows, which is something that it is actually Picking up right now. 28 00:03:18,520 --> 00:03:24,940 So the main concept in here is That we are trying to enhance these lms that we are working With. 29 00:03:25,120 --> 00:03:29,160 And what that means is that We are not only trying just to ask questions, right? 30 00:03:29,160 --> 00:03:37,940 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. 31 00:03:37,940 --> 00:03:41,140 And that's called knowledge Enhanced lms. 32 00:03:41,220 --> 00:03:58,030 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. 33 00:03:58,030 --> 00:03:59,050 So think about that. 34 00:03:59,050 --> 00:04:16,330 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. 35 00:04:18,130 --> 00:04:40,430 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, 36 00:04:40,430 --> 00:04:51,490 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. 37 00:04:51,590 --> 00:05:06,130 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? 38 00:05:06,130 --> 00:05:08,490 Think about llms have constraints, right? 39 00:05:08,490 --> 00:05:19,310 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? 40 00:05:19,310 --> 00:05:24,350 So this is one basic technique to enhance the llm knowledge. 41 00:05:25,510 --> 00:05:34,170 So the idea is to be able to now take this concept of rag, for Example, and that could be a tool. 42 00:05:34,170 --> 00:05:46,130 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? 43 00:05:46,130 --> 00:05:50,270 Everything that has to do with data has to have an interface to Communicate, right? 44 00:05:50,270 --> 00:06:05,630 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. 45 00:06:07,910 --> 00:06:27,570 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, 46 00:06:27,570 --> 00:06:38,430 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. 47 00:06:38,430 --> 00:06:48,470 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. 48 00:06:48,470 --> 00:06:57,150 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? 49 00:06:57,170 --> 00:07:05,410 and the idea is that llms Are great since they understand the language very well, right? 50 00:07:05,410 --> 00:07:14,470 They understand actually feelings in text, so it is Easier to say, can you think on step-by-step, for example, Right? 51 00:07:14,470 --> 00:07:15,430 what can i do in here? 52 00:07:15,430 --> 00:07:17,330 Can you plan in natural language? 53 00:07:17,330 --> 00:07:18,850 and that's pretty much what we Do. 54 00:07:18,850 --> 00:07:34,530 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. 55 00:07:34,530 --> 00:07:40,630 So we are going beyond just your typical you interacting With a chat bot. 56 00:07:40,770 --> 00:07:44,650 Now we have an llm that is Going to capture the question. 57 00:07:44,710 --> 00:08:01,990 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, 58 00:08:01,990 --> 00:08:02,630 right? 59 00:08:02,630 --> 00:08:16,130 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? 60 00:08:16,130 --> 00:08:20,670 That's the basic idea of an llm-based agent. 61 00:08:20,810 --> 00:08:33,710 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. 62 00:08:33,710 --> 00:08:45,710 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. 63 00:08:47,510 --> 00:09:08,390 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. 64 00:09:08,390 --> 00:09:11,030 But right now, it's not being exposed to anything, right? 65 00:09:11,030 --> 00:09:21,890 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. 66 00:09:21,890 --> 00:09:24,990 So chain of thought was one of the first techniques. 67 00:09:26,230 --> 00:09:32,150 And reasoning is not enough, so what that means is we need to Expose this to the world. 68 00:09:32,550 --> 00:09:42,030 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. 69 00:09:42,230 --> 00:09:59,130 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, 70 00:09:59,130 --> 00:10:07,350 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. 71 00:10:07,350 --> 00:10:15,230 That's the basic concept of react, and the idea is to follow This pattern of thought, action, and observation. 72 00:10:15,370 --> 00:10:18,290 Thought, you're going to think about what it is you need to do. 73 00:10:18,650 --> 00:10:28,150 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. 74 00:10:28,530 --> 00:10:47,810 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, 75 00:10:47,810 --> 00:10:50,870 Let's say, researchers or applied scientists in the world. 76 00:10:53,030 --> 00:11:01,270 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. 77 00:11:02,830 --> 00:11:08,470 Now, when we talk about Tooling, execution of tools, there's a couple of ways that You can do it. 78 00:11:08,470 --> 00:11:18,050 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. 79 00:11:18,050 --> 00:11:22,190 You can actually pass a function signature. 80 00:11:22,190 --> 00:11:25,130 So think about a python function that you define. 81 00:11:25,130 --> 00:11:42,890 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. 82 00:11:42,910 --> 00:11:51,670 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. 83 00:11:53,750 --> 00:12:06,550 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. 84 00:12:06,610 --> 00:12:20,810 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. 85 00:12:20,810 --> 00:12:24,010 So remember, llms do not Execute actions. 86 00:12:24,010 --> 00:12:31,330 They just tell you how to Execute the actions based on your question and the type of Tools that it has available. 87 00:12:31,610 --> 00:12:48,870 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, 88 00:12:48,870 --> 00:12:51,710 you're Sending the response with the same tool id. 89 00:12:52,030 --> 00:12:57,550 And if there is multiple tools to execute, then it knows that There is more now to execute. 90 00:12:57,550 --> 00:13:01,590 Thank you for executing this First tool, let's move to the next one, right? 91 00:13:01,590 --> 00:13:23,370 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, 92 00:13:23,370 --> 00:13:27,010 so that it turns into, like, a more friendly Conversation. 93 00:13:27,870 --> 00:13:38,210 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. 94 00:13:38,210 --> 00:13:42,130 But, of course, not every single llm has that. 95 00:13:42,130 --> 00:14:01,670 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. 96 00:14:01,670 --> 00:14:17,410 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, 97 00:14:17,410 --> 00:14:23,950 and that's a little painful, but a lot of Llms are getting better at actually outputting json. 98 00:14:24,030 --> 00:14:41,470 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? 99 00:14:43,450 --> 00:14:44,390 All right. 100 00:14:44,390 --> 00:15:01,310 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, 101 00:15:01,310 --> 00:15:06,450 hey, which tool is Should i actually use for this specific use case, right? 102 00:15:06,450 --> 00:15:14,850 So that's the basic concept of using one llm-based ai agent for An agentic approach. 103 00:15:18,070 --> 00:15:26,250 So now let's move to the Multi-agent world, right? 104 00:15:26,250 --> 00:15:36,010 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. 105 00:15:36,010 --> 00:15:58,530 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. 106 00:15:58,530 --> 00:16:19,450 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, 107 00:16:19,450 --> 00:16:34,870 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? 108 00:16:34,870 --> 00:16:38,990 That's the concept of multi-agents in here. 109 00:16:39,890 --> 00:16:44,050 And this takes us to the concept of agentic workflows. 110 00:16:44,970 --> 00:16:57,310 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. 111 00:16:57,610 --> 00:17:00,210 You might want to keep the State of the task. 112 00:17:00,350 --> 00:17:04,130 You might want to pass the Output of one task to the next one. 113 00:17:04,710 --> 00:17:10,030 And that actually needs to be defined by multiple systems. 114 00:17:10,030 --> 00:17:22,330 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. 115 00:17:23,430 --> 00:17:24,750 So what does it mean? 116 00:17:24,750 --> 00:17:29,090 so usually when you have a Workflow , like this is what it looks like. 117 00:17:29,090 --> 00:17:31,530 Now we're getting into microsoft graph apis, right? 118 00:17:31,530 --> 00:17:47,870 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, 119 00:17:47,870 --> 00:17:48,530 right? 120 00:17:48,630 --> 00:18:11,130 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, 121 00:18:11,130 --> 00:18:14,870 right, that you want to just simply build a Wrapper around it, right? 122 00:18:15,770 --> 00:18:22,890 the agentic workflow will look Like something like this where you don't have to know about The apis. 123 00:18:23,190 --> 00:18:39,370 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. 124 00:18:39,450 --> 00:18:53,170 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. 125 00:18:53,170 --> 00:18:59,990 And once again, you Can make this very deterministic or you can simply say, figure It out, right? 126 00:18:59,990 --> 00:19:08,570 and the way how this figure it out means is Every single agent has a task and a description in natural Language. 127 00:19:08,570 --> 00:19:24,830 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? 128 00:19:24,850 --> 00:19:30,210 So i like this better because i don't have to think about the Api as much, right? 129 00:19:30,930 --> 00:19:40,270 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. 130 00:19:40,270 --> 00:19:58,890 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, 131 00:19:58,890 --> 00:19:59,130 right? 132 00:19:59,130 --> 00:20:03,630 so you can do a lot of that or Come up with the best marketing strategy. 133 00:20:03,630 --> 00:20:05,730 You can do that with a Workflow , right? 134 00:20:05,730 --> 00:20:11,930 but in security, i haven't seen so many Workflows or agentic patterns being used yet. 135 00:20:12,170 --> 00:20:16,230 So you have the sequential, which is pretty deterministic, Right? 136 00:20:16,230 --> 00:20:34,850 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, 137 00:20:34,850 --> 00:20:37,210 saying, hey, I want you to execute this. 138 00:20:37,210 --> 00:20:38,890 Let me know what's going on. 139 00:20:38,890 --> 00:20:45,570 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. 140 00:20:46,610 --> 00:20:58,070 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? 141 00:20:58,070 --> 00:21:05,690 So highly recommend to look into autogen and be able to see What makes sense for your use case. 142 00:21:05,710 --> 00:21:10,270 Something very simple, such as just, let's go to the next one. 143 00:21:10,430 --> 00:21:28,570 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, 144 00:21:28,570 --> 00:21:32,950 the first task is going to be passed to the next One, and the next one, and the next one. 145 00:21:32,950 --> 00:21:49,290 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? 146 00:21:49,290 --> 00:21:56,430 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? 147 00:21:56,430 --> 00:22:12,490 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, 148 00:22:12,490 --> 00:22:17,350 more data, so let's Probably execute other workflows or other tools. 149 00:22:17,350 --> 00:22:23,030 That's the value of having the llm-based agents in this type Of concept . 150 00:22:25,050 --> 00:22:45,590 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, 151 00:22:45,590 --> 00:22:51,330 because, remember, it is a conversation across Llm-based applications, right, agents. 152 00:22:53,950 --> 00:23:11,350 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, 153 00:23:11,350 --> 00:23:30,190 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, 154 00:23:30,190 --> 00:23:48,670 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, 155 00:23:48,670 --> 00:23:53,270 right, because if you see in the code, It's like a very long script. 156 00:23:53,650 --> 00:24:01,870 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? 157 00:24:03,790 --> 00:24:09,350 So now let's dive into what does that mean from agent and Microsoft graph api. 158 00:24:09,410 --> 00:24:20,150 The first idea was we have a Prompt where we could actually get some of the microsoft graph Open api specifications. 159 00:24:20,550 --> 00:24:27,210 We can pass it in the prompt and Say, hey, i'm trying to do x, let's say create a user. 160 00:24:27,450 --> 00:24:39,490 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. 161 00:24:39,810 --> 00:24:41,130 That was the basics. 162 00:24:41,250 --> 00:24:49,410 And then you can have the access tokens being part of the Tooling and simply the tool will communicate with the Microsoft graph api. 163 00:24:49,410 --> 00:24:51,930 But that's not sustainable, Right? 164 00:24:51,930 --> 00:25:01,390 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. 165 00:25:02,530 --> 00:25:04,210 And this is an example. 166 00:25:04,210 --> 00:25:14,430 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. 167 00:25:14,650 --> 00:25:15,250 Okay? 168 00:25:15,430 --> 00:25:36,210 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, 169 00:25:36,210 --> 00:25:49,710 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. 170 00:25:49,910 --> 00:26:00,510 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. 171 00:26:00,510 --> 00:26:06,810 And that's the whole concept of using agents combined with a Rag tool. 172 00:26:06,810 --> 00:26:17,030 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. 173 00:26:18,510 --> 00:26:20,510 So, what does that look like? 174 00:26:20,630 --> 00:26:22,510 let's go directly to the code. 175 00:26:22,990 --> 00:26:32,750 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. 176 00:26:33,570 --> 00:26:42,410 It needs some cleaning in the Documentation, but the idea is how we can define all these Agents in a more structured way. 177 00:26:42,590 --> 00:26:56,990 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. 178 00:26:56,990 --> 00:27:04,470 Then i define my header, pretty much, i pass an application With a client secret. 179 00:27:04,870 --> 00:27:26,090 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, 180 00:27:26,090 --> 00:27:29,190 and you can see this is only one example. 181 00:27:29,190 --> 00:27:35,770 Pretty much think about this as an application that understands The api very well. 182 00:27:36,050 --> 00:27:43,430 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? 183 00:27:43,430 --> 00:27:48,870 There is a lot of things that we're missing from a security Research perspective, in my opinion. 184 00:27:49,670 --> 00:27:57,910 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. 185 00:27:58,450 --> 00:28:10,770 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? 186 00:28:11,390 --> 00:28:19,990 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. 187 00:28:20,110 --> 00:28:26,950 So if i ask it about the weather, it's going to say, no, I'm a microsoft graph api security researcher as well. 188 00:28:26,950 --> 00:28:29,370 I don't talk to you about the weather, right? 189 00:28:29,430 --> 00:28:35,650 You define the agent, i'm sorry, the llm client, and then you Pass the specifications. 190 00:28:36,770 --> 00:28:48,890 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. 191 00:28:50,410 --> 00:28:52,270 Let's go directly to here. 192 00:28:52,430 --> 00:28:59,130 So the first thing that i want To say is test if the rack tool actually works. 193 00:28:59,330 --> 00:29:04,470 So i pass a question, get information about a user with Idx. 194 00:29:04,670 --> 00:29:10,830 If i run that, it's going to Give me a couple of documents right here. 195 00:29:11,170 --> 00:29:18,190 It's going to tell me that these five apis in here can Actually be used for my task. 196 00:29:18,430 --> 00:29:20,970 And if i look into one of them, It's this one right here. 197 00:29:21,270 --> 00:29:26,370 If i want to get information About a user, i would use the get user api. 198 00:29:26,430 --> 00:29:29,870 But that was in the hundreds of apis in there. 199 00:29:30,190 --> 00:29:37,030 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. 200 00:29:37,390 --> 00:29:50,310 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. 201 00:29:50,410 --> 00:29:59,730 And remember, language models, Especially large language models, they do have a very Good understanding, statistical understanding of words in Paragraph and text. 202 00:29:59,730 --> 00:30:07,050 So i would trust this one a Little bit better to pick out of five, to pick the one that i Need to execute. 203 00:30:08,110 --> 00:30:10,050 We go all the way down. 204 00:30:10,050 --> 00:30:13,430 And then i just run the agent right now. 205 00:30:14,390 --> 00:30:24,250 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. 206 00:30:24,530 --> 00:30:30,390 Once you find the api, i want You to, let's just go here, i want you to execute it. 207 00:30:30,830 --> 00:30:36,410 And one of my tools is to actually execute apis, like a Very dynamic function. 208 00:30:36,410 --> 00:30:52,230 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. 209 00:30:52,310 --> 00:30:55,810 And the parameter that you need to use is the user id. 210 00:30:56,070 --> 00:31:00,250 All of this done by the llm, right? 211 00:31:00,250 --> 00:31:03,810 And by picking the right apis from the vector database. 212 00:31:04,290 --> 00:31:15,510 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. 213 00:31:15,970 --> 00:31:25,890 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. 214 00:31:25,890 --> 00:31:34,990 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? 215 00:31:36,290 --> 00:31:49,570 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. 216 00:31:49,570 --> 00:32:10,570 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, 217 00:32:10,570 --> 00:32:30,230 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. 218 00:32:30,230 --> 00:32:39,010 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. 219 00:32:39,010 --> 00:32:48,790 I want to have an agent that understands users, groups, Applications, security, and be able to collaborate and do Everything together. 220 00:32:50,770 --> 00:32:55,450 And that tool is going to be Released today, so that's the link over there. 221 00:32:55,450 --> 00:33:01,950 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. 222 00:33:01,950 --> 00:33:03,270 Thank you very much, everyone. 223 00:33:03,270 --> 00:33:05,850 I hope you enjoyed this talk, and you can use it. 224 00:33:06,310 --> 00:33:07,170 Thank you.