PYTHON / AI AGENTS

Nanobot: The Ultra-Lightweight OpenClaw in Python

A Python reimplementation of OpenClaw from HKU Data Intelligence Lab. 44k stars, "99% fewer lines of code" (~4,000 LOC), MCP integration, natural language cron jobs, 10+ messaging channels, and 191MB RAM footprint.

By Jose Nobile | 2026-06-11 | 10 min read

What Is Nanobot?

Nanobot is a Python reimplementation of the OpenClaw AI agent framework, developed by the Data Intelligence Lab at the University of Hong Kong (HKU). With 44k stars on GitHub and an MIT license, it is the most popular OpenClaw alternative by star count. The project's tagline -- "99% fewer lines of code" -- reflects its ~4,000 lines of Python compared to OpenClaw's significantly larger TypeScript codebase. The latest release is v0.2.1 (June 1, 2026); the v0.2.x series introduced the /goal command for sustained objectives that survive context compaction, shipped the WebUI inside the pip package, and made long-running work more durable with session locks and higher goal iteration budgets.

The design philosophy is radical simplicity. Nanobot strips away OpenClaw's gateway/node architecture in favor of a single Python process that handles everything: LLM interaction, channel adapters, memory, scheduling, and tool execution. This makes deployment trivial -- pip install nanobot-ai && nanobot start -- at the cost of some distributed-system capabilities.

Despite its simplicity, Nanobot punches above its weight. It supports MCP (Model Context Protocol) integration out of the box, connects to 10+ messaging channels, and introduces natural language cron jobs where you describe schedules in plain English instead of cron syntax. The memory footprint sits at around 191MB -- a fraction of OpenClaw's but significantly more than Rust-based alternatives like ZeroClaw.

Architecture

RUNTIME

Python 3.11+

Nanobot requires Python 3.11 or later, leveraging modern Python features like structural pattern matching, ExceptionGroup, and improved asyncio performance. The entire agent runs as a single async process using asyncio, with no external process manager required.

PROTOCOL

MCP Integration

First-class Model Context Protocol support. Nanobot can act as both an MCP client (consuming tools from MCP servers) and an MCP host (exposing its own tools to other agents). This means any MCP-compatible tool server works with Nanobot immediately, without writing custom integrations.

PROVIDERS

Multiple LLM Providers

Built-in support for OpenAI, Anthropic, DeepSeek, Qwen, Ollama, and vLLM. Provider switching is a single config change. The LLM abstraction layer normalizes tool-calling conventions across providers, so tools work identically regardless of the underlying model.

DESIGN

Single-Process Architecture

Unlike OpenClaw's distributed gateway/node/channel separation, Nanobot runs everything in one process. This simplifies deployment and debugging but means scaling requires running multiple independent Nanobot instances. For most personal assistant use cases, a single process is more than sufficient.

The single-process architecture is both Nanobot's greatest strength and its main limitation. It means you can deploy a fully functional AI agent on a $5/month VPS with pip install and a config file. But if you need distributed task execution across multiple machines, you will need to look at OpenClaw or ZeroClaw instead.

Features

SCHEDULING

Natural Language Cron Jobs

Define scheduled tasks in plain English: "Every weekday at 8am, summarize my unread emails and send the summary to Telegram." Nanobot parses the natural language description into an internal schedule representation. No cron syntax needed -- though traditional cron expressions are also supported for precision.

CHANNELS

10+ Messaging Channels

Telegram, Discord, WhatsApp, WeChat, Feishu, DingTalk, Slack, Matrix, Email, and QQ. Each channel adapter is a lightweight Python class (~100-200 lines) that maps platform-specific events to Nanobot's unified message format. Adding a new channel typically takes a few hours of development.

MEMORY

191MB RAM Footprint

Total memory consumption sits at approximately 191MB during active operation. This includes the Python runtime, all loaded libraries, and the conversation context window. Compared to OpenClaw's 1GB+ footprint, Nanobot is significantly lighter while still providing the full Python ecosystem.

TOOLS

MCP Tool Ecosystem

Because Nanobot supports MCP natively, it has access to the entire MCP tool ecosystem: file system access, web browsing, database queries, API integrations, and custom tools. MCP servers can be local processes or remote services -- Nanobot connects to them via stdio or HTTP transport.

SIMPLICITY

~4,000 Lines of Code

The entire Nanobot core is approximately 4,000 lines of Python. This makes it one of the most auditable AI agent frameworks available. A single developer can read and understand the complete codebase in an afternoon. This is a deliberate trade-off: less feature surface, but dramatically lower complexity.

INSTALL

pip Install & Go

Installation is a single command: pip install nanobot-ai. Configuration is a single YAML file. No Docker, no build step, no Node.js, no compilation. This makes Nanobot the fastest path from zero to a working AI agent for Python developers.

Academic Backing

Nanobot is developed by the same HKU Data Intelligence Lab team behind ClawWork, an economic evaluation framework for AI agents with 8.2k stars on GitHub. ClawWork provides standardized benchmarks for measuring the cost-effectiveness of AI agent deployments -- how much value does an agent generate per dollar spent on API calls, compute, and maintenance.

This academic pedigree gives Nanobot a distinctive character. The codebase reflects research-grade thinking about agent architecture: clean abstractions, minimal coupling, and well-defined interfaces between components. The team publishes research papers that inform the design decisions, which means Nanobot's architecture is grounded in empirical evidence rather than purely engineering intuition.

RESEARCH

ClawWork Framework (8.2k stars)

An economic evaluation framework for AI agents that measures cost per task completion, quality-adjusted output metrics, and resource efficiency across different agent architectures. Used by the team to benchmark Nanobot against OpenClaw and other alternatives.

RESEARCH

HKU Data Intelligence Lab

The lab focuses on data-driven AI systems, including agent frameworks, retrieval-augmented generation, and multi-modal AI. The team's research publications on agent economics directly inform Nanobot's design -- particularly the emphasis on minimal resource consumption and maximal value delivery per API call.

The academic backing is a double-edged sword. Nanobot benefits from rigorous design thinking and published research, but academic projects sometimes deprioritize operational concerns (monitoring, logging, graceful degradation) that production deployments need. Evaluate this trade-off for your specific use case.

Known Bugs

Nanobot's small codebase means fewer bugs overall, but the ones that exist tend to affect common workflows. The following are the most impactful open issues as of June 2026:

HIGH

#2343: Context Window Overflow Not Checked

The agent loop does not validate accumulated conversation history against the configured contextWindowTokens before calling the provider. Long-running sessions eventually exceed the model's maximum context length and fail with a provider-side HTTP 400 ("maximum context length exceeded") instead of trimming or compacting history. Until the loop trims history automatically, keep long sessions short or clear the conversation when the error appears.

MEDIUM

#2185: Regression Breaks Gemini Tool Calls

Upgrading from 0.1.4 to 0.1.4post5 breaks tool calling for gemini-3-flash-preview accessed through OpenAI-compatible endpoints. Every external command fails with "Function call is missing a thought_signature in functionCall parts." The regression affects Gemini 3 models proxied through OpenAI-style providers.

MEDIUM

#4302: Gateway Crashes After MCP Reconnect

When an MCP server connection drops and is re-established, the nanobot gateway can crash instead of resuming cleanly. Restarting the gateway recovers, but channel listeners and scheduled tasks are interrupted until it comes back up.

MEDIUM

#4290: Cron Job Ends Early With Subagents

A scheduled task that spawns a subagent can terminate before the subagent finishes its work, so the cron run completes without delivering the subagent's results. Until this is fixed, avoid delegating to subagents inside cron-triggered tasks.

LOW

#4287: Empty Responses Skip Model Fallback

When the primary model returns an empty response, nanobot does not trigger its fallback to alternative models -- the turn simply produces no output. The fallback chain currently fires only on transport errors, not on empty completions.

The context-window issue (#2343) is the most impactful bug for long-running sessions because the agent fails with a provider error instead of compacting history. If your use case depends on scheduled tasks that delegate to subagents, also watch #4290. The project moves fast -- v0.2.1 shipped on June 1, 2026 -- so check the issue tracker before pinning a version.

More Guides