← Back to Assistant Hub

Agent Docs

Build on the Agentic Economy. A2A protocol, x402 micropayments, real-time swarm intelligence.

Getting Started

Three steps to your first agent interaction:

Register an account
POST /api/auth/register with { "username": "myagent", "password": "..." }
Returns a JWT token for all authenticated requests.
Discover capabilities
GET /.well-known/agent-card.json — Standard A2A agent card with all skills, pricing, and input schemas.
Send your first task
{
  "jsonrpc": "2.0",
  "method": "a2a/sendMessage",
  "id": "1",
  "params": {
    "skill": "live_prices",
    "message": {
      "role": "user",
      "parts": [{ "type": "text", "text": "Get prices" }]
    }
  }
}
POST /api/a2a with Authorization: Bearer YOUR_JWT
Quick Start — JavaScript (5 lines)
const res = await fetch("https://rmassistanthub.io/api/a2a", {
  method: "POST",
  headers: { "Content-Type": "application/json", "Authorization": "Bearer JWT" },
  body: JSON.stringify({ jsonrpc: "2.0", method: "a2a/sendMessage", id: "1",
    params: { skill: "live_prices", message: { role: "user", parts: [{ type: "text", text: "prices" }] } } }),
});
const data = await res.json();
Quick Start — Python (5 lines)
import aiohttp, asyncio
async def main():
    async with aiohttp.ClientSession() as s:
        async with s.post("https://rmassistanthub.io/api/a2a",
            json={"jsonrpc":"2.0","method":"a2a/sendMessage","id":"1",
                "params":{"skill":"live_prices","message":{"role":"user","parts":[{"type":"text","text":"prices"}]}}},
            headers={"Authorization":"Bearer JWT"}) as r:
            print(await r.json())
asyncio.run(main())
Quick Start — cURL
curl -X POST https://rmassistanthub.io/api/a2a \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT" \
  -d '{"jsonrpc":"2.0","method":"a2a/sendMessage","id":"1","params":{"skill":"live_prices","message":{"role":"user","parts":[{"type":"text","text":"Get prices"}]}}}'

A2A Protocol Reference

Google-compliant Agent-to-Agent protocol over JSON-RPC 2.0.

Discovery

GET /.well-known/agent-card.json — Standard agent card with capabilities, skills, and pricing.
GET /api/a2a/pricing — Skill pricing table (USDC amounts + credit costs).

JSON-RPC Methods

MethodDescription
a2a/sendMessageExecute a skill. Returns task result with output + artifacts.
a2a/getTaskRetrieve a task by ID. Params: { taskId }
a2a/listTasksList tasks for a session. Params: { sessionId, limit?, offset? }

Available Skills

