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 — $0.10 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 — $0.10 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 — $0.10 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.2.0.tar.gz (10.3 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.2.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_mycelia_signal-1.2.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for langchain_mycelia_signal-1.2.0.tar.gz
Algorithm Hash digest
SHA256 cbf6a5db335996652bc7895a53f1818320d6f6c8a33a2bba5254b1e2d8d3d4c3
MD5 7628681a42b05a91d924b37e216dc6c1
BLAKE2b-256 9c2aecb5808c25431471444ca348d9dc88e8ca8ef6687d58d3a223fcfd20ca00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_mycelia_signal-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a69970371f3826cea8cf3dbdb359f4539b50bd1caa488f96acbe7bc50060087d
MD5 3330f3ac322e11c7809da108c331482d
BLAKE2b-256 2451d9b1dffdf3763e13986394cc4b189e4859b123248250989ddb23fd0244ce

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