3- How To Build Agents With Claude Code
18:03

3- How To Build Agents With Claude Code

Krish Naik 05.05.2026 8 615 просмотров 183 лайков

Machine-readable: Markdown · JSON API · Site index

Поделиться Telegram VK Бот
Транскрипт Скачать .md
Анализ с AI
Описание видео
Watch the entire playlist: https://www.youtube.com/watch?v=CSgbgtmhkAk&list=PLZoTAELRMXVM9033R6vUH8NabsbJNW3Eg Create and use specialized AI subagents in Claude Code for task-specific workflows and improved context management. Subagents are specialized AI assistants that handle specific types of tasks. Use one when a side task would flood your main conversation with search results, logs, or file contents you won’t reference again: the subagent does that work in its own context and returns only the summary. Define a custom subagent when you keep spawning the same kind of worker with the same instructions. Each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions. When Claude encounters a task that matches a subagent’s description, it delegates to that subagent, which works independently and returns results. To see the context savings in practice, the context window visualization walks through a session where a subagent handles research in its own separate window. -------------------------------------------------------------------------------------------- Learn from me and my team Visit https://krishnaik.in/liveclasses

Оглавление (4 сегментов)

Segment 1 (00:00 - 05:00)

Hello guys. So we are going to continue the series of understanding the cloud code ecosystem and already in our previous section we have already seen how to go ahead and install the cloud code along with that we have understood the importance of cloudmd file and one task that I have specifically done you know we made a plan of creating a vectorless rag. So here is the Jupyter notebook that is already created. Along with that uh you know we had also told that when you are creating that Jupyter notebook also jol down an entire plan in this plan file. So that thing is also created so that for the reference purpose it can be actually used. Now in this section we are going to discuss about agents and sub aents. Uh we'll understand what agents or sub aents are. How do you go ahead and create those agents from scratch? what is the importance of agents and uh you know along with that I will also show you how to create a agent itself and how to apply that agent in your project there also some kind of built-in agents that are available I'll not say agent only we can also say it as sub aents okay but anyhow we will be discussing about all those things in this specific section so let me quickly go ahead and see at any point of time the cloud code documents are very good okay if you are not even able to understand the cloud code documents it is better to directly use cloud code. So, so let's say I will go ahead and ask hey what are agents and um and explain me how it can be used in this project. Okay. Now by default let's say uh when I'm asking this specific question right uh what are agents and explain me how it can be used in this project it'll definitely give me some kind of answers. Cloud code have also some in-built agents. Okay. Some of the agent name are some like status line setup, cloud code guide, each and everything is there. We'll understand. Okay. And these agents actually work whenever we are giving some kind of questions over here. So here you can see I've got the answer right. It says that agents in cloud code an agent is a separate cloud instance I can spawn via the agent tool to handle a focus task in its own context window. It returns a sim single summary back to me when done different from langchain create agent your notebook teach. Okay. So in u if you know about lang chain you know we use create agent to create a separate agent which will be working independently. So in cloud code also you can go ahead and independently create an agent and that can spawn like that can run you know uh as a separate cloud instance itself right. So that is the reason we say it as sub aents also available agent types. So what are agents available over here? So there are some agents like explore, plan, general purpose, claude code guide, status line setup. Okay. So all these are like inbuilt agents as I said you can see. Okay. Uh I will just go ahead and press control tab. Sorry not control tab. Just a second. Control uh shift So let me do one thing. Let me just go ahead and delete this cloud and open a new instance. Okay. And I'll just go ahead and write cla R. Okay. So I'm just trying to open my cloud again. Now here you'll be able to see when I asked about agents, right? If I press shift tab, see here except edit on is one agent. This plan modeon is one agent. Right? What does plan mode basically do? When you give a specific requirement, right? this plan mode on it runs a specific sub agent in the background which will be able to create a plan that will be working as an independent cloud instance. You really need to understand that right and many people you know like when you are specifically using it you know it is basically created as a sub agent itself right so let me again go ahead and ask uh a question over here what is uh agents include in claude and why should we use it okay see the reason why I'm showing you because I don't want to create a PPT and show you each and everything you know it is better to ask uh everything to claude and then we will be able to get that specific answer. This way you know you'll be able to understand why we are developing things and we'll try to run those agents completely from scratch that thing also you should be you'll be able to understand it okay so let this gets executed okay and then we will explore about the built-in as I showed you right built-in cloud code agents are also there like plan general purpose plan and there's also some agents that is already been created the name are like cloud code guide and all right so uh yes question is bit ambiguous agent in cloud could mean a few different thing I want to make or I want to answer. Okay, this is basically happening. Okay, it is basically again uh Okay, let me do one thing. Okay, I

Segment 2 (05:00 - 10:00)

