Lesson Description

The "CLI Agent Demo" Lesson is part of the full, AI Agents Fundamentals, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Scott explains how the course will cover building agents from scratch, covering the tool loop, decision frameworks, and iterative improvements, then demonstrates a personal agent that can make API calls, search the web, write files, and use approval mechanisms.

Preview

Transcript from the "CLI Agent Demo" Lesson

[00:00:00]
>> Scott Moss:So for this course, we're going to learn how to build agents from scratch, no framework. Everything from scratch, from the tool loop to the tools, the decision framework, and even how to improve it. The flow of the course, if you've taken any of my courses, it's mostly going to be us building up to something. So we're going to be working on a personal agent, kind of like an everything agent. It's not some vertical agent that does one thing, it kind of does everything.

[00:00:26]
If you're familiar with like Cursor or Claude Code, but without the coding abilities, that's what this is going to be. It's going to be an agent that just sits in your terminal and I'll show you what it's going to look like soon. But as far as the format goes, we'll have lessons. I have them all here in the notes for you. They're going to go in order from 1 to 9. Each lesson's going to build on top of each other, and each lesson will also have the code that you can copy if you don't want to follow along or maybe I'm moving too fast.

[00:00:53]
You can get the code from the lessons. You can also check out to the branch because each one of these lessons has a branch in the repo with the solution to the previous lesson on it. So you can check out to that branch, which is what I'll be doing to catch up and have that there. So, again, what are you going to learn this course? You're going to learn everything that goes into planning and building an agent.

[00:01:13]
And trust me when I tell you, it's a lot more than just, you know, grabbing an SDK and giving it a prompt and watching it go. Those demo very well and gone are the days of 2022, 2023 where you can get away with building something like that. So I'm going to share all the experience that I have from building agents in production for startups and at scale at massive companies. So that's pretty much everything that we're going to cover here.

[00:01:37]
Prerequisites, as long as you feel comfortable with TypeScript, Node, you're pretty much fine here. If you have experience building with LLMs, this will just be the next level for you, although that is not really required. You will need an OpenAI API key, which I believe does require you to add a credit card to the platform. Although cost-wise, this course will probably cost you less than a penny in usage, so don't worry about costs, but I do think you need to add the credit card and you will need some familiarity with working in the terminal.

[00:02:06]
So if you haven't worked in a terminal before, it's okay. You should be able to follow along, just copy what I'm doing, but yeah, we will be in the terminal seeing how the agent is going to be in the terminal. So now what I want to do is give you a tour of the repo and the agent that you're going to be building at the end of the course. So I'm just going to go into my terminal here. And this, again, is a different agent than the browser one that I just showed you.

[00:02:35]
That was a demo that looks really impressive, but will never be useful for anything in its current state. In this course, we're going to learn how to take the idea of something like that and improve upon it, right? So now we have this other agent here that we're going to call AGI. If you don't know, AGI stands for Artificial General Intelligence. It's the thing that every AI company is racing for, some AI that's generally intelligent as the smartest human.

[00:03:03]
So AGI is just a bubble term that, you know, we use as a joke. So I can type in AGI here as my CLI and then I can ask it to do stuff. So right now, this agent, unlike the one that I just showed you that had access to the browser, this one can do API calls, so it can search the web. It can access our file system, very similar to something like Cursor or Code, and then it also has the ability to run commands in the terminal, which is quite terrifying, but don't worry, we're going to learn how to put approval mechanisms in front of some of those commands so it doesn't do those things.

[00:03:45]
So I can ask this agent something very similar to the browser one. So I'm just going to ask it, quickly find the current MVP or NBA MVP candidate front runners this season and put it in a table. I can type in a markdown file at MVP.md. So I can do that because it has access to the internet and it also has the ability to write to a file. So, hopefully I gave it good enough context and we can see right here, this yellow text web search with the spinner is saying that it's using a tool called web search, and it does exactly what it sounds like.

