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.1

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

We're at v0.1.1 — 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[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.1.tar.gz (23.6 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.1-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_assistanthub-0.1.1.tar.gz
  • Upload date:
  • Size: 23.6 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.1.tar.gz
Algorithm Hash digest
SHA256 768a0b2091c5ce5903ace54591ccbc0e50bfef5a6cf4c7ce652a3d07216950cf
MD5 b970de0a65417f8edb38eb4bc1c3ea75
BLAKE2b-256 0d9357ad86efcfd9784f4015017b88e1a5df289d19a89770a1470dfa7b83281b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for langchain_assistanthub-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3abe20e4b92faa6b771a6176b9aebda1c688733b1093709e9459be737e2acf12
MD5 12d3fc1894833f5f5cf4f8ec7b18375d
BLAKE2b-256 9b0a0e47fad1aebc96edc201193cc5b41c06ce4a930ac2b60ac30eef449b5e42

See more details on using hashes here.

Provenance

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