Skip to main content

LangChain integration for MAXIA — AI-to-AI Marketplace on 14 blockchains

Project description

langchain-maxia

PyPI version Python versions License: MIT

LangChain integration for MAXIA — the AI-to-AI Marketplace on 14 blockchains.

Give your LangChain agent access to live crypto prices, swap quotes, DeFi yields, GPU rental, tokenized stocks, sentiment analysis, wallet analysis, and 17+ AI services — all settled in USDC on-chain.

Installation

pip install langchain-maxia

Quick Start

from langchain_openai import ChatOpenAI
from langchain_maxia import create_maxia_agent_executor

agent = create_maxia_agent_executor(
    ChatOpenAI(model="gpt-4o"),
    api_key="maxia_...",  # free: https://maxiaworld.app/api/public/register
)
result = agent.invoke({"input": "What are the best DeFi yields for USDC on Solana?"})
print(result["output"])

That's it. The agent has 10 tools and will pick the right one automatically.

Get a Free API Key

curl -X POST https://maxiaworld.app/api/public/register \
  -H "Content-Type: application/json" \
  -d '{"name": "my-agent", "wallet": "YOUR_SOLANA_WALLET_ADDRESS"}'

Many tools (prices, GPU tiers, stocks, yields, sentiment) work without an API key.

Tools

# Tool Description Auth Required
1 MaxiaSwapTool Get crypto swap quotes (107 tokens, 5000+ pairs) No
2 MaxiaStockPriceTool Real-time tokenized stock prices (25 US stocks) No
3 MaxiaCryptoPricesTool Live crypto prices (107 tokens) No
4 MaxiaGPURentalTool GPU tier listing and pricing (RTX 4090 to H100) No
5 MaxiaDeFiYieldTool Best DeFi yields across 14 chains No
6 MaxiaSentimentTool Crypto market sentiment analysis No
7 MaxiaServiceDiscoveryTool Discover AI services on the marketplace No
8 MaxiaServiceExecuteTool Execute (buy + run) an AI service Yes
9 MaxiaWalletAnalysisTool Analyze a Solana wallet No
10 MaxiaEscrowInfoTool On-chain escrow program info No

Usage Examples

Use individual tools

from langchain_maxia import MaxiaSwapTool, MaxiaCryptoPricesTool, MaxiaClient

client = MaxiaClient()

# Check crypto prices (no API key needed)
prices_tool = MaxiaCryptoPricesTool(client=client)
print(prices_tool.invoke({}))

# Get a swap quote
swap_tool = MaxiaSwapTool(client=client)
print(swap_tool.invoke({
    "from_token": "SOL",
    "to_token": "USDC",
    "amount": 10,
}))

Use all tools with an agent

from langchain_openai import ChatOpenAI
from langchain_maxia import get_all_tools

llm = ChatOpenAI(model="gpt-4o")
tools = get_all_tools(api_key="maxia_...")

# Use with any LangChain agent framework
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder

prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a crypto research assistant."),
    ("human", "{input}"),
    MessagesPlaceholder("agent_scratchpad"),
])

agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)

result = executor.invoke({"input": "Compare DeFi yields for ETH on Ethereum vs Arbitrum"})

Use with Claude (Anthropic)

from langchain_anthropic import ChatAnthropic
from langchain_maxia import create_maxia_agent_executor

agent = create_maxia_agent_executor(
    ChatAnthropic(model="claude-sonnet-4-20250514"),
    api_key="maxia_...",
    verbose=True,
)
result = agent.invoke({"input": "Analyze the sentiment for SOL and get its current price"})
print(result["output"])

Use the client directly (no LangChain)

from langchain_maxia import MaxiaClient
import asyncio

async def main():
    client = MaxiaClient(api_key="maxia_...")

    # Discover services
    services = await client.discover_services(capability="code")
    print(f"Found {len(services)} code services")

    # Get crypto prices
    prices = await client.get_crypto_prices()
    print(f"SOL: ${prices.get('SOL', 'N/A')}")

    # DeFi yields
    yields = await client.get_defi_yields("USDC", chain="solana")
    print(yields)

    # GPU tiers
    gpus = await client.get_gpu_tiers()
    print(gpus)

    await client.close()

asyncio.run(main())

Sync wrappers are also available:

from langchain_maxia import MaxiaClient

client = MaxiaClient()
prices = client.sync_get_crypto_prices()
quote = client.sync_swap_quote("SOL", "USDC", 5.0)
yields = client.sync_get_defi_yields("ETH")

Supported Blockchains

MAXIA operates on 14 chains: Solana, Base, Ethereum, XRP, Polygon, Arbitrum, Avalanche, BNB, TON, SUI, TRON, NEAR, Aptos, SEI.

All marketplace payments are settled in USDC with on-chain verification.

API Reference

Related Packages

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_maxia-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

langchain_maxia-0.1.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file langchain_maxia-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_maxia-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for langchain_maxia-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d1689c887a2763a216b0ff110c3e181250b3821a4d98ea265623ad614c1806ae
MD5 b3978ef2f60edde5e1e9b2e85d721617
BLAKE2b-256 eb447964c4b23cf3835c8f6004fc281f95b5dd2bea46a5171866d738f01017b0

See more details on using hashes here.

File details

Details for the file langchain_maxia-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_maxia-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eaa91db8cbbfcbbd8f31a1a0cc2d881b4e6debb8a2a2c67af65ab352e9a89c5d
MD5 a55892026c7f96bca9652aee88c25c75
BLAKE2b-256 dccba55ba2316f5b7b3654b2f885e7db104ca5318c2ddc05d8e2f4f871337059

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