Skip to main content

Universal AI provenance layer — cryptographic receipts for every LLM call, with HOLD inference halt protocol

Project description

cascade-lattice

Universal AI provenance + inference intervention. See what AI sees. Choose what AI chooses.

PyPI Python License

pip install cascade-lattice

Two Superpowers

1. OBSERVE - Cryptographic receipts for every AI call

from cascade.store import observe

# Every inference -> hashed -> chained -> stored
receipt = observe("my_agent", {"action": "jump", "confidence": 0.92})
print(receipt.cid)  # bafyrei... (permanent content address)

2. HOLD - Pause AI at decision points

from cascade.hold import Hold
import numpy as np

hold = Hold.get()

# Your model (any framework)
action_probs = model.predict(state)

resolution = hold.yield_point(
    action_probs=action_probs,
    value=0.72,
    observation={"state": state},
    brain_id="my_model",
    action_labels=["up", "down", "left", "right"],  # Human-readable
)

# AI pauses. You see the decision matrix.
# Accept or override. Then it continues.
action = resolution.action

Quick Start

Zero-Config Auto-Patch

import cascade
cascade.init()

# That's it. Every LLM call is now observed.
import openai
# ... use normally, receipts emit automatically

Manual Observation

from cascade.store import observe, query

# Write
observe("gpt-4", {"prompt": "Hello", "response": "Hi!", "tokens": 5})

# Read
for receipt in query("gpt-4", limit=10):
    print(receipt.cid, receipt.data)

HOLD: Inference-Level Intervention

HOLD lets you pause any AI at decision points:

══════════════════════════════════════════════════
🛑 HOLD #1
   Merkle: 3f92e75df4bf653f
   AI Choice: FORWARD (confidence: 45.00%)
   Value: 0.7200
   Probabilities: FORWARD:0.45, BACK:0.30, LEFT:0.15, RIGHT:0.10
   Wealth: attention, features, reasoning
   Waiting for resolution (timeout: 30s)...
══════════════════════════════════════════════════

Model-agnostic - works with:

  • PyTorch, JAX, TensorFlow
  • HuggingFace, OpenAI, Anthropic
  • Stable Baselines, RLlib
  • Any function that outputs probabilities

Informational Wealth

Pass everything your model knows to help humans decide:

resolution = hold.yield_point(
    action_probs=probs,
    value=value_estimate,
    observation=obs,
    brain_id="my_model",
    
    # THE WEALTH (all optional):
    action_labels=["FORWARD", "BACK", "LEFT", "RIGHT"],
    latent=model.get_latent(),           # Internal activations
    attention={"position": 0.7, "health": 0.3},
    features={"danger": 0.2, "goal_align": 0.8},
    imagination={                         # Per-action predictions
        0: {"trajectory": ["pos", "pos"], "expected_value": 0.8},
        1: {"trajectory": ["neg", "neg"], "expected_value": -0.3},
    },
    logits=raw_logits,
    reasoning=["High reward path", "Low risk"],
)

Build Your Own Interface

Register a listener to receive full HoldPoint data:

def my_ui_handler(hold_point):
    # hold_point contains ALL the wealth
    print(hold_point.action_labels)
    print(hold_point.imagination)
    # Send to your UI, game engine, logger, etc.

hold.register_listener(my_ui_handler)

Collective Intelligence

Every observation goes into the lattice:

from cascade.store import observe, query

# Agent A observes
observe("pathfinder", {"state": [1,2], "action": 3, "reward": 1.0})

# Agent B queries
past = query("pathfinder")
for r in past:
    print(r.data["action"], r.data["reward"])

CLI

# View lattice stats
cascade stats

# List observations  
cascade list --limit 20

# HOLD info
cascade hold

# HOLD system status
cascade hold-status

# Start proxy
cascade proxy --port 7777

Installation

# Core
pip install cascade-lattice

# With LLM providers
pip install cascade-lattice[openai]
pip install cascade-lattice[anthropic]
pip install cascade-lattice[all]

How It Works

Your Model                    CASCADE                      Storage
    |                            |                            |
    |  action_probs = [0.1,     |                            |
    |                  0.6,     |                            |
    |                  0.3]     |                            |
    | ------------------------->|                            |
    |                           |  hash(probs) -> CID        |
    |        HOLD               |  chain(prev_cid, cid)      |
    |   +-------------+         | -------------------------> |
    |   | See matrix  |         |              ~/.cascade/   |
    |   | Override?   |         |              lattice/      |
    |   +-------------+         |                            |
    | <-------------------------|                            |
    |   resolution.action       |                            |

Genesis

Every receipt chains back to genesis:

Genesis: 89f940c1a4b7aa65

The lattice grows. Discovery is reading the chain.


Links


"even still, i grow, and yet, I grow still"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cascade_lattice-0.4.0.tar.gz (288.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cascade_lattice-0.4.0-py3-none-any.whl (307.5 kB view details)

Uploaded Python 3

File details

Details for the file cascade_lattice-0.4.0.tar.gz.

File metadata

  • Download URL: cascade_lattice-0.4.0.tar.gz
  • Upload date:
  • Size: 288.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for cascade_lattice-0.4.0.tar.gz
Algorithm Hash digest
SHA256 0899b3dd1b45d9fe71bf559d5608b4d99eda28b4cb2f7ff4f5b068431a57b2e6
MD5 b1e1fc4ede5c5f4ac2718449dd21f2a4
BLAKE2b-256 65795573e807cebbe28a6ee85ff00ca6a4d1af5c967f3b1d704de513d268d375

See more details on using hashes here.

File details

Details for the file cascade_lattice-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cascade_lattice-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e9f8c8b51dbfb733b01d867e3b92fc624a6039f12d4067551ab67332f653750
MD5 1fa54d30fc85f4fea751c67c19512f38
BLAKE2b-256 54b3377092c57dc5662dd3b700d173ea68a4e14f6ac6b04b1d8d058123ab7383

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page