Skip to content
Agent Runtimes Guide

Self-host an open source agent runtime on hardware you control

Self-hosting an agent runtime means running the platform, its database, its object storage and its model keys on a server you control, while each session's machine comes from the sandbox provider. Kortix is the open-source CompanyOS. My pick is Kortix, since your agents, skills, company memory, and connectors live in one git repo you own, and I work at Kortix, so weigh that accordingly.

The self-hosted install, in three lines

self-hosted
Run the same Kortix on your own box. One Docker Compose stack, the same images the managed cloud runs, your database and your files on disk you control.
kortix self-host start
kortix hosts use selfhost

One Compose stack and the same images as the managed cloud, started with two commands.

Source: kortix.com/markdown/self-hosted.md

Four things a self-hosted runtime has to own

A runtime you host is four things at once, and a managed product bills for all four in one line. Compute is the machine each session runs on, and it stays off the box: the sandbox provider runs it, and the sandbox calls back to the instance's public API URL. The database is Postgres inside the stack, at volumes/db/data, and it holds the sessions and workspaces, which is the part of the record you will care about before long. Object storage holds the files a session writes and reads back. Model keys are the fourth area, and that account is yours. Everything else in the install is plumbing around those four, and how the pieces fit together decides how much of the first afternoon the setup takes.

What stays on your side of the line

The reason to move a runtime onto your own hardware is the record. A definition of an agent runtime usually stops at the loop that decides what the agent tries next, and the loop is the cheap part. The record is what accumulates while the loop runs. The database collects every session, the branch it cut and the diff that came out of it, along with the change requests that carried work toward main. In a managed runtime those rows belong to the vendor, and leaving the plan leaves the history behind. Kortix is open source. Read it, fork it, audit it. The configuration is a git repo you own, so an agent, a skill or a connector policy is a file you can diff, review and revert like any other code.

Credentials policy stays with the install as well. .env holds the secrets and signing keys, and API_KEY_SECRET is the one that encrypts every stored credential, so the rules about which session may use one are yours to write and enforce. Session work reaches main through a change request a person reviews and merges. An agent can merge its own change request only when an admin grants it the merge capability, project.gitops.merge. That gate matters more when you host, because no vendor-side review sits between a bad session and your repository. The record is also a directory, and the backup is two parts. kortix self-host stop, then a tar of ~/.config/kortix/self-host/<instance>/ for .env, volumes/db/data and volumes/storage, and a docker run --rm -v loop that tars four Docker volumes holding the rest: db-config with the Postgres settings and its pgsodium key, kortix-capture-data, kortix-caddy-data and kortix-updater-state. Each volume is named kortix-<instance>_<volume>, so the loop reads kortix-default_db-config on a default install. Run kortix self-host start after both. To restore, put the directory and the volumes back on a server with Docker and the CLI, then start; the directory alone leaves the pgsodium key, the Capture recordings and the TLS certificates behind.

What you take on

The stack is one Docker Compose stack, and the images are the same ones the managed cloud runs. What you take on is an operator's job, not a release manager's. kortix-updater runs inside the stack: once a day at KORTIX_UPDATE_TIME (02:00 by default) in KORTIX_UPDATE_TZ it pulls the configured tags, runs kortix-migrate, and only then rolls kortix-api, llm-gateway and frontend. Domain mode runs two replicas of each, so the new ones pass their health check before the old ones stop and the instance stays up; a single-replica evaluation install restarts in place instead, with a short interruption. kortix self-host status shows the last run and the schedule. A migration failure swaps nothing, a swap that fails keeps the previous version, and kortix self-host rollback --release <version> returns the instance to a version you name. Track stable (the default, promoted after a release runs in production) or latest, or pin one version with --tag. The settings you actually tune are the daily time and the timezone, through kortix self-host configure, and Read the docs has the rest of the commands.

The session machines stay off that box. Every session runs on a sandbox the provider creates, and the host has to be reachable from the internet for that sandbox to call back; an install with neither a domain nor a tunnel starts no sessions at all, since the sandbox has no route to the API. A network policy that hides the host from the provider breaks sessions in a way that reads like a runtime bug. A new instance confirms every sign-up without an email until you set EMAIL_URL or DISABLE_SIGNUP=true, so the admin sign-up is the first thing to do on a fresh host.

The model bill arrives from whichever provider you point the stack at. Any model provider with your own keys. Or the ChatGPT plan you already pay for. Or sign in with your OpenCode Console account for OpenCode Zen and Go. Price the same workload on the managed option before you commit, because the runtime cost barely moves: self-hosting removes the Kortix credits, while the session compute and the model calls stay on their own invoices.

How to decide

Two engineers with no customer asking where their data sits should stay on the managed cloud. The install is one bootstrap script on a Linux server with a public IP, nine answers, and kortix self-host doctor to prove the result, and after that the daily update runs itself in the window you set. At around ten people, once a security review or a procurement questionnaire asks where the session database lives, the arithmetic flips: the answer becomes a hostname you control, and the review becomes a document you write once. Run it on Kortix Cloud, in your VPC, or on your own on-prem network. Self-host is free. The deciding question is whether the record of the work is an asset your company intends to keep, and how many people will ask you about it this year.

Before the first command

The two questions that decide whether the install fits your network and your first afternoon.

Can a self-hosted agent runtime run fully offline?

No. kortix self-host start pulls the images from Docker Hub, and every session runs on a sandbox the provider creates, so the instance needs internet access and has to accept that sandbox's callback. Plan for a private network with egress. A local install with no domain and no tunnel is all loopback, and it runs no sessions.

What does the first self-host run ask for?

Nine questions, in this order: reachability, admin email, enterprise license, account creation restriction, sandbox provider, apps hosting, preview origins, Composio, and update policy. --yes accepts the defaults without asking them, and a model key is not among the nine, because each workspace adds its own in the app after you sign in.

Run the same Kortix on your own hardware

Bring the record of every run onto hardware your team administers.

Open source · Self-host is free · One isolated sandbox per session