HITL Gateway

Единая точка входа для human approvals, escalations и decisions. Отдельный architectural компонент — не встроенный в отдельных агентов.

Реализация принципа Manifesto #7 — “Human в петле для критических решений” — на уровне системной инфраструктуры.

Зачем отдельный компонент

В ранней архитектуре каждый агент сам решал когда эскалировать. Проблемы:

  • Fragmented UX для human — notifications из 10 разных агентов, разные форматы, нет общего queue
  • Inconsistent escalation logic — каждый агент имеет свой threshold, бывает “забыл эскалировать”
  • Нет SLA tracking — approval pending у человека неделями, никто не замечает
  • Batch-невозможен — 20 агентов ждут approval у одного человека → 20 notifications вместо 1 dashboard
  • Policy enforcement distributed — сложно менять rules глобально

Gateway централизует это. Агент emit’ит approval.required event → Gateway решает routing, batching, SLA.

Ответственности

  • Approval queue per human role — отдельные queues для CEO / Legal / Finance / других
  • Routing — по роли, criticality, специализации
  • Context bundling — pre-computed brief для human, decision-grade info (не raw data)
  • SLA tracking — approval pending > X часов → auto-escalate на уровень выше
  • Batching — группировка related approvals в одну сессию вместо 20 notifications
  • Delegation rules — “если CEO offline > 24h → Chief of Staff authority up to $Y”
  • Audit log — Law 6 enforcement, каждое решение traced (what/who/when/why/evidence)
  • Multi-channel delivery — Slack / email / mobile push / Telegram, по preference human

Что НЕ делает

  • Не принимает решения сам — только routes к human
  • Не interpret-ит агентские выводы (это ответственность агентов)
  • Не modify-ет request — только добавляет context
  • Не bypass-ит Codex запреты (“срочно” не оправдывает нарушение)
  • Не логирует decisions без trace metadata (Law 6)

Входы

  • approval.required events от любого агента
  • escalation.triggered events от Agent-Judge или orchestrator
  • timeout.reached internal events (SLA breaches)
  • Human replies через каналы delivery (Slack/TG/email)

Выходы

  • approval.granted / approval.denied / approval.escalated events
  • Structured context briefs в channels delivery
  • Audit log entries (Law 6)
  • SLA metrics для Observability

Структура подхода

Approval request envelope

approval_id: uuid
trace_id: uuid             # scenario-level
source_agent: "agent-intel-director"
requested_action: "publish_competitor_research_report"
criticality: "L2"
context_brief:
  tldr: "3-line summary"
  key_facts: [...]
  risks: [...]
  recommendation: "approve with watermark"
  confidence: 0.84
  cost_if_proceed: "$12"
  cost_if_denied: "0 + 2h retry"
expected_approver_role: "ceo_founder"
sla_hours: 24
supporting_evidence: [trace_links, memory_refs]

Routing logic

1. Determine approver role from action type + criticality
2. Check delegation rules (is primary approver available?)
3. Check batching opportunity (similar pending requests?)
4. Route to preferred channel of approver
5. Start SLA timer

SLA ladder

CriticalityPrimary SLAAuto-escalate to
L1(agent decides, no gateway)
L224hL3 (orchestrator review)
L38hL4 (Agent-CEO attention)
L44hHuman founder + Chamber review
L52hImmediate human escalation, all channels

Batched approvals (killer feature)

Проблема: 20 агентов ждут approval у одного founder.

Решение: Gateway group-ит similar requests по:

  • Category (research publications, spending decisions, communications)
  • Time window (60 min)
  • Approver (same human)

Human видит одну сессию: “12 pending approvals, 3 batches. Tap to review.” Internal UI показывает batched дашборд. Decision per batch (approve all / review individually / defer).

Лечит “HITL bottleneck” failure pattern из Reference-Org-Blueprint §19 cross-scenario patterns.

Delegation rules

Когда primary approver недоступен:

delegations:
  - primary: ceo_founder
    conditions:
      - unavailable_hours > 12
      - criticality <= L3
      - cost_impact < $500
    delegate_to: chief_of_staff  # agent or human
    audit_required: true
  - primary: legal_counsel
    conditions:
      - unavailable_hours > 4
      - request_type == "standard_contract"
    delegate_to: commercial_legal_agent
    with_boundaries: [no_novel_terms, no_liability_changes]

Delegated decisions сохраняют full audit trail — кто delegated, кому, на каких основаниях.

Model

Gateway сам по себе — не LLM agent. Это deterministic routing service + UI layer. LLM используется только для:

  • Context bundling (Haiku-tier, cheap)
  • Semantic matching для batching (Haiku-tier)
  • Summarization длинных traces для human briefs

Стоимость: < $0.01 per approval request, dominated by delivery infrastructure, not LLM.

Связанные rules

Процессы

Open Questions

  • Unified inbox UI (Slack integration + web dashboard?) vs channel-native (просто Slack threads)
  • Persistence approval history — how long, where stored, how searchable
  • Notification fatigue — если 50 approvals в день, human overwhelmed; когда нужно tightening thresholds?
  • Multi-approver decisions (Chamber-style для L4/L5) — single approval или multi-sig pattern?
  • Rollback approvals — decision approved, потом revert: обратная связь что произошло

Связанные документы