Skip to content

HuiNeng6/langchain-rustchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

langchain-rustchain

LangChain tools for RustChain blockchain integration.

Installation

pip install langchain-rustchain

Usage

from langchain_rustchain import (
    RustChainCheckBalance,
    RustChainListBounties,
    RustChainGetNodeHealth,
    RustChainGetCurrentEpoch,
)

# Check RTC balance for a wallet
balance_tool = RustChainCheckBalance()
balance = balance_tool.run(wallet_id="my-wallet")
print(f"Balance: {balance} RTC")

# List available bounties
bounties_tool = RustChainListBounties()
bounties = bounties_tool.run(limit=10)
print(f"Available bounties: {bounties}")

# Check node health
health_tool = RustChainGetNodeHealth()
health = health_tool.run()
print(f"Node health: {health}")

# Get current epoch info
epoch_tool = RustChainGetCurrentEpoch()
epoch = epoch_tool.run()
print(f"Current epoch: {epoch}")

Example Agent Workflow

from langchain.agents import AgentExecutor, create_openai_tools_agent
from langchain_openai import ChatOpenAI
from langchain_rustchain import (
    RustChainCheckBalance,
    RustChainListBounties,
)

# Setup tools
tools = [
    RustChainCheckBalance(),
    RustChainListBounties(),
]

# Create agent
llm = ChatOpenAI(model="gpt-4")
agent = create_openai_tools_agent(llm, tools)
agent_executor = AgentExecutor(agent=agent, tools=tools)

# Run agent to find bounties
result = agent_executor.invoke({
    "input": "Check my wallet balance 'test-wallet' and find bounties I can claim"
})
print(result)

Features

  • check_balance(wallet_id): Check RTC token balance for any wallet
  • list_bounties(limit): List available bounties on RustChain
  • get_node_health(): Check RustChain node health status
  • get_current_epoch(): Get current epoch information

Links

Bounty Reference

This package was created for RustChain bounty #3074: Scottcjn/rustchain-bounties#3074

License

MIT License

About

LangChain tools for RustChain blockchain integration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages