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

pip install langchain-assistanthub

Optional extras:

pip install langchain-assistanthub[x402]    # USDC on-chain payments
pip install langchain-assistanthub[swarm]   # LangGraph multi-agent
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: 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 C: 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

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.0.tar.gz (21.4 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.0-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_assistanthub-0.1.0.tar.gz
  • Upload date:
  • Size: 21.4 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.0.tar.gz
Algorithm Hash digest
SHA256 eaaf03219e065fdf0070564cf41daea08fcf942b5bb04df601b6083377d397a9
MD5 f8860e9ac12d5b973f49b45fc8404fad
BLAKE2b-256 94e853f797921b377af4a32687ad18264e8389c0b790868dc665a6bbf4dad0a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_assistanthub-0.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_assistanthub-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f88ccb6b8ba163b7b7c54280346089be8ea2b8fd83132e5e613d2e7fb34e2e3f
MD5 417b5feb8da2d6e4fb490ed1848aed93
BLAKE2b-256 05187c13571c8bbd70a37cb1fc0014cb7f5a3a03a3b8c81d072cb0bc0e5b3a29

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_assistanthub-0.1.0-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