Getting started with Nanobot: Build your first AI agent

Machine Learning


Getting started with Nanobot: Build your first AI agent
Image by author

# introduction

I was looking for an alternative to OpenClaw, not because OpenClaw is useless, but because I can find it too heavy and bloated for simple daily use. I wanted something lightweight, easy to set up, and easy to connect to WhatsApp without too many complicated steps. That’s when I met nanobot I’ve noticed that a lot of people are starting to talk about this on GitHub and also on YouTube.

This tutorial explains the Nanobot architecture and how it works. Then, go through the installation, setup, and connection process in six easy steps. whatsapp So you can start using it as a 24/7 artificial intelligence (AI) agent for a wide range of tasks.

# Use Nanobot for your first AI agent

Nanobot is ideal for first-time AI agents as it keeps the overall setup simple while supporting features that are important for real-world use. It can connect to messaging platforms such as WhatsApp, Telegram, Slack, Discord, Feishu, QQ, and email, as well as a wide range of model providers and Model Context Protocol (MCP) tool servers. This provides beginners with a clear way to understand the structure of agents without starting with a system that feels overly complex.

Getting started with Nanobot: Build your first AI agent
Architecture of Nanobot | Image from HKUDS/nanobot

It also stands out as an OpenClaw alternative because it offers practical integration and day-to-day usability right from the start. In addition to messaging channels, it supports tool invocation, web search, scheduled tasks, audio transcription, real-time progress streaming, and multiple provider options, making it easy to turn it from just a demo project into a useful personal assistant.

# Step 1: UV installation

First, install ultraviolet lightNanobot uses this to manage its Python environment and dependencies. Next, check the version to make sure it’s installed correctly.

curl -LsSf https://astral.sh/uv/install.sh | sh

Verify the installation.

output:

uv 0.10.9 (f675560f3 2026-03-06)

# Step 2: Install Nanobot

one time uv If installed, use it to install the Nanobot package. This adds the Nanobot Command Line Interface (CLI), allowing you to launch it directly from your terminal.

uv tool install nanobot-ai

Installing the Nanobot CLI

# Step 3: Initialize the Nanobot project

Next, run the onboarding command to initialize the Nanobot.

This creates a basic local setup with default configuration directories. ~/.nanobot The workspace that Nanobot uses to store files. After completing this step, Nanobot is ready to configure providers, models, and channels.

Nanobot onboarding process

# Step 4: Add Nanobot configuration

move to ~/.nanobot/config.json Create a file and copy and paste the configuration below. Replace the placeholder values ​​with your own values ​​before saving. OpenAI API key, model, WhatsApp number.

{
 "providers": {
   "openai": {
     "apiKey": "sk-REPLACE_ME"
   }
 },
 "agents": {
   "defaults": {
     "model": "openai/gpt-5.3-codex",
     "provider": "openai"
   }
 },
 "channels": {
   "whatsapp": {
     "enabled": true,
     "allowFrom": ["1234567890"]
   }
 }
}

Edit the following before saving:

  • apiKey using your actual OpenAI API key
  • model If you want to use a different model
  • allowFrom using my WhatsApp number

There is one important caveat. The recent issue with Nanobot is that WhatsApp allowFrom In practice, the formatting can be a bit inconsistent, and some users report that some specific settings work better without the “+” symbol.

# Step 5: Connect Nanobot to WhatsApp

Before you start the WhatsApp login flow, please ensure the following: Node.js and npm WhatsApp Bridge runs through a node-based process, so it gets installed on your machine.

First, start the login flow on one device.

nanobot channels login whatsapp

WhatsApp Login QR Code

This will generate a QR code that you need to scan WhatsApp → Settings → Linked devices By mobile phone. Once the devices are linked, open a second terminal and launch the Nanobot Gateway.

Starting the Nanobot Gateway

This is the process that keeps the channel running so that Nanobot can receive and respond to WhatsApp messages.

# Step 6: Test the AI ​​agent on WhatsApp

A second phone is required to test the agent. This second phone number is already allowFrom Add it to the list in the configuration file. Send a message to the first phone number connected to Nanobot and you should receive a reply through WhatsApp.

In this example, you will be prompted to ask what is happening in the world. Nanobot then processes the request, performs a web search if the tool is enabled, and returns a detailed snapshot based on the latest information.

Test the AI ​​agent via WhatsApp

While the gateway terminal is running, you can observe the entire agent workflow in real time. This includes receiving messages, invoking tools, generating responses, and sending responses back, making it easy to verify that everything is working correctly.

Agent workflow in terminal

# final thoughts

Setting up Nanobot showed us that building a personal AI agent doesn’t have to be that complicated, although it’s not entirely without its challenges. I appreciated the quick transition from setting up my device to a WhatsApp-connected agent that actually provided helpful responses.

However, I encountered some small hurdles. On Windows, if Node.js or npm were already installed with certain configurations, Python scripts might not be able to properly detect npm in the terminal, making initial setup a bit confusing. Additionally, due to the lack of extensive documentation on WhatsApp, it was not immediately clear that the interface worked by sending messages directly to connected devices rather than through a separate bot chat interface.

Despite these minor issues, Nanobot remains a strong starting point for anyone looking to build their first AI agent. This provides the core agent experience without the overhead of heavier alternatives. Once the setup is working, its value becomes immediately apparent, bridging the gap between simple terminal commands and a truly helpful personal assistant.

Abid Ali Awan (@1abidaliawan) is a certified data scientist professional who loves building machine learning models. Currently, he is focusing on content creation and writing technical blogs about machine learning and data science technology. Abid holds a master’s degree in technology management and a bachelor’s degree in communications engineering. His vision is to build AI products using graph neural networks for students suffering from mental illness.



Source link