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.
- Confirm the target: Self-Host kit (`NEXT_PUBLIC_DEPLOYMENT_MODE=oss`). If they want hosted Humaner Cloud, stop and use the Cloud agent brief.
- Deploy or run the dashboard (Node 20+, pnpm, PostgreSQL 16+ with pgvector, SMTP or console OTP, Anthropic API key).
- Sign up → verify email → OSS onboarding: account type → website → business → invite → **required Unique system prompt** → launch (Helpdesk on).
- Copy the public Agent ID from Agents → Integrations → YOUR_AGENT_PUBLIC_ID.
- 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.
- Embed Widget or React with `data-agent` / `agentId` = YOUR_AGENT_PUBLIC_ID and `baseUrl` = their dashboard origin.
- 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
| Layer | Your job | Dashboard job |
|---|---|---|
| System prompt | Write Unique prompt (voice, rules, boundaries) | Persists as customCharacterPrompt; injects at reply time |
| Inference | Provide ANTHROPIC_API_KEY for chat (OPENAI_API_KEY optional for handoff) | Starter agent calls your key; streams SSE |
| Knowledge | Add sources in Knowledge, or drop .md into data/knowledge/ | Hybrid RAG (pgvector when configured; files as fallback) |
| Industry skills | Pick industry at onboarding | Appends open tone/behavior/escalation structures |
| Handoff | Force escalate when testing; staff the queue | Helpdesk ticket + transcript + replies |
| Integrations | Point baseUrl / widget.js at your origin; paste Agent ID | Embed script, SDK, REST contracts |
1. Deploy (operator)
- Prerequisites: Node.js 20+, pnpm, PostgreSQL 16+ with pgvector, SMTP (or SELF_HOST_LOG_VERIFICATION for local OTP), LLM API key.
- Repo: https://github.com/Humaner-inc/humaner
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:3001In 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
Sign up and verify
https://yourwebsite.com/auth/signup → OTP from email or server console → land on onboarding.
- 2
OSS onboarding
Account type → Website → Business (industry) → Invite (optional) → **System prompt (required)** → Launch. Helpdesk is enabled by default.
- 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
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/reactpage.tsx
import { HumanerChat } from "@humaner/react";
export default function SupportPage() {
return (
<HumanerChat
agentId="YOUR_AGENT_PUBLIC_ID"
baseUrl="https://yourwebsite.com"
position="bottom-right"
/>
);
}| Prop | Notes |
|---|---|
| agentId | Required. Public Agent ID. |
| baseUrl | Required for Self-hosting. Your dashboard origin. |
| position / color / greeting / defaultOpen | Optional UI props |
Hosted link on your origin
URL
https://yourwebsite.com/widget/YOUR_AGENT_PUBLIC_ID?open=15. 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
| Check | Why |
|---|---|
| NEXT_PUBLIC_DEPLOYMENT_MODE=oss | Activates Self-Host plan + starter agent; disables Polar checkout and Cloud-only nav |
| Domain allowlist | Stops other sites from embedding your Agent ID |
| Public Agent ID only in the browser | API keys stay on the server |
| Org-scoped keys | A key only touches one organization's data |
| Separate DATABASE_URL from Cloud | Avoid mixing production Cloud tenants with local OSS testing |
| Own the DB | Messages and tickets live in your Postgres; set retention as needed |
| No SELF_HOST_LOG_VERIFICATION in public prod | OTP logging is for local smoke tests only |
Report vulnerabilities to dev@humaner.io. Do not file public issues for exploitable findings.
Verification checklist
- Login / sign-up show Humaner Self-Host branding (same cream/dark chrome as Cloud).
- Onboarding has no Polar plan popup; Unique system prompt is required.
- Dashboard nav is Helpdesk-centric (no Inbox / Agent Desk / Loops / Ask Humaner).
- Chat returns a reply from your prompt (+ knowledge if present).
- Forced handoff creates a Helpdesk ticket; teammate can reply.
- widget.js loads from the same origin; Agent ID embedded with data-agent.
| Symptom | Fix |
|---|---|
| Still see Humaner Cloud onboarding / Polar | Confirm NEXT_PUBLIC_DEPLOYMENT_MODE=oss and restart the Next server after changing NEXT_PUBLIC_*. |
| Stuck on Verify email | Configure EMAIL_* or read OTP from the server console (dev / SELF_HOST_LOG_VERIFICATION). |
| Bubble missing | data-agent set? widget.js URL = your origin? Console errors? |
| Chat 403 | Allowlist the site hostname against the agent. |
| No handoff | Helpdesk enabled (default after OSS onboarding); teammates invited; escalate path fired. |
| Wrong host | Set baseUrl / script src to your origin, not app.humaner.io. |
Monorepo touchpoints
| Area | Path |
|---|---|
| White-label / OSS mode | apps/dashboard/brand.config.ts, lib/deployment-mode.ts |
| Starter agent prompt | apps/dashboard/lib/starter-agent/ |
| Plans / Cloud split | packages/shared/src/plans.ts (SELF_HOST_*) |
| Widget | apps/dashboard/public/widget.js |
| React SDK | packages/react |
| API routes | apps/dashboard/app/api/v1/ |
| Helpdesk / handoff | apps/dashboard/app/dashboard/desk/ |
| Operator A→Z | SELFHOST.md |