Build Your First Data Product

This guide walks you through creating your first source data product from scratch. You will define a schema, configure ingestion, and verify data flowing into the governed layer your agents query.

Create a Project and Data Product

Every data product lives within a project that groups related data. Start by creating a project and then defining a source data product within it.

Create the project with loxtep_workspace, then create the data product with the CLI using the domain UUID.

{ "operation": "create_project", "name": "commerce-mesh", "domain_id": "<domain-uuid>" }

Create the source product in that domain.

loxtep data-products create --name "orders" --domain-id <domain-uuid> --kind source

This creates a source data product called orders in the commerce-mesh project. Source data products represent atomic datasets ingested from your systems.

Define Your Schema

A schema describes the structure of data your product accepts. Schemas use JSON Schema with Loxtep extensions for semantic annotations and PII tagging.

Create a schema definition for the orders data product:

{
  "name": "orders-schema",
  "definition": {
    "type": "object",
    "properties": {
      "order_id": {
        "type": "string",
        "description": "Unique order identifier"
      },
      "customer_email": {
        "type": "string",
        "format": "email",
        "x-pii": true
      },
      "total_amount": {
        "type": "number",
        "description": "Order total in cents"
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    },
    "required": ["order_id", "customer_email", "total_amount", "created_at"]
  }
}

Apply the Schema

Create and apply the schema with loxtep_define.

{
  "operation": "create_schema",
  "domain_id": "<domain-uuid>",
  "name": "orders-schema",
  "version": "1.0.0",
  "format": "json-schema",
  "definition": { "type": "object", "properties": {} },
  "fields": [
    { "name": "order_id", "type": "string", "required": true, "is_primary_key": true },
    { "name": "customer_email", "type": "string", "required": true }
  ]
}

Apply the returned schema version to the product.

{
  "operation": "apply_schema",
  "schema_id": "<schema-uuid>",
  "schema_version_id": "<schema-version-uuid>",
  "data_product_id": "<data-product-uuid>"
}

Tag PII Fields

Mark fields containing personally identifiable information so governance policies can apply automatically:

{
  "operation": "tag_pii_fields",
  "schema_version_id": "<schema-version-uuid>",
  "field_names": ["customer_email"]
}

Configure Ingestion

Source data products ingest data through connectors, the SDK, or webhooks. The ingestion workflow type handles validation against your schema and routes data into storage.

Using a Connector

Connect an external system like Shopify to stream order events:

{
  "operation": "create_connector",
  "connector_type": "shopify",
  "metadata": { "api_key": "shpat_..." }
}

Using the SDK

Alternatively, push data programmatically from your application using the TypeScript SDK:

import { LoxtepClient } from '@loxtep/sdk';

const client = await LoxtepClient.fromWorkspace();

const writer = await client.get_writer('orders');
writer.write({
  id: 'evt-1',
  payload: {
    order_id: 'ord_12345',
    customer_email: 'buyer@example.com',
    total_amount: 4999,
    created_at: new Date().toISOString(),
  },
});
await writer.close();

Verify Data Flow

After configuring ingestion, verify that events are arriving and being validated against your schema.

Query the data product using the analytics engine:

SELECT order_id, total_amount, created_at
FROM orders
ORDER BY created_at DESC
LIMIT 10;

Monitor Ingestion Health

Check the status of your ingestion workflow in the Observe dashboard or via the CLI:

loxtep queue info dp_orders

This shows queue depth, throughput, and any validation errors. A healthy product shows zero validation failures and consistent throughput matching your source system's event rate.

Semantic Enrichment

Once data is flowing, your source data product starts Raw on the readiness scale. Raw means raw ingested data with system-native identifiers and no ontology bindings.

Move to In Progress

To enable entity resolution and glossary bindings, request a review:

loxtep data-products promote dp_orders --target silver

Moving to In Progress mints stable entity IRIs for primary entities and binds glossary terms to schema fields, giving your agents shared semantic context to stay grounded when they query the product.

Document semantic deltas (Minimal Ontology)

Before marking a product Ready, identify fields where your meaning differs from the vocabulary pack baseline — not every field needs custom ontology work.

  1. In the data product Govern step, toggle meaning differs from baseline and supply divergence_reason for each divergent field.
  2. Create enterprise overrides under Meaning → Enterprise overrides (or via MCP create_enterprise_override).
  3. Resolve Open Gaps (semantic gap issues) when context retrieval or decision traces surface unknowns.
  4. Mark the product Ready when override coverage on divergent fields meets your org threshold (default 80%).

If you skip divergent-field flags, marking a product Ready can pass without documenting any overrides — only do that when the pack baseline truly matches your operational meaning.

Working with Workflows

The ingestion workflow orchestrates the path from raw event to stored, validated record. You can customize validation, add transformations, and attach quality rules.

Add a Quality Rule

Attach a quality rule that rejects orders with negative amounts:

loxtep quality-rules create --file ./positive-amount-rule.json

Quality rules run inline during ingestion and flag or reject records that fail validation.