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()

# In your inference loop:
action_probs = model.predict(state)  # Your model, any framework

resolution = hold.yield_point(
    action_probs=action_probs,
    action_names=["up", "down", "left", "right"]
)

# 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 with 3D Visualization

from cascade.hold import Hold, HoldMeshServer

# Start mesh server (serves 3D decision space)
server = HoldMeshServer(port=8766)
server.start()

# Open http://localhost:8766 in browser
# See action trajectories as 3D tubes!

hold = Hold.get()
# ... yield_point() calls update the visualization

HOLD: Inference-Level Intervention

HOLD lets you pause any AI at decision points:

+-----------------------------------------------------+
|                 DECISION MATRIX                      |
+-----------------------------------------------------+
| [1] up      P=12.5%  ###                            |
| [2] down    P=37.9%  #########  <-- AI CHOICE       |
| [3] left    P=12.5%  ###                            |
| [4] right   P=37.1%  #########                      |
+-----------------------------------------------------+
|  [1-4] OVERRIDE    [ENTER] ACCEPT                   |
+-----------------------------------------------------+

Model-agnostic - works with:

  • PyTorch, JAX, TensorFlow
  • HuggingFace, OpenAI, Anthropic
  • Stable Baselines, RLlib
  • Any function that outputs probabilities
# PyTorch
probs = torch.softmax(logits, dim=-1).numpy()

# HuggingFace
probs = model(**inputs).logits.softmax(-1).numpy()

# OpenAI (after getting logprobs)
probs = np.exp(logprobs)

# Then:
resolution = hold.yield_point(action_probs=probs)

Collective Intelligence

Every observation goes into the lattice - a shared pool all agents can access:

from cascade.store import observe, query

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

# Agent B queries (same or different machine!)
past = query("pathfinder")
for r in past:
    # Learn from collective experience
    print(r.data["action"], r.data["reward"])

Optional HuggingFace sync for cross-machine sharing:

# One-time setup (optional - everything works locally without this)
pip install huggingface-hub
huggingface-cli login

Without login, everything still works locally. The lattice is local-first.


3D Decision Visualization

HOLD can export decision spaces as glTF - the universal 3D format:

from cascade.hold import HoldMeshServer

server = HoldMeshServer(port=8766)
server.start()

# Endpoints:
# GET /           - 3D viewer in browser
# GET /hold.glb   - glTF binary (import into Unity/Unreal/Godot)
# GET /hold.json  - Raw decision data
# WS  /stream     - Real-time updates

Works with any game engine:

  • Unity: GLTFUtility.LoadFromUrl("http://localhost:8766/hold.glb")
  • Unreal: HTTP request + glTF importer
  • Godot: GLTFDocument.append_from_file()
  • Blender: File > Import > glTF

CLI

# View your lattice
cascade stats

# List observations  
cascade list --model my_agent

# Start proxy (observe any app)
cascade proxy --port 7777

# Sync to HuggingFace (optional)
cascade sync

Installation Options

# Core (observation + HOLD)
pip install cascade-lattice

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

# With HuggingFace sync
pip install cascade-lattice[huggingface]

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

Why CASCADE?

Problem CASCADE Solution
"What was the AI thinking?" HOLD shows the full decision matrix
"Can I override AI decisions?" Yes, at inference level
"Prove model X made output Y" Cryptographic receipt with CID
"Share learning across agents" Collective lattice, queryable
"Visualize decisions in game" glTF export, works everywhere

Genesis

Every receipt chains back to genesis:

Genesis: 89f940c1a4b7aa65
IPFS: bafkreidixjlzdat7ex72foi6vm3vnskhzguovxj6ondbazrqks7v6ahmei

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.3.0.tar.gz (310.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.3.0-py3-none-any.whl (331.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cascade_lattice-0.3.0.tar.gz
  • Upload date:
  • Size: 310.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.3.0.tar.gz
Algorithm Hash digest
SHA256 9465bc8f9405af38b964ac3a8d8b67bb20685edeb9a16ff21f84e70e75d08536
MD5 d0cd265d3aa96bfa5fde1e6b758cf162
BLAKE2b-256 6748c655b2190f077716f3c9da79ed9ba3469421aa8e1101f4930fc7a4cb5633

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cascade_lattice-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a0fd03955db70aee169fff75524ef11aa0ce86ef90268b7e93b90dbba1d0d63
MD5 db2aced8f8ce4af3202bfe65e59fde3c
BLAKE2b-256 02a04518e1604a53dccb6fd99641273b44465a30f871f07fa6d84d88958f2254

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