5-Layer Runtime
Spec teknis untuk mempekerjakan, membatasi, mengaudit, mengevaluasi AI workers di edge Cloudflare. 5 komponen berkomunikasi via API + Queues, bukan 1 super-agent monolitik.
Role Registry
Daftar "karyawan AI" dengan JD, boundary, budget, tools, escalation. Setiap role = 1 row di tabel `ai_roles`.
GET /api/v1/rolesGET /api/v1/roles/:idPOST /api/v1/roles (founder-only)PATCH /api/v1/roles/:idPOST /api/v1/roles/:id/pausePOST /api/v1/roles/:id/resumeWork Queue
Ticket system: siapa kerja apa, SLA, priority, approval required, status tracking, evidence link.
GET /api/v1/tickets (status filter)POST /api/v1/ticketsPATCH /api/v1/tickets/:idPOST /api/v1/tickets/:id/approvePOST /api/v1/tickets/:id/rejectExecution Graph
Agent runtime — LangGraph backbone + OpenAI Agents SDK routing + smolagents workers. Durable long-running eksekusi dengan HITL.
POST /api/v1/exec/start/:ticket_idGET /api/v1/exec/:run_id/statusPOST /api/v1/exec/:run_id/resume (after approval)Governance Ledger
Audit immutable — WORM trigger (DELETE/UPDATE critical blocked), hash chain SHA256, JWT approval signature, R2 evidence. SOVEREIGN CORE.
POST /api/v1/events (append-only)GET /api/v1/events (tenant-scoped, filter by type/actor/time)GET /api/v1/events/:id/evidence (R2 signed URL)GET /api/v1/events/chain-verify (hash chain integrity)Founder Console
UI mobile-first untuk founder: AI workers list, pending approvals, Copilot brief, revenue scorecard, 1-tap approve/reject.
GET /api/v1/console/summaryGET /api/v1/console/pending-approvalPOST /api/v1/console/approve/:ticket_idPOST /api/v1/console/reject/:ticket_idGET /api/v1/console/copilot-briefGET /api/v1/console/ledger/recentCanon Law #17 · Every Agent Action Logs to Ledger
Setiap tool call AI-role WAJIB write ke governance_events dengan hash chain SHA256, approval_signature JWT, evidence URL R2. Bypass ledger = Canon violation auto-rollback.
Canon Law #18 · Framework is Commodity, Canon is Moat
Fase 3+ stack: LangGraph (backbone) + OpenAI Agents SDK (routing) + smolagents (workers). Framework boleh swap kapan saja via ADR. Canon Laws + Governance Ledger TIDAK boleh berubah.