NanoBot.Cli
0.1.3
dotnet tool install --global NanoBot.Cli --version 0.1.3
dotnet new tool-manifest
dotnet tool install --local NanoBot.Cli --version 0.1.3
#tool dotnet:?package=NanoBot.Cli&version=0.1.3
nuke :add-package NanoBot.Cli --version 0.1.3
NanoBot.Net
<div align="center"> <h1>NanoBot.Net: Ultra-Lightweight Personal AI Assistant for .NET</h1> <p> <img src="https://img.shields.io/badge/.NET-8.0+-512BD4" alt=".NET"> <img src="https://img.shields.io/badge/C%23-12.0-239120" alt="C#"> <img src="https://img.shields.io/badge/license-MIT-green" alt="License"> <img src="https://img.shields.io/badge/platforms-Windows%20%7C%20macOS%20%7C%20Linux-blue" alt="Platforms"> </p> </div>
NanoBot.Net is a .NET port of the excellent nanobot β an ultra-lightweight personal AI assistant.
β‘οΈ Delivers core agent functionality with clean C# code, re-implemented with necessary .NET optimizations and extensions.
ποΈ Built on Microsoft.Agents.AI framework β leveraging the official .NET Agent framework for optimal compatibility and extensibility.
Key Features
πͺΆ Lightweight: Clean C# code β minimal footprint, maximum efficiency.
π¬ Research-Ready: Clean, readable C# code that's easy to understand, modify, and extend.
β‘οΈ Lightning Fast: Native .NET performance with minimal startup time and resource usage.
π Easy-to-Use: One-click deployment with simple configuration.
π Framework-Based: Built on Microsoft.Agents.AI for seamless integration with .NET ecosystem.
Features
- Multiple LLM Providers: Support for OpenAI, Azure OpenAI, Anthropic, OpenRouter, DeepSeek, Groq, Gemini, Ollama, and custom OpenAI-compatible endpoints
- Multiple Channels: Discord, Slack, Telegram, WhatsApp, DingTalk, Feishu, QQ, Email, and more
- Extensible Tools: File operations, shell commands, web search, MCP (Model Context Protocol) support
- Memory & Context: Persistent memory with context injection
- Session Management: Multi-session support with history
- Scheduled Tasks: Cron-based job scheduling
- Heartbeat Service: Periodic autonomous actions
- Skills System: Loadable skill modules for extended capabilities
- Feishu File Download: Automatic download of images, audio, files, and media from Feishu messages
- Tool Hints: Real-time display of tool call progress during agent execution
Installation
Homebrew (macOS / Linux / WSL)
brew tap mbzcnet/tap
brew install nbot
nbot --version
Windows (PowerShell)
irm https://raw.githubusercontent.com/NanoBot/NanoBot.Net/main/install/install.ps1 | iex
nbot --version
curl (macOS / Linux / WSL)
curl -fsSL https://raw.githubusercontent.com/NanoBot/NanoBot.Net/main/install/install.sh | bash
nbot --version
dotnet tool (All Platforms)
dotnet tool install --global NanoBot.Cli
nbot --version
Build from Source
git clone https://github.com/NanoBot/NanoBot.Net.git
cd NanoBot.Net
dotnet build -c Release
dotnet run --project src/NanoBot.Cli -- --version
Quick Start
1. Run Configuration Wizard
nbot configure
This launches an interactive wizard to set up your LLM provider and API key.
For non-interactive setup:
nbot configure --non-interactive --provider openai --api-key YOUR_API_KEY
2. Start Chatting
nbot agent
Or send a single message:
nbot agent -m "Hello, what can you do?"
Note: If configuration is incomplete, the agent will prompt you to run
nbot configurefirst.
Commands
| Command | Description |
|---|---|
nbot configure |
Interactive configuration wizard |
nbot configure -p openai -k YOUR_KEY |
Quick non-interactive setup |
nbot onboard |
Initialize workspace (legacy) |
nbot agent |
Start interactive chat |
nbot agent -m "..." |
Send a single message |
nbot gateway |
Start gateway service mode |
nbot status |
Show agent status |
nbot config |
Manage configuration |
nbot session |
Manage sessions |
nbot cron |
Manage scheduled tasks |
nbot mcp |
Manage MCP servers |
Interactive mode exits: exit, quit, /exit, /quit, :q, or Ctrl+D.
Configuration
Configuration Wizard
The easiest way to configure NanoBot.Net is using the interactive wizard:
nbot configure
This will guide you through:
- LLM Provider Selection - Choose from OpenAI, Anthropic, OpenRouter, DeepSeek, Moonshot, Zhipu, or Ollama
- Model Selection - Defaults are provided for each provider
- API Key - Secure input with masking (or use environment variables)
- Workspace Path - Where to store sessions and memory
For CI/CD or scripts, use non-interactive mode:
# Minimal setup
nbot configure --non-interactive --provider openai --api-key YOUR_KEY
# Full setup
nbot configure --non-interactive \
--provider openrouter \
--model anthropic/claude-3.5-sonnet \
--api-key YOUR_KEY \
--workspace ~/my-workspace
Configuration Loading
Configuration is loaded from (in order):
--configcommand line optionconfig.jsonin current directoryagent.jsonin current directory~/.nbot/config.json
Environment variables are supported with NBOT_ prefix:
NBOT_AGENT_LLM_APIKEYNBOT_AGENT_LLM_MODEL- etc.
Multiple LLM Profiles
NanoBot.Net supports multiple LLM profiles, allowing you to switch between different providers or models easily.
{
"Llm": {
"DefaultProfile": "default",
"Profiles": {
"default": {
"Provider": "openai",
"Model": "gpt-4o-mini",
"ApiKey": "${OPENAI_API_KEY}",
"ApiBase": "https://api.openai.com/v1"
},
"claude": {
"Provider": "anthropic",
"Model": "claude-3-5-sonnet-20241022",
"ApiKey": "${ANTHROPIC_API_KEY}",
"ApiBase": "https://api.anthropic.com/v1"
},
"ollama": {
"Provider": "ollama",
"Model": "llama3.2",
"ApiBase": "http://localhost:11434/v1"
}
}
}
}
Managing Profiles via CLI
# View all profiles
nbot config --list
# Get specific profile field
nbot config --get llm.profiles.default.model
# Set profile field
nbot config --set llm.profiles.claude.provider=anthropic
# Change default profile
nbot config --set llm.defaultprofile=claude
Providers
| Provider | Purpose | Get API Key |
|---|---|---|
custom |
Any OpenAI-compatible endpoint | β |
openrouter |
LLM (recommended, access to all models) | openrouter.ai |
anthropic |
LLM (Claude direct) | console.anthropic.com |
openai |
LLM (GPT direct) | platform.openai.com |
deepseek |
LLM (DeepSeek direct) | platform.deepseek.com |
groq |
LLM + Voice transcription (Whisper) | console.groq.com |
gemini |
LLM (Gemini direct) | aistudio.google.com |
ollama |
LLM (local) | β |
<details> <summary>OpenRouter Configuration (Recommended)</summary>
{
"Llm": {
"DefaultProfile": "default",
"Profiles": {
"default": {
"Provider": "openrouter",
"Model": "anthropic/claude-opus-4-5",
"ApiKey": "sk-or-v1-xxx"
}
}
}
}
</details>
<details> <summary>Custom Provider (Any OpenAI-compatible API)</summary>
{
"Llm": {
"DefaultProfile": "default",
"Profiles": {
"default": {
"Provider": "openai",
"Model": "your-model-name",
"ApiKey": "your-api-key",
"ApiBase": "https://api.your-provider.com/v1"
}
}
}
}
For local servers that don't require a key, set ApiKey to any non-empty string.
</details>
<details> <summary>Ollama (Local LLM)</summary>
{
"Llm": {
"DefaultProfile": "default",
"Profiles": {
"default": {
"Provider": "ollama",
"Model": "llama3.1",
"ApiBase": "http://localhost:11434/v1"
}
}
}
}
</details>
MCP (Model Context Protocol)
NanoBot.Net supports MCP β connect external tool servers and use them as native agent tools.
Add MCP servers to your config.json:
{
"Tools": {
"McpServers": {
"filesystem": {
"Command": "npx",
"Args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
}
}
}
}
Two transport modes are supported:
| Mode | Config | Example |
|---|---|---|
| Stdio | Command + Args |
Local process via npx / uvx |
| HTTP | Url |
Remote endpoint (https://mcp.example.com/sse) |
Chat Apps
Connect NanoBot.Net to your favorite chat platform.
| Channel | What you need |
|---|---|
| Telegram | Bot token from @BotFather |
| Discord | Bot token + Message Content intent |
| QR code scan | |
| Feishu | App ID + App Secret |
| DingTalk | App Key + App Secret |
| Slack | Bot token + App-Level token |
| IMAP/SMTP credentials | |
| App ID + App Secret |
<details> <summary><b>Telegram</b> (Recommended)</summary>
1. Create a bot
- Open Telegram, search
@BotFather - Send
/newbot, follow prompts - Copy the token
2. Configure
{
"Channels": {
"Telegram": {
"Enabled": true,
"Token": "YOUR_BOT_TOKEN",
"AllowFrom": ["YOUR_USER_ID"]
}
}
}
3. Run
nbot gateway
</details>
<details> <summary><b>Discord</b></summary>
1. Create a bot
- Go to https://discord.com/developers/applications
- Create an application β Bot β Add Bot
- Copy the bot token
2. Enable intents
- In the Bot settings, enable MESSAGE CONTENT INTENT
3. Configure
{
"Channels": {
"Discord": {
"Enabled": true,
"Token": "YOUR_BOT_TOKEN",
"AllowFrom": ["YOUR_USER_ID"]
}
}
}
4. Run
nbot gateway
</details>
<details> <summary><b>Feishu (ι£δΉ¦)</b></summary>
Uses WebSocket long connection β no public IP required.
Features:
- File Download: Automatically downloads images, audio files, documents, and media from Feishu messages
- File Storage: Saves downloaded files to
~/.nanobot/media/directory - Supported Formats: PNG, JPG, JPEG, GIF, BMP, WebP, ICO, TIFF, OPUS audio, MP4 video, PDF, Office documents, etc.
1. Create a Feishu bot
- Visit Feishu Open Platform
- Create a new app β Enable Bot capability
- Get App ID and App Secret
2. Configure
{
"Channels": {
"Feishu": {
"Enabled": true,
"AppId": "cli_xxx",
"AppSecret": "xxx",
"AllowFrom": []
}
}
}
3. Run
nbot gateway
</details>
<details> <summary><b>Slack</b></summary>
Uses Socket Mode β no public URL required.
1. Create a Slack app
- Go to Slack API β Create New App
2. Configure
- Socket Mode: Toggle ON β Generate App-Level Token
- OAuth & Permissions: Add bot scopes:
chat:write,app_mentions:read - Event Subscriptions: Subscribe to
message.im,app_mention
3. Configure NanoBot.Net
{
"Channels": {
"Slack": {
"Enabled": true,
"BotToken": "xoxb-...",
"AppToken": "xapp-...",
"GroupPolicy": "mention"
}
}
}
4. Run
nbot gateway
</details>
<details> <summary><b>Email</b></summary>
Give NanoBot.Net its own email account. It polls IMAP for incoming mail and replies via SMTP.
1. Configure
{
"Channels": {
"Email": {
"Enabled": true,
"ConsentGranted": true,
"ImapHost": "imap.gmail.com",
"ImapPort": 993,
"ImapUsername": "my-nbot@gmail.com",
"ImapPassword": "your-app-password",
"SmtpHost": "smtp.gmail.com",
"SmtpPort": 587,
"SmtpUsername": "my-nbot@gmail.com",
"SmtpPassword": "your-app-password",
"FromAddress": "my-nbot@gmail.com",
"AllowFrom": ["your-email@gmail.com"]
}
}
}
2. Run
nbot gateway
</details>
Security
| Option | Default | Description |
|---|---|---|
Tools.RestrictToWorkspace |
false |
When true, restricts all agent tools to workspace directory |
Channels.*.AllowFrom |
[] |
Whitelist of user IDs. Empty = allow everyone |
Docker
Docker Compose
docker compose run --rm nbot-cli onboard
vim ~/.nbot/config.json
docker compose up -d nbot-gateway
Docker
docker build -t nbot .
docker run -v ~/.nbot:/root/.nbot --rm nbot onboard
vim ~/.nbot/config.json
docker run -v ~/.nbot:/root/.nbot nbot gateway
Project Structure
src/
βββ NanoBot.Core/ # Core abstractions (interfaces, models)
βββ NanoBot.Infrastructure/ # Infrastructure implementations
βββ NanoBot.Agent/ # Agent core implementation
βββ NanoBot.Providers/ # LLM provider implementations
βββ NanoBot.Tools/ # Tool implementations
βββ NanoBot.Channels/ # Channel implementations
βββ NanoBot.Cli/ # CLI entry point
Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Application Layer β
β (CLI / Gateway Service) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Channel Layer β
β (Telegram / Discord / Feishu / Slack / Email) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Message Bus Layer β
β (InboundQueue + OutboundQueue) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Agent Core Layer β
β (Agent Loop / Context / Memory / Session) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Tool Layer β β Provider Layer β β Infrastructure β
β (File/Shell/Web)β β (OpenAI/etc.) β β (Cron/Heartbeat)β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
Technology Stack
| Dimension | Choice |
|---|---|
| Language/Runtime | C# / .NET 8+ (LTS) |
| Core Framework | Microsoft.Agents.AI |
| LLM Client | Microsoft.Agents.AI (ChatClientAgent) - Built-in multimodal support |
| Tool System | AITool / AIFunction |
| Dependency Injection | Microsoft.Extensions.DependencyInjection |
| Configuration | Microsoft.Extensions.Configuration |
| Logging | Microsoft.Extensions.Logging |
| JSON | System.Text.Json |
| CLI Framework | System.CommandLine |
New Features (Latest Release)
Feishu File Download
NanoBot.Net automatically downloads and saves files from Feishu messages, making them available for agent processing.
Supported File Types:
- Images: PNG, JPG, JPEG, GIF, BMP, WebP, ICO, TIFF
- Audio: OPUS format
- Documents: PDF, Word (DOC/DOCX), Excel (XLS/XLSX), PowerPoint (PPT/PPTX)
- Media: MP4 videos and other media files
How it Works:
- When a Feishu message contains files, NanoBot.Net automatically detects them
- Downloads files using Feishu's API endpoints
- Saves files to the local
~/.nanobot/media/directory - Makes file paths available in the message context for agent processing
Configuration: No additional configuration required - works automatically with existing Feishu setup.
Tool Hints
During agent execution, NanoBot.Net provides real-time feedback about tool calls being executed.
How it Works:
- When the agent decides to use tools, it displays a concise hint like
web_search("query") - Shows progress during tool execution
- Provides immediate feedback about what the agent is currently doing
Example:
Agent: I'm searching for information about AI assistants...
web_search("AI assistants comparison")
Agent: Found several relevant results. Based on the information...
Benefits:
- Transparency: Users can see what the agent is doing in real-time
- Better UX: Provides feedback during potentially long-running operations
- Debugging: Helps identify when tools are being called and with what parameters
This feature works across all channels and provides a better user experience by showing the agent's thought process and tool usage.
Development
Prerequisites
- .NET 8.0 SDK or later
Build
dotnet build
Test
dotnet test
Pack
dotnet pack src/NanoBot.Cli/NanoBot.Cli.csproj -c Release
Roadmap
- Feishu File Download: Automatic download of images, audio, files, and media from Feishu messages β
- Tool Hints: Real-time display of tool call progress during agent execution β
- Multi-modal support (images, voice, video)
- Long-term memory enhancements
- Better reasoning (multi-step planning)
- More integrations (Calendar, etc.)
- Self-improvement mechanisms
Contributing
PRs welcome! The codebase is intentionally small and readable.
References
License
MIT License
<p align="center"> <sub>NanoBot.Net is for educational, research, and technical exchange purposes only</sub> </p>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.