Nanobot - An open-source personal AI assistant from the Data Science Lab at the University of Hong Kong
Nanobot is an ultra-lightweight personal AI assistant open-sourced by the Data Intelligence Laboratory at the University of Hong Kong. It fully replicates the core functionality of the OpenClaw agent in approximately 4,000 lines of code. Nanobot possesses capabilities such as web search, file operations, scheduled tasks, and a memory mechanism, supporting scenarios including 24/7 real-time market analysis, full-stack development, schedule management, and personal knowledge bases.
Nanobot is an ultra-lightweight personal AI assistant open sourced by the Data Intelligence Laboratory of the University of Hong Kong. It is completely reproduced with only about 4,000 lines of code. OpenClaw The core functions of the agent. Nanobot has capabilities such as web search, file operations, scheduled tasks, and memory mechanisms, and supports scenarios such as 24-hour real-time market analysis, full-stack development, schedule management, and personal knowledge base. Compared with the 430,000 lines of code of the original version, Nanobot uses 99% of the code to achieve the same productivity. Developers can read through the source code in a few hours and quickly understand the underlying logic of AI calling tools and management memory. It is an ideal choice for learning and customizing Agents.
Nanobot’s main features
- Intelligent core : Based on the large language model, it realizes a complete closed loop of autonomous task planning, tool invocation and multi-round dialogue.
- information acquisition : Integrated web search interface to support real-time retrieval of external information for analysis and processing.
- File operations : Provides code reading and writing and file system management capabilities, and can build a localized personal knowledge base.
- Communication integration : Native support for Telegram and WhatsApp, enabling cross-platform messaging and remote interaction.
- scheduled tasks : Built-in Cron-like scheduling system, which can automatically execute reminders and tasks according to preset periods.
- memory mechanism : Use a persistent storage solution to save conversation context to support long-term memory review.
- Voice interaction : Connect to the Groq Whisper service to realize automatic recognition and transcription of voice messages.
- scene template : Preset four types of ready-to-use application templates: financial analysis, development assistant, schedule management, and knowledge Q&A.
Nanobot’s technical principles
- Minimalist architectural design : Nanobot disassembles the system into four core modules - the Agent loop is responsible for coordinating the interactive execution between large language models and tools, the memory module implements persistent storage and retrieval of dialogue context, the skill loader supports dynamic expansion of functional components, the message bus uniformly handles internal and external communication routing, and the overall use of explicit dependency injection replaces complex abstraction layers.
- Agent execution process : User input first passes through the Prompt builder to assemble the context, and then is sent to the large language model for reasoning and decision-making. The model independently determines the tools to be called and generates execution instructions. After the tool is executed, the results are fed back to the model, and finally the memory state is updated, forming a complete closed loop of “perception-decision-action-learning”.
- Multi-source LLM access : The system implements unified routing through OpenRouter, which can seamlessly switch cloud models such as Claude, GPT, and Gemini. It is also compatible with local vLLM deployment solutions, meets flexible selection needs, and supports data security requirements in privatization scenarios.
- dynamic tool system : All functions are placed in the form of skill modules
skills/Directory, automatically loaded at runtime, with built-in common tools covering code operations, network requests, system commands, etc. Developers can quickly expand customization capabilities by following unified interface specifications. - Cross-platform communication layer : Telegram implements message sending and receiving based on the official Bot API, and WhatsApp uses a Web protocol bridging solution. All channel messages are standardized on the internal bus and distributed to Agents for processing, ensuring a consistent multi-platform experience.
Nanobot project address
- GitHub repository :https://github.com/HKUDS/nanobot
Application scenarios of Nanobot
- Financial real-time analysis : Nanobot can monitor market conditions 24/7 and automatically capture data to generate investment insight reports.
- Full stack development assistance : Support the execution of code writing, debugging, and deployment tasks at any time, and act as a portable technical partner.
- Intelligent schedule management : Nanobot can automatically schedule meetings, send reminders, handle to-dos, and coordinate personal time planning.
- personal knowledge base : Nanobot supports the integration of private documents such as PDFs and notes, and supports natural language question and answer and knowledge retrieval.
- Remote assistant : Interact anytime, anywhere via Telegram or WhatsApp, no need to be in front of the computer. ©