Skip to content

E32 — Chat with your data: generated answers with OpenUI #1528

Backlog
0 of 10 issues completed
Backlog

Description

@athvin

Goal

People ask questions about their workspace in plain language. The answer comes back as something they can read and work with: a table of the entities in question, a ranked list of which sources produce duplicates, a run summary with its counts, a review pair with its evidence. All of it renders in our own components rather than as a paragraph of prose.

OpenUI (MIT) is the renderer. The model writes OpenUI Lang, a compact DSL that renders while it streams. The browser renders it with a component library that we register and control, and nothing outside that library can render.

Owner decision (2026-12-02)

The owner asked for this feature on 2026-12-02. It reverses part of the 2026-11-26 board prune, which put "AI and MCP" out of scope (#1008).

The pruned epics stay closed, and this epic needs none of them:

What this builds on: the assistant already exists

Verified in the code at 71a493d5:

  • The screen. /[org]/[ds]/assistant and frontend/src/components/assistant/assistant-chat.tsx are a streamed chat with expandable tool citations (design §5.8, "talk with your data").
  • The loop. frontend/src/app/api/orgs/[org]/datasets/[ds]/assistant/route.ts is a Messages API tool loop in the BFF (@anthropic-ai/sdk). It runs up to 8 rounds and emits SSE text, tool, actions, done and error events.
  • The tools. frontend/src/lib/assistant/tools.ts defines 8 read-only tools. They run with the dataset's viewer credential through forward(), so erserver enforces tenant isolation and read-only access; the prompt does not.
  • The controls.
    • Per-org AI settings, with a bring-your-own key and an off switch (lib/ai/config.ts, org_ai_settings).
    • Per-round metering through meter(org, "ai_assistant", …).
    • V9 steward proposals, which become confirm cards and never execute on the model's say-so.
  • The tests. The functional tier scripts the model: tests/mock-erserver/server.mjs serves /anthropic/v1/messages, and tests/functional/grow.spec.ts drives the real loop through it.

So the new work is the answer surface and the data reach. The chat stack itself already exists.

Decisions (recommended here; the spike confirms or overturns them)

  1. Use only @openuidev/react-lang, which provides Renderer, defineComponent and createLibrary. Version 1.2.0 is MIT, and its peers (react ≥19, zod ^3.25 || ^4) are already met. Not the other packages:
    • @openuidev/react-ui ships its own unlayered CSS, d3-scale and d3-shape charts, react-markdown and katex. That contradicts the hand-rolled-charts decision (frontend-data-ui) and the closed token set (frontend-design-system).
    • @openuidev/server calls Thesys's hosted Gateway with THESYS_API_KEY for its autofix and conversation features.
    • @openuidev/react-headless pulls in @ag-ui/core and a Vercel AI SDK peer to parse a stream we already parse.
  2. The loop stays in the BFF. library.prompt() generates the system prompt from the same library the browser renders. There is no generated artifact to drift, and nothing for Rust to carry. Tools keep going through forward() with the viewer credential.
  3. Keep our SSE protocol. Feed the accumulated text into <Renderer response isStreaming>. There is no translation into AG-UI or OpenAI-shaped streams.
  4. Bind, don't transcribe. The model never copies rows or numbers into the UI. A data component names the tool result it shows, and the browser resolves it from the results the same stream delivered. Every rendered value traces to a cited tool call in the same turn.
  5. A closed library of our own components.
    • No Mutation() and no @OpenUrl.
    • Links resolve to in-app routes only.
    • V9 proposals stay on their own actions channel.

Facts found while planning that shape the tickets

Children

# Ticket Est. (wk)
1 #1529 Spike: OpenUI react-lang inside the assistant 0.5
2 #1530 Adopt @openuidev/react-lang: pin, supply-chain gates, telemetry provably off 0.5
3 #1531 The answer component library 2.0
4 #1532 The assistant route speaks OpenUI Lang 1.0
5 #1533 The assistant renders generated answers 1.0
6 #1534 Widen the read-only toolbox to the analytics the API already serves 1.0
7 #1535 Generated-UI threat model 0.5
8 #1536 Live eval set for generated answers 1.0
9 #1537 Ask from where you are: explain this run, this score, this entity 1.0
10 #1538 Release: generated answers on in dev, then prod 0.5

The total is about 9 engineer-weeks. Estimate the children only; the parent isn't summed.

Sequencing

  1. Spike: OpenUI react-lang inside the assistant (streaming, result binding, prompt size) #1529 first. Its write-up amends §5.8 and confirms or overturns the decisions above.
  2. Adopt @openuidev/react-lang: exact pin, supply-chain gates, telemetry provably off #1530 is the first merged code PR.
  3. Then, in parallel:
  4. The assistant renders generated answers: Renderer per turn, citations per component #1533 once The answer component library: a closed OpenUI library built from our primitives and hand-rolled charts #1531 and The assistant route speaks OpenUI Lang: result events, binding rules, prompt caching, stop reasons #1532 land.
  5. Generated-UI threat model: injection through record values, links, size caps, no write path #1535 reviews The answer component library: a closed OpenUI library built from our primitives and hand-rolled charts #1531 through The assistant renders generated answers: Renderer per turn, citations per component #1533 and gates the release. Live eval set for generated answers: parse rate, grounding, correctness, cost per answer #1536 can start as soon as The assistant route speaks OpenUI Lang: result events, binding rules, prompt caching, stop reasons #1532 lands.
  6. Ask from where you are: explain this run, this score, this entity #1537 after The assistant renders generated answers: Renderer per turn, citations per component #1533.
  7. Release: generated answers on in dev, then prod #1538 last.

Adjacent work: #1520 surfaces per-task counters and output, the same data #1534's get_job_tasks tool reads. #1523 adds phase read routes, which become tool candidates once they land.

Not in this epic

  • Text-to-SQL over the lake. SQL the model writes against a tenant's catalog falls in the "config-as-code raw SQL" class the security skill names, and it bypasses the declared-statement rule (entity-framework). Live eval set for generated answers: parse rate, grounding, correctness, cost per answer #1536 may show questions the read routes cannot answer. If it does, the follow-up is a governed aggregate endpoint in er-server with declared dimensions and measures. That would be a separate decision.
  • Persisted conversation history. Threads would store tool results, including golden-record PII, in erweb Postgres. That needs a retention decision first.
  • An API or MCP surface for chat. E28 (E28 — In-app agent and published MCP server #538) stays pruned.
  • Write actions from generated UI. V9 proposals remain the only path, unchanged.

Rollout

There is one flag, ERWEB_ASSISTANT_GENUI_ENABLED. With it off, the assistant answers in text exactly as it does today. It turns on in dev first, then in prod (#1538).

Risks

Design references

  • .claude/skills/frontend-design-system/references/frontend-design.md §5.8.
  • Skills: frontend-bff, frontend-data-ui, frontend-design-system, frontend-testing, security, ci-and-supply-chain, observability.

Sub-issues

Sub-issues

0 of 10 Issues completed
Loading 10 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    epicpost-mvp

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions