agentport

Guide · Self-hosting

Self-hosted AI coding agent on your own server with Docker

Cloud coding agents run in someone else's sandbox. A self-hosted agent runs on a machine you control, next to your code, tools and logins. This guide explains how AgentPort does that with one Docker container, and how to set it up.

The setup in one picture

Your browser (phone, laptop, tablet)
      │  secure WebSocket, direct
      ▼
Your server: AgentPort container ──▶ Grok Build / Antigravity
      │                                   working in ~/agentport-workspaces
      │  sign-in + "which computers are mine"
      ▼
AgentPort cloud (no code, no chat stream)

What stays on your machine

Updates replace the container but keep all of the above, so logins, projects and chats survive.

Requirements

You do not need a domain, open ports or a reverse proxy for the standard install.

Option A: one-line install (recommended)

  1. In AgentPort, click Add machine, name it, and choose Your computer.
  2. Click Copy and paste the command on the server.
curl -fsSL "https://control.agentport.johnstech.in/install.sh" | bash -s -- \
  --control-url "https://control.agentport.johnstech.in" \
  --token "apj_…" --tunnel-token "…" --wss-url "wss://…/ws"

The script:

  1. Checks Docker is installed and running, and refuses to install twice on the same computer (one computer, one AgentPort) unless you pass --replace.
  2. Pulls ghcr.io/johnversus/agentport-node:latest with a simple progress bar.
  3. Starts the container with --restart unless-stopped, published only on 127.0.0.1:8787.
  4. Starts a cloudflared container for this computer's managed secure link. It connects outward, so nothing listens on a public port.
  5. Waits for the node to link to your account, then saves settings to ~/.agentport/ and an update-node.sh helper.

Back in the browser the computer flips to ready; click Connect. Then sign in to your agent from the computer's AI Model settings: Grok uses a device code on xAI's verify page, and Antigravity uses Google sign-in.

Option B: Coolify (Docker Compose)

If you already run Coolify, you can deploy AgentPort as a compose resource and let Coolify's HTTPS domain be the public address. No install script, no tunnel.

  1. In AgentPort, Add machine (a new one) and open the Coolify tab.
  2. In Coolify, create a Docker Compose resource and paste AgentPort's compose file.
  3. Give the resource a domain, for example https://desk.example.com.
  4. Set three environment values from AgentPort: CONTROL_URL, the one-time JOIN_TOKEN, and PUBLIC_WSS_URL=wss://desk.example.com/ws (the resource's domain, wss, path /ws, no port).
  5. Deploy, wait for AgentPort to say ready, then Connect.
DNS check: the domain must point at your Coolify server. https://desk.example.com/health should return JSON with "service":"agentport-node". If you see the Coolify login page instead, PUBLIC_WSS_URL points at the wrong host. On Coolify, update by pulling the latest image in Coolify, not with update-node.sh.

Day-to-day use

Updating and removing

When a new version is published, the computer's Software tab shows Update. Or run bash ~/.agentport/update-node.sh. The updater never wipes your account link, projects, or agent logins.

To uninstall, copy the uninstall command from the computer's settings. It removes AgentPort's containers, volume, network and ~/.agentport; your project folder and agent logins stay. Then delete the computer in the app.

Is self-hosting right for you?

Choose it if you want the agent next to your real files and tools, want tasks to keep running when your laptop is closed, or do not want your code in a third-party sandbox. The trade-off is that you keep a machine running with Docker. If you already have a VPS or home server, that is usually nothing new.

Try it on your own computer

The Free plan covers 1 computer. Pro is $27/month for up to 3. You bring the AI login and pay that provider directly.