PPactDocs
Productivity

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. 1

    Parse

    POST /v1/nl/parse takes your { prompt } and returns an intermediate representation (IR), a preview of what it would produce, and a suggested output_type. It writes one nl_compilations audit row but has no other side effects.
  2. 2

    Compile

    POST /v1/nl/compile takes the compilation_id from the parse step plus a confirmed output_type and name, 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_typeProducesPermission to compile
viewA saved viewANALYTICS_READ
alertA metric alertANALYTICS_READ
segmentAn audience segmentSEQUENCES_WRITE
workflowAn automationSEQUENCES_WRITE
ruleA sharing ruleTENANT_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 isolationget_tenant_id scopes every query, and compile re-verifies that the compilation_id belongs 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_type returns 422.
  • Suggested type — if you don't pass an output_type, the compiler uses the parser's suggest_output_type heuristic 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.