Skip to main content

LangChain toolkit for Assistant Hub (rmassistanthub.io) — crypto intelligence via MCP

Project description

langchain-assistanthub

PyPI version Downloads License: MIT CI

Crypto intelligence toolkit for LangChain agents. Real-time prices, risk scores, Monte Carlo backtests, AI forecasts, and more — powered by Assistant Hub.

Install

# Recommended: pin to current stable version
pip install langchain-assistanthub==0.1.4

# Or latest (for bleeding-edge users)
# pip install langchain-assistanthub

We're at v0.1.4 — pinned install recommended for stability. Check the changelog for updates!

Optional extras:

pip install langchain-assistanthub[x402]      # USDC on-chain payments
pip install langchain-assistanthub[swarm]     # LangGraph multi-agent
pip install langchain-assistanthub[notebook]  # JupyterLab + pandas + matplotlib for examples
pip install langchain-assistanthub[dev]       # pytest, ruff, mypy

Quick Start

Option A: Pre-built toolkit (recommended)

from langchain_assistanthub import AssistantHubToolkit
from langgraph.prebuilt import create_react_agent

toolkit = AssistantHubToolkit.from_api_key("ahk_your_key")
# or: toolkit = AssistantHubToolkit.from_env()   # reads ASSISTANT_HUB_API_KEY
tools = toolkit.get_tools()

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

Option B: Login with Hub credentials

from langchain_assistanthub import AssistantHubToolkit

toolkit = AssistantHubToolkit.from_hub_login("you@email.com", "password")
tools = toolkit.get_tools()

Option C: MCP auto-discovery

Dynamically discover tools from the MCP server — picks up new tools without upgrading the package:

from langchain_assistanthub import AssistantHubToolkit

tools = await AssistantHubToolkit.from_mcp(api_key="ahk_your_key")
agent = create_react_agent(model, tools)

Option D: MCP client directly

from langchain_assistanthub import AssistantHubMCPClient

client = AssistantHubMCPClient.from_api_key("ahk_your_key")
tools = await client.get_tools()

Available Tools

Tool Description Tier
live_prices Real-time prices for 8 major coins Free
fear_greed Crypto Fear & Greed Index Free
crypto_news Latest crypto headlines Free
risk_scores AI-computed composite risk scores Free
daily_pulse Daily macro threats + opportunities Free
ai_forecast AI price predictions (24h/7d) Premium
monte_carlo_backtest Strategy backtesting with Monte Carlo Premium
slippage_estimate Trade slippage estimation Premium
create_alert Price/change alerts Premium
strategy_analysis Full backtest + Monte Carlo + walk-forward Premium
execute_trade Paper/live trade execution Premium
check_approval Trade approval status Premium
price_monitor Live WebSocket price feed + alerts Free*

* Requires enable_price_feed=True and websockets package.

Advanced Usage

# Free tools only
toolkit = AssistantHubToolkit(api_key="...", include_premium=False)

# Specific tools
toolkit = AssistantHubToolkit(api_key="...", tools=["live_prices", "risk_scores"])

# Custom instance (local dev)
toolkit = AssistantHubToolkit(api_key="...", base_url="http://localhost:3000")

# With live price monitoring
toolkit = AssistantHubToolkit(
    api_key="...",
    enable_price_feed=True,
    price_feed_coins=["BTC", "ETH", "SOL"],
)

Anonymous Free Tier

No API key? You get 10 free calls per day on non-premium tools:

toolkit = AssistantHubToolkit()  # no api_key needed
tools = toolkit.get_tools()     # 10 calls/day, then 429 with upgrade CTA

Payment

Free tools work instantly. Premium tools require:

  • Pro/Premium JWT — unlimited calls
  • x402 USDC on Base — pay per call (no subscription needed)
  • HUB stakers — 50% off all x402 calls

Package Structure

sdk/langchain-python/
  src/langchain_assistanthub/
    __init__.py          # Public API + __all__
    _version.py          # Single source of truth for version
    toolkit.py           # AssistantHubToolkit (main entry)
    client.py            # AssistantHubMCPClient (MCP adapter)
    tools.py             # Individual tool wrappers
    price_feed.py        # WebSocket price feed
    price_monitor.py     # Price alert monitor
    strategy.py          # Strategy analysis tool
    execution.py         # Trade execution tools
  tests/
    test_toolkit.py      # Comprehensive test suite
  pyproject.toml         # hatchling build config

Example Notebooks

See sdk/notebooks/ for runnable examples:

Notebook Description Difficulty
01_sentiment_trader.py ReAct agent: sentiment → news → risk → trade Beginner
02_backtest_optimizer.py Grid search 4 strategies × 3 coins Intermediate
03_live_monitor.py WebSocket feed + auto AI analysis on big moves Advanced

Telemetry

This package sends a single anonymous ping on toolkit init to help us gauge adoption. No PII is collected — just a random ID, package version, and auth type (keyed vs anonymous).

Opt out:

export ASSISTANT_HUB_TELEMETRY_OPT_OUT=1

Links

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_assistanthub-0.1.4.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_assistanthub-0.1.4-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file langchain_assistanthub-0.1.4.tar.gz.

File metadata

  • Download URL: langchain_assistanthub-0.1.4.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for langchain_assistanthub-0.1.4.tar.gz
Algorithm Hash digest
SHA256 0e996a8b0db21aa20cef15a2d495b0f27115a9b0e495493dbd1011cb39773da1
MD5 b5683681e47d965f0d77fafea51d8511
BLAKE2b-256 7b1cb2d1e502071da2583a6f39448ae2d0de8eac11dafdf06ea91f5be76ecaa8

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_assistanthub-0.1.4.tar.gz:

Publisher: release.yml on redman4220/langchain-assistanthub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_assistanthub-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_assistanthub-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f2a3c51d55c97afca9256afea9391a935d9125f7c187768fd39cd316e8f7bd39
MD5 698db597518f141d5c06def6ac783038
BLAKE2b-256 cc398403a2c386dde27240a21a1225e9637d1418258e627d256eba92714a764c

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_assistanthub-0.1.4-py3-none-any.whl:

Publisher: release.yml on redman4220/langchain-assistanthub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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