Skip to content

Configuration

This page covers where nanobot keeps its settings, the defaults the image sets, and how to connect a private Telegram bot.

Where configuration lives

Path Contents
/var/lib/nanobot/.nanobot/config.json Main configuration: models, keys, channels and the web UI password. Mode 0600.
/var/lib/nanobot/.nanobot/workspace/ The agent's workspace and memory. Schedules are in its cron/ folder.
/var/lib/nanobot/.nanobot/ Sessions, gateway data and settings
/opt/nanobot/ The installed runtime. Root-owned and read-only to the agent.

Everything under /var/lib/nanobot is owned by the nanobot user, which has no login shell.

Defaults set on first boot

Setting Value
Web UI 127.0.0.1:8765, sign-in required
Gateway 127.0.0.1:18790
Agent workspace /var/lib/nanobot/.nanobot/workspace
Tools restricted to workspace On
Heartbeat and "dream" Off

First boot never overwrites an existing config.json, so your changes are kept across restarts.

Models

Configure providers, models and keys in the web UI under Settings → Models. To rotate a provider key, update it there.

If you edit config.json by hand, keep it owned by nanobot with mode 0600, then restart the service:

sudo systemctl restart sushi-nanobot.service

Workspace

The agent's tools are restricted to its workspace. To give it files, copy them into the workspace and give them to the nanobot user:

sudo cp -r ~/<folder> /var/lib/nanobot/.nanobot/workspace/<folder>
sudo chown -R nanobot:nanobot /var/lib/nanobot/.nanobot/workspace/<folder>

Any custom workspace folder must be under /var/lib/nanobot and owned by nanobot. The service cannot write anywhere else.

Telegram

Telegram is optional. Finish the test task in the web UI first.

1. Prepare a dedicated bot

  1. Create a new bot with BotFather in your own Telegram account. Use a bot that nothing else polls.
  2. Note the bot token, your Telegram user ID and your private chat ID.

Treat the bot token as a secret. Keep it out of shell commands, URLs and logs.

2. Create the private input file

Open the file in an editor as root:

sudoedit /var/lib/nanobot/.nanobot/telegram.private.json

Paste this template and fill it in. IDs are numbers written as strings:

{
  "telegramToken": "",
  "allowedUserIds": [],
  "allowedChatIds": []
}

Empty lists, usernames, zero and wildcards are rejected. Then make the file private to nanobot:

sudo chown nanobot:nanobot /var/lib/nanobot/.nanobot/telegram.private.json
sudo chmod 0600 /var/lib/nanobot/.nanobot/telegram.private.json

3. Apply it and restart

Run the helper as nanobot. It adds the Telegram channel to config.json, keeps your other settings, and never prints the token:

sudo runuser -u nanobot -- /opt/nanobot/venv/bin/python /opt/nanobot/telegram-config.py \
  --config /var/lib/nanobot/.nanobot/config.json \
  --private-input /var/lib/nanobot/.nanobot/telegram.private.json
sudo systemctl restart sushi-nanobot.service

The helper turns on Telegram in polling mode and limits it to exactly the user and chat IDs you listed. Messages from anyone else are ignored.

Use the helper rather than the web UI to set up Telegram. Setting the exact chat allowlist from the web UI has not been verified.

Change the bot

To change the token or the allowlists, edit the private input file, run the helper again and restart the service. Only one instance should poll a bot at a time.