How hkuds/nanobot works
nanobot is a self-hosted personal AI agent framework. A user submits a request through the WebUI, terminal, API, or a chat channel; the agent processes it with a configured model and tools, then returns a response through the initiating surface. Sessions preserve history, while memory, scheduled automation, integrations, and remote access extend that core workflow. The graph reflects documented capabilities and source-index references; unsampled subsystem links are omitted where their wiring is not evidenced.
Main entry points: loop.py Agent loop · server.py Agent API · manager.py Chat channels · queue.py Message bus
Components 18
User surfaces
- Browser UI
webui/src/App.tsx - Terminal UI
tui/src/app/app.ts - Agent API
nanobot/api/server.py - Chat channels
nanobot/channels/manager.py - Agent gateway
nanobot/gateway/service.py - Python SDK
nanobot/sdk/clients.py
Agent runtime
- Message bus
nanobot/bus/queue.py - Agent loop
nanobot/agent/loop.py
Agent capabilities
- Agent tools
nanobot/agent/tools/registry.py - Long-term memory
nanobot/agent/memory.py - Subagent delegation
nanobot/agent/subagent.py
Persistence and scheduling
- Session history
nanobot/session/manager.py - Scheduled tasks
nanobot/cron/service.py
Models and integrations
- Configuration
nanobot/config/loader.py - Model providers
nanobot/providers/base.py - MCP integrations
nanobot/agent/tools/mcp.py
Other components
- User
- Model service
Connections 20
- User → Browser UI: submits requests
README.md - User → Terminal UI: submits requests
README.md - User → Agent API: sends requests
README.md - User → Chat channels: sends messages
README.md - Browser UI → Message bus: routes messages
- Chat channels → Message bus: dispatches messages
nanobot/channels/manager.py - Message bus → Agent loop: delivers messages
nanobot/bus/queue.py - Agent API → Agent loop: runs requests
nanobot/api/server.py - Terminal UI → Agent API: uses HTTP API
- Agent loop → Model providers: requests completion
nanobot/agent/loop.py - Model providers → Model service: calls model
- Agent loop → Agent tools: dispatches tools
nanobot/agent/loop.py - Agent loop → Session history: reads and writes
nanobot/agent/loop.py - Agent loop → Long-term memory: uses memory
nanobot/agent/loop.py - Agent loop → Subagent delegation: delegates tasks
nanobot/agent/loop.py - Scheduled tasks → Agent loop: runs scheduled turns
nanobot/cron/service.py - Configuration → Model providers: configures models
- Agent tools → MCP integrations: loads integrations
- Agent gateway → Chat channels: hosts channel runtime
- Python SDK → Agent loop: starts agent turns
nanobot/sdk/clients.py