Self-hosting — Agent Brief

Copy this Markdown into an AI coding agent. It covers standing up the free customer-support starter kit: Humaner dashboard, Unique system prompt, BYO LLM, Helpdesk handoff, and Widget / React / API embeds so humans only paste the public Agent ID afterward.

Instructions for the integrating agent

Your job

Stand up the Self-Host kit (or point at an existing deploy), complete OSS onboarding with a required Unique system prompt, confirm Helpdesk + BYO LLM chat, then embed Widget / React with the public Agent ID. Do not send them browsing HTML docs. Do not set up Humaner Cloud Polar billing, Inboxes, Agent Desk, live chat, or Cloud Intelligence.

  1. Confirm the target: Self-Host kit (`NEXT_PUBLIC_DEPLOYMENT_MODE=oss`). If they want hosted Humaner Cloud, stop and use the Cloud agent brief.
  2. Deploy or run the dashboard (Node 20+, pnpm, PostgreSQL 16+ with pgvector, SMTP or console OTP, Anthropic API key).
  3. Sign up → verify email → OSS onboarding: account type → website → business → invite → **required Unique system prompt** → launch (Helpdesk on).
  4. Copy the public Agent ID from Agents → Integrations → YOUR_AGENT_PUBLIC_ID.
  5. Optional: add knowledge sources in the dashboard Knowledge tab, or drop markdown into `data/knowledge/` (or crawl with `@humaner/into-markdown`). Hybrid RAG uses pgvector when configured; files are the fallback.
  6. Embed Widget or React with `data-agent` / `agentId` = YOUR_AGENT_PUBLIC_ID and `baseUrl` = their dashboard origin.
  7. Allowlist the site hostname. Verify chat + a forced handoff ticket in Helpdesk.

Quickstart: https://docs.humaner.io/oss/quickstart · A→Z in repo: SELFHOST.md · Cloud brief: https://docs.humaner.io/agent-brief · Self-hosting vs Cloud: https://docs.humaner.io/contributing/open-source-vs-cloud

What the Self-Host starter kit includes

Self-Host is a free customer-support starter kit. Operators write their own agent prompt (same idea as Humaner Cloud Unique), bring an LLM key, and run Helpdesk on their infrastructure under the Humaner brand.

  • Included: Humaner auth/dashboard, org/team, Unique system prompt agent, open Industry Skills, hybrid RAG (pgvector when configured, markdown files otherwise), Widget / React / REST, Helpdesk (async handoff), API keys.
  • You own: LLM API key, knowledge sources / files, prompt content, hosting, SMTP for sign-up email.
  • Not included (Cloud-only): Core Skills, session memory, Agent Desk, runbooks, loops, live chat, collaborative Inbox, Polar billing, Ask Humaner.

Responsibility split

LayerYour jobDashboard job
System promptWrite Unique prompt (voice, rules, boundaries)Persists as customCharacterPrompt; injects at reply time
InferenceProvide ANTHROPIC_API_KEY for chat (OPENAI_API_KEY optional for handoff)Starter agent calls your key; streams SSE
KnowledgeAdd sources in Knowledge, or drop .md into data/knowledge/Hybrid RAG (pgvector when configured; files as fallback)
Industry skillsPick industry at onboardingAppends open tone/behavior/escalation structures
HandoffForce escalate when testing; staff the queueHelpdesk ticket + transcript + replies
IntegrationsPoint baseUrl / widget.js at your origin; paste Agent IDEmbed script, SDK, REST contracts

1. Deploy (operator)

Clone and install

git clone https://github.com/Humaner-inc/humaner.git
cd humaner
pnpm install
cp apps/dashboard/.env.example apps/dashboard/.env.local
  • Set `NEXT_PUBLIC_DEPLOYMENT_MODE=oss` (required — unlocks Self-Host plan + starter agent path).
  • Set DATABASE_URL / DIRECT_URL, AUTH_SECRET, NEXT_PUBLIC_APP_URL.
  • Set EMAIL_* (SMTP or Resend) — required for email/password sign-up OTP.
  • Set ANTHROPIC_API_KEY for widget chat streaming (OPENAI_API_KEY optional for Helpdesk handoff).

Migrate and start

pnpm --filter @humaner/dashboard exec prisma migrate deploy
pnpm --filter @humaner/dashboard dev
# Local default: http://localhost:3001

In snippets below, https://yourwebsite.com is a placeholder for the user's dashboard origin (e.g. http://localhost:3001 or https://support.example.com).

Local OTP without SMTP

In development, the server prints the verification OTP after sign-up / Resend. For Docker-like runs set SELF_HOST_LOG_VERIFICATION=true. Never leave that on in a public production deploy.

2. Onboard + Unique prompt + copy Agent ID

OSS `/onboarding` is not the Humaner Cloud wizard. There is no Polar plan step. The agent step requires a Unique-style system prompt (same storage as Cloud Unique: `character=CUSTOM` + `customCharacterPrompt`).

  1. 1

    Sign up and verify

    https://yourwebsite.com/auth/signup → OTP from email or server console → land on onboarding.

  2. 2

    OSS onboarding

    Account type → Website → Business (industry) → Invite (optional) → **System prompt (required)** → Launch. Helpdesk is enabled by default.

  3. 3

    Copy public Agent ID

    Agents → your agent → Integrations. That cuid is YOUR_AGENT_PUBLIC_ID — the only value end users paste into site embeds.

  4. 4

    Allowlist domains

    Widget settings → Allowed domains. Add the customer site hostname. Leave empty only for local testing.

