Skip to main content

LangChain tools for Mycelia Signal — cryptographically signed price oracles with automatic x402 (USDC on Base) payment

Project description

langchain-mycelia-signal

LangChain tools for Mycelia Signal — cryptographically signed price oracles with automatic x402 (USDC on Base) payment.

56 endpoints across crypto, FX, precious metals, US/EU macro, and commodities. No API keys. No accounts. Install and go.


Installation

pip install langchain-mycelia-signal

For paid mode (signed attestations with automatic x402 payment):

pip install langchain-mycelia-signal[paid]

Quick Start

from langchain_mycelia_signal import MyceliaSignalTools
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_openai import ChatOpenAI

# Get tools
tools = MyceliaSignalTools().as_list()

# Build your agent
llm = ChatOpenAI(model="gpt-4o")
agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)

# Ask naturally
result = executor.invoke({"input": "What is the Bitcoin price right now?"})
result = executor.invoke({"input": "What is the current US CPI?"})
result = executor.invoke({"input": "What is the EUR/USD rate?"})

Free vs Paid Mode

Free mode (default — no config needed)

Returns price data without a cryptographic signature. Data may be up to 5 minutes stale.

tools = MyceliaSignalTools()
print(tools.mode)  # "free"

Paid mode — signed attestations

Add your Base wallet private key to your .env:

MYCELIA_WALLET_PRIVATE_KEY=0x...

The tool detects the key automatically and switches to paid endpoints. Payment is handled internally via x402. No code changes required.

tools = MyceliaSignalTools()
print(tools.mode)  # "paid"

Signed responses include a cryptographic signature (Ed25519) verifiable against the published public key. See verification docs.


Supported Pairs (56 endpoints)

Crypto Spot — $0.01 per query

Pair Description
BTCUSD Bitcoin / USD (median, 9 sources)
BTCEUR Bitcoin / EUR (cross-rate + direct feeds)
BTCJPY Bitcoin / JPY
ETHUSD Ethereum / USD (median, 5 sources)
ETHEUR Ethereum / EUR (hybrid)
ETHJPY Ethereum / JPY
SOLUSD Solana / USD (median, 9 sources)
SOLEUR Solana / EUR (hybrid)
SOLJPY Solana / JPY
XRPUSD XRP / USD
ADAUSD Cardano / USD
DOGEUSD Dogecoin / USD

Crypto VWAP — $0.02 per query

Pair Description
BTCUSD_VWAP Bitcoin / USD 5-min VWAP
BTCEUR_VWAP Bitcoin / EUR 5-min VWAP

Precious Metals — $0.01 per query

Pair Description
XAUUSD Gold / USD (median, 8 sources)
XAUEUR Gold / EUR
XAUJPY Gold / JPY

FX Pairs — $0.01 per query

Pairs
EURUSD, EURJPY, EURGBP, EURCHF, EURCNY, EURCAD
GBPUSD, GBPJPY, GBPCHF, GBPCNY, GBPCAD
USDJPY, USDCHF, USDCNY, USDCAD
CHFJPY, CHFCAD, CNYJPY, CNYCAD, CADJPY

US Economic Indicators — $1.00 per query

Indicator Description
US_CPI Consumer Price Index (BLS)
US_CPI_CORE CPI Core (ex food & energy)
US_UNRATE Unemployment Rate
US_NFP Nonfarm Payrolls
US_FEDFUNDS Federal Funds Rate
US_GDP GDP
US_PCE PCE Price Index
US_YIELD_CURVE 10Y-2Y Yield Spread

EU Economic Indicators — $1.00 per query

Indicator Description
EU_HICP HICP Inflation (Eurostat)
EU_HICP_CORE HICP Core
EU_HICP_SERVICES HICP Services
EU_UNRATE Unemployment Rate
EU_GDP GDP
EU_EMPLOYMENT Employment

Commodities — $1.00 per query

Indicator Description
WTI WTI Crude Oil
BRENT Brent Crude Oil
NATGAS Henry Hub Natural Gas
COPPER Copper
DXY US Dollar Index

Example Response

Free mode:

Pair:      BTC/USD
Price:     84231.50 USD
Timestamp: 1741521600
Sources:   binance,binance_us,bitfinex,bitstamp,coinbase,gateio,gemini,kraken,okx
Method:    median
Signed:    False

Paid mode:

Pair:      BTCUSD
Price:     84231.50 USD
Timestamp: 1741521600
Sources:   binance,binance_us,bitfinex,bitstamp,coinbase,gateio,gemini,kraken,okx
Method:    median
Signed:    True
Signature: MEUCIQD...
Pubkey:    03c1955b8c543494c4ecd86d167105bcc7ca9a91b8e06cb9d6601f2f55a89abfbf
Canonical: v1|PRICE|BTCUSD|84231.50|USD|2|1741521600|562204|binance,binance_us,...|median

Direct Tool Use

from langchain_mycelia_signal import get_mycelia_price

result = get_mycelia_price.invoke({"pair": "BTCUSD"})
result = get_mycelia_price.invoke({"pair": "US_CPI"})
result = get_mycelia_price.invoke({"pair": "WTI"})
print(result)

Links


License

MIT

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

langchain_mycelia_signal-1.3.1.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_mycelia_signal-1.3.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file langchain_mycelia_signal-1.3.1.tar.gz.

File metadata

File hashes

Hashes for langchain_mycelia_signal-1.3.1.tar.gz
Algorithm Hash digest
SHA256 ac63242e4e9f315cd279d95a1534ed594b95c242439d4ec313cd6c6e3f6720c6
MD5 d3c3ee0b2e95b3f359a7f1dd37b62a25
BLAKE2b-256 3074bfb1f6f72e9cfd890ac9d04310c36eee311037922bfdb07e0be06011b1f2

See more details on using hashes here.

File details

Details for the file langchain_mycelia_signal-1.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_mycelia_signal-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c65bccf2cd7e0cbf118323a9ff1945e1788065c68f93218c1fb4bbd41fb0eb01
MD5 a41901bcc92335f8dcebe8699132579f
BLAKE2b-256 37f52b6d66161cda4e8191139353c1bf290cc24c7dccc0afba2792bbbd0606f8

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