Nanobot is a lightweight, production-ready personal AI assistant with multi-channel support (Telegram, Discord, WhatsApp, Feishu), local model integration, and powerful tool capabilities.
- 🤖 Multi-Provider LLM Support: OpenRouter, Anthropic, OpenAI, DeepSeek, Groq, Gemini, and more
- 🖥️ Local Models: Run your own models with vLLM or any OpenAI-compatible server
- 💬 Multi-Channel: Telegram, Discord, WhatsApp, and Feishu (飞书) integration
- 🛠️ Powerful Tools: File operations, shell execution, web search, and custom skills
- 📅 Scheduled Tasks: Cron-like job scheduling with natural language
- 🎯 Memory & Skills: Persistent memory and extensible skill system
- 🔒 Security: Sandbox mode, access control, and safe command execution
- Docker and Docker Compose installed
- At least one LLM provider API key (recommended: OpenRouter)
-
Copy the example environment file:
cp .env.example .env
-
Edit
.envand configure at least one LLM provider:# For OpenRouter (recommended for global access) OPENROUTER_API_KEY=sk-or-v1-xxxxx # Or use any other provider ANTHROPIC_API_KEY=sk-ant-xxxxx OPENAI_API_KEY=sk-xxxxx
-
Start the service:
docker compose up -d
-
Initialize configuration (first time only):
docker compose exec nanobot nanobot onboard -
Check status:
docker compose exec nanobot nanobot status
Chat directly with nanobot:
docker compose exec nanobot nanobot agent -m "What is 2+2?"Interactive mode:
docker compose exec nanobot nanobot agentThe default docker compose up starts the gateway server which enables:
- Telegram bot integration
- Discord bot integration
- WhatsApp messaging (requires additional setup)
- Feishu/Lark integration
- HTTP API access (port 18790)
-
Create a bot via @BotFather on Telegram
-
Get your user ID from @userinfobot
-
Configure in
.env:TELEGRAM_ENABLED=true TELEGRAM_TOKEN=your_bot_token
-
Restart the service
-
Create a bot at Discord Developer Portal
-
Enable MESSAGE CONTENT INTENT in bot settings
-
Configure in
.env:DISCORD_ENABLED=true DISCORD_TOKEN=your_bot_token
-
Restart the service
Requires Node.js and additional setup. See official documentation for details.
-
Create an app at Feishu Open Platform
-
Enable Bot capability and add
im:messagepermission -
Configure in
.env:FEISHU_ENABLED=true FEISHU_APP_ID=your_app_id FEISHU_APP_SECRET=your_app_secret
-
Restart the service
See .env.example for all available configuration options.
Key settings:
| Variable | Description | Default |
|---|---|---|
NANOBOT_MODEL |
LLM model to use | anthropic/claude-opus-4-5 |
NANOBOT_COMMAND |
Command to run (gateway, agent, status) | gateway |
RESTRICT_TO_WORKSPACE |
Sandbox mode - restrict tools to workspace | false |
BRAVE_API_KEY |
API key for web search tool | (empty) |
TELEGRAM_ENABLED |
Enable Telegram channel | false |
DISCORD_ENABLED |
Enable Discord channel | false |
When multiple providers are configured, nanobot will:
- Match provider based on model name (e.g.,
gpt-4→ OpenAI) - Fall back to first available API key
For production deployments:
- Set
RESTRICT_TO_WORKSPACE=trueto sandbox all file and shell operations - Configure
allowFromlists in the config file for channel access control - Use dedicated user accounts for channel integrations
- Monitor API usage and set spending limits
- Keep credentials in environment variables, never in code
Run tasks on a schedule:
# Add a daily reminder
docker compose exec nanobot nanobot cron add \
--name "morning" \
--message "Good morning! What's on the agenda?" \
--cron "0 9 * * *"
# List scheduled jobs
docker compose exec nanobot nanobot cron list
# Remove a job
docker compose exec nanobot nanobot cron remove <job_id>Run nanobot with your own local models:
-
Start a vLLM server:
vllm serve meta-llama/Llama-3.1-8B-Instruct --port 8000
-
Configure in
.env:VLLM_API_KEY=dummy VLLM_API_BASE=http://host.docker.internal:8000/v1 NANOBOT_MODEL=meta-llama/Llama-3.1-8B-Instruct
-
Restart the service
nanobot_config: Configuration files and credentialsnanobot_workspace: Agent workspace and files
18790: Gateway HTTP API (configurable viaNANOBOT_PORT_OVERRIDE)
Default resource limits:
- CPU: 1.0 cores (limit), 0.5 cores (reservation)
- Memory: 1GB (limit), 512MB (reservation)
Adjust via environment variables: NANOBOT_CPU_LIMIT, NANOBOT_MEMORY_LIMIT, etc.
docker compose logs -f nanobotdocker compose exec nanobot nanobot statusdocker compose exec nanobot nanobot agent -m "Hello!"No API key configured:
- Ensure at least one provider API key is set in
.env - Restart the service after updating environment variables
Channel not responding:
- Check that the channel is enabled in
.env - Verify bot tokens are correct
- Check logs for connection errors
File permission errors:
- Ensure volumes have proper permissions
- Try running with
RESTRICT_TO_WORKSPACE=falsefor debugging
Nanobot is an open-source project. See the official repository for license details.
- Official Repository: https://github.com/HKUDS/nanobot
- Documentation: https://github.com/HKUDS/nanobot#readme
- Issues: https://github.com/HKUDS/nanobot/issues