Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
title: Install kwnt: self-host AI agents on a VPS or Docker
description: Build the kwnt binary and run your AI bots on your laptop, on a VPS with systemd, or with Docker Compose behind an HTTPS reverse proxy.
card_title: Install & run
path: docs/install.html
nav: install
card: On your own computer, on a VPS with systemd, or with Docker Compose.
card_art: avatar:devops
---
<p class="kicker">Docs</p>
<h1>Install & run on a laptop, VPS or Docker</h1>
<p class="intro"><code>kwnt</code> is one self-contained binary with the web app and SQLite built in. Build it once, then run it on your own computer or on a server. New to this? Read <a href="../self-hosted-ai-agents.html">what self-hosting an AI agent team involves</a>.</p>
<h2 id="build">Build the release binary</h2>
<pre><code>make build
./target/release/kwnt serve</code></pre>
<p>The binary embeds the web app, so the machine that runs it needs no Node.js. Docker is only needed for VM mode and the bots' shared browser (see <a href="browser.html">Browser</a>).</p>
<h2 id="mac">The Mac app</h2>
<p><a href="https://github.com/alexsergivan/kwant/releases/latest/download/kwant_universal.dmg" rel="noopener">Download the Mac app</a> (a universal <code>.dmg</code> for Apple silicon and Intel), open it and drag kwant to Applications. It runs its own kwant bots on your Mac, with the same data folder as <code>kwnt serve</code> (<code>~/.kwnt</code>), and keeps running in the menu bar when you close the window.</p>
<p>The app is signed ad hoc, not notarized by Apple yet, so macOS asks once, the first time you open it:</p>
<div class="mac-first-doc">
<ol class="mf-steps">
<li><span>Drag kwant to Applications and open it. When macOS says it couldn't verify it, click <b>Done</b>.</span></li>
<li><span>Open <b>System Settings › Privacy & Security</b> and scroll down to <b>Security</b>.</span></li>
<li><span>Click <b>Open Anyway</b> next to “kwant” was blocked, then <b>Open Anyway</b> again, and enter your Mac password or use Touch ID.</span></li>
</ol>
<figure class="mf-fig">
<a class="zoom" href="{{root}}assets/media/open-anyway-wide.svg" data-caption="A mock-up of macOS 15: the “kwant” Not Opened alert (click Done), System Settings › Privacy & Security, and Open Anyway under Security.">
<picture>
<source media="(max-width: 640px)" srcset="{{root}}assets/media/open-anyway-phone.svg" width="340" height="452">
<img src="{{root}}assets/media/open-anyway-wide.svg" width="560" height="360" loading="lazy" decoding="async"
alt="A mock-up of the three macOS steps: the “kwant” Not Opened alert with Done marked, System Settings › Privacy & Security, and the Security row “kwant” was blocked to protect your Mac with Open Anyway marked.">
</picture>
</a>
</figure>
<p class="mf-after">You only do this once. On macOS 14 or earlier, right-click kwant in Applications and choose <b>Open</b> instead.</p>
</div>
<p>When a bot needs you, with a question or an approval, the menu-bar icon plays a short animation once and a small note drops under it; click it to open that chat. The Linux app changes its tray icon and shows a notification. Untick <b>Show nudges</b> in the icon's menu to turn them off.</p>
<h2 id="linux">The Linux app <span class="beta">beta</span></h2>
<p>On Linux (x86_64) there's a desktop app too. Like the Mac app, it runs its own kwant bots, uses the same data folder (<code>~/.kwnt</code>) and puts an icon in the tray.</p>
<ul>
<li><strong>Ubuntu 22.04 or newer, Debian 12 or newer:</strong> <a href="https://github.com/alexsergivan/kwant/releases/latest/download/kwant_amd64.deb" rel="noopener">download the <code>.deb</code></a>, then install it with <code>sudo apt install ./kwant_amd64.deb</code>. apt installs what it needs with it.</li>
<li><strong>Other distributions:</strong> <a href="https://github.com/alexsergivan/kwant/releases/latest/download/kwant_x86_64.AppImage" rel="noopener">download the AppImage</a>, then <code>chmod +x kwant_x86_64.AppImage</code> and run it. It needs a normal GTK desktop and FUSE.</li>
</ul>
<p>Updates arrive in the app, which checks each one's signature before installing it. With the <code>.deb</code>, your system asks for your password to install the update. To remove the <code>.deb</code>, run <code>sudo apt remove kwant</code>; your data in <code>~/.kwnt</code> stays.</p>
<p class="note warn"><strong>The Linux app is a beta.</strong> We've tested it in clean installs of Ubuntu 22.04, Ubuntu 24.04 and Debian 12, but not yet on real desktops, so the tray icon, Wayland and HiDPI screens may behave differently on yours. It's x86_64 only for now: no ARM builds. Something wrong? <a href="https://github.com/alexsergivan/kwant/issues" rel="noopener">Open an issue</a>.</p>
<h2 id="windows">The Windows app <span class="beta">beta</span></h2>
<p>On 64-bit Windows there's an app too. It runs kwant on your PC with the same data folder as <code>kwnt serve</code>: <code>.kwnt</code> in your user folder.</p>
<ol>
<li><a href="{{windows_exe}}" rel="noopener">Download the installer</a>, <code>kwant_X.Y.Z_windows_x64_beta_setup.exe</code> from the <a href="https://github.com/alexsergivan/kwant/releases/latest" rel="noopener">latest release</a>. Its SHA-256 is next to it, in the <code>.sha256</code> file and in the release notes.</li>
<li>Run it. It installs for your user only, so it needs no admin rights, and adds kwant to the Start menu.</li>
<li>The installer isn't code-signed yet, so the first time Windows SmartScreen warns about an unrecognized app. Click <b>More info</b>, then <b>Run anyway</b>.</li>
</ol>
<p class="note warn"><strong>The Windows app is a beta.</strong> It doesn't update itself yet: a new version is a new installer. Grok, the VM (bots work on your own computer instead) and looking inside videos aren't on Windows yet. Dev mode works, but in a folder OneDrive syncs with Files On-Demand, kwant can't safely read the repo's git files, so it asks you before every push from that folder. Something wrong? <a href="https://github.com/alexsergivan/kwant/issues" rel="noopener">Open an issue</a>.</p>
<h2 id="side-by-side">This Mac and your servers, side by side</h2>
<p>The Mac and Linux app can open This Mac and every server you use at the same time, each in its own window. Nothing restarts when you go from one to another.</p>
<figure>
<div class="frame">{{shot:v075-side-by-side-card|kwant's Add a server window with the address kwant.example.com typed in and a Connect button.|(max-width: 860px) 100vw, 760px}}</div>
<figcaption>Add a server takes an address or a sign-in link.</figcaption>
</figure>
<ul>
<li><strong>Add a server…</strong> in the menu bar (the tray on Linux) takes the server's address or a sign-in link. Sign in once, and the server stays listed and signed in until you remove it, so you never type it again.</li>
<li>The menu bar lists each place with what's waiting there, or "Sign in to see what's waiting", or "Couldn't reach it". Choose a place to open or bring up its window.</li>
<li>A link to another listed place opens that place's window. Other links open in your browser.</li>
<li>When a server can't be reached, its window says why, with <strong>Try again</strong> and <strong>Remove this server…</strong>.</li>
<li><strong>Remove a server</strong> asks first, then signs the app out on that server when it can reach it, so it also disappears from that server's signed-in devices. If the server is down, the app removes it anyway, and you can sign the app out later on the server in <strong>Settings → All spaces → Signed-in devices</strong>.</li>
<li><strong>Run kwant on this Mac</strong> is on by default. Turn it off if you only use servers. You need at least one server added first.</li>
</ul>
<p>The list is kept in <code>~/.kwnt/desktop-places.json</code>. It holds addresses only, never a token.</p>
<h2 id="whats-new">After an update: What's new</h2>
<p>New in 0.7.6. After kwant updates, a <strong>What's new</strong> sheet shows the version's highlights, smaller changes and fixes. Each device shows it once, and <strong>Got it</strong> closes it. The web app shows it when its server updates. <strong>See what's new</strong> on the <strong>Updated</strong> banner opens it again, and <strong>Settings › About</strong> keeps every version's notes.</p>
<figure>
<div class="frame">{{shot:v077-whats-new|kwant's What's new dialog for 0.7.7 over the app, updated from 0.7.6: Run Claude inside the VM, kwant for Windows (beta), Dev mode reviews only fresh work and Bring your bots, then Smaller changes and fixes: 6, and a Got it button.|(max-width: 860px) 100vw, 760px}}</div>
<figcaption>What's new in 0.7.7, as the app shows it after the update.</figcaption>
</figure>
<h2 id="app">Install the web app</h2>
<p>kwant bots also installs from the browser, so it opens in its own window. In Chrome or Edge, click <b>Install app</b> in <b>Settings → All spaces</b> (or the install icon in the address bar; the sidebar also offers it once, as a tip). In Safari on a Mac, choose <b>File › Add to Dock</b>. On a phone, open your kwant in Safari or Chrome and add it to the Home Screen: <a href="phone.html">kwant on your phone</a> has the steps. Browsers only install pages served over https or from <code>127.0.0.1</code>, so a server needs an <a href="#proxy">HTTPS reverse proxy</a> first.</p>
<h2 id="local">On your own computer</h2>
<p>Run <code>kwnt serve</code> and open <a href="http://127.0.0.1:8799">http://127.0.0.1:8799</a>. There's nothing to sign in to: requests from this machine need no token, and <code>kwnt serve</code> prints nothing about one.</p>
<p>"This machine" means a loopback connection with a loopback <code>Host</code> and no proxy headers. A VPS you reach through an SSH tunnel counts too:</p>
<pre><code>ssh -N -L 8799:127.0.0.1:8799 user@your-vps <span class="c"># on your computer, then open http://127.0.0.1:8799</span></code></pre>
<p>Not with Docker: its published port always counts as remote. And <code>127.0.0.1</code> only: opening kwant at your computer's network address (say <code>192.168.1.20:8799</code>) counts as another machine.</p>
<h2 id="one-line">A Linux server in one line</h2>
<p>New in 0.7.6. On Ubuntu 22.04 or newer, or Debian 12 or newer, on x86_64 or arm64, one command installs kwant and starts it. Run it as the user that should run kwant:</p>
<pre class="prompt"><code>curl -fsSL https://kwant.si/install.sh | sh</code></pre>
<figure>
<div class="frame">{{shot:v076-linux-install-card|A terminal on a Linux server running curl -fsSL https://kwant.si/install.sh piped to sh. It installs kwant 0.7.6 for Linux arm64, says it runs in the background and that Laya and a browser are getting ready, then shows a one-time sign-in link and the ssh tunnel command to run on a laptop.|(max-width: 860px) 100vw, 760px}}</div>
<figcaption>The install ends with your sign-in link. The rest happens in the browser.</figcaption>
</figure>
<ul>
<li><strong>Checked before it installs.</strong> It downloads the prebuilt <code>kwnt</code> from the latest release and checks it against its SHA-256. If they don't match, nothing is installed. kwnt goes in <code>~/.local/bin</code> and your data in <code>~/.kwnt</code>.</li>
<li><strong>Never sudo.</strong> When a step needs admin rights, it prints the command for you instead.</li>
<li><strong>Keeps running.</strong> kwant runs as a service for your user when the system allows it, so it starts again after a reboot. If starting at boot needs admin rights, it prints the one command for that. With no user services, it runs in the background and says how to start it again.</li>
<li><strong>Gets the rest ready.</strong> Laya and a browser for the bots install in the background, and Claude Code too when no AI CLI is there yet.</li>
<li><strong>Sign in.</strong> It ends with a one-time link that works for 15 minutes. On a server, it also prints the <code>ssh -N -L</code> command to run on your laptop first, so the link opens there. In the browser you choose your AI and sign in. Lost the link? Run <code>kwnt signin-link</code>.</li>
<li><strong>Update:</strong> run the same line again. It upgrades kwant in place and keeps your data.</li>
</ul>
<h2 id="vps">On a VPS</h2>
<pre><code><span class="c"># 1. Copy the binary to your server</span>
scp target/release/kwnt user@your-vps:/usr/local/bin/kwnt
<span class="c"># 2. Run it</span>
ssh user@your-vps "kwnt serve --host 0.0.0.0 --port 8799"</code></pre>
<p>On a bind other than loopback, <code>kwnt serve</code> prints a one-time sign-in link on its output, never in the log. It works once, for 15 minutes:</p>
<pre><code>http://<this-host>:8799/#kwnt_token=kl1.…</code></pre>
<p>Swap <code><this-host></code> for the server's address and open the link. The page signs in with an HttpOnly cookie that lasts a year and clears the address bar. With <code>KWNT_ALLOWED_ORIGINS</code> set to your HTTPS address, the link is ready to open and comes with a QR code to scan with your phone.</p>
<ul>
<li><strong>Used, expired or lost the link?</strong> On the server, as the user that runs kwnt, <code>kwnt signin-link</code> (or <code>kwnt token</code>) prints a new one-time link, and <code>cat ~/.kwnt/api-token</code> prints the token to paste on the sign-in screen. With the systemd unit below that's <code>sudo cat /var/lib/kwnt/api-token</code>. Built from source and kwnt isn't on your <code>PATH</code>? Use <code>./target/release/kwnt token</code> from the source folder.</li>
<li><strong>Same user:</strong> run as another user, <code>kwnt token</code> fails with an error, because it can't find or read the token file. Run it as the user that runs kwnt, or with the systemd unit use <code>sudo cat /var/lib/kwnt/api-token</code>.</li>
<li><strong>Same machine:</strong> each install has its own token. A token from your laptop won't open kwnt on your server. Get it on the server.</li>
<li><strong>Scripts:</strong> <code>kwnt token --raw</code> prints just the token, to send as <code>Authorization: Bearer <token></code>.</li>
<li>The token lives in <code><data dir>/api-token</code> (mode 0600), or set <code>KWNT_API_TOKEN</code> (16+ characters).</li>
</ul>
<p><strong>Adding a phone or another browser:</strong> once you're signed in, open <strong>Settings → All spaces → Signed-in devices</strong> and choose <strong>Add a phone or browser</strong>. kwant shows a one-time QR code and a link to copy. Like the server's link, it works once, for 15 minutes. Scan it with your phone's camera and the panel changes to <strong>Signed in ✓</strong>. The QR code is drawn in your browser, and the code is hidden again when it expires, when you press <strong>Hide</strong> or <strong>New code</strong>, or when you leave the page.</p>
<p><strong>Signed-in devices</strong> lists the browsers signed in with a link, a QR code or an approval, with <strong>Sign out</strong> for each one. The browser you're using is marked <strong>This device</strong> and has no Sign out button. Browsers signed in by pasting the API token aren't listed. Signing a browser out doesn't change the API token. On your own computer, where there's nothing to sign in to, this section doesn't appear.</p>
<p><strong>Signing in from a new device without a link:</strong> on the sign-in screen, choose <strong>Sign in from another device</strong>. The new browser shows a short code, valid for 10 minutes. Every browser that's already signed in shows <strong>New device wants access</strong> with the same code, the browser name and its IP address. Check that the code matches, then press <strong>Approve</strong>, and the new browser signs itself in. <strong>Approve only a code that's on a screen you're holding right now.</strong> An approved device gets full control of kwant as you, so if someone asks you to approve a code, press <strong>Deny</strong>.</p>
<div class="note warn"><strong>The link signs in as you.</strong> Anyone who can read the server's output, or <code>docker compose logs</code> with Docker, can use it. Keep that output private.</div>
<h3 id="systemd">As a systemd service</h3>
<p>Create a dedicated user (<code>useradd --system --create-home --home-dir /var/lib/kwnt kwnt</code>), then sign the CLIs in as that user, or add API keys in the app.</p>
<pre><code><span class="c"># /etc/systemd/system/kwnt.service</span>
[Unit]
Description=Kwant AI agent platform
After=network.target
[Service]
Type=simple
User=kwnt
ExecStart=/usr/local/bin/kwnt serve --host 0.0.0.0 --port 8799
Restart=always
Environment=KWNT_DATA_DIR=/var/lib/kwnt
Environment=LAYA_URL=http://127.0.0.1:8000
[Install]
WantedBy=multi-user.target</code></pre>
<pre><code>systemctl daemon-reload
systemctl enable --now kwnt</code></pre>
<h2 id="docker">VPS in 5 minutes with Docker Compose</h2>
<p>One command starts kwnt, Laya (with its model baked in) and a private Chromium for the bots, so VM mode works without mounting the Docker socket. You need Docker with Compose and about 4 GB of free RAM.</p>
<pre><code>git clone https://github.com/alexsergivan/kwant.git && cd kwant
KWNT_CLIS=claude,codex docker compose up -d --build <span class="c"># any of claude,codex,grok; leave out for none</span>
docker compose exec kwnt kwnt doctor <span class="c"># what works, and the fix for what doesn't</span>
docker compose exec kwnt claude auth login <span class="c"># or codex login --device-auth, grok login --device-auth</span>
docker compose exec kwnt kwnt token --raw <span class="c"># the token to paste on the sign-in screen</span></code></pre>
<p><strong>The released image.</strong> Since 0.7.6, <code>docker compose up -d</code> without <code>--build</code> pulls the released kwnt image, <code>ghcr.io/alexsergivan/kwnt</code>, instead of building it here. It has no AI CLIs inside, so add an API key in the app, or build with <code>KWNT_CLIS</code> as above. To pin a version, set <code>KWNT_VERSION=0.7.7</code> in <code>.env</code>. To update: <code>docker compose pull kwnt && docker compose up -d</code>.</p>
<p>Instead of CLIs you can add an API key in the app under <strong>Settings → This space → Accounts</strong>. CLI sign-ins persist in the <code>kwnt-home</code> volume and data in <code>kwnt-data</code>. The UI is published on <code>127.0.0.1:8799</code> only: put HTTPS in front (below) and set <code>KWNT_ALLOWED_ORIGINS=https://your.domain</code> in <code>.env</code>. With Caddy that's a two-line <code>Caddyfile</code>: <code>your.domain { reverse_proxy 127.0.0.1:8799 }</code>.</p>
<p>Requests through Docker's published port count as remote, so sign in with a one-time link: <code>docker compose exec kwnt kwnt signin-link</code> prints a new one (and a QR code), or paste the token from <code>docker compose exec kwnt kwnt token --raw</code>. kwant's own <code>execute_shell</code> tool isn't available in this stack, because it would need the host's Docker socket; the CLIs' shell tools work. Upgrading from an older image, where kwnt ran as root? If it says <code>/data isn't writable</code>, run once: <code>docker compose run --rm -u root kwnt chown -R 10001:10001 /data</code>.</p>
<h2 id="stores">Render, CasaOS, Umbrel and Coolify</h2>
<p><a href="https://render.com/deploy?repo=https://github.com/alexsergivan/kwant"><img src="https://render.com/images/deploy-to-render-button.svg" alt="Deploy to Render" width="153" height="40"></a></p>
<p>The button reads <a href="https://github.com/alexsergivan/kwant/blob/main/render.yaml"><code>render.yaml</code></a>: one web service from the released image, with a 1 GB disk on <code>/data</code>. <strong>Render keeps files only on a disk, and disks need a paid instance</strong> (Starter or up), so the free plan won't work. Render makes the sign-in token: copy <code>KWNT_API_TOKEN</code> from the service's <strong>Environment</strong> page and paste it on the sign-in screen.</p>
<p>For a home server, the repo's <a href="https://github.com/alexsergivan/kwant/tree/main/deploy"><code>deploy/</code></a> folder has a listing for each store, pinned to the release:</p>
<ul>
<li><strong>CasaOS:</strong> sign in with the token that <code>kwnt token --raw</code> prints in the app's <strong>Terminal</strong> (kwant's menu on the dashboard). Until the store lists kwant, import the file under <strong>Custom Install</strong>.</li>
<li><strong>Umbrel:</strong> sign in with the password Umbrel shows for kwant. Umbrel's own login stays in front of it.</li>
<li><strong>Coolify:</strong> sign in with <code>SERVICE_PASSWORD_64_KWNT</code> from the service's environment variables. Until it is a Coolify template, run the file as a <strong>Docker Compose</strong> resource.</li>
</ul>
<p>These run kwnt alone, without Laya or the bots' private browser, so bots are picked by keyword and VM mode is off. The image has no AI CLIs inside: add an API key in the app.</p>
<h2 id="deps">Without Docker: <code>kwnt setup</code>, then <code>kwnt doctor</code></h2>
<p><code>kwnt setup</code> installs what kwant needs on this machine: Chromium or Chrome for the bots' browser, Laya (in kwant's data folder, with its own <code>uv</code> if there's no Python) and a CLI (<code>claude</code> unless you name others with <code>--clis</code>). It asks before each step (<code>--yes</code> skips the questions), never runs <code>sudo</code> itself (it prints the command for you), installs into your home folder where it can, skips Docker unless you pass <code>--docker</code>, and is safe to run again.</p>
<p><strong>No Node needed.</strong> Since 0.7.6, on a Mac or Linux computer without Node, kwant installs Codex from OpenAI's standalone release and checks its SHA-256 before unpacking anything. With no Chrome or Chromium on the computer, kwant downloads Chrome for Testing into its own folder the first time a bot needs the browser. If a download fails, Settings says why.</p>
<pre><code><span class="c"># Mac or Linux app: nothing to run, it installs the Laya router itself on first start</span>
<span class="c"># Mac or Linux, from source (needs Rust and Node)</span>
git clone https://github.com/alexsergivan/kwant.git && cd kwant && make build
./target/release/kwnt setup && ./target/release/kwnt doctor
<span class="c"># Debian or Ubuntu, system packages only</span>
sh scripts/install-linux-deps.sh --clis claude && kwnt doctor
<span class="c"># VPS with Docker: see above, then</span>
docker compose exec kwnt kwnt doctor</code></pre>
<h2 id="proxy">Behind an HTTPS reverse proxy</h2>
<p>Only the HTTPS port needs to be reachable from outside. Forward the original <code>Host</code> header, because the live browser stream checks <code>Origin</code> against it, and allow WebSocket upgrades:</p>
<pre><code>location / {
proxy_pass http://127.0.0.1:8799;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_read_timeout 90s;
}</code></pre>
<p>Requests carrying proxy headers count as remote, so they need the sign-in link even if the proxy runs on the same machine. Never publish Chromium's debugging port or the Docker socket.</p>
<h2 id="settings">Settings</h2>
<div class="table-wrap"><table>
<thead><tr><th>Environment</th><th>What it does</th></tr></thead>
<tbody>
<tr><td><code>KWNT_DATA_DIR</code></td><td>Where kwant keeps its database (<code>kwnt.db</code>), account profiles and saved passwords. Default <code>~/.kwnt</code>.</td></tr>
<tr><td><code>KWNT_REQUIRE_TOKEN</code></td><td><code>always</code> requires the token for local requests too; <code>never</code> turns the check off (only behind your own authentication).</td></tr>
<tr><td><code>KWNT_API_TOKEN</code></td><td>Use your own API token instead of the generated one.</td></tr>
<tr><td><code>KWNT_ALLOWED_ORIGINS</code></td><td>Extra browser origins allowed to call <code>/api</code>, comma separated.</td></tr>
<tr><td><code>KWNT_COMPUTER_MODE</code></td><td><code>local</code> or <code>vm</code>, unless a choice is saved in Settings.</td></tr>
<tr><td><code>LAYA_URL</code></td><td>Where the Laya router answers. Default <code>http://127.0.0.1:8000</code>.</td></tr>
<tr><td><code>KWNT_LAYA_MANAGED=0</code></td><td>Don't install or run Laya; use your own. <code>kwnt serve --no-laya</code> skips it.</td></tr>
</tbody>
</table></div>
<p><code>~/.kwnt/config.toml</code> can also set <code>host</code>, <code>port</code>, <code>data_dir</code> and the Laya options (<code>laya_url</code>, <code>laya_managed</code>, <code>laya_models</code>). More on Laya is in <a href="models.html#laya">Models & routing</a>.</p>