Skip to main content

Lightning-paid reasoning and decision intelligence for autonomous agents

Project description

invinoveritas SDK

Lightning-paid reasoning and decision intelligence for autonomous agents.

Pay per insight. No subscriptions. No accounts. No KYC.
Atomic intelligence purchases over Bitcoin Lightning using the L402 protocol. ⚡


Installation

# Sync client only (lightweight)
pip install invinoveritas

# With async support (recommended for agents)
pip install "invinoveritas[async]"

Quickstart

Synchronous

from invinoveritas_sdk import InvinoClient, PaymentRequired

client = InvinoClient()

try:
    result = client.reason("What are the biggest risks for Bitcoin in 2026?")
except PaymentRequired as e:
    print(f"Pay this invoice → {e.invoice}")
    print(f"Amount: {e.amount_sats} sats")

    # After paying with any Lightning wallet
    result = client.reason(
        "What are the biggest risks for Bitcoin in 2026?",
        payment_hash=e.payment_hash,
        preimage="preimage_from_wallet_here",
    )

print(result.answer)

Asynchronous

import asyncio
from invinoveritas_sdk import AsyncInvinoClient, PaymentRequired

async def main():
    async with AsyncInvinoClient() as client:
        try:
            result = await client.reason("What are the biggest risks for Bitcoin in 2026?")
        except PaymentRequired as e:
            result = await client.reason(
                "What are the biggest risks for Bitcoin in 2026?",
                payment_hash=e.payment_hash,
                preimage="preimage_from_wallet_here",
            )
            print(result.answer)

asyncio.run(main())

Core Tools

reason() — Deep strategic reasoning

result = client.reason(
    question="Should we expand into the European market in 2026?",
    payment_hash=...,
    preimage=...
)

print(result.answer)

Base price: ~500 sats


decide() — Structured decision intelligence

result = client.decide(
    goal="Grow capital safely while managing risk",
    question="Should I increase BTC exposure now?",
    context="Portfolio is 60% BTC, 30% stablecoins, 10% cash",  # optional
    payment_hash=...,
    preimage=...
)

print(result.decision)      # "Increase BTC exposure slightly"
print(result.confidence)    # 0.78
print(result.reasoning)
print(result.risk_level)    # "low" | "medium" | "high"

Base price: ~1000 sats


Utility & Discovery Methods

client = InvinoClient()

# Get full current pricing (recommended for agents)
pricing = client.get_prices()

# Get single base price (for backward compatibility)
price = client.get_price("reason")

# Get tool definition for agent frameworks
tool = client.get_tool_definition()

Same methods are available on AsyncInvinoClient.


Payment Flow (L402)

  1. Call any method → server returns 402 Payment Required + Lightning invoice.
  2. Pay the invoice using any Lightning wallet.
  3. Retry the same call, passing payment_hash and preimage.

The SDK makes this simple: PaymentRequired exception carries everything you need.

Note: Each invoice is single-use. Reusing a payment hash returns PaymentError.


Agent Framework Integration Examples

LangChain Tool

from langchain.tools import tool
from invinoveritas_sdk import AsyncInvinoClient, PaymentRequired

@tool
async def invino_reason(question: str, payment_hash: str = None, preimage: str = None) -> str:
    """Get strategic reasoning powered by Lightning payments."""
    async with AsyncInvinoClient() as client:
        try:
            result = await client.reason(question, payment_hash=payment_hash, preimage=preimage)
            return result.answer
        except PaymentRequired as e:
            raise ValueError(f"Payment required. Invoice: {e.invoice}")

Get Invoice First (Orchestration Pattern)

client = InvinoClient()
question = "What are the biggest risks for Bitcoin in 2026?"

try:
    result = client.reason(question)
except PaymentRequired as e:
    # Send invoice to user / payment service
    invoice = e.invoice
    payment_hash = e.payment_hash
    amount = e.amount_sats
    # ... wait for payment confirmation ...
    result = client.reason(question, payment_hash=payment_hash, preimage=received_preimage)

Exceptions

Exception Trigger Attributes
PaymentRequired 402 - No valid payment provided .invoice, .payment_hash, .amount_sats
PaymentError 401 / 403 - Invalid or used payment -
InvinoError Rate limiting (429) -
ServiceError Server errors (5xx) or malformed responses -

All exceptions inherit from InvinoError.


Local Development

client = InvinoClient(base_url="http://localhost:8000")

Same for AsyncInvinoClient.


MCP Support

If you're using Claude Desktop, Cursor, or any MCP-compatible client, you can connect directly without the SDK:

MCP Endpoint: https://invinoveritas.onrender.com/mcp


Links


License

Apache-2.0


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

invinoveritas-0.2.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

invinoveritas-0.2.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file invinoveritas-0.2.0.tar.gz.

File metadata

  • Download URL: invinoveritas-0.2.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for invinoveritas-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bd76e0e591c605b2617ee5d41e649bd3b3f4eee7f985d2a32df41ae66e509351
MD5 cc4a976024c4973bd00a29244108ae82
BLAKE2b-256 fb9eaba420d1cc8958c86f4b5ce4560f70c532c989d3974ff7bd75fa2493fb74

See more details on using hashes here.

File details

Details for the file invinoveritas-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: invinoveritas-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for invinoveritas-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ab19e46f8b26569ff70437787728b59e77b1a7de0739501a53f74450c57b826
MD5 609b273f01f8440cebee9f496a228926
BLAKE2b-256 2c5838208d6220dd78288c1bd696c9ba7100566a15c164be380acc964fb24779

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