WEBVTT

00:00:00.000 --> 00:00:34.690
In today's video, we're gonna build out our own coding agent like Claude Code. Most vibe coding tutorials show you how to max out Claude Code with skills or settings. They don't explain the core fundamentals. I've been coding more than thirty years and the fundamentals have always been my advantage. You need the fundamentals if you wanna build something great and if you wanna build agentic agents into your projects. Just like the second brain I'm building out inside my community, it's an Obsidian clone except that it has an agentic agent built directly inside of it. So if you want the advantage in your coding projects, stick around to the end of the video. Let's get into it. Alright. So let's jump in. I'm gonna jump over to Cloud Code. I'm gonna make a new directory

00:00:34.850 --> 00:00:35.970
coding agent

00:00:36.610 --> 00:00:41.490
and load up Cloud Code and then I'm just gonna grab this prompt here that will build out

00:00:42.055 --> 00:01:47.655
our agent. It looks long but it's not really and we're just gonna paste this in here and we're gonna let it run and while it's building I'll have a chance to explain more about coding agents and what they are and really demystify how they work. So at the heart of it when you're using something like Cloud Code, you've got this terminal here and you're able to send it messages. You send that message. The magic is really it's just an LLM running in a loop. So if you're used to something like n eight n, you've probably used something like this where you send a provider like OpenAI or Anthropic a prompt and then you get a response. Now that's the same thing that's happening with a coding agent like Cloud Code. You give it a message, the model decides what to do. Coding agents typically run some sort of tool, right, because they're running on your computer. So they have access to, you know, look at your files and write files and read files. So the agent is deciding what to do. It runs that tool and then at the end the agent looks at what it did and then the agent reads the result of that tool and then at the end it decides, hey, did we get the job done? And if not, it just continues that process in a loop until it feels like it completed the task you gave it in this original request

00:01:47.815 --> 00:02:21.215
and then it replies back to you. And in n eight n, they solve that same problem with the AI agent here. It does the same thing. It's really doing the same thing as this except there is a loop here where something decides whether it's done or not and if not, it just sends it back into the message again until it's done and then it comes out the other end. And you can see here even this message model here has a place to add tools, right? So this is like a built in feature that OpenAI and Anthropic have had for a long time. This is nothing new. The agent is nothing more than the loop itself

00:02:21.510 --> 00:02:51.010
and the ability to run these tools on your computer. So if I come back here to Cloud Code, it looks like it's actually already done. It's a very small program. So we sent it the prompt. It decided to figure out what version of node I was running. Decided it wasn't done, so it decided to run another tool just like you would have sent a message in n eight n. It wrote the file, it decided it wasn't done yet. It wrote another file, decided it wasn't done yet. It wrote another file, decided it wasn't done yet until it had done all of the work, decided it was done and replies back to us with the task complete.

00:02:51.010 --> 00:02:54.770
And what really gives these coding agents a lot of power, the LLM

00:02:54.850 --> 00:02:58.850
has access to these tools where they can read and write

00:02:59.170 --> 00:03:00.930
and run commands

00:03:01.650 --> 00:03:10.925
on our computer which you couldn't really do on something like n eight m because these tools running inside of the cloud do not have access to whatever is running

00:03:11.085 --> 00:03:21.405
on your local computer. Now one other thing to touch on as well which is pretty interesting when you start to think about these different agents here. While it's running inside of this loop, every single call

00:03:21.780 --> 00:03:26.020
to the LLM agent is starting from scratch. It's simply remembering

00:03:26.260 --> 00:03:45.915
all of the things that you asked it and then all of the things that the agent came back with and each time this is obviously getting longer and longer and longer and it just keeps feeding this back into the agent over and over and over again. Every time you send this a message and that's why we have this memory here on these AI agents, we just continue to send that same conversation

00:03:46.280 --> 00:03:58.200
back into the LLM over and over and over and it gets longer and longer and it looks at that conversation to understand what it should do next. Now one thing I do wanna mention in this particular video is I'm using this SDK called the Vercel

