Overview
This guide walks you through setting up nanobot from scratch to having your first conversation. We’ll use OpenRouter as the LLM provider (recommended for global users) and configure optional web search capabilities.Time to complete: ~2 minutesPrerequisites:
- Python ≥3.11 installed
- nanobot installed (see Installation)
Step-by-Step Setup
Initialize nanobot
Run the onboarding command to create configuration files and workspace:This creates:
~/.nanobot/config.json- Main configuration file~/.nanobot/workspace/- Working directory for agent files~/.nanobot/workspace/MEMORY.md- Persistent memory across conversations~/.nanobot/workspace/HEARTBEAT.md- Periodic task definitions
Get API keys
nanobot needs an LLM provider to function. We recommend OpenRouter for global access to all major models:Optional: Get Brave Search API key (for web search)
- OpenRouter (Recommended)
- Anthropic (Claude Direct)
- OpenAI (GPT Direct)
- Other Providers
Why OpenRouter?
- Access to all major models (Claude, GPT-4, Gemini, etc.)
- Pay-as-you-go pricing
- No separate API keys needed for each provider
- Visit openrouter.ai/keys
- Sign up or log in
- Create a new API key
- Copy the key (starts with
sk-or-v1-)
- Visit brave.com/search/api
- Sign up for free tier (2,000 queries/month)
- Copy your API key
Configure your API keys
Open the config file in your editor:Add your API keys by merging these sections into the existing config:
Common First Tasks
Now that nanobot is running, try these common tasks to explore its capabilities:File Operations
Web Search
Code Generation
Shell Commands
Example: Multi-Step Task
Try a complex task that demonstrates nanobot’s multi-step reasoning:- Generate the FastAPI code
- Save it to
server.pyin your workspace - Provide instructions to run the server
Example: Scheduled Tasks
Set up a recurring reminder:- Create a cron job for the reminder
- Store it in the cron service
- Execute it daily at 9 AM (requires gateway running)
Scheduled tasks require the gateway to be running. See Running 24/7 section below.
Configuration Examples
Here are complete configuration examples for common setups:Minimal Setup (OpenRouter Only)
Minimal Setup (OpenRouter Only)
With Web Search (OpenRouter + Brave)
With Web Search (OpenRouter + Brave)
Multi-Provider Setup
Multi-Provider Setup
model field or using different model names in the CLI.Workspace Sandboxing (Production)
Workspace Sandboxing (Production)
Running 24/7
To enable scheduled tasks, heartbeat monitoring, and chat channel integrations, run the gateway:- ✅ Keeps the agent running continuously
- ✅ Processes messages from Telegram, Discord, etc.
- ✅ Executes scheduled cron jobs
- ✅ Runs periodic heartbeat tasks every 30 minutes
Linux Service Setup
To run the gateway as a systemd service that starts automatically:Troubleshooting
Error: No API key configured
Error: No API key configured
Problem: You see this error when running Solution: Make sure you’ve added your API key to the config file:Verify with:
nanobot agent:Model not responding / Timeout
Model not responding / Timeout
Problem: The agent hangs or times out when processing requests.Possible causes:Test with a different model:Enable debug logs:
- Invalid API key: Check that your key is correct
- Network issues: Test connectivity to the provider
- Model unavailable: Try a different model
Web search not working
Web search not working
Problem: Agent says “web search not available” or searches fail.Solution: Add Brave Search API key to config:Get a free API key at brave.com/search/api.
Can't access files outside workspace
Can't access files outside workspace
Problem: Agent can’t read/write files in other directories.Cause: Option 2: Disable restriction (not recommended for production)Option 3: Change workspace directory
restrictToWorkspace: true in config (security feature).Solutions:Option 1: Work within the workspaceInteractive mode exits immediately
Interactive mode exits immediately
Problem: For non-interactive usage, use single-message mode:
nanobot agent starts but exits right away.Possible causes:- Ctrl+D pressed: EOF signal exits the session
- Piped input: Interactive mode requires a TTY
Next Steps
Now that you have nanobot running, explore more features:Connect Chat Channels
Set up Telegram, Discord, WhatsApp, and more
Configure Providers
Add more LLM providers and switch between models
Explore Tools
Learn about built-in tools and MCP integration
Advanced Configuration
Fine-tune temperature, tokens, memory, and more
GitHub Repository
Star the repo and check out the source code
Community Support
Join the Discord server for help and discussions