How drxikunzhao/nanobot works
Nanobot is a self-hosted personal AI agent runtime with WebUI, terminal, chat-channel, and OpenAI-compatible API entry points. The main workflow accepts a user turn, runs the agent with model and tool capabilities, persists session context, and returns a response through the originating surface. Additional documented capabilities include long-term memory, scheduled automation, multi-agent delegation, MCP integrations, and an SDK. The graph combines README-level product scope with sampled implementation evidence; unsampled subsystem wiring is represented conservatively.
Main entry points: loop.py Agent loop · runtime.py Gateway runtime · queue.py Message bus · manager.py Chat channels
Components 21
User surfaces
- WebUI
webui/src/App.tsx - Terminal UI
tui/src/app.ts - Chat channels
nanobot/channels/manager.py - OpenAI API
nanobot/api/server.py
Agent runtime
- Gateway runtime
nanobot/gateway/runtime.py - Message bus
nanobot/bus/queue.py - Agent loop
nanobot/agent/loop.py
Models and tools
- Model routing
nanobot/providers/factory.py - Agent tools
nanobot/agent/tools/loader.py - Subagents
nanobot/agent/subagent.py
State and automation
- Session manager
nanobot/session/manager.py - Long-term memory
nanobot/agent/memory.py - Scheduled automation
nanobot/cron/service.py - Long-horizon goals
nanobot/session/goal_state.py
Integrations
- MCP integration
nanobot/agent/tools/mcp.py - Web search
nanobot/agent/tools/search.py - Image generation
nanobot/providers/image_generation.py - Python SDK
nanobot/sdk/runtime.py
Other components
- User
- LLM providers
- Chat services
Connections 24
- User → WebUI: sends turn
- User → Terminal UI: sends turn
- User → Chat channels: sends message
- User → OpenAI API: sends request
- WebUI → Gateway runtime: connects
- Terminal UI → Gateway runtime: connects
- Chat channels → Message bus: dispatches messages
- Gateway runtime → Message bus: coordinates runtime
- OpenAI API → Agent loop: runs request
- Message bus → Agent loop: delivers turn
- Agent loop → Model routing: requests completion
- Model routing → LLM providers: calls model
- Agent loop → Agent tools: dispatches tools
- Agent loop → Session manager: reads and writes
- Agent loop → Long-term memory: uses memory
- Agent loop → Subagents: delegates work
- Agent loop → Long-horizon goals: supports goals
- Scheduled automation → Agent loop: starts turns
- Chat channels → Chat services: connects
- Agent tools → MCP integration: exposes integration
- Agent tools → Web search: exposes search
- Agent loop → Image generation: requests images
- Python SDK → Gateway runtime: uses runtime
- Agent loop → Message bus: publishes response