00:03:58.535 --> 00:04:11.735
AI SDK, but it's a free library that helps you build these types of things. And specifically, when I build this coding agent, I didn't want it to be tied to a specific provider or a specific model. I wanted it to be able to work with

00:04:12.070 --> 00:04:13.190
OpenAI

00:04:13.430 --> 00:04:14.630
or Anthropic

00:04:14.630 --> 00:04:38.075
or really any of the other LLMs out there. And what it provides is basically an abstraction. So it gives you this ability to message a model. And I guess it's a lot like this as well where you come in here and you select which model you want in your n eight n automation. So instead of building your coding agent to work with a specific provider, you use this SDK and it allows you to configure it. You send the message to the SDK,

00:04:38.820 --> 00:05:01.805
you configured it to work with a specific model and then it will call that model and it will abstract all of the differences so that you can use one single call and at any time you can switch from model one to model two and you're never locked into a single provider. Now this SDK does a whole bunch of other things as well. It actually has its own coding agent built into it as well but again in this example we are building out our own

00:05:02.205 --> 00:05:12.710
coding agent just to really understand the fundamentals. If you're enjoying this video make sure to like and subscribe it tells me what type of content you want more of. Alright. So let's get back to Cloud Code. I'm gonna open up this project in Visual Studio

00:05:13.030 --> 00:06:03.085
Code. We can see the different files that it created and here's the main one, our agent. So we'll open that up. Notice at the top here, we are including a couple of different libraries, one for Anthropic so that our coding agent works with Anthropic and we also added another one for DeepSeek and we could add libraries for all the others. Here we gave our agent a system prompt that it's a CLI coding agent and describing what it has access to. It can read files, write files, and run shell commands. Shell commands are the things that we type here like l s to list all the files in our terminal. Here are all the different tools that we define, so obviously we can write other tools as well. It wrote a function to actually execute each of these different tools. It created a object here with a list of all of the different providers. So if we added other providers, would just add those in there. Few other functions here to help set everything up. A function here to call the model. You can see it's passing in a system message,

00:06:03.530 --> 00:06:04.970
the actual messages.

00:06:05.290 --> 00:06:35.380
We talked about that earlier. That's the memory. The messages that we have that we build up over time between you and the agent. We pass in the tools and then here's where we send in the actual user input and here's that loop, that while loop. This is a loop in your code and then it just loops forever. This is basically saying loop while this is true and we're passing true. So it's just gonna keep looping. So let's go into our shell here. Actually first, I'm gonna need to set up the environment variables. It's defaulting to use anthropic with this model and now we got to put in an API key.

00:06:35.620 --> 00:06:36.820
Let me grab that.

00:06:37.300 --> 00:06:38.580
Just drop that here.

00:06:40.980 --> 00:06:48.715
Save it. Come back to the terminal, CD into the coding agent. We can look back to the instructions on how to run the

00:06:48.955 --> 00:06:51.275
agent. I believe we can just do NPM

00:06:51.835 --> 00:06:55.195
start. We're actually running our own agent. We can type in

00:06:56.235 --> 00:06:59.310
anything we want. Let's just go type test.

00:07:00.030 --> 00:07:10.510
So you can see it's streaming back to us. That's one of the things that the AI SDK gave us the ability to. If you remember when you're using AI agents or if you're using cloud or OpenAI,

00:07:10.510 --> 00:07:16.355
whenever you ask it a question it streams it to you. It gives it to you live in bits. You don't just ask it a question

00:07:16.595 --> 00:07:31.250
and it goes and thinks for ten seconds and there's just dead space and then it responds back. So when you are developing your own AI agents or coding agents, you want to make sure you're always streaming the response back so it feels more responsive. So we can go ahead and say, show me

00:07:31.570 --> 00:07:33.090
all the all

00:07:33.490 --> 00:07:36.770
the files in this directory.

00:07:37.170 --> 00:07:39.330
So now you can see it's running a tool. Right?

00:07:40.145 --> 00:07:44.145
And now it's just listing the files. So here it ran the command

00:07:44.545 --> 00:07:56.750
l s dash l a. The dash l a just means that it listed them down this way and the a means that it responds hidden files like the dot ENV file. So now we should be able to say