Prompt vs additives

Your system prompt is primary. Open Industry Skills (from industry) and hybrid RAG (dashboard sources + data/knowledge/) are appended at reply time — they do not replace the Unique prompt.

3. Starter agent runtime (included)

With `NEXT_PUBLIC_DEPLOYMENT_MODE=oss`, chat uses the starter agent path: your Unique prompt + Industry Skills + hybrid RAG + BYO LLM. You do not need to implement a separate bot for the happy path.

Hover to zoom

  • POST /api/v1/chat on your origin streams SSE token deltas.
  • Handoff when the model emits the kit handoff signal (or widget escalate path).
  • Optional advanced: replace/point the chat handler at your own runtime — still create Helpdesk tickets with escalate + handoff payload.

SSE final event when escalating

{
  "delta": "",
  "done": true,
  "escalate": true,
  "handoff": {
    "humanDesk": true,
    "urgency": "high",
    "conversationSummary": "Customer cannot access account after password reset."
  }
}

curl · chat against your origin

curl -N -X POST https://yourwebsite.com/api/v1/chat \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "YOUR_AGENT_PUBLIC_ID",
    "message": "Where is my order?",
    "sessionId": "sess_abc123"
  }'

4. Embed (Agent ID only for the site)

After deploy + onboarding

The customer site only needs the public Agent ID and your dashboard origin. No secret keys in the browser.

Widget

index.html · before </body>

<script
  src="https://yourwebsite.com/widget.js"
  data-agent="YOUR_AGENT_PUBLIC_ID"
  data-color="#18181b"
  data-position="bottom-right"
  async
></script>

Attribute name

Use data-agent. The script does not read data-agent-id.

Theme, bubble/send icons, and corner radius are configured in Dashboard → Integrations on the agent — not as embed data-* attributes.

React

Terminal

npm install @humaner/react

page.tsx

import { HumanerChat } from "@humaner/react";

export default function SupportPage() {
  return (
    <HumanerChat
      agentId="YOUR_AGENT_PUBLIC_ID"
      baseUrl="https://yourwebsite.com"
      position="bottom-right"
    />
  );
}
PropNotes
agentIdRequired. Public Agent ID.
baseUrlRequired for Self-hosting. Your dashboard origin.
position / color / greeting / defaultOpenOptional UI props

URL

https://yourwebsite.com/widget/YOUR_AGENT_PUBLIC_ID?open=1

5. REST API from a custom UI

  • Create an org API key in the dashboard. Keep it server-side.
  • POST /api/v1/chat on your origin with agentId + message; consume SSE.
  • On escalate, POST /api/v1/handoff/ticket or let the widget handoff UI run.
  • Contract shapes match the API reference; host is your baseUrl.

Security & Cloud split

CheckWhy
NEXT_PUBLIC_DEPLOYMENT_MODE=ossActivates Self-Host plan + starter agent; disables Polar checkout and Cloud-only nav
Domain allowlistStops other sites from embedding your Agent ID
Public Agent ID only in the browserAPI keys stay on the server
Org-scoped keysA key only touches one organization's data
Separate DATABASE_URL from CloudAvoid mixing production Cloud tenants with local OSS testing
Own the DBMessages and tickets live in your Postgres; set retention as needed
No SELF_HOST_LOG_VERIFICATION in public prodOTP logging is for local smoke tests only

Report vulnerabilities to dev@humaner.io. Do not file public issues for exploitable findings.

Verification checklist

  1. Login / sign-up show Humaner Self-Host branding (same cream/dark chrome as Cloud).
  2. Onboarding has no Polar plan popup; Unique system prompt is required.
  3. Dashboard nav is Helpdesk-centric (no Inbox / Agent Desk / Loops / Ask Humaner).
  4. Chat returns a reply from your prompt (+ knowledge if present).
  5. Forced handoff creates a Helpdesk ticket; teammate can reply.
  6. widget.js loads from the same origin; Agent ID embedded with data-agent.
SymptomFix
Still see Humaner Cloud onboarding / PolarConfirm NEXT_PUBLIC_DEPLOYMENT_MODE=oss and restart the Next server after changing NEXT_PUBLIC_*.
Stuck on Verify emailConfigure EMAIL_* or read OTP from the server console (dev / SELF_HOST_LOG_VERIFICATION).
Bubble missingdata-agent set? widget.js URL = your origin? Console errors?
Chat 403Allowlist the site hostname against the agent.
No handoffHelpdesk enabled (default after OSS onboarding); teammates invited; escalate path fired.
Wrong hostSet baseUrl / script src to your origin, not app.humaner.io.

Monorepo touchpoints

AreaPath
White-label / OSS modeapps/dashboard/brand.config.ts, lib/deployment-mode.ts
Starter agent promptapps/dashboard/lib/starter-agent/
Plans / Cloud splitpackages/shared/src/plans.ts (SELF_HOST_*)
Widgetapps/dashboard/public/widget.js
React SDKpackages/react
API routesapps/dashboard/app/api/v1/
Helpdesk / handoffapps/dashboard/app/dashboard/desk/
Operator A→ZSELFHOST.md