LangChain Plugin

Native LangChain tool for querying signed price attestations from Python AI pipelines. Free preview mode included — no wallet required to get started.

Free Preview Mode

No wallet or API key needed. Install the package and start querying immediately. Preview mode returns real price data (up to 5 minutes stale, unsigned). Set MYCELIA_WALLET_PRIVATE_KEY to upgrade to real-time signed attestations via x402.

Installation

bash
# Free tier — preview mode only
pip install langchain-mycelia-signal

# Paid tier — includes eth_account for x402 automatic payment
pip install langchain-mycelia-signal[paid]

Quick Start

Free Mode (no wallet required)

Without a wallet key configured, all queries hit the free preview endpoints. Data is real but may be up to 5 minutes stale and is not cryptographically signed.

python
from langchain_mycelia_signal import MyceliaSignalTools

# No env var needed — free preview mode
tools = MyceliaSignalTools().as_list()
tool = tools[0]

result = tool.invoke({"pair": "BTCUSD"})
print(result)
output
Pair:      BTCUSD
Price:     70659.41 USD
Timestamp: 2026-03-06T10:10:12Z
Sources:   ['binance', 'binance_us', 'bitfinex', 'bitstamp', 'coinbase', 'gateio', 'gemini', 'kraken', 'okx']
Method:    median
Signed:    False

Paid Mode (real-time signed attestations)

Set MYCELIA_WALLET_PRIVATE_KEY to a funded Base wallet and the tool automatically pays $0.001 USDC per query via x402, returning a fully signed attestation.

bash
export MYCELIA_WALLET_PRIVATE_KEY=0xYourBaseWalletPrivateKey
python
from langchain_mycelia_signal import MyceliaSignalTools

tools = MyceliaSignalTools().as_list()
result = tools[0].invoke({"pair": "BTCUSD"})
output
Pair:      BTCUSD
Price:     70659.41 USD
Timestamp: 2026-03-06T10:10:12Z
Sources:   ['binance', 'binance_us', 'bitfinex', 'bitstamp', 'coinbase', 'gateio', 'gemini', 'kraken', 'okx']
Method:    median
Signed:    True
Signature: QiQK2fdRh4ROB8Vl...
Pubkey:    0236a051b7a0384e...
Canonical: v1|BTCUSD|70659.41|USD|2|2026-03-06T10:10:12Z|890123|binance,...|median

Using with a LangChain Agent

python
from langchain_mycelia_signal import MyceliaSignalTools
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate

# Load the oracle tool
tools = MyceliaSignalTools().as_list()

# Build the agent
llm = ChatOpenAI(model="gpt-4o")
prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a financial data assistant. Use the oracle tool to fetch verified prices."),
    ("human", "{input}"),
    ("placeholder", "{agent_scratchpad}"),
])
agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)

# Run a query
result = executor.invoke({"input": "What is the current Bitcoin price in USD?"})
print(result["output"])

Supported Pairs

Pair Description Sources Method
BTCUSDBitcoin / US Dollar9Median
BTCUSD_VWAPBitcoin / US Dollar (5-min VWAP)7VWAP
ETHUSDEthereum / US Dollar5Median
EURUSDEuro / US Dollar8Median
XAUUSDGold / US Dollar8Median
SOLUSDSolana / US Dollar9Median
BTCEURBitcoin / Euro17Cross-rate
BTCEUR_VWAPBitcoin / Euro (5-min VWAP)17VWAP cross-rate
ETHEUREthereum / Euro4Hybrid median
SOLEURSolana / Euro4Hybrid median
XAUEURGold / EuroCombinedCross-rate

Pass any pair name to the tool's pair argument. Case-insensitive — btcusd, BTCUSD, and BTC/USD all work.

Free vs Paid Mode

Feature Free (Preview) Paid (x402)
Setup requiredNoneBase wallet with USDC
Data freshnessUp to 5 min staleReal-time
Cryptographic signatureNoYes (Ed25519)
CostFree$0.001 USDC / query
Suitable for productionNoYes
Verify independentlyNoYes

Response Format

The tool returns a formatted string. In paid mode, signature fields are appended:

text
Pair:      BTCUSD
Price:     70659.41 USD
Timestamp: 2026-03-06T10:10:12Z
Sources:   ['binance', 'binance_us', ...]
Method:    median
Signed:    True              # False in preview mode
Signature: QiQK2fdRh4ROB8Vl...  # Only in paid mode
Pubkey:    0236a051b7a0384e...  # Only in paid mode
Canonical: v1|BTCUSD|...       # Only in paid mode
Signature Verification

In paid mode, the canonical field contains the complete pipe-delimited payload that was signed. You can independently verify the signature using the pubkey — see the Signature Verification guide.

Environment Variables

Variable Required Description
MYCELIA_WALLET_PRIVATE_KEYNoBase wallet private key (0x...). If set, enables paid mode with real-time signed attestations via x402.

Package Info

Detail Value
PyPIlangchain-mycelia-signal
Latest version1.1.0
Python3.11+
LicenseMIT
GitHubjonathanbulkeley/langchain-mycelia-signal