Self-hosted AI agents: choose the boundary before the server
Choose self-hosted AI agents by where work runs, which actions need approval, and who owns recovery, with a validated read-only review example.
Self-hosted AI agents are only the right choice when you can name what must stay on your infrastructure. Start with the job: coding, visual workflows, an internal AI application, or a shared team working from a git repo. Then check the execution boundary and permissions before you choose a server. We build Kortix CompanyOS, the open-source option for that last job, but self-hosting its control plane does not put every agent session on your server.
Pick the job before the platform
The best self-hosted AI agent platform is the one whose execution model fits the work you need done. For a company that wants agent instructions and review rules in a repository, evaluate Kortix. For a coding-focused team that needs to choose local or remote agent backends, evaluate OpenHands. For operations built around a visual sequence of steps, evaluate n8n before turning each step into an agent. For an internal AI application with a bundled retrieval stack, evaluate Dify; you still own the application stack and its upgrades.
Those are different purchases. OpenHands Agent Canvas describes a developer control center with local, remote, and cloud backends. n8n combines a visual canvas with custom code and AI agent steps. Dify's self-hosting instructions describe a bundled application stack with a database and vector store. None makes a platform interchangeable with the others.
For your evaluation, write one acceptance task before installing anything. A repository reviewer must return a useful review without changing a file. A support agent must answer from the right documents without sending a reply. A workflow must stop before its external write. If you cannot say what success and refusal look like, an impressive demo will not settle the choice.
Self-hosted AI agents have separate boundaries
Self-hosted AI agents can still send work outside your server. Treat the control plane, agent execution, file storage, and model inference as separate decisions. A locally hosted dashboard proves where the dashboard runs, not where the agent reads a document or where a model processes it.
In the Kortix self-hosting reference, the server runs the web app, API, LLM gateway, and supporting services. Agent sessions run in Platinum sandboxes that call back to the instance's public API URL. Drive and App volumes also live at Platinum. The gateway calls the model providers you connect. That is the documented topology, checked November 2026, not an all-local deployment recipe.
Domain mode is the production path. Tunnel mode exposes the API for evaluation while the web app stays local. With neither flag, the stack binds to loopback and sessions cannot run because the remote sandbox cannot reach the API. Buying a larger server does not change that reachability requirement.
This distinction can rule Kortix out early. If your requirement says agent execution and persistent files must remain inside your network, do not accept a self-hosted control plane as proof that the requirement is met. Ask for a deployment design that covers every boundary. If your requirement is to administer the platform while using remote execution and an approved model provider, the documented split may fit.
Fine-grained permissions need an explicit test
For self-hosted AI agents with fine-grained permissions, consider Kortix for per-agent tool grants and configured connector-call rules, or n8n for permissions around workflows and credentials. Evaluate three separate controls: which tools the agent receives, which resources its identity may access, and which external calls need a person's decision. A role name alone does not prove all three. n8n's RBAC reference distinguishes instance roles from project roles; self-hosted project roles include Registered Community, while custom roles require Enterprise (checked November 2026). Those are permissions for people managing workflows and credentials, not proof of argument-level controls on every agent call.
The important default is equally short: "Approval gates you set. Off until you set them." The manifest reference documents policy.default_mode: risk for reads to run while writes and deletes wait for approval. Explicit matching policies can block calls. These connector rules do not make arbitrary shell commands safe, and a prompt saying "ask first" is not a substitute for a configured rule.
Start with a review task that needs no external account. The following complete kortix.yaml limits the example agent to reading and searching repository files:
default_agent: reviewer
policy:
default_mode: risk
policies:
- match: '*.delete*'
action: block
agents:
reviewer:
description: Reviews repository files without changing them.
prompt: Read the repository and return a written review. Do not change files.
tools: [read, glob, grep]
permission:
edit: deny
bash: deny
connectors: []
secrets: []
kortix_permissions: []
We ran kortix validate --json on this example. It returned "valid":true and "issues":[]. This example has not been runtime-tested. The manifest reference says kortix validate does not check policy or policies; malformed rules can be skipped during connector sync. A valid result is not proof that approval rules work. After granting a connector, check sync errors and test its approval rules on a harmless call before permitting real writes. The example declares no connector or secret grants. The workspace-level policy becomes relevant to connector calls when you later add an appropriate connector grant; the empty list deliberately makes no such connection here.
Copy the file into a scratch directory and validate it before using it. On your instance, request a repository review, then request a file edit and a shell command. The first task should produce a written review; the latter two should have no granted tool with which to run. Keep a record of what actually happened. Do not widen the tool list to make a refusal disappear.
Restore more than the database
A company should use hosted AI agents when nobody owns patches, incident response, and recovery. Self-hosted AI agents make sense when a named team needs deployment control and accepts those duties. Neither option removes the need to scope tools or choose an acceptable model provider.
Before choosing self-hosting, assign an owner to a restore exercise. The Kortix docs separate the instance directory and named volumes from remote Drive, App, and session data. A backup of one database cannot establish recovery of every file or credential. Follow the documented backup and restore procedure, restore into a separate instance, and check that the data and connections you need remain usable.
Run kortix self-host doctor after configuration and after changes to DNS or reachability. The command is an installation check, not a compliance certificate or proof that the agent respects your business rules. Keep the operational check and the permission test as separate acceptance records.
Audit access needs its own budget decision: "Every action is recorded. Reading, exporting and streaming the audit log depend on the plan." Confirm the access you need before making an export part of incident response. Recording alone is not a usable recovery procedure.
Count the dependencies you still operate
Self-hosting is not a promise of a lower total bill. Budget separately for the platform server, remote session compute, model usage, and the time spent operating the deployment. Local inference is another infrastructure decision, not something that follows from installing the dashboard.
Our hosting offer is: "Run it on Kortix Cloud, in your VPC, or on your own on-prem network. Self-host is free." Read that alongside the documented Platinum execution boundary, not instead of it. Free software does not pay the sandbox or model bill, and an on-prem control plane does not make the default topology disconnected from outside services.
Choose the hosted option when the administrative work would be an unowned second job. Choose self-hosting when the control you gain is specific enough to justify an owner and a tested restore. If the only requirement is private document chat, start with the self-hosted workspace comparison instead of assuming you need an action-taking agent.
The agent control-plane walkthrough follows the hosting split in more detail. The review-gate example covers the decision before work lands.