[00:04:30]
It's going to search the web until it finds the information that it's looking for. If we needed to search the web in parallel, we'll see multiple web searches, but that's not up to me. It's up to the agent to decide how many times it needs to search the web. It'll keep doing that on the loop until it's satisfied with the amount of information that it needs. And as you can see here, it found the amount of information that it needs, and now it's asking for my approval to call this one tool here, write file, to this file path right here, MVP.md, which is exactly what I described it to do.

[00:05:02]
It's asking for an approval because as you'll see in this course, we're going to learn how to put approval mechanisms in tools like writing to a file and deleting a file. And here's the argument. So here's everything that it wants to write to the file, and I can say yes. It successfully wrote to the file, and then what we can do is we can go check it out. So you can see here, it created this MVP.md.

[00:05:29]
I'm just going to preview this so we can look at it better, and there we go. It created a table with Nikola Jokić, Shai Gilgeous, Luka, and all the notes on them. So yeah, it did a really good job. Tyrese Maxey's been balling this season, which is surprising, but yeah, you're going to build this, right? You're going to learn how to give an LLM the superpowers of the tools, the thinking process, and the autonomy to figure things out for itself.

[00:05:59]
Okay, so let's get started with the course. The first thing you're going to need to do is get set up. You're going to need this repo that I just ran. So make sure you clone the repo here at my GitHub, which is going to be Hendrixer, and then the repo is just going to be Agents V2. Here you go. So clone this repo, and like I said, there's multiple branches. You can see there's a done branch, that's the branch that I was just on, that's the completely finished agent.

[00:06:32]
And then we have lessons 1 through 9. So clone this, pull it down. And then the next thing you want to do once you have it pulled down is you want to, actually I have some changes here that I'm going to stash. Oh, no, I don't. You want to check out to lesson one. So make sure you check out to lesson one. That's where we're going to start. Each additional lesson will have the solution for the previous lesson, and then also I'm going to live code and then again, also, the code will be in the notes that you can follow along.

[00:07:03]
So once you check out to lesson one, let's just get a tour of what this repo has so you can understand all the things that you need to do. Obviously, you won't have this MVP thing in here that we just generated, but essentially there are a lot of things in here that you will not be making, specifically, a lot of the UI stuff that you saw in the terminal, we will not be covering any of that, but feel free, the code is there, go check it out.

[00:07:26]
There's a bunch of utility stuff in here that we won't be talking about. Most of the things that we'll be discussing will be in the source agent folder, and even in here, there are some things that are already filled out. Again, these are mostly non-LLM, non-agent related things that are just utility functions to help us out. As we get through the course, we'll pull them in and use them as needed.

[00:07:49]
So don't worry too much about that. But that's the course. Because this is a CLI, there's a flow that you have to follow to run this, so you can install it locally, but I'll talk about that as we go through it, and I have commands for it here, so you don't have to worry too much. And the last thing is your OpenAI API key. You want to make sure you create a .env file on the root. Don't worry, it's already in the .gitignore, and you want to put OPENAI_API_KEY and paste in your API key there.

[00:08:22]
You will need this. Without this, you won't be able to run the examples. You could potentially get away with using a model from a different provider, but you'll have to make those changes on your own. It's best just to use OpenAI and follow along to keep it easy and keep the mental overhead low. But technically it should work for other models. I just can't promise you what changes you would need to make if you did that.

[00:08:45]
And that's mostly it. There's some other things in here. All the course notes are in here. I have this open spec thing here. This is if you're using agents like Cursor or Claude Code to give them context about this. So if you want to use them to help you add features and stuff, you can send it to this folder and it'll know everything about the specs and all the stuff that's here. And then I have this evals folder.

[00:09:08]
We will be doing evals here. Don't worry if you don't, I don't expect you to know what evals are right now, but this folder is something we will be working pretty aggressively in as well. So that's the app. There's a lot here already. But we still have a lot to make, so let's get to it.

Learn Straight from the Experts Who Shape the Modern Web

  • 250+
    In-depth Courses
  • Industry Leading Experts
  • 24
    Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now