AgentsHub is a multi-tenant platform for configuring domain agents (Sales, HR, Accountant, ...). Sales Agent is the first concrete instance — it validates platform primitives while supporting the BD team with auto lead generation, qualification, pre-call context, and proposal drafting.
Twendee ERP already owns lead/deal/company data and UI. Hub does not duplicate — it provides agent capabilities (skills, workflows, memory) exposed via API and embeddable chat widget.
Kỷ luật ranh giới: mọi primitive dùng được cho agent vertical khác phải ở platform layer. HR/Accountant next chỉ cần viết skills mới.
Agent runs autonomously in background (lead gen → qualify → brief). Rep takes over once lead is Hot, with full context pre-loaded. At negotiation, rep triggers proposal — agent drafts, rep reviews, ERP approves.
Rep sees tangible output (a proposal document) in week 2-3 instead of waiting for full pipeline. Platform primitives build in M0, then each vertical phase adds 1 skill group.
| Phase | Scope | Effort | Value delivered |
|---|---|---|---|
| M0 | Platform primitives. Skill registry · Workflow runner (sync first) · Integration adapter generalize · JWT SSO · ERP schema PR with Twendee team | ~60h | Infra foundation — no user value yet |
| M1 | Proposal Generator. sales.proposal-generator skill · Finance cross-check · chat widget embed on ERP Deal page · POST /skills/.../run API | ~48h | Rep generates proposal from ERP in < 3 min |
| M2 | Qualification Pipeline. sales.icp-scorer · async workflow runner · platform.notify (Slack) · push score to ERP via webhook | ~36h | Auto-scoring · Hot lead notifications < 60s |
| M3 | Discovery. sales.pre-call-briefer · sales.post-call-extractor · memory wiring · transcript upload UI | ~32h | Pre-call brief 30min before call |
| M4 | Polish + dogfood. Observability dashboards · bug fixes · 1-week BD team dogfood | ~16h | Production-ready · metrics-validated |
Each decision locks a trade-off. Listed with rationale so future readers can challenge them if constraints change.
ERP owns lead/deal rows + UI. Hub stores only agent-layer data (skill runs, memory, workflow state). Avoids duplicate schema and sync conflict.
Admin UI configures agent name, prompts, rules, tool toggles. Skills are code-registered. Avoids over-engineered DSL while keeping config flexible.
ERP already has best-in-class lead/deal UI. Hub only builds what ERP lacks — agent config, chat, approvals. Saves ~40h of duplicate work.
Sync in-process for user-triggered (proposal gen). Async BullMQ for batch/cron (qualify 500 leads / 5 min). Approval steps pause-resume via persisted job state.
ERP signs JWT (tenantId, userId, roles, exp). Hub verifies shared secret. Deep-link + widget embed both use same token. IdP upgrade path kept behind AuthProvider interface.
User-facing value first. Rep sees proposal output week 2-3. Forces platform primitives to ship early — later phases reuse the same runner, adapter, and SSO plumbing.