How It Works

From API response to compliant AI output.

AIPC uses a dual-runtime architecture: deterministic code handles compliance-critical content before and after the LLM generates narrative. The result is output you can trust.

End-to-End Pipeline

The big picture.

Every AIPC interaction follows this six-stage pipeline. Data flows left to right, with compliance enforced at every boundary.

API Provider

Returns data + AIPC contract

AIPC Response

JSON payload with compliance rules

Pre-Gen Runtime

Validate, format, build prompt

LLM

Generates narrative only

Post-Gen Runtime

Render, validate, assemble

User

Sees compliance-enforced output

Key insight: Compliance-critical content is rendered by deterministic code. The LLM only generates unconstrained narrative.

Step 1 · Provider Side

The provider wraps data in a contract.

Every AIPC response is a JSON envelope containing both the data payload and the compliance contract. The contract specifies exactly how the data must be presented -- and what happens if the consumer cannot comply.

Six contract components

Disclosures

Required disclaimers and legal notices that must appear alongside data.

Display Rules

Field-level formatting: decimals, percentages, currency, date formats.

Attribution

Source credit that must appear in header, footer, or both.

Freshness

Staleness thresholds and warnings when data ages past its window.

Tone

Constraints on narrative voice: neutral, factual, no promotional language.

Conditionals

Rules that activate based on data values, jurisdictions, or scopes.

Example AIPC response

{
  "aipc_version": "0.1.0",
  "provider": {
    "name": "Acme Financial Data",
    "id": "acme-fin"
  },
  "contract": {
    "disclosures": [
      {
        "text": "Past performance is not indicative of future results.",
        "position": "before_data",
        "severity": "critical"
      }
    ],
    "display_rules": {
      "price": { "format": "currency", "currency": "USD", "decimals": 2 },
      "change_pct": { "format": "percentage", "decimals": 2, "sign": true }
    },
    "attribution": {
      "text": "Data provided by Acme Financial Data",
      "position": ["header", "footer"]
    },
    "freshness": {
      "max_age_seconds": 900,
      "stale_warning": "Data may be delayed up to 15 minutes."
    },
    "tone": {
      "style": "neutral",
      "prohibit_phrases": ["guaranteed", "risk-free", "best investment"]
    }
  },
  "payload": {
    "symbol": "ACME",
    "price": 142.57,
    "change_pct": 0.0312
  }
}

Step 2 · Pre-Generation

Validate, format, build prompt.

Before the LLM sees anything, the pre-generation runtime processes the AIPC contract through three deterministic stages.

2.1

Contract Validation

Parse and validate the AIPC contract against schema. Check required fields, evaluate conditionals, resolve scopes.

2.2

Field Formatting

Apply display_rules to raw payload values. 0.1247 becomes +12.47%. Deterministic, provider-controlled.

2.3

Prompt Construction

Build a constrained prompt with NarrativeContext: data summary, referenceable fields, tone restrictions, prohibitions.

AIPC Response AIPCRuntime.validate() ValidatedOutput AIPCPromptBuilder LLM Prompt

Step 3 · Generation

The LLM generates narrative.

The language model receives a constrained context and produces only the narrative portion of the response.

What the LLM receives

NarrativeContext {
  data_summary: "ACME stock, current price $142.57, up +3.12%",
  referenceable_fields: ["price", "change_pct", "symbol"],
  tone: "neutral",
  prohibit_phrases: ["guaranteed", "risk-free", "best investment"],
  prohibit_framing: ["investment advice", "recommendation"],
  max_length: 200
}

What the LLM produces

"ACME shares are trading at $142.57,
reflecting a gain of +3.12% in the
current session. Trading volume
remains within recent averages."

The LLM never sees raw data values. It receives pre-formatted, pre-constrained context. It generates only the narrative -- not disclosures, not data tables, not attribution.

Step 4 · Post-Generation

Render, validate, assemble.

The post-generation runtime is where compliance is enforced. Three subsystems work in sequence to produce the final output.

ValidatedOutput RENDERER RenderedBlocks
LLM Narrative VALIDATOR Pass / Redact / Retry
Blocks + Narrative COMPOSITOR Final Response
4a

AIPCRenderer

Deterministic Block Rendering

Attribution

Disclosures

Data Tables

Freshness Warnings

Suppression Notices

Same input → identical output. No randomness. Pure function.

4b

AIPCValidator

Narrative Validation

Prohibited Phrases
Prohibited Framing
Editorial Restrictions
Data Reformatting
Suppressed Data Leakage
Verbatim Reproduction
Tone Consistency

Critical

Suppress entire response

Major

Redact or retry

Minor

Warn and continue

4c

AIPCCompositor

Compliance Assembly

The compositor assembles the final response in a fixed order. Every block has a designated position. The LLM's narrative occupies exactly one slot.

1 Attribution (header) renderer
2 Freshness Warning renderer
3 Before-data Disclosures renderer
4 Narrative llm
5 Data Blocks renderer
6 After-data Disclosures renderer
7 Footer Disclosures renderer
8 Suppression Notices renderer
9 Attribution (footer) renderer

Enforcement

Three levels of enforcement.

AIPC supports progressive enforcement. Consumers choose their level based on risk tolerance and capability. Providers can set minimums.

L1

Prompt-Only

Contract rules injected into LLM prompt. Relies on instruction-following. No post-generation checks.

L2

Deterministic Rendering

Compliance-critical blocks rendered by code. LLM generates narrative only. No validation.

L3

Full Enforcement

Deterministic rendering + narrative validation + retry/suppress on violations. Full audit trail.

Providers can set minimum_consumer_enforcement to require L2 or L3. If a consumer cannot meet the minimum, the data is suppressed entirely.

Next Steps

See it in action.

Explore the playground, read the full specification, or dive into the implementation guides.