Skip to main content

Primordia economic metering for LangChain - track AI costs with machine-readable receipts

Project description

langchain-primordia

Economic settlement infrastructure for LangChain agents.

What is this?

Not just cost tracking. Clearing-grade settlement for AI agents.

MSR (local receipts)  →  IAN (kernel-signed netting)  →  MBS/ALR (audit-grade)
     FREE                      5 bps                        $25K+

Installation

pip install langchain-primordia

Quick Start (Shadow Mode - FREE)

from langchain_openai import ChatOpenAI
from langchain_primordia import PrimordiaCallbackHandler

handler = PrimordiaCallbackHandler(agent_id="agent-alpha")
llm = ChatOpenAI(callbacks=[handler])

response = llm.invoke("Hello")

# Local receipts accumulated
print(f"Receipts: {len(handler.get_receipts())}")
print(f"Total: ${handler.get_total_usd():.4f}")

Settlement (PAID - 5 bps)

When you need proof of settlement between agents:

handler = PrimordiaCallbackHandler(
    agent_id="agent-alpha",
    submit=True
)

# ... run your agent ...

# Net receipts into kernel-signed IAN
result = handler.net_receipts()

if "signed_ian" in result:
    # This is clearing-grade proof
    # Agent B can verify this signature
    print("IAN signed by Primordia kernel")
else:
    # 402 - need to purchase credit
    print(result["purchase_url"])

Audit-Grade Reports (Enterprise)

# Requires pack_team ($25K) minimum
mbs = handler.get_balance_sheet()

if "error" in mbs:
    # 402 - PACK_TEAM REQUIRED
    print("Purchase pack_team for audit-grade MBS")
else:
    # Kernel-signed Machine Balance Sheet
    print(mbs)

The Rail

Stage What Cost
MSR Local receipt per LLM call FREE
Index Submit receipts to kernel FREE
IAN Kernel-signed netting 5 bps
MBS Machine Balance Sheet $100 (pack_team min)
ALR Agent Liability Report $100 (pack_team min)
Default Resolution $25,000

Why Kernel Signature?

Agent A: "I paid Agent B $100"
Agent B: "Prove it"
Agent A: shows IAN with Primordia kernel signature
Agent B: verifies signature → TRUST

No kernel signature = no clearing-grade proof.

Links

License

MIT

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

langchain_primordia-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

langchain_primordia-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file langchain_primordia-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_primordia-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for langchain_primordia-0.1.0.tar.gz
Algorithm Hash digest
SHA256 862ee57708f3c6fb9c319c7460634ee0cc9d28cecddd8dfc7593914a3b180685
MD5 7ff138db9d7f43fc29fd74776555484a
BLAKE2b-256 2a0b169c95998328e785f50526a43c3d60259bbbd7a0f122cb01d0aa9bf68e8b

See more details on using hashes here.

File details

Details for the file langchain_primordia-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_primordia-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 827a3f47542148f9a393a2e1f8df0b4aca89548d55a8a4536075bc6e708b417e
MD5 16474e9d312471997359684653e58126
BLAKE2b-256 598e5d70a23004e35bda177a068f8c6808aa8b48ce93264cbc4eea83acaf7167

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