Self-Host an Open-Source AI Agent Platform with Kortix
To run an AI agent platform on your own server, Kortix is the open-source AI Management System you can install on a laptop, a VPS, your VPC, or your own on-prem network. It runs as one Docker Compose stack, and your agents, skills, memory, connectors, and model keys stay in a git repo you own.
Self-hosting means the platform runs on hardware you control instead of a vendor's cloud. That matters for teams that cannot send company context to someone else's database, that need their own model keys, or that have to pass a security review before an agent touches production. The Kortix self-hosting docs describe the stack as the frontend, the API, the LLM gateway, and a vendored Supabase distribution, all rendered into one Compose file.
Agent sessions are the one part that stays off the box. Kortix runs each session on a separate sandbox provider, Daytona by default, with Platinum and E2B also supported, so sandbox compute does not load your self-hosted server. Kortix is open source (Elastic License 2.0): self-host, read and modify the code.
What you need before you start
Self-hosting Kortix needs a machine you control, Docker, the Kortix CLI, and keys for agent sandboxes and models.
- A Linux or macOS machine. The install script ships a prebuilt binary for both; Windows is not supported.
- Docker and Docker Compose. The self-hosted instance is a Compose stack, so the engine has to be installed before
kortix self-host start. - A domain for production, or a Cloudflare tunnel for evaluation. Point A and AAAA records for your domain and
api.<domain>at the box, and open ports 80 and 443 so the bundled Caddy proxy can issue a TLS certificate. Without a domain or a tunnel, sessions cannot run, because the sandbox has no stable URL to reach the API. - A sandbox provider key.
kortix self-host configureasks for it after the stack starts. - A model API key or a Kortix Gateway key. Self-hosted instances use your own key by default, and any major provider works.
Install the CLI, scaffold a project, ship it
The Kortix CLI controls both cloud and self-hosted instances; the active host decides which one you are talking to. The CLI reference lists every stable command and flag.
- Install the CLI. Run
curl -fsSL https://kortix.com/install | bash. The script downloads a prebuilt binary for macOS or Linux, andkortix updatepulls a newer one later. - Scaffold a project. Run
kortix init my-app, thencd my-app. This creates a project with akortix.yamlthat declares version 2 and runs the OpenCode harness, plus the agents and skills the starter ships. - Ship it. Run
kortix shipfrom inside the project. It lintskortix.yaml, commits your local changes, pushes your branch, and prompts for any missing secret or connection. The first run creates the project and repo on the active host if none exists.
Run the stack on your own server
Self-hosting uses the same CLI against your own host.
- Initialize the instance. With DNS in place, run
kortix self-host init --domain kortix.example.com. Kortix rendersdocker-compose.yml, a.envfile, and a Caddyfile into~/.config/kortix/self-host/<instance>/. - Start it. Run
kortix self-host start, which runsdocker compose up. Usekortix self-host status,kortix self-host logs, andkortix self-host doctorwhile the containers come up. - Configure the sandbox provider. Run
kortix self-host configureand enter the provider key, plus a managed-git token if you use one. - Connect a model. Sign up in the dashboard, then connect your own LLM key in the model picker.
- Point the CLI at your host. Run
kortix hosts use selfhostto switch to your instance, orkortix hosts use cloudto switch back. Kortix stores auth per host, so both stay signed in.
Instances update themselves once a day, and you can pin an exact version with kortix self-host update --tag <version> or turn auto-updates off. Each API container has a 640 MiB memory limit by default; on a 16 GiB host, raise it with kortix self-host env set KORTIX_API_MEMORY_LIMIT=1024m and confirm the applied limit with docker stats --no-stream. Your data lives under ~/.config/kortix/self-host/<instance>/ in volumes/db/data and volumes/storage, and the instance .env holds its secrets, so back up all three before a destructive command.
Connect models with your own keys
Kortix is model-agnostic, so you can pick the model per agent, per session, or per message. Bring an API key from any major provider, use the Kortix Gateway, sign in with a ChatGPT subscription you already pay for, or point an agent at any OpenAI-compatible endpoint running behind your own URL.
On a self-hosted instance, your own key is the default. Model choice lives with the project configuration, so one agent can run on Anthropic, another on OpenAI or Google, and a third on a model you host yourself, all in the same repo.
The governance loop once it runs
Every session runs an agent in an isolated sandbox on its own branch, and nothing reaches your default branch until you merge it. Start one with kortix sessions new --prompt "Summarize this week's commits and open a change request", then attach with kortix sessions chat or the full terminal TUI with kortix connect.
When the agent has commits ready, it opens a change request. Run kortix cr ls to list them, kortix cr diff <cr> to read the unified patch, and kortix cr merge <cr> to land the work on the default branch. The agent can install, run, and break anything inside its sandbox; only what it commits survives, and only a human merge puts it on main.
Because agents, skills, memory, connector config, and triggers are files in the same repo, you can grep the whole company, diff any change, and roll any part of it back. Every one of those files sits in your repo, where it can be reviewed like any other code change.
Troubleshooting common setup problems
| Symptom | Likely cause | Fix |
|---|---|---|
| Sessions never start | No domain or tunnel, so sandboxes cannot reach the API | Use kortix self-host init --tunnel cloudflare for evaluation, or set a domain |
| TLS certificate never issues | DNS not pointed or ports 80 and 443 closed | Point A/AAAA records for the domain and api.<domain>; open both ports |
| API container killed under load | The default 640 MiB memory limit | Set KORTIX_API_MEMORY_LIMIT=1024m; confirm with docker stats --no-stream |
| Sandbox never provisions | Sandbox provider key not set | Run kortix self-host configure |
Get started with open-source Kortix
Kortix is the open-source AI Management System, and a self-hosted instance uses the same CLI and the same change-request gate as the managed cloud. Install the CLI, start the stack, and keep every agent, skill, and key in a repo you can read.
Get started with Kortix. To weigh it against the rest of the field, compare the open-source AI agent platforms or start from the platform overview.
Keep reading
For the category context, read the open-source AI agent platform guide on the Kortix blog and the open-source AI agent platform guide repository.