LangChain Plugin

Native LangChain tool for querying signed oracle data from Python AI pipelines — prices, regime intelligence, macro risk scores, and more. 22 tools across all four oracle layers. 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"])

All 22 Tools

The package exposes tools across all oracle layers. Pass the tool name to MyceliaSignalTools(tools=[...]) to load a subset, or use .as_list() for all.

ToolLayerDescriptionPaid cost
get_priceL1Spot price for any supported pair$0.01
get_price_vwapL15-min VWAP for BTC/ETH pairs$0.02
get_fx_rateL1FX rate for any supported currency pair$0.01
get_volatility_indexL1MSVI volatility index for BTC or ETH$0.05
get_sentiment_indexL1MSXI sentiment index for BTC or ETH$0.05
get_stress_indexL1MSSI market stress index$0.05
get_contagion_indexL1MSTI crypto-TradFi contagion index$0.05
get_funding_rateL1Composite funding rate for BTC/ETH/SOL$0.05
get_gas_priceL1Gas price for Ethereum, Base, Arbitrum, Polygon, Optimism, Solana$0.01
get_econ_indicatorL1Economic indicator (CPI, NFP, Fed Funds, GDP…)$0.10
get_commodity_priceL1Gold, crude oil, natural gas, copper, DXY$0.10
get_cot_positioningL1BTC CME COT institutional positioning$1.00
get_weatherL1Weather data at any coordinates$0.10
get_marine_dataL1Sea state, vessel tracking, voyage forecast$0.10–$0.50
get_defi_yieldL1DeFi yield rates across 15+ protocols$0.05
get_market_synopsisL215-signal market state snapshot$0.25
get_perp_regimeL2Perp trading regime for BTC, ETH, or SOL$0.15
get_macro_riskL3Cross-domain macro risk score 0–100$1.00
get_perp_setupL3Best perp setup across BTC/ETH/SOL$1.00
get_defi_opportunityL3Risk-adjusted DeFi yield opportunity$0.75
price_toolsConvenience loader — price + FX tools only
intel_toolsConvenience loader — Layer 2 + Layer 3 tools only

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 version2.4.0
Python3.11+
LicenseMIT
GitHubjonathanbulkeley/langchain-mycelia-signal