will just go ahead and press escape. ask what are agents in plot code and why should we use it? See sometimes this kind of scenario will also happen and this see entire plan in the background how it is basically happening when I'm asking this question right it is basically getting executed in planned mode on right so now the thought process behind this will be in a different way okay uh in case of planned mode you know it basically makes a plan to answer a specific question now this is basically been done by an agent itself sub agent itself right now here I've got the Answer what are agents and why should we use it? So here it is basically written agent sub aents in cloud code. What are they specialized AI helpers? I can spawn via the agent tool. Each one run it own context window. Okay, this is also really important. Every sub agent run in on its own context window on its separate own memory which you can summarize it compact it whatever things you really want to do that is an independent or a separate clawed instance. Does it works and return a single summary message back to me? Think of them like co-workers. I delegate to them and they don't see our conversation only the prompt I hand them. Okay. Built-in are like explore plan. We have already discussed general purpose cloud code guide answer questions about cloud code itself the agent SDK. Right. So now what is basically happening when I'm asking anything related to cloud code automatically this uh cloud code guide is basically getting executed. The this agent SDK is basically getting clogged. Then you have status line configures your status line. Right? Why use them? Okay, there are multiple reasons why we should specifically use them. Context protection. A search across hundreds of file can dumb huge output. A sub agents reads it all then returns a 200word summary. Right? My main context stays clean. In case whenever you are working or using a sub agent, it does a specific task and its context is saved within that particular memory for that agent itself. Right? Parallelism. can run three agents in one message concurrently like many number of agents you can run it concurrently specialization each agent has focused a tool set and all all the information in them when not to use them you already know the file path just read it you know the exact symbol just grab it oneline retrieval task spawning an agent is overhead okay so for your boot camp worth noting that this concept is exactly the same idea as lang create agent so we have already created this IPv file over here so it is saying that cloud core sub agents just one product productized example of this pattern. Okay. Now uh let's do one thing. Okay. Let's run any of the agents. So here what I will be doing I will first of all go ahead and write agents in order to see how many agents have been created. So if you see over here there are agents running library. There are no agents right now. Right? So what I will do? I will go to the library. Okay. So here I'm in the library and there it shows a create a new agent. If I want to create a new agent I will go over here. Now here also you can see built-in agents are like cloud code hi uh guide it is basically using this haiku haq the name is haiku I guess general purpose inherit plan inherit status line setup and all right but our main is basically to create one agent right so I will just go ahead and um do one thing I will just uh go ahead and uh you know basically go ahead and create one of the agent over here so this is my agent um just a second I will uh we'll close all this file and let me go ahead and create one agent. Okay. So now here you can see that some suggestion is basically given for your boot camp. Worth noting that this concept is exactly this is there. Now I have gone to this I can okay so something is basically happening in this terminal but no worries. So now I will go ahead and create a new agent over here. So I'll go ahead and click on create new agent. You just need to move it from your arrow keys. Okay. And I'll press over here. Now there are two important things. It first of all asks me when I'm creating a new agent what location should I basically use? Should I actually create in a project that is on the project level or on the personal level? when I create on the personal level, this gets applied to every project, this specific agent. And if I'm selecting the first one that is on the project level, it will basically getting created over here. It'll create a dot cloud file and then it'll create a folder called as agents and it'll help me to create this specific agent itself. Right? So now I will go ahead and create like this. And then there are two more option after this. Okay. So I'm actually creating the agent in the project level and it is asking me generate with claude recommended. So I will go ahead and select this. Okay. Um once we do this

Segment 3 (10:00 - 15:00)

