📹 Hands-On Walkthrough: Building Your First Subagent in Claude Code
Jules Boiteux
4 months ago
Transcript
00:00
All right, now that we saw how my cloud code setup does work, let's actually build it from scratch So we are going to at a custom agent that enables to refine the content of an email, let's say just for like fixing grammatical mistakes etc.
00:23
So what we're going to do is that we are first going to actually create a new folder that will be used for our email know code code, sub agent setup.
00:33
Okay.
00:33
So I'm going to call it aicopilot, demo here.
00:40
So here we go.
00:41
I'm going to actually show you also how to install cloud code.
00:46
If you haven't done it, you'll see it's actually very, very simple.
00:50
There's only one command to run for this and I'm going to show it to you.
00:56
So this is inside cloud code documentation and there's actually one command to run which is NPM install.
01:06
So yeah, for me it was way shorter because it's already installed.
01:11
But once you have done that, what's happening is that you have cloud code installed on your environment.
01:15
So that means that by typing cloth inside the terminal you already have access to cloud code AI.
01:25
All right, and here we go.
01:28
So the first step that you need to do is actually to set up the custom sub agent.
01:35
To do so it's very, very simple.
01:37
You just need to type agents tab and then create a new agent.
01:44
So you see that I already have my built in agent here.
01:47
I'm going to set it up on this specific project.
01:50
What that means is the agent will not be available in other folders in other projects.
01:58
while if you set it up on your personal environment then it will be available from any projects that is located under the root path of your environment.
02:11
Okay, so I'm going to generate with cloud and here I'm going to give the specific instruction.
02:19
Okay.
02:19
All right, so this agent goal is to refine an email that I have drafted.
02:26
And and I don't necessarily want to update the content or to rethink the content or change the tone.
02:37
I just want to fix grammatical mistakes or maybe like clumsy formulation that I may have used.
02:45
I also know that I tend to write up long sentences.
02:49
So if you can break them down.
02:52
that will be also very interesting for me.
02:55
So yeah, again inputs an email and outputs a refined, sharper email that you know, has the same content but it's just formulated in a way with no grammatical mistakes.
03:12
Don't hesitate to be like a very thorough when you are giving those instructions and following this instruction here, Cloud code is actually going to generate specific instructions.
03:26
Actually there will be two parts inside this agent.
03:30
The first part is like a description of what the agent does.
03:33
Why?
03:34
So because that way this will enable cloud code to understand when to call this specific agent.
03:42
you can choose then the model that you want to use.
03:47
So we're going to use Sonet here and you'll see that there's a second also content which is basically what are the tasks that should be followed by the agent.
03:58
Okay, so you can choose a color, etc.
04:00
And yeah, as you can see here, so a new folder claude has been added here.
04:06
and as you can see there's the description part again that is used by code to know when to use this specific agent.
04:16
And the second part is actually what are the tasks that are given to the agent?
04:23
What we're going to do is because we want to use them on very specific, very specific instructions.
04:37
What we're going to do is that we're not going to leave it that way.
04:40
What we're going to do is that we're going to add what we call the custom commands, which is basically a command that will be added to the list of slash command here and that will enable to like call on demand this specific agent.
04:56
Okay, so to do so it's very simple.
04:58
you're going to say that you want to create a custom command.
05:01
So I want to add a new custom command called email refine email, which will take as an input an email as an argument.
05:20
Let's say that's more exact term and that will give as output a refined email following the use of.
05:35
And you can directly call the newly created agent by using the command so email refiner agents.
05:45
So and then you can use Tab to autocomplete the name of the agent for the use of the agent.
05:51
Okay so it's going to create a new custom command that going to be able to reuse.
05:57
All right, so it's creating a new folder here under the cloud folder called Commands.
06:04
And normally it should add up a new File which will be the custom command.
06:09
And that's what you see here.
06:12
All right, so as you can see it has been added here.
06:15
And as you can see it takes as input this email content here.
06:22
And the specific instruction is to launch the email refiner agent following the email content, which is actually the argument that you will give as an input.
06:35
Just note that if you want to give more than one argument as inputs to the custom command, you can do so.
06:44
but to do so you should actually use the following format.
06:47
So the first argument should be this one one like this and the second argument should be this one, etc.
06:54
Etc.
06:54
If you have more than two or three arguments.
06:57
Okay?
06:58
so that way that enables cloud code to know which I mean in which order and which arguments argument is the right one depending on whether you, on how you want to use it.
07:08
Okay, so let's actually test this out.
07:12
So normally it should not be available right away and you need to actually restart Claude so that they update the content of the comments that are available.
07:22
And here normally yeah as you can see you can refine the email.
07:26
So again tap to autocomplete the name of the custom command.
07:32
And here we can add an email content.
07:34
So for example here I had a sample of email for Vibeconi Academy that I'm going to paste here.
07:43
and yeah as you can see, it's going to come up with a refined content.
07:49
Okay?
07:50
And as you can see the content has been created.
07:52
The problem here as you can see is that it hasn't been added like we wanted like somewhere where we can like iterate over it etc.
08:02
So it has just been added, provided as an answer.
08:05
Okay?
08:05
And that's where Obsidian comes in.
08:08
So the next step is actually to set up Obsidian.
08:12
Okay?
08:13
So Obsidian, as I referred to in the last video is a note taking tool that does interact with files on your local environment.
08:24
So once you have downloaded it what you can do is actually create a new vote, what they call a vote.
08:31
Okay?
08:32
So this vault is you can create it here.
08:36
So you just hit the create.
08:38
I'm going to call it like Obsidian demo, okay.
08:42
And I'm going to choose the location.
08:44
Okay.
08:44
And so the location that I'm going to opt for is actually the routes of the project that is going to be dedicated to this AI copilot.
08:55
Okay?
08:55
So I'm going to create it and as you can see it does create a new page and for now we don't have any content.
09:02
Okay.
09:02
We just have this welcome file.
09:04
However as you can see here we have a new folder that has been added.
09:10
And here the trick is actually to yeah let's remove actually the, the welcome file here.
09:18
And the trick is actually to add up a new folder in which we will ask explicitly the newly created agents to write up and add up actually the contents that we asked them to write.
09:33
Okay.
09:34
So I'm going to call it LinkedIn email email basically.
09:38
Okay, so that's a folder that is under the, the Obsidian demo folder which means that all the files that are going to be added below are going to be visible inside my newly created vault.
09:49
Okay.
09:50
And so what I'm going to say here is that I'm going to say okay cloud code please update email refiner agent.
09:58
So to do so again type and then the name of the agent.
10:03
Okay.
10:04
Tab for autocomplete of the name.
10:07
So please update Agent email refiner in such a way that the newly created content is added to and we are going to say that it's added to the Obsidian Demo folder also.
10:29
And we also going to give an instruction that says that they should you know the agent should take inspiration from the already existing content and follow follow the format that is already available there.
10:43
So that's where we are like doing and adding some rag to our you know workflow here.
10:50
It's by asking cloud code to explicitly reuse content and personal historical content basically.
10:59
Also make sure to use the same format as the already existing emails that have, that are available inside this specific folder.
11:18
Okay.
11:19
So that way it's going to update instructions to the agents and normally it should be able to now write a content in the right location.
11:30
Okay, so what's interesting here is that they proactively decided to actually add up the article inside the newly generated folder.
11:41
articles.
11:42
And here if we have a look at Obsidian now we can see that we do have to the content that was written up.
11:50
And that's where you know as I explained in the former video, you can actually iterate over the article manually directly from Obsidian or by using cloud code directly and asking them to update content So that's actually how to set up your, you know, cloth code, and AI agents, workflow.
12:10
obviously it takes a bit of time to add up all those, you know, agents that, can help you automate tasks and automate your workflows.
12:18
But the good thing is that I shared with you all my sub agents so you can take inspiration from them.
12:26
And in the next video, I'm going to actually show you exactly how to steal, my agents and just, like, replicate them on your own cloud code setup.