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

# Core (sync client)
pip install invinoveritas

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

# With LangChain autonomous payment handler
pip install "invinoveritas[langchain]"

What's new in v0.2.0

Autonomous LangChain payments. Agents can now call invinoveritas tools with zero human intervention — the InvinoCallbackHandler intercepts tool calls, pays Lightning invoices automatically via your LND node, and retries. The agent never sees the payment.

from invinoveritas.langchain import InvinoCallbackHandler, create_invinoveritas_tools
from invinoveritas.providers import LNDProvider

handler = InvinoCallbackHandler(
    provider=LNDProvider(
        macaroon_path="/root/.lnd/data/chain/bitcoin/mainnet/admin.macaroon",
        cert_path="/root/.lnd/tls.cert"
    )
)

tools = create_invinoveritas_tools(handler)
result = agent.run("Should I increase my BTC exposure in 2026?", callbacks=[handler])

Quickstart

Sync (manual payment flow)

from invinoveritas 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")

    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)

Async

import asyncio
from invinoveritas 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",
    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


Autonomous Agent Integration (v0.2.0)

LangChain — fully autonomous payments

pip install "invinoveritas[langchain]"
from invinoveritas.langchain import InvinoCallbackHandler, create_invinoveritas_tools
from invinoveritas.providers import LNDProvider
from langchain.agents import initialize_agent

handler = InvinoCallbackHandler(
    provider=LNDProvider(
        macaroon_path="/root/.lnd/data/chain/bitcoin/mainnet/admin.macaroon",
        cert_path="/root/.lnd/tls.cert"
    ),
    budget_sats=10000  # optional spend cap per run
)

tools = create_invinoveritas_tools(handler)
agent = initialize_agent(tools=tools, ...)
result = agent.run("Should I increase my BTC exposure in 2026?")
print(f"Total spent: {handler.total_spent_sats} sats")

AutoGen

from invinoveritas.langchain import InvinoAutoGenTool
from invinoveritas.providers import LNDProvider

tool = InvinoAutoGenTool(
    provider=LNDProvider(
        macaroon_path="/root/.lnd/...",
        cert_path="/root/.lnd/tls.cert"
    )
)

result = await tool.reason("What are Bitcoin's biggest risks in 2026?")
result = await tool.decide(
    goal="Grow capital safely",
    question="Should I increase BTC exposure?"
)

Bring your own wallet

async def my_pay(invoice: str) -> str:
    result = await my_wallet.pay(invoice)
    return result.preimage

handler = InvinoCallbackHandler(pay_invoice=my_pay)

lnget (CLI agents)

lnget handles L402 automatically at the CLI level:

lnget POST https://invinoveritas.onrender.com/reason \
  '{"question": "What are the biggest risks for Bitcoin in 2026?"}'

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 with payment_hash and preimage

The SDK handles this automatically in autonomous mode. In manual mode, PaymentRequired carries everything you need.

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


Providers (v0.2.0)

Provider Install Description
LNDProvider built-in Pay via local LND node using lncli
NWCProvider invinoveritas[nwc] Nostr Wallet Connect (v0.3.0)
CustomProvider built-in Bring any async pay function

Exceptions

Exception Trigger Attributes
PaymentRequired 402 — no valid payment .invoice, .payment_hash, .amount_sats
PaymentError 401/403 — invalid or used payment
InvinoError 429 — rate limited
ServiceError 5xx or malformed response

All exceptions inherit from InvinoError.


Utility Methods

client = InvinoClient()

health = client.check_health()      # full health + pricing dict
price  = client.get_price("reason") # int sats

MCP Support

Connect directly without the SDK using any MCP-compatible client (Claude Desktop, Cursor):

https://invinoveritas.onrender.com/mcp

Listed on the official MCP Registry: io.github.babyblueviper1/invinoveritas


Local Development

client = InvinoClient(base_url="http://localhost:8000")
async with AsyncInvinoClient(base_url="http://localhost:8000") as client:
    ...

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for invinoveritas-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3a1210f421a83e5bbf755fd559b7cd8e067367aa420d6679d56c5cc15fd90cba
MD5 b693980b81a95c9923dbea19a606d2b0
BLAKE2b-256 b71602a9a2fc9c98b848b59dae6c1be3dbd194d06b8f1fde0e50997efa623dd0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: invinoveritas-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be956b55abe976f0ab577492f2eb63b32001127eab8a155de648eec4a9039504
MD5 6a951c55ca636c0cf11e93c5eb4057f8
BLAKE2b-256 0730099a0ad65f4d1630ae011820b1092e8ee656be9d85d346af25c682a3501b

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