Add live web search to a LangChain, LlamaIndex, or CrewAI agent

Superhighway guides

Most Python agent frameworks can load Superhighway's five search tools with a few lines of code — no custom HTTP, no wallet required if you use an API key.

Two paths

PathBest forWhat you need
MCP adapterFrameworks with MCP support (LangChain, LlamaIndex, CrewAI)A funded Base wallet or API key
REST + API keyAny Python code — zero protocol overheadA free API key from /pricing

Path 1: MCP adapter (recommended)

The walls-mcp-examples repo has working examples for LangChain, LlamaIndex, and CrewAI. The pattern is the same in all three: launch the MCP server as a subprocess and load its tools into your agent.

LangChain / LangGraph

pip install langchain-mcp-adapters langgraph langchain-openai
import asyncio
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI

async def main():
    async with MultiServerMCPClient({
        "superhighway": {
            "command": "npx", "args": ["-y", "superhighway-mcp"],
            "env": {"AGENT_PRIVATE_KEY": "0x...", "X402_NETWORK": "base"},
            "transport": "stdio",
        }
    }) as client:
        tools = client.get_tools()
        agent = create_react_agent(ChatOpenAI(model="gpt-4o"), tools)
        result = await agent.ainvoke({"messages": [{"role": "user",
            "content": "What's happening with AI agent frameworks this week?"}]})
        print(result["messages"][-1].content)

asyncio.run(main())

LlamaIndex

pip install llama-index-tools-mcp llama-index-llms-openai
import asyncio
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
from llama_index.core.agent import ReActAgent
from llama_index.llms.openai import OpenAI

async def main():
    client = BasicMCPClient("npx", args=["-y", "superhighway-mcp"],
        env={"AGENT_PRIVATE_KEY": "0x...", "X402_NETWORK": "base"})
    tools = await McpToolSpec(client=client).to_tool_list_async()
    agent = ReActAgent.from_tools(tools, llm=OpenAI(model="gpt-4o"))
    print(agent.chat("Search for the latest news on x402 payments"))

asyncio.run(main())

CrewAI

pip install crewai crewai-tools
from crewai import Agent, Task, Crew
from crewai_tools import MCPServerAdapter

with MCPServerAdapter({
    "superhighway": {
        "command": "npx", "args": ["-y", "superhighway-mcp"],
        "env": {"AGENT_PRIVATE_KEY": "0x...", "X402_NETWORK": "base"},
        "transport": "stdio",
    }
}) as mcp:
    agent = Agent(role="Researcher", goal="Find live web information",
                  tools=mcp.tools)
    task = Task(description="Find the top 3 AI search APIs and their pricing",
                agent=agent, expected_output="A ranked list with prices")
    Crew(agents=[agent], tasks=[task]).kickoff()

Path 2: REST API with an API key

Get a free API key (1,000 calls/month, email only) and call the API directly — no MCP, no wallet:

pip install httpx
import httpx

API_KEY = "sk-..."  # from superhighway.walls.sh/pricing

def web_search(query: str, limit: int = 5) -> dict:
    r = httpx.get(f"https://superhighway.walls.sh/search",
        params={"q": query, "limit": limit},
        headers={"Authorization": f"Bearer {API_KEY}"})
    r.raise_for_status()
    return r.json()

def news_search(query: str) -> dict:
    r = httpx.get(f"https://superhighway.walls.sh/news",
        params={"q": query},
        headers={"Authorization": f"Bearer {API_KEY}"})
    r.raise_for_status()
    return r.json()

# Use as a LangChain tool:
from langchain.tools import tool

@tool
def search_the_web(query: str) -> str:
    """Search the live web. Use for current events, facts, and research."""
    results = web_search(query)
    return "\n".join(f"{r['title']}: {r['url']}\n{r['description']}"
                      for r in results["results"])

The same pattern works for /news, /images, /scrape, and /research. Full endpoint list: /openapi.json.

Wallet vs. API key

API key (free / plan)x402 wallet
SetupEmail → key in 30 secondsGenerate a wallet, fund with USDC on Base
Billing1,000 calls/month free; flat monthly above$0.001–$0.005 per call, settled on-chain
AutonomyAgent uses your keyAgent holds its own wallet, pays itself
Best forTeams, controlled spend, Python scriptsFully autonomous agents with no human billing loop

Both lanes call the same endpoints. Get a free key or learn the x402 wallet flow.