Loading video player...
Babe, Netflix is broken. I'm seriously so mad. Fix my game. Chuck never the toilet again, man. I really need this thing to flush. I would normally stress about this, but N manages my home lab.
Yay, it works. Did you just see that? My new AI employee, Terry, fixed everything before I could even start trouble. No, Terry. No, don't optimize. Quit. Cancel. Cancel. Terry. No. Okay. So that right there, that's Terminator Terry, and we're going to avoid that at all cost. So, in this video, we're going to build your very own super intelligent AI agent, aka your new IT employee. It can monitor, it can troubleshoot, and even with your explicit permission, fix
things in your network and home lab. Get your stinky coffee ready. Let's try and avoid Skynet. In part one, we built Baby Terry with N8. He was okay. He could monitor your websites, but he definitely could not troubleshoot your home lab at 3:00 a.m. Let's change that. Welcome to employee onboarding. First day, fresh pot of coffee., We're, going to, give, our, AI, agent access to real tools. The ability to actually connect to things in our home lab and network so it can monitor
troubleshoot, and yes, even fix stuff. Now, talking UniFi, Proxmbox, Plex, your NAS. If it has a CLI or API, Terry can handle it. But hold on. We're going to treat Terry like a new hire. You don't give the new guy root access in the first day. You got to build that trust. It won't be long. Give him a few cups of coffee and he'll be unstoppable. Unstoppable. Anyway, now before Terry gets to work, we got to set him up properly. And even though he's an AI agent powered by N8N, he
still needs a home. He needs a desk. You got two options for this. Think carefully. Option one, you can put him in your home lab. Terry's in the house. I show you how to do that right here. But the downside is that if your home lab goes down, so does Terry. That's why I like the option of putting Terry in the cloud. A self-hosted NAN instance on the hosting your cloud. I love this option for two reasons. First, Terry's immune to my tinkering. Two, this is so
crazy easy to set up. Wait, hold on. You don't have an N instance. Let's fix that right now. By the time I'm done sipping this cup of coffee, just taking one sip you're going to have one. Ready, set go., All right., First,, head, out, to hostinger.com/ncn or check the link in the description. Choose your plan. KVM2 is perfect. Look at those muscles. Yes, I am purposely moving in slow motion right now for this bit. Enter coupon code network chuck and magic happens. Continue. Enter your
stuff. Yes, this is pretty dumb, but you're still here. Create a root password. Say yes to a free malware scanner. Take a quick coffee break while I'm sipping mine. Click on manage VPS. and then click on manage app and finish your setup. And then you're good to go. Done. And thank you to Hostinger for making this video possible. Terry now has his desk in the cloud. Now the hacker move is to have Terry use Twin Gate to securely connect back to your network at your house or your business.
This way Terry can reach your home lab securely 24/7. And he's up even when your home lab isn't. I'll show you what that looks like later. Okay, day one. Terry's going to learn how to monitor and troubleshoot. It's a big day for Terry. I'm excited. Here we are in 8. Let's create a new workflow right up here at the top. And then we'll add our first step. We'll make that a manual trigger. And then we'll add one more node, our AI agent. AI and AI agent. Don't do anything just yet. Click out of
there. And here is our starting point. Man, Terry's going to be so smart. Actually, let's make him smart. Let's give him a chat model and AI model. I'm going to choose chat GBT. You have a lot of options for this. For more info on how to set this up, I got it all covered in my first video. I'm going chat GBT with the 4.1 mini model. It's very fast. And then for memory so he doesn't forget what we're talking about. We'll add some simple memory right there. Perfect. Now to teach Terry, we're going
to give him a few simple tasks. First make sure this website is up. That's it. What website? We're going to make one real quick. Just a test one so we can walk through it together. We're going to throw this website inside a Docker container on the same N host we're working on right now. If you have no idea what I'm talking about, that's totally cool. I'm going to walk you through it right now. Now, if you followed along with me on Hostinger we're, going to, go, back, to, our, VPS, panel,
and you'll see a button for browser terminal right here at the top right. Go ahead and click on that. If you're hosting somewhere else, what you want to do is get CLI access to the server that's running your NAN instance. And here we are, Home Sweet Home, the terminal, my favorite place to be. And we're going to run two commands. First we'll, copy, and, paste, this., I'm, going to have all the commands below. This will run a simple website on port 8090. Ready, set, go. Then, we'll run this
docker exec command. We're just adding a nice H1 header to our website. Hit enter and we'll do a docker restart website. That's the name of our container by the way. And now it should be ready. Let's test it out real quick. I'm going to grab the IP address of my server. Open up a new tab, paste that in, and type in colon port 8090. Perfect. We have a website. Now, hold on one second. I want you to stop and think. How did you make sure that website was up? What did you do? You're
like, Chuck, all I did was take the URL open up a new tab, and made sure it looks good. That's what we're going to do with Terry. We're going to teach him to do that. And that's going to be a common thread throughout this video. You're going to think about how you would monitor something, how you would troubleshoot something, how you would even fix something, and then show Terry the same process. I'm telling you, this stuff is crazy. And it feels kind of like we're training another human, but
it's AI. It's weird. Anyways, just got to stuff those thoughts down. Can't dwell on that. Now, for Terry to visit a website, we got to give him a tool right here. So, we're going to add a tool to his tool belt. This will be the HTTP request tool right here. It'll pop open for us. And we're going to change a few parameters. First, I'll just rename it. I'm going to call it website tool. And then here in the description, I'll just say what he's supposed to use it for.
Use this tool to see if the website is up. And we'll paste in our URL right here. Let's do a little test to make sure it works. Execute step. And there we go. It returns the data that we saw. So, Terry has a tool. Let's tell him how to use it. Let's tell him who he is. Actually, let's open up Terry and we're going to give Terry an identity so he doesn't have a crisis. We're going to click on add option and then system message. This is also referred to as his system prompt. I'm going to paste in
this. Again, I'll have all this below. Essentially, I'm telling Terry who he is. He's an IT administrator. He has one job. Make sure the website is up. And I'm telling him how to use the tool and how to report back to me if the website is up or down. That's it. Let's try it out. So, I'm going to open this chat message here. By default, the AI agent's going to have a chat message or a chat box attached to it. That's how he's triggered. And I'll say, "Hey, Terry, is
the website up?" And watch what happens here. He's going to think about it. He's going to use his tool. You saw that. And he's done. And there's our message. The website is indeed up. And he did what we would do. He visited the website. Now let's make it go down. Let's see what happens. We'll go over here to our terminal, and I'll say docker stop website. If I type in docker ps, I'll be able to see that my server is not running because right now we only have n running
in our tray fit container. Those are supposed to be running. Don't touch those. Terry can't fix that yet. Now let's run Terry. I'm going to reset my chat session and say the same message. Hey, Terry, is the website up? And it's down. Okay, cool. But why is it down? What would you do to troubleshoot this? Well, we know that it's a Docker container running on this server. We go over here and start doing things like, I don't know, Docker or PS to see if it's running. Let's show Terry how to do
that. Let's teach our new employee how to log into a server and check if a Docker container is running. For that we're, going to, need, a, new, tool,, the, SSH tool, giving our AI agent the ability to log into servers via CLI. That is so stinking powerful. Coffee break. Oh, also don't forget to save every once in a while. You don't want to lose your work. Now, there's one annoying thing here, though. If I click on add tool and I'll go over here to search, there's no
SSH tool. I got a workar around, don't worry. Instead of adding a tool, we're going to, add, a, new, node., So,, hit, that plus sign at the top right here. Search for SSH. Notice there is an SSH node. Click on that and we'll choose the execute a command option. Now immediately we're thrust into the SSH node configuration. Let's go ahead and make this happen right now. Let's configure it. I'll select my credential which, we're, not, going to, have, one, yet. Let's click on create new credential
here. All you're going to do is put in the credentials for your server. And for our, situation, right, now,, it's, going to be the host server where NAN lives. I'm going to give it the external IP address here as the host, taking away all the HTTP and bracket stuff. Port 22 is good. Username will be root and then password is one I set when I set up Hostinger. Click on save. It'll test the connection. Good to go. And then we have our command field. Let's test it out
real quick. We'll do a simple command like host name. Click on execute this step. And cool, it works. Host name is this guy right here. I'm going to remove the host name because we're not quite done because right now our AI agent has no way to use this node. It needs to be a tool, but right now it's just a standalone node. Let's change that. If I hover over this SSH node, I'll see some dots right here. I'm going to click those and I'll choose the option convert
node to subworkflow. Watch what happens. Boom. Nothing crazy. It's like rename this please. We're going to call this SSH_N server. Confirm. That's it. Now, what did that just do? It's like you put on a new suit, some new clothes. It actually converted this SSH node into its own workflow. So, let's actually save this workflow. Go back to personal over here on the left. We now have two workflows. The one we were working on and the one we just created with the SSH node. Let's
jump in there. Ah, look at that. Now while we're here, we're going to do a couple things. First, we'll connect the start node to our SSH node. Then, we're going to edit this start node. Just double click that real quick. And we'll change the input data mode from accept all data to define using fields below. And then we'll click on add field. For name, we're going to type in command. The type will be string. And then click on execute step. Right now, it's going
to be nothing null. That's fine though. Click out of that. And then go to your SSH node right here. Double click that. And we're going to do one thing. Notice here on the left, we have our start node as input. And then that command string that we created. We're going to drag that over right to the command field. Perfect. Now, what did we just do? What is all that? What we did is made it possible for Terry to use this workflow and he's going to fill in that command
variable we made with whatever command he wants. So let's say he wants to say host, name., That, is, what's, going to, be fed to this execute a command SSH node. Let's test it out. We're going to save this workflow. Go back to our original workflow. And first let's remove this uh sub workflow right here. It's not going to delete it. It's just going to remove it from our current workflow. And then we'll add a tool for Terry. And the tool we're going to use is call nan workflow
tool. And then down here at the bottom we'll have our workflow and we have a choose option or a choose drop-own box. We're going to click on choose and choose our SSH nan server, the one we just created. And notice we're immediately given the option to say which command do you want to run. Well getting back to our example, we want Terry to see if that Docker container is running the same way we would check. So let's have him run docker ps. That's our command. And then also one more thing
I'm going to change the name of this tool to docker tool so Terry knows what to use. Done. Just going to move things around. and make it clean. And now let's tell Terry how to use the tool. Again I'll have all these prompts below. We're going to double click on Terry and we're going to copy and paste this in. Now pretty much the same story as before. We're telling Terry he can use the website tool to check if the website is up. He's actually looking at the website
for network chuck coffee header. But then we're saying, "Hey, the website is down. See if the container is up." That's it. Let's get out of there and save. And then let's see if Terry can check it out for us. Hey, Terry. Is the website up? Watch Terry go checks the website uses our Docker tool. Ah, look at that. So he's like, "Yeah, the website is down." Additionally, the container is not running in the list. Now, think about what we just did here. We taught Terry
how to troubleshoot like us. And yes this was simple, but we're just scratching the surface. Now, I don't know about you, but I'm starting to trust Terry a bit more. Let's give him some more power. So far, we have him pretty locked down to the one command he can run. That's docker ps. What do you say we let him choose? Watch this. I can jump back into that SSH tool or the nan workflow call tool. And here where it says command docker ps. Let's not specify a command. Let's take that away
and click this magic fairy dust button here. That will say let the agent decide what to set that variable to. Or in other words, let the agent decide what the command he'll run will be. I know. I know it's a bit more trust. I feel like I'm there. Now, let's tell Terry about our new trust in him. Let's change his prompt. And we're going to add a few more troubleshooting steps. Again website down. Run docker ps, but also now maybe run a docker inspect command
to see why the container is down. Maybe look at the docker logs and see if there's anything weird. I mean, that's what you and I would do. Right now we're teaching Terry. Let's try it out. Let's save, reset our chat session, and ask him one more time, "Hey, Terry, is the website up?" And watch this magic happen. And it's done. Notice a couple things real quick. He used the Docker tool twice for two commands. Let's see what he came up with. Websites down. He found
the exit code for the container at zero. And let's see what commands he ran. So let's go to our logs down here. Click on Docker logs. He ran See, he ran Docker PS and then he ran Docker inspect, but he didn't run the logs. Did we tell him to? I thought we told him to. Let's be more specific. Always check logs. Let's try it again. Ah, he ran it three times. Good boy Terry. See, he's learning. We're teaching him well. Recent logs, graceful shutdown, and exit messages. Terry, I'm
so proud of you. Employee of the stinking month. So dumb. But here is where Terry can become more powerful. He can do what a human can do. Troubleshoot like a human. But he can do it constantly. This next part is pretty crazy. Now, we're kind of promoting Terry to a level two engineer here. We're going to give him two things that'll make him overpowered. One of those things is fixing things. Here we go. Now, first, this is kind of an annoying thing. Like, I hate this. I
don't want to have to ask Terry to check if my website's up. Come on, Terry. Do your job. I want you to check all the time. Let's make that happen right now. To do that, it's simple. We have a new trigger. Right now, we have a manual trigger., We, have a, chat, trigger., Let's add a schedule trigger. Go up here click on the plus sign, click on add another trigger, and then we got where did it go? On a schedule. Boom. Now Terry, I own you, buddy. You're on the clock 24/7. I want you every five
minutes checking my website. Let's make some room for him. We'll connect this trigger to Terry. Can I change the way Terry looks? No. They should really add that to NAN. That would really just be the extra oomph to really juzj it up you know, stupid. Now, doing this is actually going to break a few things. So, watch. I'm going to execute my trigger. Excute workflow. Boom. And it's like, whoa, what are you talking about? You can't do this. Terry's brain is fried. Let's fix that.
There are two things blowing him up here. First, he's expecting a chat message telling him what to do. That initial, "Hey, Terry, check if the website is up." It's not happening right here with the schedule trigger. we have to make it happen artificially. Let's do that. So, right here in between schedule trigger and Terry, click on that plus icon and we're going to add a set field node or edit fields. It's going to pop open for us. We're going to add two fields first. First will be the prompt.
We'll name it prompt and the value will be whatever we want Terry to do. This is his user message. I'll simply say check if the website is up and then we'll add one more field. This is the second thing tripping up Terry. It's the chat ID or session ID. We'll call it chat ID. Chat ID just like this. And we'll put a value in. Let's just say Terry 1 2 3 4 5. Cool. Those are set. Now we have to tell Terry about these new things. Click out of that. Go to Terry. And notice here in
Terry's config, the prompt for the user message was tied to that chat input. We don't want that. We want the schedule. So let's back out for a sec. Go back to edit fields. Let's execute that step so it actually produces data Terry can look at. Get back into Terry. And for this chat message, if we drop down the edit fields over here on the left, we want it to be that prompt right here. So we're going to change the source for prompt from connected chat trigger node to
define below. And then we'll drag over our prompt right there. So now whatever we set in that prompt is going to show up here as Terry's user prompt. Cool. But what about this chat ID? What are we doing with that? Well, if we go to our simple memory right here, Terry's little short-term memory. Double click that. It will remember conversations but based on ID. Again, this ID was tied to the chat node, but we're not going to use that. So, we have to set that manually. We'll
change it from connected chat trigger node to define below. And here, I'm going to, type, it, in, manually., It'll, be opening brackets dollar sign JSON. ID. And look, it even kind of filled in right there for us. And that's it. Cool. So, Terry should be good now to have this trigger scheduled. Ready, set execute workflow. Boom. And he's working fine. No errors. And we can check his work down here. If we click on the last OpenAI chat model log down here, it'll
show us what he would have told us in a chat message. Perfect. Well, actually not so perfect. We're kind of moving away from the chat message. In fact let's delete it. Goodbye, chat message. We're now more focused on the schedule trigger. I'm not going to micromanage you, Terry. You do it yourself. But how is Terry going to tell us how the website's doing? When Terry is done checking all these things, he's going to output all that stuff he would have normally told us to the next step. That
next step needs to come to us. Let's make that happen. I'm going to click on the plus icon right here and I'm going to search for Telegram. Now, this is the example I'm going for right now. Telegram is a chat app. You can use Slack if you wanted to or Discord. You got options. Essentially, Terry's going to yell at us and tell us, "Hey, here's what's going on." I'll choose Telegram and say, "Uh, the action will be Gosh there's so many actions. Just send me a
stinking chat. Where's it at?" Oh, send a text message. There we go. Now, like every node that connects to an external service, you'll often need a credential. I'll select mine, but I don't have one. Let's create one. Now, depending on the chat app you select, Slack, Telegram Discord, they're going to have different ways to set this up. I'm not going to detail it right here, but I will have a document below. And also, if you click on open documents, they'll give you some
help. Like Telegram involves chatting with the botfather. So, I went through the setup. Let's see if it works. Test. Awesome. There's my message. Now, we don't want the output to be test. We want it to be what Terry says to us. So I'll take the output of our agent and put that right here in text. So, now let me step out of here real quick with my send a message as the last in line here or the end of the line. Let's trigger Terry. Do your work, Terry. Boom. Message sent. There's our report.
Okay, that's pretty cool. But, you know also if Terry's going to be checking this every 5 minutes, I don't want him to tell me if there's nothing wrong. Such a noob mistake, Terry. Come on, new guy. Only tell me if there's something wrong, dude. Let's teach him. Let's show him how to do it. And this is what makes n so powerful. Watch this. It's a thing called structured output. Because right now, we need some logic right here to determine if a message should be sent to
us. So, we'll start here. Click on Terry. Double click Terry. Notice we have an option that says require specific output format. Let's click on that. Let's see what happens. Boom. Nothing. Let's click out of Terry. But notice there's a new guy floating around. Or actually, not a new guy, a new little connector sticking out of him. He's got an output parser with nothing attached. Let's attach one. Click on plus sign. And for this, we're going to click on structured output
parser. And it opens something up for us. And it seems kind of weird, right? Like what's what's happening here? Generate from JSON example. Then it has like California, Los Angeles. Essentially, what it's enabling us to do is have Terry respond to us in a way we always want to be responded to. For example, we could do this. Again, I'll have everything in the description below. I'm going to remove all this San Diego business and paste in this. With this, we're telling Terry, when you send
us a message after you check the website, I want you to tell us in this nice clean JSON. If the website's up or not, I want you to output a boolean true or false. Don't tell me a story, just say true or false. Now, I want to give you the option to tell me a story. That's what the message field is for. send me a message. Let's test it out. Let's jump out of there. Notice how the output parser is just like another little thing hanging off here like a tool. Let's test Terry once more. Okay
let's go check our message. Oh, you know what we forgot? Look at this. It's like object object. What is that? We got to change how our message is sent. Let's go into our telegram here real quick. We got to change our text box here. Let's remove that JSON.output. And we need to actually add these individual fields. And that's the power of the structured data. Notice how it's like one item false one item the message. So we'll say website up and we'll put the result
which would be true or false and we'll say I don't know just message and we'll put the message content right there. Okay, now let's try it again. Here we go. Okay, we got our message. Let's check it out. That's better. Website up false message whatever wants to tell us. Now why is that important? Because we can do this. We can now filter what's being sent to us and what isn't. Right in between Terry and our Telegram message sent, we're going to add a new node. Click on the plus sign
right there. And we're going to search for if just the if. Add the if and it opens up for us here. We're going to grab the website up field and put it right here in the first value. We're then going to change the logic right here in the middle from is equal to to boolean is true. So, let's get out of there real quick. And notice coming out of our if node here is a true path and a false path. The logic right now is if the website is up, then it'll go down the true path. If the website is down
it should go down the false path. And that should be all we really care about right? So, I'm going to actually put the message on the false path because that's going to tell us when it's down. Let's test it out. Boom. We got our message. And notice the path it took. It went down the false path. Let's look at our output or the input the if box received. See, it got the false. It evaluated it. sent it down the false branch. Let's bring that website back up. We'll do
docker start website. Let's see what happens when it is up and all good to go. Ready, Terry, go. Boom. Terry noticed, hey, the website's up. Should I tell my boss? Should I tell Chuck? No Terry. You're learning. You went down the true path. And that goes nowhere. We don't get notified. That's the power of the structured output. It's so cool. Okay, cool. Terry's on his own. He's checking the website by himself. He's visiting the website. He's running Docker commands. Not too bad for a first
day. I'm feeling kind of confident with Terry. What do you say we let him fix the website? This is where so many things unlock. And what's crazy is all we have to do is change his prompt just a little bit for him to fix it. Let's do it again. Everything will be below. Let's jump into Tererry's prompt here. Change it up. And everything is pretty much the same except for two things. We're saying if the website's down, go ahead and try to start it up. Run the Docker container start website command.
actually could just be docker start website. And then we're telling them hey, once you start it, go verify once more. Try to visit the website and tell us if it's up and then give us our report. What happened? Let's try it out. This is going to be crazy. Actually let's make the website go down first. Docker, stop website. So, website is down. If I try to visit it real quick the human test says no. Let's run Terry again. Terry will be doing this every five minutes. Ready, set, go. Terry's
thinking. Terry's working. He's running commands. He's being Oh. Oh, look at that. Okay, so it went down the true path, which means the website was up. Let's see his last message. Initially the website was down with connection refused. I restarted the container successfully. After restart, the website responded correctly with the expected content. Therefore, the website is now operational. Are you kidding me right now? Terry. While this is a simple example, I know Terry monitored an issue, he
troubleshooted an issue, he fixed an issue. If Terry can be taught to do that, what else can Terry be taught to do? That felt like a tongue twister 10 times fast. But let's get real here. Terry, he did a good job, but he's on rails. He fixed a well doumented issue. Like, we told him exactly how to fix this thing when he encounters it. What if we give him something he's never seen before? Can he solve it? Let's see. I'm going to throw something nasty his way and see what he can do. We're being
pretty mean to Terry on his first day. Eh, oh well. Let's introduce a port conflict issue. Let's see how Terry does troubleshooting something he's never seen before. So, let's go to our terminal here. Type in docker ps. Make sure our container is running. It is. There it is. Let's change that. We'll say docker stop website. Now, Terry knows how to fix that, but he doesn't know how to fix this. We're going to run a Python server with this command here. Python 3-mTP.Server
port 8090. Just run that command. Boom. What that's going to do is run a web server, just a quick one, on that same port, but it's not our site. And if Terry tries to spin up that container there's going to be a port conflict and it won't happen. How's Terry going to deal with that? Let's see. Terry, let's see what you stinking got. Ready, set go. Oh, we got the message. It means he failed. Let's see. websites down. He tried to restart the container, didn't work. I'm actually kind of proud of
Terry because he did exactly what he knew how to do and nothing more. That's what you expect from a lower level engineer. You don't want them getting too crazy. But now I want Terry to get crazy. I want him to figure this out for me. I don't want to sit here and troubleshoot this. I want him to. Let's give Terry some more power. And it's kind of scary easy to do this. Watch. It's just going to be a simple prompt change. I'll simply tell Terry he can do whatever he needs to do to bring this
website up. No more limits on his commands. So notice this prompt is kind of thin. The differences here are if the website is not up, use the CLI tool to troubleshoot the issue. Once you figure out the issue, you can apply whatever fix you need to bring the that container up and fix the website. Also, we gave him a bit of context, too. So no longer is he just like, "Oh, website, I'm going to follow instructions." Let's let's tell him where he's at. Let's tell him
we're running a website and a Docker container. It's on this port. So he's not troubleshooting blind. He's got documentation. Let's see what he can do. I'm so curious if he can solve it. Okay let's make sure our Python server is still running. It is. Container's down. Terry, let's see what you got, buddy. Dude, he's going Oh, problem. So, here's we run into a problem here. Obviously, I too many iterations. Notice he ran that Docker tool like nine times. I think the
limit is 10 by default. And also notice one thing here. I need to change the tool name. So, let's change it to CLI tool because I told Terry in his prompt use the CLI tool. Now, let's describe it. Use this tool to run commands on this server. Running our website for troubleshooting purposes., All right,, Python, server, is running. Let's see if Terry can do this. And actually, I'm going to change Terry's user message, too, because right now it just says in our user prompt
check if the website is up. I'm going to tell him monitor this website. If it's down, fix it. Simple. Let's see what we got. Here we go. Terry, can you fix it with it being kind of ambiguous? He's going. He's running tools. He's sweating. His first real test. He's thinking there. What? What did he run? No. Terry, you stuffed yourself. That's a problem. He stopped the container that's running him. Let's see. Yeah, Trafic is done. What's it called? Let's start it up again.
Okay, we start it up again. Now, let's try to access stuff. Terry, you broke yourself, dude. That right there brings us, to, one, of the, main, problems, I, have with letting AI do anything on my network. I would have stopped Terry from doing that, but I didn't know. But I still want him to try and troubleshoot things. I want him to work, but I want to be in the loop. And this is called human in the loop. That's what we're going to implement right now. We're going to solve two problems actually.
First, I'm going to figure out why he was trying to stop himself and trying to fix this container. And second, let's be able to stop him when he tries. Now, how human in the loop works is very similar to our message here we received from Telegram. But instead, we're going to have the opportunity to approve a message. So, Terry will go, "Huh, I'm about to run a command. I need permission from my boss first. He's going to send it to us. We click approve and then he can continue working." This
involves two steps. First, set up human in the loop. Two, tell Terry about it. Tell Terry his new rules. And then kind of a side note like how we'd fix that issue where he was trying to destroy himself. That would just be a better prompt, better documentation, like don't stop these containers. They are running you. If there's a port conflict, we can instruct him to look for port conflicts and how he might find those. Actually I'm curious if we gave Terry a smarter
brain. Let's do a smarter GBT model like 4.1. That was 4.1 mini. Let's do four full 4.1 real quick. All right, smarter Terry. See what you got. Oh, I think smarter Terry did it. Let's go see. Website up is true. Let's go. Let's go look. Yeah, it is. He did it. Oh, it found the Python 3 process and it did it. Good job, Smarter Terry. But see it's that reason like it's inconsistent. We want to be in control. We want to have that human in the loop. Let's make
it happen right now. So, let's add a new node. Top right here, and we're going to use what's called human in the loop. It's actually right there. It's a main category. Click on that. And they're going to show us a bunch of messaging apps like we've seen before. We'll choose Telegram. And this is just going to be a regular Telegram node with a different operation. The other one was like send message. Now we're send and wait for response. We're going to have the opportunity to approve something.
And notice how the response type is approval versus let's see what other options we have. Free text. We could like respond back with free text. It's still a wait for response situation or a custom form. All we need is approval. Right now I'm going to add back in my chat ID from the Telegram setup. I'll use that same uh channel we're using. But then there's a few things we have to wire up here to make sure this works. First, Terry's going to have to know when to seek approval. How do we do
that? We tell him. It's a prompt. I got one right here. Let's change it up. Notice it says right here, critical permission issues. You must request explicit approval before running any commands that could modify the system. I don't care if he runs Docker PS or if he checks any logs. I don't care about that. Anything that will change the system, I care about. And we give a few examples here. Giving examples to AI is very important. When in doubt, ask first., One, of the, main, things, we're
changing is down here at the bottom, and that's his structured output. We already had him telling us before, like, hey, is the website up true or false? And then send us a message about what you did. We're, going to, add, a, few, more, here, to help us control the flow of things like, hey, did you apply a fix? True or false? Or, hey, do you need approval for this command? True or false? What are the commands you're requesting? We can tell him to tell us that. Now, notice
I'm actually adding it to the prompt now because it's a bit more involved. He might figure it out by himself, but I like to explicitly tell him what he's supposed to do right here in the prompt. And then we'll take the same stuff here and add it to our output parser. So whereas before we only had two things he's telling us, we're going to change that to all of this, making sure it's all proper JSON with no errors here. Now I'm going to test the output. So I'm actually going to delete the uh line
going out here and just see if he outputs properly. Before he does anything, I'm actually going to break things again. run our Python web server. Run Terry. Let's see if he actually runs these commands first of all. He shouldn't do it. He should ask for permission, permission, first., Come on, Terry. Don't be a dummy. Okay, cool. Let's see what he did. Perfect. Website's down. Here's the message. Apply fix. False. Needs approval. True. Here's the commands he's requesting. He
wants to kill that process and start up the website. That's perfect. But now we need that logic to play out and for us to approve it. So, I'm going to add another if, another if node here. I'll drag him over here. Connect them up. Jump it to the if and say if needs approval. I'll drag that over to the first value. Boolean is true. Then we're going to do off the true branch our approval message. So actually real quick, I'm going to jump into our agent and pen this data so we don't have to
run him again. Let's go into our if and run that. It's going to pass it forward. Go down the true branch. Perfect. That worked. And then here for the approval we're going to say website status or website up false message needs approval. And finally, commands requested. So now that message will be sent to us, but then we still have a problem here. When we respond to that message, it's going to go nowhere. So we have to actually send him back to the agent. We have to
create the loop ourselves. So, I'm going to grab this and and put it all the way back over to Terry. And it's kind of messy and weird, but you can see what's happening. Terry's going to ask for approval. We're going to approve it. It's, going to, be, sent, back, to, him., But one more problem we have to solve right here. The only thing being sent is an approve message. And here's why that's a problem. When it arrives at Terry with a simple approve, Terry's going to be
like, "Okay, what are they talking about? Let me check my simple memory to see if that's a current chat I'm working on." He can't because he has no chat ID to reference. We need to not just send the approved message. We also need to send the chat ID we were working with. So he knows like, oh, you're talking about those commands. Okay, I'm on the same page now. That's going to be a simple set. So right here between Telegram message and Terry, we're going to add a new node. The set or edit
fields. Notice how it's sitting right in between us here. And let's actually test the telegram real quick. I'm going to execute it so we have some data. Cool. I got it. Look, there's the message. Needs approval. True. I'll click on approve. It's going to open up a web page. Cool. Got it. Thanks. If we go to N. Boom. It sends it across. Approved. True. So now on the edit fields, we're going to drag over the approved field. And we'll actually change the data, but I'm going
to rename it to prompt because that's what Terry's looking for when he receives any information on the side. The user message will be JSON.prompt. So we're, going to, set, that, to, prompt., And then, for, the, data, type,, we're, going to change from boolean to string. And then finally, we'll set one more thing back in our earlier edit fields where we were originally setting our chat ID. We're just going to drag this over here to set the chat ID. And that's it. So, what's
happening here? Terry's going to go "Oh, I have commands to run. I'm setting needs approval to true." That's going to go down the true branch and it's going to be sent to us. We're going to have the option to approve those commands. If approved, it's going to say, "Oh approved message." That's going to go to our set fields node. This node is going to go, "Oh, okay. Let me prep this message for Terry because Terry needs this in a format he can understand." We're going to tell him the message is
approved, and, we're, going to, tell, him, the chat ID. That way, Terry has the context of what we're talking about. Let's test it out. Currently, our website is still down. Let's trigger Terry and we'll connect up our false path. So, when it doesn't need approval, it'll go to this if statement, which will only notify us when the website is down. Let's see if Terry can do this. Ready, set, go. Okay he's asking for permission. He wants to do the kill and docker start. Let's
prove it, buddy. Good job. I approve. Let's see what happens. Okay, he's running the stuff. Okay, there's the flow. Did you see it happen? It was fast. Actually, let's see the message he outputed first. This is the final one. Website up. True. The Python process was terminated. I started the Docker container website fully operational. You apply a fix. True. Doesn't need approval. Commands are empty. And then it went through to the true path. Now there's one annoying thing here, and
that's we're not being notified when he does fix something. So, let's change this up. We're actually going to remove this if and replace it with a switch. A switch is like an if, but we get more options than just two. So if you apply a fix, I want to know about it. So I'll say if that's true, it's going to create a path, which is zero. Send me a message. Also, if the website is down so website up false, I want you to send me a message. And this is going out branch one. Let's duplicate this and
have it sent here. And I think that's all we care about. Let's run it one more time to see if it works. Me unpin my data here. Break our website again. Come on, Terry. You got this, buddy. Okay, he sends me a message wanting approval. Let's approve it. Okay, we got a message. Website up. True. Website is fully operational. That's perfect. Look what we just did here. Terry can now identify problems, troubleshoot a problem, and fix the problems, but only if we approve it. We get a message on
our phone saying, "Oh, problems. Yeah you can run those commands." Boom. He finishes the job and then tells us when it's done. Again, I know this is a simple example, but I wanted you to be able to follow along. And are you seeing the power of this? If you're like me you're bursting with ideas. Like imagine if we connected Terry to our actual home lab, to everything we have. Unifi, Plex, our NAS. What do you say we do that right now? Yeah, let's do that. Now, so far, Terry's been playing in a
sandbox, going through the tutorial levels. Let's change that. Let's give him access to real tools in my home lab in my business. Kind of scary, but I think he's ready for it. I trust him kind of. Now, right now, he does have his head in the clouds, meaning he's in hosting your cloud and he can't access my HomeLab stuff. Right now, I'm going to use Twinate to change that real quick. I'll just run a simple Twingate headless client and run just a few commands on the Hostinger VPS to get it up and
running. And by few, I mean two. And then I'll give it access to my network. Let me see if I can ping my UniFi gateway here, my dream machine, which is my router. Yep, there it is. We got access. That's the first thing I want to control is my network. Let's give Terry access to that. Again, anything with the CLI or API, you can pretty much control with Terry. For UniFi, we'll do the UniFi API. So, I'm going to add a new HTTP request tool. Create a new API key.
I'll quickly add in all this stuff. I'm not going to show you step by step unless you want to see that in another video because I can't show every service. Let's give Terry a new persona. Let's make him a network engineer. We'll set up a new schedule trigger, a new edit fields, connect all that up, and we'll have them do something like, I don't know,, identify, the, top, five bandwidth hogs on the network right now. And then we'll give him a system prompt too. Right here, telling him how to use
the UniFi API, which by the way, I just grabbed this from the website. I had AI summarize it and make it nice. We'll tell Terry to look at that system prompt. Cool. Now, let's see what he does using the unified tool. And then we have all this flow in here that doesn't quite match the network. We got a message. Oh,, there, it, goes., All right., Send, us, a message. Let's see what it says. Oh cool. Found the top users. And it's totally accurate. Again, simple example
but think about what you could do with that. The troubleshooting you could do. What about Proxmox? Let's add that. Proxmox is fun because they have an API and a CLI, and they're both pretty powerful. So I'll create a new SSH node for Proxmox CLI convert that into a sub workflow, set up the sub workflow
and then add that as a tool to Terry. Things are getting pretty busy around here. It's okay. Terry's just getting all the more powerful. We'll add a new set of triggers and edit fields. We can actually just highlight multiple and duplicate. For the prompt, we'll just say how many VMs are currently running. Let's see if it works. Using the Proxmox tool, we got a message. Currently, three VMs running. Home Assistant, Keith, Docker, and my free IPA server, which is running LDAP.
That's a whole other video coming out. But think about that. Anything you can do in the CLI, including creating virtual machines, deleting them stopping them, restarting, whatever you got to do, you can have Terry do that. Walk through a flow and teach him. What about Plex? Let's do that.
We'll just say, is anyone watching anything right now? And this will be using the uh Plex API.
Let's watch something so we can find it. And this is my favorite movie, by the way. All right, let's test it out. All right, let's see what we got. One active stream. Chuck Keith is watching The Mummy 1999. Yes, look at all that info it gives me. All right,, let's, go, stop, that., Great actor. Love him. I could keep going, but we don't have time right now. like my NAS. I've got one here in my studio running Seth on my 45 drive server. You guys have seen that. I've got a ZMA Cube
Pro running at my house. This can all be accessed via CLI. Terry can control everything. Now, similar to the first video, I'm showing you all this just to maybe start sparking those ideas. I'm not sure why I'm doing this. Like, I'm not providing a full IT blueprint. Here's Terry fully configured. No, no no. I'm showing you what Terry can do what's possible. You are going to go through and do this. Now, think about this. This is going to make you so much better. You're having to reverse
engineer how you would troubleshoot things. You're having to think about how your lab or your network or your business network is actually put together so you can describe it properly to an AI agent, Terry. So, not only will you come out with something amazing that will save you time hopefully and stress you're going to be better from this. You're going to know so much more. And also notice here like we're doing a bunch of schedule triggers. We're chatting with Terry. You don't have to
throw out everything you have right now. Maybe you already have Solar Winds or Uptime Kuma. You can have those things work with Terry. Like maybe when Uptime Kuma detects that something is down your website, normally it would just say it's down, fix it. But maybe he'll kick off a web hook that goes to Terry who can receive that and Terry can troubleshoot and fix it. So whatever monitoring tool you have, Terry can be connected to that to help you. And it's okay. You may not
want Terry fixing things for you right away. Let him troubleshoot. Let them dig through logs. Just think about what you can do with this tool. This is crazy. getting a little too excited. So, here we are. Conclusion of this video. Look at what we stinking built. This is a lot from where we first started, especially from the first video with baby Terry. Terry is now an IT wizard. He can monitor stuff. He can troubleshoot. He can even fix things. Please comment
below and tell me if you built your own Terry. And also, we set up approvals. Like, that's a pretty amazing thing. Putting yourself, the human, in the loop. That's people's biggest fears right now with AI. It's like, I don't know what it's doing, man. I can't control it. Like fine, put yourself in the middle. Put in guard rails. And please become crazier than what I've done here. You could have a much more strict approval process, stricter guard rails. But beyond all that, if you're
like me, your mind has got to be exploding with ideas. What can you do with this? Build something right now. Do something simple. Solve one problem. Let Terry help you troubleshoot one thing. Comment below what that is. And also tell me if you've done something crazier than this. I want to know. But hold on a second. We have a problem here. Terry he's a little stressed out. We've given him too much to do. I mean, look at all this. We've had to give him like four
different personas. We have one guy managing our entire IT infrastructure when we really should have specialized people. So, there's actually three glaring problems I see. First, Terry needs help. We're going to hire Terry some help. In fact, Terry is getting a promotion CTO because he's going to be managing a network engineer, a storage engineer,, a, Linux, admin., We're, going to give him sub agents that he can manage. Two, notice that we don't really have
our network documented. Well, any good home lab or IT infrastructure, it's going to, have, a, lot, going, on., This, I have not even scratched the surface. Terry has no idea yet, and it's still pretty messy. We need a good way to create documentation, have it centralized, and make it available to Terry and our future agents to be able to access easily. We want to maintain the state of our IT network. So, like hey, here's how it looks, agents, our IT team. If you ever change anything
update it. Or, hey, be aware of what's going on in our network before you change anything so you know it doesn't break anything. And then three, we need a help desk because sometimes Terry and team are not going to always catch something. Sometimes it's the user, my editors, my family. They are the ones who first identify an issue and they're usually calling me. I want them to talk to a help desk. We need a help desk or even like submit a ticket and our AI
agents can handle that, too. We're going to accomplish all of that in the next video. I'll see you there. Hey, you're still here. There's something new I'm wanting to start with my videos, and that's I want to pray over you. Now, I know that sounds weird, and if you're immediately like, uh, no, that's fine. Turn it off. I'm only going to do this at the end of my videos, but if you do want to stick around, here's what I'm going to do. I'm just going to pray for
you. Pray for your career. Pray for this thing you're learning right now to help you understand it and take it and use it. That's pretty much it. So, I'll go ahead and start. God, I thank you for whoever is watching right now. I thank you that uh they're part of my team, my audience, and that they are excited about it and their career. Lord, I ask that you bless their life that as they watch this video, that their mind would just erupt with ideas that this would propel them forward to
help them gain skills, skills they can put on their resume, and that will help them to either get a job or get a new job or just make themselves more valuable at their current job. Lord, give them fulfillment and joy in what they're doing. And whatever fear they have right now, the job market, any uh insecurities, any imposttor syndrome Lord, I ask that that would just melt away from them right now. And Lord while they may be getting a lot of fulfillment through it in their careers
I ask that they would come to know you who you are, Jesus, and have a relationship with you. And if they're doubting or questioning or just are having a rough time, just be there with them, God. And I ask that you bless their families. I pray favor over their families which is probably their their why, their why for doing any of this. Let their families prosper and grow and be blessed through the the work they're doing in it and through the skills they're learning through school, through
my videos, and whatever they're doing. Lord, we thank you, Jesus, for everything. It's in your name we pray. Amen. Anyways, I know that's probably kind of weird to be seeing this at the end of my video, but I'm a man of faith. It's who I am. If you're ever wondering why I am the way I am, it's because of Jesus. Anyways, that's all I got. I hope you guys have a great day. I'll catch you next time. Let their families prosper and grow and be blessed through the the work they're
doing in it and through the skills they're learning through school, through my videos, and whatever they're doing. Lord, we thank you, Jesus, for everything. It's in your name we pray. Amen. Anyways, I know that's probably kind of weird to be seeing this at the end of my video, but I'm a man of faith. It's who I am. If you're ever wondering why I am the way I am, it's because of Jesus. Anyways, that's all I got. I hope you guys have a great day. I'll catch you next time.
Setup n8n in 5 min with https://hostinger.com/ncn8n + use code NETWORKCHUCK for a discount. In this video, I take n8n to the NEXT LEVEL by building an AI agent. Meet my new IT employee “Terry” who can monitor, troubleshoot, and even fix my homelab. From Docker containers to Plex, Proxmox, and UniFi, Terry learns how to keep everything running smoothly. This is not just automation; this is AI running my ENTIRE homelab. GUIDE / RESOURCES: 📃 Guide / Documentation: https://github.com/theNetworkChuck/n8n-terry-guide 📺 Part 1 (Baby Terry – first n8n video): https://youtu.be/ONgECvZNI3o?si=xCwIMQLjIjug-hNP TIMESTAMPS: 0:00 - Intro: Meet Terminator Terry (The AI IT Employee) 0:58 - Employee Onboarding: Teaching Terry the Basics 2:22 - Setting Up n8n in the Cloud (Hostinger Setup) 2:58 - Connecting Terry to Your Homelab with Twingate 3:15 - Building Terry's First Workflow in n8n 4:01 - Creating a Test Website (Docker Container Setup) 5:00 - Terry's First Tool: HTTP Request (Website Monitoring) 6:11 - Teaching Terry to Monitor Like a Human 7:43 - Terry's Second Tool: SSH Access (Docker Commands) 10:00 - Converting SSH to a Workflow Tool 11:06 - Terry Learns to Troubleshoot (Docker PS & Inspect) 13:05 - Giving Terry More Freedom (Dynamic Commands) 14:16 - Making Terry Autonomous (Schedule Trigger Setup) 17:54 - Telegram Notifications: Terry Reports Back 19:24 - Structured Output: Teaching Terry Clean Data 22:33 - Smart Filtering: Only Alert on Problems 23:09 - Level 2 Engineer: Teaching Terry to Fix Things 24:49 - The Port Conflict Challenge (Terry's First Real Test) 26:42 - Upgrading Terry's Brain (GPT-4 vs Mini) 28:18 - Human-in-the-Loop: Taking Back Control 30:27 - Setting Up Approval Workflows 32:02 - Terry Asks Permission Before System Changes 35:06 - Testing the Complete Workflow (Monitor → Troubleshoot → Approve → Fix) 37:02 - Connecting Terry to Your Real Homelab 37:40 - Unifi Network Control (API Integration) 38:55 - Proxmox Integration (CLI & API Access) 🔥🔥Join the NetworkChuck Academy!: https://ntck.co/NCAcademy **Sponsored by Hostinger SUPPORT NETWORKCHUCK --------------------------------------------------- ➡️NetworkChuck membership: https://ntck.co/Premium ☕☕ COFFEE and MERCH: https://ntck.co/coffee Check out my new channel: https://ntck.co/ncclips 🆘🆘NEED HELP?? Join the Discord Server: https://discord.gg/networkchuck STUDY WITH ME on Twitch: https://bit.ly/nc_twitch READY TO LEARN?? --------------------------------------------------- -Learn Python: https://bit.ly/3rzZjzz -Get your CCNA: https://bit.ly/nc-ccna FOLLOW ME EVERYWHERE --------------------------------------------------- Instagram: https://www.instagram.com/networkchuck/ Twitter: https://twitter.com/networkchuck Facebook: https://www.facebook.com/NetworkChuck/ Join the Discord server: http://bit.ly/nc-discord AFFILIATES & REFERRALS --------------------------------------------------- (GEAR I USE...STUFF I RECOMMEND) My network gear: https://geni.us/L6wyIUj Amazon Affiliate Store: https://www.amazon.com/shop/networkchuck Buy a Raspberry Pi: https://geni.us/aBeqAL Do you want to know how I draw on the screen?? Go to https://ntck.co/EpicPen and use code NetworkChuck to get 20% off!! fast and reliable unifi in the cloud: https://hostifi.com/?via=chuck how to use n8n to automate your homelab how to build an ai agent with n8n how to monitor docker containers with n8n how to automate proxmox with n8n how to set up plex monitoring in n8n how to use n8n with unifi how to make ai troubleshoot your server how to automate your home network with n8n how to connect telegram alerts to n8n how to build a self hosted ai helpdesk with n8n how to teach ai to monitor your website with n8n how to restart docker containers automatically with n8n how to use ssh in n8n workflows how to integrate api monitoring into n8n how to use n8n for server monitoring how to automate plex and unifi with n8n how to run ai workflows with n8n how to set up automated troubleshooting in n8n how to use n8n to fix server issues how to automate your homelab with ai #n8n #homelab #automation TAGS: n8n, home lab automation, AI agent, Terry the AI, Docker automation, Plex automation, Proxmox automation, UniFi API, IT automation, self-hosted AI, AI troubleshooting, network automation, Telegram alerts, DevOps tools, sysadmin tools, home lab project, monitor and fix servers, Docker containers, automation tutorial, NetworkChuck