00:07:57.310 --> 00:07:59.870
create me a Node

00:08:00.110 --> 00:08:00.990
JS

00:08:01.150 --> 00:08:01.950
hello

00:08:01.950 --> 00:08:02.750
world

00:08:03.150 --> 00:08:19.925
program. And for anybody that's not familiar with the hello world program, if you're a computer science major, when you take your first programming lesson, the first thing that they do is they tell you to create an application that just says hello world. Nowadays, this seems so basic, it's kind of anticlimactic

00:08:20.170 --> 00:08:23.770
but it's just a good exercise to go through. So let's go ahead and run that.

00:08:26.810 --> 00:08:31.850
So we built our own coding agent here. We have a new file called hello j s

00:08:32.090 --> 00:08:37.155
and it's right here and it tells us how to run it. So we can just grab this,

00:08:37.795 --> 00:09:00.660
we can open up another terminal and we'll run it and we've got hello world. Now let's use it to actually solve a problem. I'm not sure if you're familiar with that question. Would you rather have a million dollars today or would you rather have a penny that is doubled every day for thirty days? So let's write a program that'll solve that for us. Write a program that will solve the question,

00:09:00.980 --> 00:09:03.220
would it be smarter

00:09:03.655 --> 00:09:04.375
to

00:09:04.535 --> 00:09:06.135
have a million

00:09:06.615 --> 00:09:07.495
dollars

00:09:07.735 --> 00:09:08.455
today

00:09:09.095 --> 00:09:10.295
or a

00:09:10.935 --> 00:09:15.895
penny that is doubled every day for thirty days?

00:09:16.055 --> 00:09:18.855
Create a program that loops

00:09:19.170 --> 00:09:19.970
through

00:09:20.130 --> 00:09:20.850
and

00:09:21.170 --> 00:09:22.930
doubles the value

00:09:23.570 --> 00:09:25.330
showing each day

00:09:25.650 --> 00:09:28.050
and the final output.

00:09:28.290 --> 00:09:29.170
So we'll run that.

00:09:33.265 --> 00:09:36.225
Cool. So there we go. Let's jump back over here.

00:09:36.465 --> 00:09:39.825
Now we've got the penny app. Okay? So now let's do node

00:09:39.905 --> 00:09:40.625
penny

00:09:41.425 --> 00:09:43.985
and we've got our answer here. Pennies

00:09:44.710 --> 00:09:45.590
$1.02

00:09:45.590 --> 00:09:46.710
so

00:09:46.710 --> 00:09:47.750
thirty days.

00:09:48.390 --> 00:10:08.795
Wow. So that's obviously much better. I'll take the 5,000,000 over the million. And then if we look inside the penny app, again, we're gonna see a loop. This loop is a little bit different. So this is a for loop. There's two different types of loops. There's while loops and for loops. What this is saying is let day equal one. So it's taking this variable here and it's setting it to one. So it's day one and it's saying loop

00:10:08.955 --> 00:10:10.235
until this day

00:10:10.550 --> 00:10:25.190
is greater than days. And what is days? Days is 30. Okay? So day equals one, keep looping until this is less than 30 and then at the end of the loop right here, it doesn't say it. We we write it here.

00:10:25.885 --> 00:10:30.925
Just showing you some basics. Where that actually happens is right here and the plus plus means

00:10:31.245 --> 00:10:33.005
add one today.

00:10:33.005 --> 00:10:37.645
So then it outputs to the console and when people say console, when you see console log,

00:10:37.805 --> 00:10:43.340
what that just means is right here. It's saying output that right here. This is the console and then you can see here

00:10:43.820 --> 00:11:02.925
that it's outputting the day and then you can see the little pipe here. So you don't need to understand all of this here. I'm just trying to show you little elements of it. Here's the pipe. Here's the day, here's the value of the doubling penny. It's basically doubling the value of pennies every day. This here is essentially the equivalent of doing something like this, pennies

00:11:03.005 --> 00:11:03.965
equals

00:11:04.285 --> 00:11:05.085
pennies

