Skip to content

Sequence · Chat round-trip

sequenceDiagram
  autonumber
  actor U as User
  participant D as Dashboard
  participant A as Auth / session
  participant B as One brain · API
  participant P as Planner / LLM router
  participant G as Governance gate
  participant T as Tool
  participant X as LLM observability proxy
  participant L as LLM · DeepSeek
  participant M as Memlink · memory
  participant R as Redis · stream
  U->>D: type a message
  D->>A: validate session
  A-->>D: owner identity (per-owner scope)
  D->>B: POST /v1/chat/send
  B->>M: ingest message (events_raw)
  B->>P: plan — answer or use a tool?
  alt needs a tool
    P->>G: propose tool action
    Note over G: capability · risk · policy · DLP · sign · audit
    alt allowed
      G->>T: run tool
      T-->>B: result
    else needs approval
      G-->>D: approval chip
      D-->>G: operator approves
      G->>T: run tool
      T-->>B: result
    else denied
      G-->>B: blocked (policy / DLP)
    end
  else just answer
    P-->>B: answer directly
  end
  B->>M: recall relevant memory
  M-->>B: support bundle
  B->>X: generate reply (logged)
  X->>L: provider API
  L-->>X: streamed tokens
  X-->>B: streamed reply
  B->>R: publish stream events
  R-->>D: fan out (SSE)
  D-->>U: reply appears, token by token
  B->>M: persist final reply