npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lumen-langchain-kit

v1.0.1

Published

LangChain integration toolkit for LUMEN World Computer - Enable AI agents to interact with blockchain

Readme

🔗 LUMEN LangChain Kit

LangChain Integration for LUMEN World Computer

npm version License: MIT

Enable AI agents built with LangChain to interact directly with the LUMEN World Computer blockchain infrastructure.


🎯 What is This?

LUMEN LangChain Kit provides custom LangChain tools that allow Large Language Models (LLMs) to write permanent records to the blockchain, creating a bridge between AI reasoning and decentralized storage.

Key Features

  • 🤖 AI-to-Blockchain Bridge: Let AI agents write directly to LUMEN
  • 🔧 LangChain Native: Works seamlessly with existing LangChain workflows
  • ⛓️ Base Mainnet: Deployed on Ethereum L2 for low fees
  • 🔐 Trustless: All operations are cryptographically verified on-chain

📦 Installation

npm install lumen-langchain-kit

Peer Dependencies

npm install @langchain/core ethers

🚀 Quick Start

Basic Usage

import { LumenWriteTool } from 'lumen-langchain-kit';

// Initialize the tool
const lumenTool = new LumenWriteTool(
  process.env.PRIVATE_KEY!,           // Your wallet private key
  "0x52078D914CbccD78EE856b37b438818afaB3899c",  // LUMEN Kernel contract address
  "https://mainnet.base.org"          // Base Mainnet RPC
);

// Use with LangChain agent
import { initializeAgentExecutorWithOptions } from "langchain/agents";
import { ChatOpenAI } from "@langchain/openai";

const model = new ChatOpenAI({ temperature: 0 });

const executor = await initializeAgentExecutorWithOptions(
  [lumenTool],
  model,
  {
    agentType: "zero-shot-react-description",
  }
);

// Let the AI decide when to write to blockchain
const result = await executor.invoke({
  input: "Save a record that user Alice completed task #42 at 2025-01-15"
});

console.log(result.output);

🔧 Available Tools

LumenWriteTool

Writes a permanent context record to the LUMEN World Computer.

Parameters:

  • privateKey: Ethereum wallet private key (must have ETH for gas)
  • kernelAddress: Address of the LUMEN Kernel contract
  • rpcUrl: RPC endpoint for Base Mainnet

Usage:

const tool = new LumenWriteTool(
  "0x1234...",
  "0x52078D914CbccD78EE856b37b438818afaB3899c",
  "https://mainnet.base.org"
);

// Call directly
const result = await tool._call("Log: User completed payment");
console.log(result); // ✅ Success! Context written to LUMEN. Tx: 0xabc...

📖 How It Works

  1. AI Reasoning: The LangChain agent decides when blockchain storage is needed
  2. Tool Invocation: Agent calls LumenWriteTool with the data to store
  3. On-Chain Write: Tool calculates fees, prepares transaction, and writes to LUMEN Kernel
  4. Verification: Transaction hash is returned for permanent proof
┌─────────────┐      ┌──────────────┐      ┌─────────────┐
│   AI Agent  │─────▶│  LumenTool   │─────▶│   LUMEN     │
│  (LangChain)│      │              │      │   Kernel    │
└─────────────┘      └──────────────┘      └─────────────┘
     Decides              Executes           Stores Forever

🌐 Network Information

  • Chain: Base Mainnet
  • Chain ID: 8453
  • RPC: https://mainnet.base.org
  • Explorer: https://basescan.org

🛡️ Security

Best Practices

  • ✅ Never hardcode private keys in source code
  • ✅ Use environment variables for sensitive data
  • ✅ Start with testnet before mainnet deployment
  • ✅ Monitor gas prices and transaction costs
  • ✅ Implement rate limiting for production agents

Environment Setup

Create a .env file:

PRIVATE_KEY=your_wallet_private_key_here
KERNEL_ADDRESS=0x52078D914CbccD78EE856b37b438818afaB3899c
BASE_RPC_URL=https://mainnet.base.org

📚 Examples

Example 1: AI Logger

import { LumenWriteTool } from 'lumen-langchain-kit';
import { ChatOpenAI } from "@langchain/openai";
import { initializeAgentExecutorWithOptions } from "langchain/agents";

const lumenTool = new LumenWriteTool(
  process.env.PRIVATE_KEY!,
  process.env.KERNEL_ADDRESS!,
  process.env.BASE_RPC_URL!
);

const model = new ChatOpenAI({ temperature: 0 });

const executor = await initializeAgentExecutorWithOptions(
  [lumenTool],
  model,
  { agentType: "zero-shot-react-description" }
);

const result = await executor.invoke({
  input: "A critical event occurred: Database backup completed successfully at 2025-01-15 14:30 UTC. Store this permanently."
});

console.log(result.output);

Example 2: Multi-Agent Coordination

// Agent 1 writes a job request
const jobRequest = await agentExecutor1.invoke({
  input: "Create a job request for data analysis task #123"
});

// Agent 2 reads and responds (via LUMEN event monitoring)
const jobResponse = await agentExecutor2.invoke({
  input: "Check for pending job requests and accept task #123"
});

🔗 Related Projects

  • LUMEN GENESIS KIT: https://github.com/Lumen-Founder/LUMEN-GENESIS-KIT
  • Agent Zero V2: Autonomous agent implementation
  • Deploy Kit: Smart contract deployment tools
  • Relay Monitor: Real-time network monitoring

🤝 Contributing

Contributions are welcome! Please open issues or submit pull requests.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

📄 License

MIT License - see LICENSE file for details


🚀 What's Next?

The LUMEN LangChain Kit enables:

  • 🤖 AI agents that can prove their actions on-chain
  • 🔐 Trustless AI-to-AI communication
  • 💱 Autonomous agent marketplaces
  • 🌍 Decentralized AI orchestration
  • ⚡ Verifiable AI reasoning trails

Build the future of AI × Blockchain.


Made with ❤️ by LUMEN Protocol

"Trust, but Verify"