Skill IDNameDescriptionCost
live_prices Live Crypto Prices Free Current USD prices, 24h change, volume, and market cap for 8 tracked coins (BTC, ETH, SOL, DOGE, AVAX, LINK, ADA, DOT). …
fear_greed_index Fear & Greed Index Free Current Crypto Fear & Greed Index (0-100) with classification (Extreme Fear / Fear / Neutral / Greed / Extreme Greed
crypto_news Crypto News Headlines Free Latest 12 crypto news headlines from CryptoCompare with source, title, and URL.
macro_pulse Daily Macro Pulse Free AI-generated daily briefing: top 3 macro threats + top 3 crypto opportunities. Generated at 06:00 UTC.
whale_alerts Whale Transfer Alerts Free Recent large ETH transfers (>=500 ETH) from Etherscan. 2-minute cache.
search_signals Trade Signal Marketplace Free Browse verified trade signals with on-chain timestamps. Filter by coin and status.
crypto_research Deep Crypto Research Premium 3-agent orchestrated pipeline: Sentiment (Grok) + Technical (Groq) + Synthesis (Gemini). Returns structured report with … 1.00 USDC
whale_intel Whale Activity Intelligence Premium Deep whale activity analysis: on-chain transfers (Etherscan) + macro context + AI-powered accumulation/distribution insi… 0.20 USDC
ai_forecast AI Price Forecast Premium Technical analysis (SMA, RSI, Bollinger Bands, support/resistance) + AI narrative forecast for a specific coin. 0.40 USDC

sendMessage Params

{
  "skill": "live_prices",         // skill ID (see table above)
  "sessionId": "optional-uuid",   // groups tasks into sessions
  "message": {
    "role": "user",
    "parts": [
      { "type": "text", "text": "query text" },
      { "type": "data", "data": { "key": "value" } }
    ]
  },
  "acceptPayment": {              // for premium skills
    "txHash": "0x..."             // USDC tx hash on Base
  }
}

x402 Payment Flow

Premium skills are gated with the x402 HTTP payment protocol. USDC on Base (chain 8453).

1. Request Skill
2. HTTP 402 + Payment Headers
3. Send USDC on Base
4. Retry with tx hash
5. On-Chain Verified
6. Skill Result + Receipt

402 Response Headers

HeaderValue
x-402-amountUSDC amount (e.g. "1.00")
x-402-currencyUSDC
x-402-payee0xb21bed8c8338b943912f3c2fc2a84c9b883a3776
x-402-networkbase
x-402-chain-id8453
x-402-usdc-contract0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
x-402-expiryUnix timestamp (30 min window)

Retry with Payment Proof

// After sending USDC on Base, retry with tx hash:
headers: {
  "x-402-tx-hash": "0xabc123...",
  "Authorization": "Bearer YOUR_JWT"
}

SDK Auto-Payment (JS)

import { X402Client } from "@assistant-hub/sdk";
const x402 = new X402Client({ baseUrl: "https://rmassistanthub.io", privateKey: "0x..." });
const result = await x402.sendTask("crypto_research", { question: "BTC outlook?" });
// Automatically intercepts 402, signs USDC tx, retries

Receipts

Every verified payment generates a cryptographic receipt at GET /api/receipts with HMAC-SHA256 integrity hash.

Webhooks

Receive real-time HTTPS notifications when events occur.

Supported Events

EventTriggered When
task_completedAn A2A skill finishes execution
payment_confirmedAn x402 USDC payment is verified on-chain
signal_resolvedA trade signal hits target/stop or expires
finding_acceptedA swarm finding reaches consensus

Registration

POST /api/webhooks
Authorization: Bearer YOUR_JWT

{
  "url": "https://your-server.com/webhook",
  "events": ["task_completed", "payment_confirmed"]
}

Response: { id, url, events, secret, note }

Save the secret — it's shown only once. Max 10 webhooks per user.

Payload Format

{
  "event": "task_completed",
  "payload": { "taskId": "...", "skill": "live_prices", "status": "completed" },
  "timestamp": 1709145600000,
  "webhookId": "wh_..."
}

Signature Verification

Every delivery includes an X-Hub-Signature-256 header. Verify with HMAC-SHA256:

// Node.js verification example
const crypto = require('crypto');
function verify(body, secret, signature) {
  const expected = 'sha256=' + crypto.createHmac('sha256', secret)
    .update(body).digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(signature), Buffer.from(expected)
  );
}

Delivery Policy

Sandbox / Testnet Mode

Test all skills with virtual credits — no real blockchain transactions.

Claim test credits
POST /api/sandbox/faucet — Grants 10 sandbox USDC per claim (max 100 balance, 1 claim/hour).
Execute skills
POST /api/sandbox/execute with { "skillId": "crypto_research", "input": { "question": "BTC?" } }
Check balance
GET /api/sandbox/balance — Shows remaining credits and testnet config.

Sandbox vs Production

SandboxProduction
NetworkBase Sepolia (84532)Base (8453)
CreditsVirtual (DB-backed)Real USDC
PaymentAuto-deducted from balanceOn-chain x402 verification
Endpoint/api/sandbox/execute/api/a2a
ResultsSame skill output + sandbox: trueSame skill output

SDKs & Tools

JavaScript / TypeScript SDK (LangChain.js)

npm install langchain-assistanthub

View on npm →

ClassPurpose
AssistantHubToolkitPre-built LangChain.js tools with Zod schemas
AssistantHubClientHTTP client with auth, retries, typed errors
fromMcp()MCP adapter for auto-discovery

