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.1.tar.gz (18.8 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.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: invinoveritas-0.3.1.tar.gz
  • Upload date:
  • Size: 18.8 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.1.tar.gz
Algorithm Hash digest
SHA256 671e530a9710dbddc4b3ea6a25f7c03cb690fed0b7ad053fa027b97e8f6bf7dd
MD5 fc29a744791d3b621d2258273b312194
BLAKE2b-256 ba83c0069545a953937f22415a3e9100da6b6379684c7e9e80b80a760bf6255f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: invinoveritas-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 18.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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e0720bc67336305f1e3c63077b92969a39ba270a1c9df5b73b18c7d18feef05b
MD5 9bb4c100f297fc38c64a1131aaa9a094
BLAKE2b-256 bc8c41f5e534f7a7f40ef4d3ec0e4e277f962e503ea1fd3d98ecd7958ecafccb

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