specific thing then it'll basically tell me describe me what this agent should do and when it should be used be comprehensive for best results. Okay. Now I will go ahead and you know give some agent. I'll try to create one agent and this will be basically for my purpose. Okay. So let me go ahead and uh write a prompt over here. I'll say that code improvement agent that scans files and suggest improvement for readability, performance and best practices. It should explain each issue and show the current code and provide an improved version. So this is what I really want my agent to do, right? So this is just one example what I'm actually specifically creating an agent for. My agent should probably go ahead and scan all the files and suggest improvement for readability, performance and bread. It should also explain each issue, right? I'll go ahead and press enter. This is what my agent should basically do. Now automatically you'll be able to see that one folder will also get created right in my project file. So it is saying generating agent from the description and is going to use claude for creating the specific agent. Okay. Now after this uh there may be scenario that it may also ask us what all tools our agent may probably go ahead and use. Now for this particular use case since I am telling that hey go ahead and just scan this specific project my project folder access if I'm able to give it that is more than sufficient. Okay. So uh right now it is basically generating an agent for description. So let's wait for some time and then we will should we should be able to so here now you can see that we have got selected now it is saying man that okay now what tools I really want to probably um select. So I can select all tools read only tools edit tools execution tools MCP tools and other tools. Now see this agent that we are basically creating is a code improvement agent right? So I'm not going to select all the tools. Instead I'll say only read only tools because the way of the reason why I'm saying this is that because it should only be able to access my entire project folder. It should be able to read the code and then give me the suggestion. Okay. Now once this is done I will go ahead and continue. Okay. And then it is paying telling me to select some of the models which model I should basically use for this particular agent. So there are model like set opus h highq inherit from parent. So I will just go ahead and press uh set and then it is also saying me that choose background color right. So I will just go ahead and say and see this is what is my agent name code improvement advisor right. So automatic color I will go ahead and select configure the uh agent memory where the memory should be configured whether it should be configured within the project scope or within a user scope or local scope. I've already explained you what is the difference between user scope and local scope. Local scope is basically in our desktop. User scope is specific for a uh user itself who is using the system. Right? So different location is basically over here. I'm going to basically go ahead and create for the project scope. Right? And here is my entire information with respect to the agents. The name is code improvement advisor. Then I have this location tools. We have given the excess of this globe grap red task stop web search and web search uh web fetch and web search. The model is set memory it is basically store iting storing it in the um you know same project location and then description tells cloud when to use this agent. Use this agent when the user asks for code improvement suggestion and all. Uh system prompt you are an allied code improvement advisor a senior prompt. So this is basically created by the cloud code itself. Right. System prompt is very long over 10,000 characters. So I will just go ahead and press enter to save it. Okay. Now my uh agent is basically there. Now what I will be doing is that I will go ahead and see in the library. And here is my project agent code improvement advisor. So let me just go ahead and press enter. I will say go ahead and run this particular agent. So once this agent is basically created, we'll try to run this particular code improvement advisor. I'll describe a task. I'll say review the code of the entire project. Okay. And provide me suggestions. So this is what I'm actually telling to do. Now you can see that it is going to run this particular code improvement advisor. So now here you can see that the entire code improvement advisor uh which is for this particular project is basically running as an agent and automatically it'll be running it over here. You could see that how we did we configure the memory how did we do everything evaluations everything is basically happening and it is just going to go ahead and give me all the things over here right with respect to the user. Now this is really important. One more thing that I really want to show you over here is that see in the dotcloud folder right here you have agent memory. This is for the code improvement and here is your code improvement advisor. Right now you can see in the format how it is basically created this MD file. So here you can

Segment 4 (15:00 - 18:00)

have see that code improvement advisor is there description use this agent for so and so task tools access model access you are an allied code improvement advisor. So here you can see the scope is also given the project aware behavior is also given right analysis methodology read the entire file. So automatically this is basically created by the cloud right. So and again based on the best practices that is available in the cloud code automatically this will get created. Now here you can see uh all the code improvement advisor agent is basically running and you can basically run it for the entire project. You can even ask suggestions you know this is really important. You can even ask suggestions by cloud code where you should basically use all these kind of sub aents for what kind of task and automatically by seeing your folders project folder structure itself right it'll be able to tell you now uh inside this agent you could see that okay code improvement advisor is over here and this is the description this is how the format is tools model memory right as you went ahead and selected right based on that this entire MD file is basically getting created okay now this will basically be running independently. Okay. Um you don't even have to uh you know as I said like you can also go ahead and open another command prompt. You can go ahead and write cloud over here and you can start a different instance automatically. Right? This is going to run parallelly since we are running everything with respect to the agent. Right? Uh so automatically this is basically happening this many number of tokens has been used. You know this is one of the thing that I feel uh about cloud code. You know lot of tokens will be gone. So here you can see the agent reviewed the entire project. Here are the highlights. Prioritize high severity. U these all files it is saying open call user establish search with no import student crash on cell 2. Right? Automatically it is showing me medium severity low severity. I'm still in plan mode so nothing has been changed. If you want I can either pick a subset and write a proper plan to plan MD for execution. Just hand back to you so that you can act whichever item you are uh you care about. Right. So now I can probably go ahead and provide lot of suggestions with respect to this. Uh this is just a one of the idea like how you can go ahead and work with the subway agents right and uh I've shown you how to create a sub agent from scratch. I've shown you uh you know how to probably go ahead and uh create a sub agent from scratch itself as I said and then you can also go ahead and see the context. Now if I go ahead and write context over here so automatically you'll be able to see the context being used. Okay. Um over here the context is basically you can also compact this particular context right custom agent/ agents project this this is there memory files you can see how many number of memory files like how much tokens is basically saved with respect to this right and there is also one more concepts with respect to the agents you can still make sure to and always remember you have to see this structure how it is basically getting created right this is how a sub aent structure looks

Другие видео автора — Krish Naik

Ctrl+V

Экстракт Знаний в Telegram

Экстракты и дистилляты из лучших YouTube-каналов — сразу после публикации.

Подписаться

Дайджест Экстрактов

Лучшие методички за неделю — каждый понедельник