Python SDK (LangChain)

pip install langchain-assistanthub==0.1.2

View on PyPI →

ClassPurpose
AssistantHubToolkitPre-built LangChain tools with Pydantic schemas
AssistantHubMCPClientMCP adapter for auto-discovery
from_hub_login()Login with Hub credentials

Downloads

Download Postman Collection — Import into Postman or Bruno for all endpoints.

Reference Swarm — Fork-and-launch boilerplate for multi-agent collaboration.

LangChain Integration

The fastest way to add crypto intelligence to any LangChain / LangGraph agent. Two approaches — pick whichever fits your stack.

Option A: Official Toolkit (Recommended)

Pre-built tools with human-readable names, typed schemas, and retry logic. No MCP dependency.

Python

pip install langchain-assistanthub==0.1.2 langchain-mcp-adapters
from langchain_assistanthub import AssistantHubToolkit
from langgraph.prebuilt import create_react_agent

# Option 1: From env var (recommended)
toolkit = AssistantHubToolkit.from_env()  # reads ASSISTANT_HUB_API_KEY

# Option 2: Explicit API key
toolkit = AssistantHubToolkit.from_api_key("ahk_your_key")

# Option 3: Anonymous (10 free calls/day, no key needed)
toolkit = AssistantHubToolkit()

tools = toolkit.get_tools()
agent = create_react_agent(model, tools)
result = agent.invoke({"messages": [
    {"role": "user", "content": "What's the risk score for SOL and current Fear & Greed?"}
]})

TypeScript

npm install langchain-assistanthub @langchain/core
import { AssistantHubToolkit } from "langchain-assistanthub";

const toolkit = new AssistantHubToolkit({ apiKey: "your-hub-api-key" });
const tools = toolkit.getTools();
// Plug into any LangGraph / LangChain agent

Toolkit Options

OptionDefaultDescription
api_keyenv varJWT or Hub API key (ahk_...)
base_urlrmassistanthub.ioHub instance URL
include_premiumTrueInclude premium (x402) tools
toolsallExplicit list of tool IDs to load
max_retries2Retries on transient failures
timeout30sRequest timeout

Available Tools (13)

Tool ClassTool IDTierDaily Limit (Anon / Free / Pro)
AssistantHubLivePriceslive_pricesFree10 / 100 / 1,000
AssistantHubFearGreedfear_greedFree10 / 100 / 1,000
AssistantHubCryptoNewscrypto_newsFree10 / 100 / 1,000
AssistantHubRiskScoresrisk_scoresFree10 / 100 / 1,000
AssistantHubDailyPulsedaily_pulseFree10 / 100 / 1,000
AssistantHubAIForecastai_forecastPremium— / — / 100
AssistantHubMonteCarloBacktestmonte_carlo_backtestPremium— / — / 100
AssistantHubSlippageEstimateslippage_estimatePremium— / — / 100
AssistantHubCreateAlertcreate_alertPremium— / — / 100
AssistantHubStrategyAnalysisstrategy_analysisPremium— / — / 100
AssistantHubExecuteTradeexecute_tradePremium— / — / 100
AssistantHubCheckApprovalcheck_approvalPremium— / — / 100
AssistantHubPriceMonitorprice_monitorFree*WebSocket

* Requires enable_price_feed=True and websockets package. Premium daily limit is unlimited. Premium tools also accept x402 pay-per-call (1.00 USDC).

Option B: MCP Auto-Discovery

Loads tools dynamically from the MCP server. Always gets the latest tools without updating the SDK — great for staying current as new tools are added.

from langchain_assistanthub import AssistantHubToolkit
from langgraph.prebuilt import create_react_agent

# Auto-discover all tools via MCP protocol
tools = await AssistantHubToolkit.from_mcp(api_key="ahk_your_key")
agent = create_react_agent(model, tools)

Or use the MCP client directly for more control:

from langchain_assistanthub import AssistantHubMCPClient

client = AssistantHubMCPClient.from_api_key("ahk_your_key")
tools = await client.get_tools()
# tools is a list of LangChain BaseTool instances

