← 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
best_setups Best Setups by Window Free Up to eight ranked setups for one window (1m, 1h, 1d, 1w or 1y), each with its score, the scored inputs, why now, what w… —
setups_track_record Best Setups Track Record Free How the desk's past setups turned out, per window: every published card graded as a buy over its window's horizon, close… —
list_trading_skills List Trading Skills Free Installable trading skills: versioned, hashed rule sets an agent runs on paper in its own loop. Each lists its label (ex… —
get_trading_skill Trading Skill Card Free One skill's full manifest (rules, parameters with bounds, risk contract, allowed regimes, engine config) and its card: t… —
install_trading_skill Install Trading Skill Free The installable bundle for a skill, pinned to its hash: manifest, run loop and risk contract. Installs for paper trading… —
get_skill_regime Skill Regime Check Free Whether a skill may open a position on each of its pairs now: the pair's regime from closed hourly bars, whether the ski… —
live_prices Live Crypto Prices Free Current USD prices, 24h change, volume, and market cap for the top 250 coins by market cap (CoinGecko page 1). 60-second… —
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 CoinDesk, Cointelegraph, Decrypt and The Block, 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 Single-Wallet ETH Activity Free The latest transactions of one well-known Ethereum wallet (vitalik.eth), from Etherscan. A narrow sample of a single wal… —
search_signals Trade Signal Marketplace Free Browse community trade signals and how they resolved (win/loss is checked against CoinGecko prices at expiry). Signals w… —
crypto_research Deep Crypto Research Premium 3-agent orchestrated pipeline: Sentiment (Grok) + Technical (Groq) + Synthesis (Gemini); Gemini stands in when Grok or G… 1.00 USDC
whale_intel On-Chain Transfer Commentary Premium AI commentary on recent Etherscan transfers plus macro context. The on-chain input is narrow: for ETH, one well-known wa… 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
strategy_analysis Strategy Lab Analysis Premium Backtest a trading strategy on historical OHLCV, then run Monte Carlo and Walk-Forward robustness analysis — all in one … 0.50 USDC
pulse_deep_dive Pulse Deep-Dive Analysis Premium Deep-dive on the current Daily Macro Pulse, written by an AI from the pulse text alone: for each opportunity, the reason… 0.30 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)

Not on npm yet — this will be @rmassistanthub/sdk. Do not install @assistant-hub/sdk: that name belongs to an unrelated project. Until it ships, send the payment and the x-402-tx-hash header yourself as shown above.

import { X402Client } from "@rmassistanthub/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.

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"