Transcription
Yes, hello, how are you all? Welcome to Chai aur Code, and I am 100% sure you have definitely heard about Open Claws Clot Bot. You must have also been interested, and then thought, "Should I do it or not? Install it." The same happened with me. I also got interested in it, thinking, "Everyone is looking at it, everyone is installing it. Let me also see at least what it is." And then, not just that, when it is fully openly available to you, can it be read? Can its architecture be seen? Can one delve into its system design? So, that's exactly what I did. And actually, if you install it in the true sense, its installation is not as easy as they say on the website. So, I collected all the commands, faced all the issues that arose, and noted them all down. After that, I read its entire structure, looked at the architecture. Then I felt that I should make notes on it and share them with you, so that if you also have a desire for new projects, thinking, "I want to build something different." Through this video, by understanding this detail, you too can build similar projects. It's quite easy. It's time-consuming, no doubt. But once you understand the flow, you can also do it easily. So, sit back comfortably. We will tell you the entire structure, details, discussions, everything. What all problems I faced, when I reached the installation stage, how everything happened. You will enjoy it a lot, and I will also tell you the thought process behind why I am not installing it on Mac. Why all these issues are there, I will tell you all that. So, let's first go to our Open Claws website. So, this is OpenClaws.ai. By the way, let me tell you that I have written down all the problems, issues, commands, etc., here. After that, we are going to look at the architecture and everything else here. So, yes, it's detailed. You will enjoy it. So, sit comfortably. By the way, if you are sitting, then let me know in the comment section if you want more such system design videos, so definitely write "More System Design" in the comments, so that we can not only cover Open Claws but also many other system designs, and AI-centric special system designs are also happening. So, if you want them, please comment. The target is not much. It's a target of 100 comments. Finish it quickly. Okay. So, I have reached the Open Claws website just like you all, and saw how big their claims are. Look at it. So, they said, "The AI that actually does things." Others are also doing work, but okay. After that, they said, "Clear inbox, send emails, manage your calendar." It does quite a lot of work, okay. "From WhatsApp, Telegram, already used." Now, look, if you still haven't clicked with these, then you should click with this: we have two things. One is an event, where is the event originating from? You can originate an event from WhatsApp, from Telegram, from any chat app. These are your inputs that create the event. What is the response to that event? The response to that event is that somehow, through AI processing, the inbox is cleared, or a new inbox is sent. But what else is happening, how is all that, let's see about it. Okay? Now, they said that it is very easy to install. You can either install it with a one-liner, or with npm, or you can do it on Mac. We said, "No, we are not going to do it on Mac." Although there is no work done on this machine, this is all just a recording machine, but still, there are videos. So, we are not going to do that. Then we moved to the one-liner. So, they said, "Works everywhere, installs everything." But when things are coded in a "vibe," they don't run that easily. So, we said, "Okay, let's copy it and go to our Hostinger." Let's get a machine from here and do it. Although I am using quite a few machines these days from them. There are two on this account itself. And we are using it. So, this one was already in use. I said, "This one above was in use." I said, "Let's get another machine." This is a bit of a heavy machine. Let's get this one, which is a bit less, okay. What do you need to do? The link is in the description. And the coupon code, as always, is there. Hostinger's is always there. Okay? You need to go to VPS, and interestingly, let me tell you something. I thought that it would probably be available by default on Hostinger. But go to the next one. Now, I reached this one, just like we reach every time, Applications. I thought, "Open Claws will be here." But when I looked, Open Claws was not there. Open LiteSpeed, Open LiteSpeed, OpenCart, OpenLite, OpenVPN, but Open Claws was not there. I said, "Okay, no problem. We know all this." So, we go to Plain OS and our favorite Ubuntu. Okay? So, we reached Ubuntu, selected it, and we needed an Ubuntu machine. So, whatever is here, I'll put something in. I don't even know what I'm putting in. Okay? Because I am not going to buy a machine. I have the machine. So, we go to Next. Now, let me tell you, the machine, actually, you don't need a bare minimum malware scanner much right now. Now, you can take this machine if you want, but this machine is not that useful. Whether you take it for one month, or however you take it, at least get a decent machine so that things become fast. So, at least get two CPUs. Don't go by RAM, CPUs are also needed. Cores are also needed. So, getting two is better. Getting four is even better for testing. At least for one month. And the coupon code gives a discount anyway. I always keep one or two machines. So, select from here and just go to Next. It takes only two-four minutes. It's quite fast, and all this work gets done. Okay. So, we also finished the work. After that, we reached the point where, when all the work is done, you get a panel like this inside Ubuntu. Docker manager and all these things are available. We went to the terminal. I like this the most. No need to SSH or anything. Whatever experiment you want to do, do it from here. We went to the terminal, and it opened a terminal like this. Now, we have reached here, but not after installing and all. We reached here, but not like this. Look above, you will see a lot of errors. Not here. Here they are, and there are more. It doesn't happen that easily. It gives issues in many places. So, we reached here. Then we said, "Okay, let's take the Open Claws command and install it." We took this command and told it to install. So, now we are moving to our notes. So, we said, "Okay. Take this command and run it as is." Okay? Issues arose. Then I said, "Okay, maybe it won't work." And then issues arose. So, you will notice here, as we go to the top, that it has started the installation very well. I said, "Wow, this turned out to be very good that you just ran one command." It said, "Open Claws installer," and started installing. Wow, that's a great thing. Then it said, "OS installed," and told me that, "See, your Linux building, etc., is all fine. Node.js installed." But when I checked the Node version, Node was not installed at all. I said, "Wow, what kind of vibe coding is this that, okay, you said Node is installed. I believed you. You showed a tick mark there, but actually, it wasn't installed." Then I realized that, "Okay, this is not going to work." I said, "Okay. So, I'll install some of the dependencies myself and find out from the errors which dependencies are missing." So, I went to install Node first. On the Node website, you get this command as is. And you can do `sudo apt install nodejs`. We said, "Okay." After that, when I said, "Now that Node is installed, maybe it won't work with the main command. Let's install it with npm." This works fine. `sudo npm install -g open-claws`. We ran this too, and it still didn't work. It said, "Wow, what's the matter? Just run." Then I realized, "Okay." So, then when I debugged it a bit, looked at the logs, everything was written there. So, it was found that there is some issue with Discord. Some Discord libraries don't build directly. There is an issue with this. So, then I had to run these three commands. One is `build-essential` to build, and after that, `libopus-dev`. It took a lot of time to find this one. This one alone took about 10-15 minutes. After that, finally, when it was done, then finally you can run `sudo apt install -g open-claws@latest`. Yes, after doing all this, it works. So, after these two commands finally ran, then it was like, "Okay, our work is done, and you can run them easily." Okay, here you go. So, after these two commands ran, finally, don't run this first. First, you actually have to run this. So, `npm install open-claws@latest`. So, now you have the entire set of commands that you need to run. And after that, onboarding. So, Open Claws gives you two types of onboarding. One is that you can talk to it directly from the terminal, and the other is that you get a web interface like ChatGPT. And as soon as you run this command, then we go to the bottom. So, here it says that, "Okay, the tool is very powerful, this is everything." So, I said, "Okay, I understand. Yes, let's agree here." Now, here you also have Quick Install and Manual Install. Let's zoom in a bit more so that you can see it easily. Yes, no, here. So, you can see this part. Yes, you can see it. Okay? So, as is, we said, "Okay. Quick Install." As soon as you do Quick Install, you will know that the very first thing for you is the Auth Provider. Because all the work is happening with AI, providing AI is essential. Now, you provide OpenAI, you provide Anthropic's best model. It depends on your budget. I recommend that you try Google because Gemini's key is available a bit more easily and cheaply. That is the best. If you have any other, like Minimax, then it's even better. So, we said, "Okay. For now, let's skip this so that I can tell you the options." You can also provide Cloudflare or a custom provider. But for now, let's skip it so that we can see the entire flow once. Okay? After that, we said, "Skip for now." Let's do this. All providers. Oh ho ho. Keep current. Now, you get to select the channel. This is where we will explain the entire system design. So, the most important thing is your channel, which they call a channel, or you can also call it a client. Where can your messages come from, or where can the input be configured from? You must have seen Telegram or WhatsApp as the most common. WhatsApp, I still feel, should be done thoughtfully. You can do Telegram. There is no such issue. But you can receive messages from anywhere. You can also receive from Slack and anywhere else. I skipped this and told it to configure skills. What are skills? I will tell you that too. It's not much more than a markdown file. For now, we will say no to this, as we don't need any specific skills right now. But a skill could be, maybe there are special skills for email replies, special skills for writing English, and anything else. Now, read carefully here. Enable Hooks. Yes. This is the most important thing. This is a completely event-driven architecture. Hooks are definitely present here. So, hooks let you automate actions when the agent commands are issued. I will tell you about this too. So, you can do BootMD etc. if you want, but for now, I will skip this too. Okay? So, we said, "Enter this," and that's it. Gateway Service Installed. Now, this important thing, the Gateway Service, this is the most meat part of Open Claws. Now, you have understood the story that, okay, this is how it is. But now, its architecture, I know it's confusing right now. But now you will understand this architecture. By the way, I can also complete the onboarding dashboard directly from here, or use the chat. I can run Open Claws. But now let's come here and read its architecture one by one, because if this is not read, then what has been read? Why is it even here? So, this in the center, the Gateway, this is your entire Open Claws, and this entire thing runs on an event-driven architecture. Look at two things, don't look at the entire diagram right now. Two small things: one is your input, one is your agent, and one is your gateway. So, it's simple: your input sends some message to the gateway. Now, this message can be from anywhere. Okay? The gateway doesn't keep it with itself for long. But the gateway sends it as is to the agent. It's a very simple job. You can also build this: you receive input from somewhere. It can come from a web request, from a chat, from anywhere. You don't keep it with yourself. You directly send it to the AI or the agent and tell it to do this work. Suppose you had the task to create a new file. The agent can do it very easily. Okay? Now, the question arises, how to understand things? So, first, understand the input layers. So, in the input layer, you will mostly hear WhatsApp, Telegram, Slack, although it's not like that. The entire Open Claws sees input in this way: input can be messages. Okay? We know that too. Input can also be heartbeats. If you have seen recently, I told you about Time Arena, or software like this, there is a concept of heartbeat. I will tell you what it is now. Apart from that, cron jobs. People nowadays think cron is some magic. It has been there for years, it is still there, and it will remain. You get some work done at a particular given time. This is how database backups are taken: every night at 12:00 AM, a script runs automatically and takes the database backup. That script doesn't just back up the database; it can do many other things. Anyway, let's get to that now. Apart from that, hooks. This is the most important. And an input can also be an agent. Okay? We will talk about each of these one by one. By the way, this is given in their docs. I haven't extracted anything extraordinary. The heartbeat is interesting. Okay? So, input can come from anywhere. We will talk about input again later. But input can come from anywhere. Where does this input go? This input goes to the gateway. Now, the gateway doesn't think much about it. It's just sitting there to process it further. But it's possible that an agent is free to process it further, or not. Many things can happen. So, what does it do first? It keeps a queue system with itself, that whatever messages come, I will put them in the queue, and as agents become free, I will deliver the message to those agents: "Okay, do this work, do this work." Okay? Now, what is the second thing this gateway has? It also has some tools. How will it work without tools? What are tools? Look, in tools, there is your connectivity. You connect your Gmail and give it, so it takes full access of Gmail: that now I can send emails from it, read them, delete them, whatever it needs to do. This is one tool. Similarly, you create your own tools. This is called tool calling. These tools can be different. Reading messages on your WhatsApp, deleting them, this can also be a tool. Opening your web server or Chrome, this can also be a tool. Taking your Twitter API and reading tweets, this is also a tool. So, every functional, what they used to call functions, are now called tools in the world of AI. So, this is our tools. Okay? The tool part is done. Now, what does it do? Along with this, it also keeps a memory. And interestingly, this memory is text files. Yes. Markdown files that you can open, read easily. So, whatever agents work, whatever information there is, it summarizes it and keeps it in memory. Now, interestingly, your input can also be an agent. Meaning, this agent can send some message back to the gateway, and based on the requirement, it can call the agent again. Multi-tool calling is a very common practice in AI. Now, how does all this work, and how do you see the interesting examples on Twitter etc.? Suppose a message comes. You sent a message at night saying, "Build my website for me," or "Host it." So, because it was already running on the gateway server there, a message simply goes to you: a message simply goes to us at the gateway saying, "Suppose, build a website for me in dark mode and deploy it too." Okay? Now, this message has reached the gateway. The gateway itself does nothing. The gateway puts it in the queue. Because the queue was free, it gave it to an agent. The agent might have a tool for web design, web development, design skills, whatever tool it has, it built it with that. Now, because it was there, interestingly, this agent will say that my task is to design the website and also deploy it. Maybe it can do it itself. Maybe it can call another agent. Now, the interesting thing is that suppose this agent's job was to build a website. It can call another agent. AI does this very easily. At least it passes information that now, by setting up a Caddy or an Nginx server, serve the files kept in this folder. Now, the interesting thing about Open Claws is that it doesn't claim to be foolproof. Yes. You asked it to build and host a website. It might just build it and stay there. That's why it's called vulnerable. It is quite vulnerable. Cisco did a recent study. They said many things are vulnerable. Many of your keys can be leaked in this. It is still improving. So, that's a different matter. Now, the second thing is heartbeat. What is heartbeat? Heartbeat is nothing. A small software is created which will ping your gateway with something at every given interval. Like you have seen tracking software that companies install on your system, to see how long you were working. Did you complete 8 hours or not? They also run on the heartbeat mechanism. Every little while, a heartbeat comes, so you were active, otherwise not. Now, heartbeat is automatically present with the gateway and this entire Open Claws. What does it do? Suppose it sends a heartbeat every 15 minutes. In that heartbeat, you can check things. Like, for example, check Twitter every 15 minutes. Check email every 15 minutes. Now, it's not necessary that it's every 15 minutes. These heartbeats keep coming. Because the flow of heartbeats is very fast. And that's why it appears active, that it's always active. As soon as you message. By the way, messaging is reactive in nature. Heartbeats are constantly sent. Heartbeats are so common that almost many times one heartbeat is sent every minute. Many times, one heartbeat keeps going every 10 seconds. Based on that, you can see if there is anything in the queue. Are there messages from some agents further? That's why it feels automatic. Because if the agent has sent something in the queue, like, "Okay, now run Nginx." And who will execute it? Heartbeat executes it: if there is anything in the queue, pass it to the agent. Nice, right? Very nice architecture. After that, this is the most basic, cron. There isn't much to it. In cron, the simple job is to keep working at every given time or interval. Send "Good Morning" every day at 9 AM. Send "Good Evening" every day at 8 AM. It's a very easy job. You can do it. Second is the most recent hooks. Many people underestimate this, but hooks are actually very interesting. If you have ever used a payment gateway, Razorpay or anything, then you are 100% familiar with hooks. In hooks, the server sends you a message, replies. So, suppose an email comes, it also triggers a hook. A WhatsApp message comes, it also triggers a hook. Someone replies to you on Notion, it also triggers a hook. A hook is also triggered on Slack. So, when everyone triggers a hook, based on that, the gateway and agents can be fired. And I told you that agents can also fire other agents. Meaning, they can invoke them. This is the entire architecture. So, with just these things, the entire Clot Bot is built. Now, tools have been added to it. A little memory has been added so that it knows what the previous tool did. Because it's a text file, there's no such thing as a database in it. Even if it crashes, it restarts automatically. Because there's no state stored in a database or anywhere. It's a stateless kind of a thing. And the second thing is your agents. Fire as many as you want, you have your tokens. So, this is the entire architecture, and this is called event-driven architecture. Although it's not completely event-driven. If it were event-driven, then heartbeats or crons might not have been so prominent. But they have used everything that is mostly used in development, and they have built a very interesting project. Now, what can you do? You can also build a similar project. A simple gateway that is always listening. And based on a message that comes, like from Telegram, where you also get webhooks. Based on that, you can fire agents. And apart from that, you can do cron very easily. So, this cron and this message, you can do these very easily. You can also build your own same project. Interestingly, in this project, you will learn to implement the gateway, tools, memory, and queue system. Just take a simple Redis queue. Implement that. It's a very interesting tool, that's why I liked it. But yes, there is one more thing: because it has many security issues, it's preferable that you play with it, but play with it on a VPS. Hostinger has one of the best VPS. So, play with them and do it. Otherwise, the link will be in the description, and I hope you liked the video. A detailed deep dive into how systems are built, and how they are given the name AI. And look, skills and opportunities are two different things. You also have skills. Opportunities come from trying as much as possible. The founder of Open Claws tried a lot, so opportunities came. Maybe if you try, some opportunities might come your way too. But it's a very interesting project. I think you should definitely try it at least once. So, if nothing else, at least try installing it. Try it on Telegram and all these. Let's see how it is, what is built, whether it works or not. And how will it happen? That's all for this video. And the link is in the description. You can use the Chai aur Code coupon code if you are buying anything on User. And that's all. Definitely leave a comment. And see you in the next video.