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.2.0.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_maxia-0.2.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_maxia-0.2.0.tar.gz
  • Upload date:
  • Size: 12.7 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.2.0.tar.gz
Algorithm Hash digest
SHA256 4c4514b30e297598a683beb6359fd70aeb733a46c4bd5f0385cb7fa92b9f5a86
MD5 ea197f280c4bb56e07d6c87a4c42d137
BLAKE2b-256 f19d62443bfb183790ed806bb12473e4b4a8ce7378092386fa059a742316081c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_maxia-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 066b85861837508ed67e199bcfbb32eddfc2eb5b53f87f4fa61cb4c1cbf2c1bf
MD5 87f54a46b119c1d43aaedc9b269ba690
BLAKE2b-256 4e1d4ded2c08e0d3a4ab485dd6eb6b1c06b636c1a2b1183d96a44d2b311125d7

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