Skip to main content

keeperhub-langchain

PyPI Python License Tests

Give any Python LangChain agent onchain superpowers — 24 tools for DeFi, transfers, ENS, workflows, and more.


Skill Install

npx agentskills install keeperhub

Install

pip install keeperhub-langchain

With MCP bridge (adds KeeperHub's official workflow tools):

pip install "keeperhub-langchain[workflows]"

5-Minute Quickstart

import asyncio, os
from langchain_keeperhub import KeeperHubToolkit
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent

# pip install keeperhub-langchain langchain-openai langgraph
# export KEEPERHUB_API_KEY=kh_...
# export OPENAI_API_KEY=sk-...

async def main():
    toolkit = KeeperHubToolkit(testnet_only=True)  # safe for dev
    agent = create_react_agent(
        model=ChatOpenAI(model="gpt-4o-mini"),
        tools=toolkit.get_tools(),
    )
    result = await agent.ainvoke({
        "messages": [("user", "What blockchains does KeeperHub support?")]
    })
    print(result["messages"][-1].content)
    # → "KeeperHub supports 19 chains: Ethereum, Base, Arbitrum, Optimism..."

asyncio.run(main())

Get your API key at app.keeperhub.com → Settings → API Keys.


Safety

# Block all mainnet writes — safe for development
toolkit = KeeperHubToolkit(testnet_only=True)

# Restrict to specific chains only
toolkit = KeeperHubToolkit(
    testnet_only=True,
    allowed_chain_ids={"11155111", "84532"},  # Sepolia, Base Sepolia
)

Applies to transfer_funds, contract_call, check_and_execute. Returns a structured error instead of executing on mainnet.


Execution History

# SQLite-backed — zero extra deps
toolkit = KeeperHubToolkit(history=True)           # ~/.keeperhub/executions.db
toolkit = KeeperHubToolkit(history="./project.db") # custom path

# Or bring your own store
from langchain_keeperhub import SqliteExecutionStore
toolkit = KeeperHubToolkit(history=SqliteExecutionStore("./executions.db"))

When history=True, every transfer_funds call is persisted with execution ID, network, amount, and recipient. get_execution_status updates the row with the tx hash when the transaction completes.


MCP Bridge (Optional)

# Combines native tools + KeeperHub's official MCP tools
toolkit = KeeperHubToolkit(
    workflows=True,
    mcp_include={"list_workflows", "execute_workflow", "ai_generate_workflow"},
)
tools = await toolkit.aget_tools()  # must use async when workflows=True

All 24 Tools

Chains

Tool Description
keeperhub_list_chains List all 19 supported blockchains
keeperhub_fetch_contract_abi Fetch verified ABI, auto-resolves EIP-1967/UUPS/Diamond proxies

Web3

Tool Description
keeperhub_transfer_funds Send ETH or any ERC-20 token
keeperhub_contract_call Read or write any smart contract function
keeperhub_check_and_execute Atomic condition check + transaction
keeperhub_estimate_gas Estimate gas cost before submitting

Workflows

Tool Description
keeperhub_list_workflows List all org workflows
keeperhub_execute_workflow Run a workflow by ID
keeperhub_generate_workflow Create a workflow from plain English
keeperhub_get_execution_status Poll status, get tx hash

DeFi

Tool Description
keeperhub_list_protocols Browse all 396 available protocol actions
keeperhub_protocol_action Execute any action — Aave V3/V4, Uniswap, Lido, Compound V3, Morpho, Yearn V3, Curve, CowSwap, Aerodrome
keeperhub_get_action_schema Get required params for any action
keeperhub_search_actions Search 396 actions by keyword

Payments

Tool Description
keeperhub_pay_and_run Execute a paid workflow via x402 (Base USDC) or MPP (Tempo USDC.e)

Identity

Tool Description
keeperhub_register_agent Register agent on-chain (ERC-8004) — mints identity NFT
keeperhub_wallet_balance Check managed wallet balance across all chains
keeperhub_provision_wallet Provision new Turnkey-backed agentic wallet

ENS

Tool Description
keeperhub_ens_resolve Resolve ENS name → address (e.g. vitalik.eth)
keeperhub_ens_text_record Read ENS text records (avatar, email, twitter, url)
keeperhub_ens_lookup Reverse lookup — address → ENS name

Chainlink

Tool Description
keeperhub_chainlink_ccip Cross-chain token transfer via Chainlink CCIP
keeperhub_chainlink_price Get latest price from Chainlink oracle

Utility

Tool Description
keeperhub_run_code Execute custom JavaScript in KeeperHub sandbox
keeperhub_math_aggregate Sum, average, median, min, max

Config Reference

Parameter Type Default Description
api_key str env KEEPERHUB_API_KEY KeeperHub API key
base_url str https://app.keeperhub.com API base URL
timeout float 30.0 Per-request timeout in seconds
tools list[str] None (all 24) Allowlist of tool names to load
testnet_only bool False Block all mainnet writes
allowed_chain_ids set[str] None Chain ID allowlist
history bool | str | Store False Execution history store
workflows bool False Enable MCP bridge
agent_context dict None Session/goal metadata for observability

Links


License

MIT

Metadata

Release files for keeperhub-langchain 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keeperhub-langchain 0.3.3
File Size Uploaded
keeperhub_langchain-0.3.3.tar.gz 43.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for keeperhub-langchain 0.3.3
File Interpreter ABI Platform
keeperhub_langchain-0.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 90.3 kB

Release files / keeperhub_langchain-0.3.3.tar.gz

Download URL keeperhub_langchain-0.3.3.tar.gz
Size 43.0 kB
Tags Source
SHA-256 checksum
How to use checksums
20f7e4bd8b9e028e8ee003da0bb5f5d12991fcd69d3eeae1275d5741678382de
BLAKE2b-256 checksum
How to use checksums
0fd0b9cf9a92a669167ebadf4d0ba91ba5f34ea5bd585fd59ecb1671daf5cac5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / keeperhub_langchain-0.3.3-py3-none-any.whl

Download URL keeperhub_langchain-0.3.3-py3-none-any.whl
Size 47.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f896555ab303641e8594379b04cc1fdf671c3f90d210af02c5d8e517af1c80a3
BLAKE2b-256 checksum
How to use checksums
a080f7c1e8652ca5be8318345c9b957685212e7cd9e6b48bf6c7ecb4f59e6479
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

1 release file

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page