LangChain Plugin
Native LangChain tool for querying signed price attestations from Python AI pipelines. Free preview mode included — no wallet required to get started.
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
# 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.
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)
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.
export MYCELIA_WALLET_PRIVATE_KEY=0xYourBaseWalletPrivateKey
from langchain_mycelia_signal import MyceliaSignalTools tools = MyceliaSignalTools().as_list() result = tools[0].invoke({"pair": "BTCUSD"})
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
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 |
|---|---|---|---|
BTCUSD | Bitcoin / US Dollar | 9 | Median |
BTCUSD_VWAP | Bitcoin / US Dollar (5-min VWAP) | 7 | VWAP |
ETHUSD | Ethereum / US Dollar | 5 | Median |
EURUSD | Euro / US Dollar | 8 | Median |
XAUUSD | Gold / US Dollar | 8 | Median |
SOLUSD | Solana / US Dollar | 9 | Median |
BTCEUR | Bitcoin / Euro | 17 | Cross-rate |
BTCEUR_VWAP | Bitcoin / Euro (5-min VWAP) | 17 | VWAP cross-rate |
ETHEUR | Ethereum / Euro | 4 | Hybrid median |
SOLEUR | Solana / Euro | 4 | Hybrid median |
XAUEUR | Gold / Euro | Combined | Cross-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 required | None | Base wallet with USDC |
| Data freshness | Up to 5 min stale | Real-time |
| Cryptographic signature | No | Yes (Ed25519) |
| Cost | Free | $0.001 USDC / query |
| Suitable for production | No | Yes |
| Verify independently | No | Yes |
Response Format
The tool returns a formatted string. In paid mode, signature fields are appended:
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
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_KEY | No | Base wallet private key (0x...). If set, enables paid mode with real-time signed attestations via x402. |
Package Info
| Detail | Value |
|---|---|
| PyPI | langchain-mycelia-signal |
| Latest version | 1.1.0 |
| Python | 3.11+ |
| License | MIT |
| GitHub | jonathanbulkeley/langchain-mycelia-signal |