Deep dive into the nano bot's modular, research-friendly design
Explore the clean, understandable architecture that makes nanobot ai so accessible
The nano bot is built with a modular, layered architecture that separates concerns while maintaining simplicity. Every component is designed to be understandable and modifiable by developers.
The nanobot ai architecture divides functionality into clear modules: agent core, channels, providers, tools, and cron. Each module has a specific responsibility, making the nano bot codebase easy to navigate and understand.
The nanobot uses a layered approach: agent core orchestrates conversations, providers supply LLM capabilities, channels handle platforms, and tools enable actions. Clean separation of concerns throughout the nano bot.
The entire nanobot ai framework fits in approximately 4,000 lines of Python code. This is 99% smaller than Clawdbot (430,000+ lines) while retaining core functionality. Extreme simplification without sacrificing capability.
The nano bot architecture is designed for research and learning. Clean code, clear structure, minimal complexity. Developers can comprehend the entire nanobot system in days instead of weeks.
The nano bot organizes code into a clear directory structure. Each directory contains related functionality, making the nanobot ai codebase intuitive to navigate.
nanobot/
├── nanobot/
│ ├── agent/ # Agent Core
│ │ ├── context.py # ContextBuilder - system prompt construction
│ │ └── memory.py # Memory System - long/short-term memory
│ ├── channels/ # Communication Channels
│ │ ├── telegram/ # Telegram integration
│ │ ├── discord/ # Discord integration
│ │ ├── whatsapp/ # WhatsApp integration
│ │ ├── slack/ # Slack integration
│ │ ├── email/ # Email integration
│ │ ├── qq/ # QQ integration
│ │ ├── dingtalk/ # DingTalk integration
│ │ ├── feishu/ # Feishu integration
│ │ └── mochat/ # Mochat integration
│ ├── providers/ # LLM Providers
│ │ ├── openrouter.py # OpenRouter integration
│ │ ├── anthropic.py # Anthropic (Claude)
│ │ ├── openai.py # OpenAI (GPT)
│ │ ├── deepseek.py # DeepSeek
│ │ ├── gemini.py # Google Gemini
│ │ ├── zhipu.py # Zhipu (智谱)
│ │ ├── dashscope.py # DashScope
│ │ ├── moonshot.py # Moonshot
│ │ ├── groq.py # Groq
│ │ ├── aihubmix.py # AiHubMix
│ │ └── vllm.py # vLLM (local models)
│ ├── tools/ # Tool Registry
│ │ ├── file_ops.py # File operations
│ │ ├── shell.py # Shell command execution
│ │ └── web.py # Web access
│ └── cron/ # Cron System
│ └── scheduler.py # Job scheduling (apscheduler)
├── pyproject.toml # Project configuration
└── README.md # Documentation
Clarity: Every file has a clear purpose
Simplicity: No unnecessary complexity
Modularity: Components are independent
Extensibility: Easy to add new capabilities
The agent core is the heart of the nano bot. It orchestrates conversations, manages context, and coordinates tool execution. Two primary files handle all core functionality.
Purpose: Constructs system prompts for LLM calls
Responsibilities: Combines personality, memory, tools, and conversation history
The nanobot ContextBuilder automatically includes:
Every nano bot conversation starts with a complete context built by this component.
Purpose: Manages long-term and short-term memory
Redesigned: February 12, 2026 for improved reliability
The nanobot ai memory system handles:
The redesigned memory system uses less code while being more reliable.
The nano bot Provider Registry makes integrating new LLM APIs trivial. Adding a new provider takes just 2 steps, enabling the nanobot ai to support 11+ providers.
Step 1: Create a provider class (inherit from base provider)
Step 2: Register the provider with the Registry
That's it! The nanobot can now use your new LLM provider. All the plumbing (API calls, error handling, response parsing) is handled automatically by the nano bot framework.
The nanobot ai currently supports:
Each nano bot provider inherits from a base class that defines the interface. Providers implement send_message() and handle provider-specific details. The nanobot Registry manages provider selection and fallback.
Want to use a new LLM with the nanobot? Create a simple provider class following the pattern, register it, and the nano bot can immediately use it. The architecture makes LLM integration straightforward.
The nano bot supports 8+ messaging platforms through a modular channel architecture. Each platform has dedicated integration code while sharing common patterns.
Status: Full support (recommended)
Features: Voice transcription, media, inline keyboards
Code: channels/telegram/
The nanobot Telegram integration is the most mature, with complete feature support including voice message transcription.
Status: Full support
Features: Server integration, DMs, slash commands
Code: channels/discord/
Deploy the nano bot as a Discord bot for community management and server automation.
Status: Supported
Features: Platform-specific capabilities
Code: channels/whatsapp/, channels/slack/, channels/email/
The nanobot ai connects to business and personal communication platforms.
Status: Supported
Regions: Chinese messaging platforms
Code: channels/qq/, channels/dingtalk/, etc.
The nano bot integrates with popular platforms in China and Asia.
All nanobot channels follow a common pattern: authenticate, receive messages, send responses, handle media. Platform-specific code handles API differences while the nano bot core remains platform-agnostic.
The nano bot tool system enables the AI to interact with files, execute commands, and access the web. Tools are registered and made available to the LLM during conversations.
Capabilities: Read, write, create, delete files
Use Cases: Reading documentation, updating memory, analyzing code
The nanobot can manipulate files on the filesystem with appropriate permissions. Critical for memory management and document processing.
Capabilities: Execute shell commands
Use Cases: Running scripts, checking processes, system operations
The nano bot can run shell commands to interact with the operating system. Security restrictions apply to prevent misuse.
Capabilities: Fetch URLs, call APIs
Use Cases: Gathering information, integrating external services, API calls
The nanobot ai can access the internet to fetch data, call APIs, and integrate with external systems.
Tools register with the nano bot by providing a description and function. The LLM sees available tools in the context and can invoke them during conversations. The nanobot handles tool execution and result integration.
How does the nano bot achieve full AI assistant functionality in just ~4,000 lines? Through ruthless focus on essentials and clean architecture.
| Project | Lines of Code | Memory Usage | Complexity |
|------------|---------------|--------------|------------|
| Clawdbot | 430,000+ | High | Very High |
| OpenClaw | 430,000+ | ~1GB RAM | Very High |
| nanobot | ~4,000 | ~100MB RAM | Low |
| Reduction | 99% | 90% | Dramatic |
The nanobot ai includes only what's necessary for core AI assistant functionality. No GUI, no mobile apps, no extensive admin panels. The nano bot does one thing well: AI assistance.
Every line of nanobot code serves a purpose. No duplicate functionality, no dead code, no "just in case" features. The nano bot achieves maximum functionality per line of code.
The nanobot architecture is straightforward. No over-engineering, no excessive abstraction. Simple patterns consistently applied throughout the nano bot codebase.
HKUDS designed the nanobot for research and learning. The nano bot proves that extreme simplification is possible while retaining capability. A model for future AI systems.
The nano bot source code is open and available on GitHub. Read the ~4,000 lines yourself to see how extreme simplification works in practice. The nanobot ai architecture is designed to be understood.