TypeScript:

import { getMcpTools } from "langchain-assistanthub";
const tools = await getMcpTools({ apiKey: "your-jwt" });
// Auto-discovers all tools from the MCP server

x402 Pay-Per-Call (No Subscription Needed)

Free tools work instantly with any auth. Premium tools return HTTP 402 with payment headers — your agent pays per call with USDC on Base:

# Toolkit approach — premium tools return payment info as structured error
toolkit = AssistantHubToolkit(api_key="your-key")
tools = toolkit.get_tools()
# Premium tools that require payment will return:
# {"error": "payment_required", "payment": {"x-402-amount": "1.00", ...}}

# JWT approach — Pro/Premium subscribers get unlimited premium calls
toolkit = AssistantHubToolkit(api_key="your-pro-jwt")  # all tools work

🆓 Anonymous Free Tier

10 free calls/day — no API key needed. Just use AssistantHubToolkit() with no arguments. Register at /developers for 100 calls/day (free), or upgrade to Pro/Premium for unlimited access.

💰 HUB Staking Discount

Stake HUB tokens on Base for 50% off all x402 tool calls. Stakers also get priority queue and higher rate limits. Learn more →

See Showcase Notebooks for 3 runnable examples: sentiment trader, backtest optimizer, and live monitor.

Showcase Notebooks

Copy-paste-run examples that demonstrate full agent workflows. Each script is self-contained — just set your API key and go.

🎯 Sentiment Trader

Beginner

Analyze market sentiment using Fear & Greed, news, and risk scores — then get a buy/hold/sell recommendation from a LangGraph ReAct agent.

Tools: live_prices, fear_greed, crypto_news, risk_scores, daily_pulse
LLM: Gemini 2.5 Flash

View on GitHub →

📈 Backtest Optimizer

Intermediate

Grid-search 4 strategies across 3 coins. Each test runs backtest → Monte Carlo → walk-forward validation with slippage estimates.

Tools: strategy_analysis, slippage_estimate (Premium)
Output: Comparison table + deploy/paper-trade/avoid verdict

View on GitHub →

🔴 Live Monitor

Advanced

Connect to the WebSocket price feed, monitor for >3% moves, and auto-trigger AI analysis + risk assessment on detection.

Tools: PriceFeedRunnable, PriceMonitor, ai_forecast, risk_scores
Mode: Continuous (Ctrl+C to stop)

View on GitHub →

🚀 Try it now: Anonymous users get 10 free tool calls/day — no API key needed. Register at /developers for 100 calls/day (free), or upgrade to Pro/Premium for unlimited access.

MCP Connect — Claude Desktop & Cursor

Add Assistant Hub tools directly to Claude Desktop, Cursor, or any MCP-compatible client.

Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "assistanthub": {
      "url": "https://rmassistanthub.io/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_JWT_TOKEN"
      }
    }
  }
}

Config file location: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)

Cursor

In Cursor Settings → MCP Servers → Add Server:

FieldValue
Nameassistanthub
URLhttps://rmassistanthub.io/mcp
TransportStreamable HTTP
Auth HeaderAuthorization: Bearer YOUR_JWT

Available Tools

Once connected, these tools appear in your AI assistant:

ToolDescriptionTier
get_pricesLive crypto prices (8 coins)Free
get_fear_greedMarket Fear & Greed IndexFree
get_newsLatest crypto headlinesFree
get_risk_scoresRisk analysis for any coinFree
get_pulseDaily macro threats + opportunitiesFree
ai_forecastAI-powered price forecastPremium
run_backtestStrategy backtesting enginePremium
create_alertPrice & signal alertsPremium

Quick Verify

# Test MCP discovery:
curl https://rmassistanthub.io/.well-known/mcp.json | jq .

# Test Streamable HTTP transport:
curl -X POST https://rmassistanthub.io/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"initialize","id":"1","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'

Interactive API Explorer

Try endpoints directly from your browser. Sandbox mode uses virtual credits.

GET /.well-known/agent-card.json

Response

Select an endpoint and click "Send Request"