Plain-English Builder
Type what you want in plain English and Pact compiles it into a saved view, alert, segment, workflow, or sharing rule — with a preview before anything is created.
Plain-English Builder
The builder lets anyone describe what they want — "accounts in the pipeline with no activity in 30 days", "alert me when a deal over $50k stalls" — and Pact compiles it into a real, saved artifact. You can type the prompt or compose it with chips; both paths compile through the same engine.
Live
Backed by api/routes/nl_builder.py and core.nl_builder, with the history
table from alembic migration 0052_nl_compilations. The /builder page mounts
the BuilderTabs component over these endpoints.
Two-step flow: parse, then compile
Parsing and creating are deliberately separate so you always see a preview before anything is written.
- 1
Parse
POST /v1/nl/parsetakes your{ prompt }and returns an intermediate representation (IR), a preview of what it would produce, and a suggestedoutput_type. It writes onenl_compilationsaudit row but has no other side effects. - 2
Compile
POST /v1/nl/compiletakes thecompilation_idfrom the parse step plus a confirmedoutput_typeandname, then creates the real artifact and returns its id — the moment you click "Save as View" / "Create Alert".
A history drawer is backed by GET /v1/nl/compilations (filterable by status,
limit, and user=mine) and GET /v1/nl/compilations/{id} for a single row,
so you can rerun or duplicate past compilations.
Output types
The IR compiles into one of five artifact types, and the compile step is gated per type:
output_type | Produces | Permission to compile |
|---|---|---|
view | A saved view | ANALYTICS_READ |
alert | A metric alert | ANALYTICS_READ |
segment | An audience segment | SEQUENCES_WRITE |
workflow | An automation | SEQUENCES_WRITE |
rule | A sharing rule | TENANT_WRITE |
Parsing is intentionally gate-free
Parse requires only a valid bearer token — any authenticated user can turn a
prompt into an IR and preview. This keeps the "no admin priesthood" promise
honest: typing a question into Cmd+K must never 403. The gate applies at
compile time, per output type, and an audit row is written either way so the
history drawer shows what was attempted.
Guardrails
- Tenant isolation —
get_tenant_idscopes every query, and compile re-verifies that thecompilation_idbelongs to the calling tenant before publishing. - Ambiguity — an ambiguous prompt is surfaced back to the user rather than
compiled into a guess; an invalid
output_typereturns422. - Suggested type — if you don't pass an
output_type, the compiler uses the parser'ssuggest_output_typeheuristic and you can override it at compile time.
Not a document/email template designer
Despite the "builder" URL, this surface builds analytics and automation artifacts — views, alerts, segments, workflows, and sharing rules — from natural language. Email and proposal template editing lives on separate admin surfaces, not here.