Skip to content

LLM Output Storage with nilAI and nilDB #125

@jcabrero

Description

@jcabrero

📦 LLM Output Storage with nilAI and nilDB

This module enables secure, TEE-backed storage of LLM-generated outputs into nilDB, with full user control and delegated access. In this flow, there is no prompt owner—instead, storage revolves around the output data owner, who delegates schema access to the requesting user via NUCs (Nil Usage Credentials).


🔧 Overview

This feature enables:

  • LLM-based query execution through nilAI inside a Trusted Execution Environment (TEE)
  • Secure storage of generated outputs in nilDB
  • Delegated access from the output schema owner to the user
  • Retrieval of stored outputs via SDKs (nilai-py, nilai-ts)

⚙️ How It Works

1. Delegation of Output Schema

  • An Output Owner creates an output schema in nilDB or uses an output user-owned schema.
  • They delegate write access to a user by issuing a NUC scoped to that schema.

2. Query and Output Generation

  • The User submits a query to nilAI, attaching the delegated NUC to authorize output storage.
  • nilAI executes the query inside a TEE-protected environment.
  • The generated output is securely written to nilDB using the delegated access rights.

3. Store ID Issuance

  • Once stored, nilAI returns the Store ID and not the output of the written output to the user.
  • The user can optionally share this Store ID with the Output Owner or others for retrieval.

4. Retrieval

  • The Output Owner, or any authorized retriever, uses the Store ID to access the stored output directly from nilDB.

🔁 Sequence Diagram

sequenceDiagram
    participant OutputOwner
    participant User
    participant nilai-py/ts
    participant nilAI
    participant nilDB

    OutputOwner->>User: Output Schema Delegation NUC
    User->>nilAI: Submit query + request output storage with NUC
    nilAI-->>nilAI: Execute query in TEE
    nilAI->>nilDB: Store output using NUC delegated authority
    nilDB-->>nilAI: Store ID
    nilAI-->>User: Return Store ID

    User-->>OutputOwner: Store ID
    OutputOwner->>nilDB: Retrieve Store ID
    nilDB-->>OutputOwner: Output Query Data
Loading

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions