Skip to main content

LangChain integration for PayLobster - AI agent payment escrow on Base

Project description

langchain-paylobster

LangChain integration for PayLobster - AI agent payment escrow on Base.

Installation

pip install langchain-paylobster

Quick Start

from langchain_paylobster import (
    PayLobsterCreateEscrow,
    PayLobsterReleaseEscrow,
    PayLobsterCheckReputation,
    PayLobsterRegisterAgent,
    PayLobsterGetBalance,
)
from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI

# Initialize tools
tools = [
    PayLobsterCreateEscrow(),
    PayLobsterReleaseEscrow(),
    PayLobsterCheckReputation(),
    PayLobsterRegisterAgent(),
    PayLobsterGetBalance(),
]

# Create agent
llm = ChatOpenAI(temperature=0, model="gpt-4")
agent = initialize_agent(
    tools, 
    llm, 
    agent=AgentType.OPENAI_FUNCTIONS, 
    verbose=True
)

# Use the agent
response = agent.run(
    "Check the reputation of agent 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
)
print(response)

Available Tools

PayLobsterCreateEscrow

Create a payment escrow that locks USDC funds until work is completed.

Parameters:

  • worker_address: Ethereum address of the worker
  • amount_usdc: Amount in USDC (e.g., 100.50)
  • deadline_hours: Hours until deadline (default: 24)
  • description: Description of the work
  • private_key: Your private key (client)

PayLobsterReleaseEscrow

Release payment to the worker after work is completed.

Parameters:

  • escrow_id: ID of the escrow to release
  • private_key: Your private key (must be the client)

PayLobsterCheckReputation

Check an agent's reputation score and task history.

Parameters:

  • agent_address: Ethereum address of the agent

PayLobsterRegisterAgent

Register your agent on the PayLobster identity system.

Parameters:

  • metadata: JSON string with agent info (capabilities, contact, etc.)
  • private_key: Your agent's private key

PayLobsterGetBalance

Check USDC balance of any address on Base.

Parameters:

  • address: Ethereum address to check

Example: Negotiating Agent

See examples/negotiating_agent.py for a complete example of an agent that can:

  • Negotiate work terms
  • Create escrow for agreed payment
  • Track reputation of potential workers
  • Release payment upon completion

Contract Addresses (Base Mainnet)

  • Identity: 0xA174ee274F870631B3c330a85EBCad74120BE662
  • Reputation: 0x02bb4132a86134684976E2a52E43D59D89E64b29
  • Escrow: 0x703B528C1b07cd27992af9Ae11DD67bE685E489e
  • Credit: 0x4c22B52eacAB9eD2Ce018d032739a93eC68eD27a
  • USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913

Security

⚠️ Never hardcode private keys in production! Use environment variables or secure key management:

import os
private_key = os.environ.get("AGENT_PRIVATE_KEY")

License

MIT

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_paylobster-0.1.0.tar.gz (6.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_paylobster-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_paylobster-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for langchain_paylobster-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d920a0058146216f947db48a4025882115e7db6da5da0d163483b901584a2fb9
MD5 a1402fa54ceff2a350a8e222a16e7eeb
BLAKE2b-256 1631889fc0e97c67b20dd9685c8017d56c9d69891e7f0d93fcd98ddc4e99e5b4

See more details on using hashes here.

File details

Details for the file langchain_paylobster-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_paylobster-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96f9cb86e9fab9c65a4d2a5216dae283cac913ef4fed254f62ec542b1c6e64eb
MD5 c5af1d9e72b3351f9eddd3efda172f47
BLAKE2b-256 d61859f0c1bb5df58526a1cbc06c115f9bedf14e41a6a34fbe20c2b6a4a01ad0

See more details on using hashes here.

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