Cohub
中文Start a Space

Deploy Cohub as a self hosted AI agent platform on your own cluster

To self-host an AI agent platform with Cohub, provision Kubernetes, Postgres, Redis, shared storage, S3-compatible object storage and an OIDC provider, then deploy each service from the repository's templates.

Who
Platform or infrastructure engineers asked to run a shared agent workspace inside their own environment.
When
Hosted Cohub is ruled out by policy, or the team wants to modify and operate the platform itself.
Why
Cohub's source is Apache-2.0 with deploy templates for each service, and without hosted billing everything runs on your infrastructure with your keys.
Self-hosting architecture overview for Cohub listing the web app, API, worker, agent service, sandbox and gateway
The self-hosting guide in the Cohub repository, with the typical production architecture
Cohub pricing page showing Free, Plus ($10/mo), Pro ($50/mo) and Max ($200/mo) alongside the Apache-2.0 self-hosting FAQ

Bringing up Cohub as a self hosted AI agent platform puts the entire Apache License 2.0 stack onto infrastructure you operate, using your own OIDC provider and model keys with hosted billing off by default. Bring up the local development stack first to verify auth and databases, then deploy each service onto Kubernetes from its template directory.

Provision the production stack first

Full production expects Kubernetes for per-Space sandboxes alongside the backing data and identity services below:

Component Production requirement
Kubernetes Schedules isolated sandboxes per Space; expected for full production
Postgres and Redis Stores application state, background queues, and caches
Shared filesystem Holds Space workspaces and checkpoint caches
S3-compatible object storage Stores assets and checkpoint history as Git packs (no Git host needed)
OIDC provider Logto or another OIDC-compatible identity provider for sign-in
Container images Build and publish your own images, then point deployment configs at them
Model keys Defined in the platform's .cohub/models.json

The repository's deployment guide is concise and assumes Kubernetes familiarity. Under deploy/, each component (api, web, worker, agent, gateway, fs-api, storage, and more) carries its own README.

Boot the repo locally before touching Kubernetes

Clone the Cohub source tree and confirm the API and web services start against your database, Redis, and OIDC settings locally:

# clone the Cohub source, then run the rest from its root
cd cohub
pnpm install
cp apps/api/.env.example apps/api/.env
cp apps/web/.env.example apps/web/.env
# fill DATABASE_URL, REDIS_URL and the OIDC settings
pnpm dev

Wire OIDC sign-in across web and API

Update both the frontend build configuration and the API runtime environment so token validation matches. The API resource value must equal the audience your OIDC provider writes into access tokens:

# web, at build time
PUBLIC_LOGTO_ENDPOINT=https://auth.example.com/
PUBLIC_LOGTO_APP_ID=...
PUBLIC_LOGTO_API_RESOURCE=https://api.example.com
# API, at runtime
LOGTO_ENDPOINT=https://auth.example.com
AUTH_RESOURCE=https://api.example.com

Configure platform and user model keys

Shared platform providers are registered in the platform's .cohub/models.json. Only platform-level configuration is permitted to read keys from service environment variables.

Individual users can also attach their own providers inside their Home Space using literal keys. Supported provider interfaces include openai-completions, openai-responses, and anthropic-messages.

Roll out services from deploy templates and run migrations

Inside deploy/<component>/<env>/ for each service, copy values.example.yaml to values.yaml and secrets.template.yaml to secrets.yaml, populate real values locally without committing them to Git, and execute deploy.sh. The API deployment directory includes the database migration script.

Point the CLI at your cluster and run a smoke test

Direct the Cohub CLI at your self-hosted API and OIDC issuer, sign in, and create a test Space:

export COHUB_BASE_URL=https://api.example.com
export COHUB_AUTH_ISSUER=https://auth.example.com
export COHUB_AUTH_CLIENT_ID=<cli-client-id>
cohub auth login
cohub spaces create --name "smoke-test"

If the gateway or web frontend runs on separate hosts, export COHUB_WS_URL and COHUB_WEB_URL as well.

Finish with a four-step end-to-end check inside that Space: create the Space, send a prompt to the agent, start a server and preview its port, and publish an App. That single pass verifies the API, agent service, sandbox runtime, and object storage together.

Optional integrations and default switches

  • Telemetry: Export traces by setting OTEL_EXPORTER_OTLP_TRACES_ENDPOINT; leave it unset to send no telemetry.
  • Shared screens: Configure a Cloudflare Realtime TURN key when corporate networks block direct WebRTC connections.
  • App room media: Add an SFU app to enable WebRTC in App rooms; without an SFU, rooms still function over WebSocket.
  • Billing: Hosted billing is off by default and commerce remains disabled.

Reference in the docs

This page: The order to bring up a self-hosted Cohub in, and how to check each step.

  • CLI: the CLI settings for a self-hosted API and OIDC provider
  • Self-hosting: the self-hosting architecture, deploy templates, OIDC and storage setup

FAQ

Can I run it without Kubernetes?

For development, yes, with pnpm dev. The guide says full production still expects Kubernetes for sandboxes.

Do image and video generation work self-hosted?

They depend on the model adapters and keys you configure; the guide lists this as a known limit.

Sources

Published · Updated