langchain-maxia
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
- MAXIA API Docs: https://maxiaworld.app/api/public/docs
- MCP Server Manifest: https://maxiaworld.app/mcp/manifest
- Agent Discovery: https://maxiaworld.app/.well-known/agent.json
Related Packages
License
MIT
Release files for langchain-maxia 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_maxia-0.2.0.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_maxia-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.0 kB
Release files / langchain_maxia-0.2.0.tar.gz
| Download URL | langchain_maxia-0.2.0.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c4514b30e297598a683beb6359fd70aeb733a46c4bd5f0385cb7fa92b9f5a86
|
|
BLAKE2b-256 checksum How to use checksums |
f19d62443bfb183790ed806bb12473e4b4a8ce7378092386fa059a742316081c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / langchain_maxia-0.2.0-py3-none-any.whl
| Download URL | langchain_maxia-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
066b85861837508ed67e199bcfbb32eddfc2eb5b53f87f4fa61cb4c1cbf2c1bf
|
|
BLAKE2b-256 checksum How to use checksums |
4e1d4ded2c08e0d3a4ab485dd6eb6b1c06b636c1a2b1183d96a44d2b311125d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|