00:11:05.965 --> 00:11:07.005
times two.

00:11:07.680 --> 00:11:18.080
These two are functionally the same, it's just written this is like shorthand for computers. And then it loops, we see it all the way to 30 and then increments it one more time. Now days equals 31.

00:11:18.080 --> 00:11:25.695
So now this statement here is no longer true because now day is 31 and it's greater than this. So it breaks out of the loop and then it displays

00:11:26.095 --> 00:11:36.900
those final results. Now again, there's lots of different types of coding agents. You don't really have to build your own. Like I said in this library here, there's a coding agent you can use Cloud,

00:11:37.060 --> 00:12:02.955
agent SDK, there's the py coding agent that was made famous by OpenCloud. You can just import those directly into your project without having to build your own. But knowing how to build it is important and there might be times where you might want to, but even more importantly, the point is here is that where we're going with software, most software is gonna be agentic software. It's gonna have an AI agent at the center of it. What I noticed is most people that are getting into vibe coding, because this is what they know most,

00:12:03.195 --> 00:12:15.090
is they go to build just traditional SaaS apps or they go and they want to build a bunch of dashboards. These things can be built in seconds. So you want to learn how to build software where it is agentic

00:12:15.090 --> 00:12:15.730
first.

00:12:15.970 --> 00:12:23.355
It everything revolves around the agent. Because if you think about traditional software, and this is a really important insight for you to understand,

00:12:23.595 --> 00:12:27.115
is that it's all built around a user interface

00:12:27.115 --> 00:12:30.075
that is supposed to make it easier for people

00:12:30.395 --> 00:12:35.540
to use. And then not only that, but you have to build out all of these UI elements

00:12:35.540 --> 00:12:52.135
one by one, feature by feature, and that's very difficult. It's very difficult to build software that people actually like to use. A gentic first software revolves around a chat. You don't have to build all the features. I can just ask my app to do something. I can say, hey, delete this file, delete that file. I can say delete

00:12:52.455 --> 00:12:53.335
all the

00:12:53.975 --> 00:12:55.495
untitled

00:12:55.495 --> 00:13:10.770
MD files. Right? I don't have to go delete them. I don't have to create an interface. I do have it. Notice how I just delete it here. So you can just talk to your app. This is the future. Right? And like what if I want to do some research and then put it into my note taking app? Well, could go over to Claude and I could say,

00:13:11.090 --> 00:13:12.690
what are all the

00:13:13.225 --> 00:13:14.265
schools

00:13:14.825 --> 00:13:15.705
in

00:13:16.025 --> 00:13:17.065
Riverside,

00:13:17.225 --> 00:13:18.025
California.

00:13:18.105 --> 00:13:25.305
Right? I could wait for it to run, could cut and paste it or in my note taking app I could add a feature where I can just ask it directly in the app

00:13:26.310 --> 00:13:35.910
and it can just give me the response directly inside of the app and this is the Obsidian clone that I'm building. Right? So you get that all here and then what if you want to rewrite something?

00:13:38.630 --> 00:13:41.830
Give me the top five schools

00:13:42.925 --> 00:13:43.725
only.

00:13:45.245 --> 00:14:06.740
And I can just have it rewrite it. So I'm building this software called Shockwave with an AI agent mindset at the center of it versus just trying to replicate traditional apps that have been built and nobody's looking for. Because just remember, vibe coders come in, they wanna build traditional things, but what are the consumers looking for? What does everyone want? They want AI

00:14:06.740 --> 00:14:07.140
agents.

00:14:08.020 --> 00:14:19.455
They don't want software that makes it easy for them, they want software that does all of the work for them. Now if you wanna join a community where you can learn how to do all this stuff and you wanna see me literally build out this entire

00:14:19.615 --> 00:14:38.050
second brain app that I just showed you here, make sure to jump into the AI architects. I'm totally revamping the classroom from start. I've got these live builds and I'm building out a full course that takes you from an absolute beginner to an expert AI product engineer. It's an amazing group. I'd love to see you there. But either way, hope you enjoyed this video and I'll see you on the
