Full transcript of “How Agentic Multi-Agent AI Works: Build Local Agents with AutoGen + Ollama”. Click a timestamp to open the video at that moment. Need another video? Use the YouTube transcript generator.
0:00 Hi guys, welcome back and today in this video be talking about what are agentic multi- aent systems and how they work. We have already talked about what is this AI agent and what they really do. Well, if you not really watched that video, I'll just give you a quick summary of what an AI agent is. An AI agent is a fully autonomous system that operates independently over extended period using various tools to accomplish the task. It can perceive, decide and act in an environment based on the goal that you give it to. And these agents are so powerful that they can autonomously act on behalf of you by using various different technologies such as uh the cloud anthropics MCP server which actually does the exact same operation by gaining access to your file system and it will do the operation
0:46 based on the goal that you give it. For example, if you ask it to go and change the uh log files extension, it will go change that for you using the power of MCP by gaining the access of the file system. Similarly, if you ask the um the agent to go and create a database in the docker container, it will do it for you because the agent will have those ability to access those system. That is how this agent actually works and we have already talked about it. And we also have got our own MCP playright server as well as the MCP database server which does those operations for you. So that is an AI agent in a nutshell. But now you may have already guessed what is this agentic multi- aent because it says multi- aent which mean it's going to be a collections or a group of agent which is going to perform those operation. You guessed it right. Well, an agentic multi- aent is a
1:33 network of multiple AI agents and each with a role working collaboratively or even competitively towards a specific goal that you throw it. These agents may communicate, delegate and coordinates dynamically to perform or achieve those operation. That is the power of this agentic multi- aent systems. They are so good that they also know that how to accomplish the task and how to make the work efficiently done and give you the response that you're looking for. Just think of these agents as a group of domain experts for a specific task. For instance, just assume that this agent is pretty good in the banking domain and this agent is pretty good in the healthcare and this guy is pretty good in searching online to get the answer
2:19 that are relevant details and documents for you and maybe this agent is pretty good in writing code to accomplish the same task to analyze whatever that you have analyzed from the online write the code and then send it to these agent to make the operation. So these coordinations can also be happening among these agent itself to accomplish this task. This is so powerful because this is what exactly many companies are now trying to build like a like a army of agents where this is going to achieve a specific task for you without you sweating by creating multiple different agents and uh asking one agent all the time. Rather you can just throw it to the group of agent using this multi- aentic system. They will do it for you. This is scary and quite amazing. This is
3:04 what is the uh agentic multi- aent system that you can think of and as that said this agent will be pretty good as it said uh it can do a task specialization like divide and conquer. You can do things parallelly and also it can keep scaling based on the number of agent that you create on the network and also you can uh and also these agents can be modular and reusable. They can be emergent intelligent which means they keep on learning to become more intelligent for you and they can be dynamically adaptable based on the questions and based on the task that that you give it to it and also it works on a complex workflow automation to achieve those operation. See these kind of things are pretty much like a RPA systems but they are very intelligent than an RPA itself in a nutshell. So
3:50 that's the power of the agentic multi- aent system. Now let's see an example of the real world agentic multi-agent system. Have you heard about the manus from Chinese company that's exactly doing the same thing that we're talking about. Similarly, there is something called as magentic one which actually do the exact same thing as well. It's from Microsoft and it does these same kind of operation like a group of the army of the AI agent which does those operation for you and also there is something called as agile coder which does the exact same thing by doing coding operation in multiple different agent to get the job done. So these are the real world agentic multi- aent system. But now we are going to see our own custom agentic multi- aent system like how I built it in very very less number of code to achieve these operation. You can
4:35 see that this is a simple uh custom agentic multi- aent system where I'll be using my local large language model to perform these operation u using QN 2.5 latest model. That's all. It's a very very super simple model as well and I'm running everything on my local Mac operating system. And you know what this is using a very very small uh small parameterized version of the uh model as well and it don't have access to the internet. So the information that you get will not be as accurate as you get from the uh open AI but it still works and I'll show you how it actually works. So you see that this guy is a uh is the ama which we're going to ask the question to which is going to be the model that we're going to be using. So we are going to have a research agent. So this agent's main functionality is
5:21 going to research on the given topic and then it will give you a real world example and then it will give you uh a response and then once the response is fully okay then it will say that research completed only then uh it will give you the research completed answer there and then it'll go to the coordinator agent where this coordinator agent's job is to coordinate on what is the next step that it has to do. So because you have got the research agent then the next step is that the coordinate agent will send it to the summarizer agent where the agent's task is to go and summarize the key points and organize the sections and create a bullet point and make it so concise so that it can be easily readable by the user who has asked that question. That is what this uh summarizer agent and then it will finally give you a response
6:08 saying the summary complete and then it will say terminate. That's what this guy will do. uh in the meantime if there is any exception happens or if there is any uh any errors happen or maybe the result which is generated by the summarizer agent is not quite up to date or quite relevant then it'll go to a fallback method where it will keep on uh getting all these outputs um to be regenerated from these agents and then it'll uh give you uh the response back. So this is how the coordinator agent will keep on doing that for you. So it it knows that the response which is coming up is not up to date or up to the mark. So it will keep asking the researcher agent to get even more detail and similarly the summarizer agent to summarize the information even better and then get the response. And if
6:53 the coordinator agent is happy with the response which is coming up then it will uh it will finally do a combined output of all the responses and then it will uh give a summary in the research summary over here. So in an nutshell there are three agents over here. One is the researcher agent, another one is the summarizer agent and there is a coordinator agent and there is going to be a group communication happen among all these agent to make an uh task achievable. And these kind of multi- aent system we can build using many different libraries available today. Some of them are lang chain and lang. You can also use autogen from Microsoft and Google ad or the agent development kit. We can also use that. You can also use the llama index if you wanted to. So there are many different tools available
7:39 and you can use these tools to build this agentic multi- aent system. We also have a course in our Udemy where we have built this entire uh thing uh using uh lang chain as you can see over here where we are going to be talking about how you can run the uh large language model using lama and how you can work with uh the lang chain the basic understanding of the lang chains and how you can work with the chat history create the chatbot using the streamlit applications and create a rag applications and how you can uh do a tool callings and function callings and how you can create an AI agents and then how you can evaluate all these operations that you have built over here using deep eval and raa. So that's all covered in this particular course. If you really not watched it before, I highly recommend you to do so. That's
8:26 about the the actual crux of how you can uh do everything from this particular uh lang chain for that matter. Well, as I said, I'll quickly show you a demo of how all these operation really works. All right, as you can see over here, I'm actually uh writing a simple code using autogen over here. Uh and you can see that I'm using a uh a simple uh configuration for my Olama. So this is the llama 3.2 uh model which I'm using over here. Uh and uh I'm using the uh lama running within my local machine. And this is the temperature as well. And this is the uh the assistant agent which is an uh researcher agent which is going to perform these operations. So basically I'm going to say a system message here saying you are a
9:11 researcher. Provide a concise information on the given topic. Focus on finding the relevant and accurate information about the subject matter. After providing your research say research complete to indicate you are done. Right? Similarly there is a summarizer agent which is going to do a summary of the uh of the points which is given by the researcher agent. Uh and then finally there is also a planner agent which is going to do a coordination between these two agent the research agent as well as the summarizer agent and once it is happy with the summary of the responses and the points which is generated by the researcher agent it will say terminate over here that is how things will happen uh over here and we also have got a group chat class which is going to register all the agents that we have got which is the planner researcher and summarizer uh and
9:58 it is going to give you it's going to do like a 20 rounds of tool call uh un unless until you actually stop in the middle. Uh it'll keep on doing that for you. And then it will do the speaker selection automatically. So I'll show you how the speaker selection works there. And there is a group chat manager which is going to do uh which is going to get the group chat as well as the the LLM configurations. Uh and that's it. And this is the this is the this code which we are going to be instantiate over here as the initiate chat. And we are going to uh get the uh the question that we're looking for. So I'm going to say find information on the impact of the AI in education and summarize it. This is the question that I'm asking and what's going to happen is it's going to go and ask multiple different agent to achieve this uh this operation for us over here. So the number of lines of
10:44 code that I have written is just 72 lines of code including the try catch blocks and some comments here and there. But it is going to do a lot of different operation for you. So I'm going to quickly show you how it actually works. The moment I run this particular code over here, look at that. This is going to invoke this uh chat manager which is the planner. It says find the information on the impact of AI in education and summarize it. The first thing is going to say okay I need to invoke the researcher agent. It knows that it needs to invoke the researcher agents. So it's going to go and invoke that and this guy will give you some positive impacts and negative impacts and future direction. And it says that the research is complete. And then it's going to go and invoke the summarizer agent where it's going to say okay here is the concise summary of the impact of the artificial intelligence in the education. And it's going to give you
11:30 the response and then it's going to say okay the next speaker is again summarizer agent but summarizer agent since it is terminated now it's not going to do anything for you over there. And it's going to say I kept the summary concise while maintaining the key point from the original research. If you like me to expand modify uh anything and feel free to ask. So they are communicating themselves. I'm not really asking that question. They are communicating themselves to do it. Uh and finally you see that the summarizer agent is giving the information saying terminate which means it's not ready to do anything any further. And then uh you will notice that it is it is going to give you the response over here. So this is how the agents are going to communicate for you over here. It depends on the question that you're really asking in. Now if you ask some other questions, the agents will keep on talking even further uh in
12:15 between themsel. For instance, I'm going to say what are the best countries to live in the world and also research which come country is less impacted with AI influence. Something I want to really ask uh we'll see if uh our AI agent can really get those response for me. So it's going to start doing it over here. Uh you can see that now it's see it's going to give me the researcher agent is going to give me the response and then the summar uh summarizer agent is coming up over there and it's summarizing the responses uh and it's again going to call the uh chat manager uh over here um it's going to give me the response I think because the response that it has
13:02 given already is pretty close to what we're looking for. So the planner says that okay terminate the answer looks quite right. So it has terminated for me over here. But if you want to keep on refining the response for you, you can also change the prompt over here. So you are a planner. Uh coordinate the workflow between the research and summarizer. Uh once you receive the final summary uh reply, terminate to end the conversation, return the response. Right? So what I'm going to do here is uh I'm just going to say uh try to analyze summary and if you are still not happy try to reinitiate the process and once you are happy then you say uh reply
13:47 with terminates uh over here right so this is something which I'm telling the uh the planner uh to keep on digging and get the response as much as possible so this something you're fine-tuning your prompt uh to to make sure that the response that you are getting in uh is actually uh is something that you're looking for uh or not. So see that now the researcher agent has given me this particular response. It's keep on calling the researcher agent again and again and again. See that is what the planet is doing. It's still not happy with the answer which is being generated and finally it feels like okay there we go. Now the response seems to be okay. Then it's sending it to the uh summarizer agent but still it's uh thinking that there may be still few a few more updation needs to happen uh but looks like the researcher agent has
14:34 given whatever that it can get out of and then it's giving you that this research is completed and finally the planner agent is again uh asking that I'm glad you could summarize the information but based on my analysis seems that Bhutan and this country are potentially the candidates of being less less impacted by the AI influence due to their limited technology advancement. and strong cultural heritage. So it's now again asking the research agent, can you get me some more information? See, now with simple change of a prompt, it can keep on asking or invoking the research agent to get a even more fine-tuned response. And now look at that. Now the research agent is giving even more responses for me over there. Uh and now it's uh calling the summarizer agent. Uh and then finally uh it's terminating. See the research agent
15:20 has finally terminate uh over here. Uh and look at that now that the planner is giving me that uh it is finding that this answer is more refined than what it thought before uh and it is finally going to quit over there. So this is quite amazing right like now these these agents are talking among themsel to get an response that it feels that it is fine. That is the reason why I told you that these agents are more like a domain expert where it's going to do things for me over there. Uh and finally it's going to quit over there. And there is a limitation within my own machine where I can't really do quite a lot of different operations simultaneously because already my fans are cranking uh to uh to actually get you the actual response uh correctly or fastly. But at least now
16:08 you can see that the research is completed uh even by the planner uh and the response that you have got over here is the actual upto-date information uh based on the question that you have thrown to it. So this is the power of the agentic multi- aent system where it's going to keep on talking among themsel and get you the answer that you're looking for. Uh and this is the world that we are heading towards right now where these agents are going to be like an army of AI agents who's going to do all these things for us removing us and get the responses back. So let me know your thoughts about all these craziness happening the technology. Once again thank you so much for watching this video. Catch you in the next one.