Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

Skip to main content
Privy is powerful wallet infrastructure for AI agents, built for scale.

Overview

Create agents that can:
  • Automatically create and manage wallets
  • Make payments in a variety of digital assets, including stablecoins
  • Sign messages and transactions
  • Query wallet balances and addresses

How it works

Privy provides wallet infrastructure that removes the complexity of blockchain interactions:
  1. Give your agent a powerful wallet
  2. Secure your agent’s assets with transaction policies
  3. Make payments with speed
Zero-friction onboarding Different from traditional wallet solutions, Privy automatically creates embedded wallets for your agents without requiring private key management, seed phrases, or complex setup. Production-ready infrastructure Trusted by leading Web3 applications, Privy handles secure key generation, multi-chain address derivation, transaction signing, and compliance policies at scale.

Quickstart

import os
from langchain_privy import PrivyWalletTool
from langchain.agents import create_agent

# Set credentials
os.environ["PRIVY_APP_ID"] = "your-privy-app-id"
os.environ["PRIVY_APP_SECRET"] = "your-privy-app-secret"

# Initialize wallet tool (automatically creates wallet)
privy_tool = PrivyWalletTool()
print(f"Wallet created! Address: {privy_tool.wallet_address}")

# Create agent
agent = create_agent(
    model="claude-sonnet-4-6",
    tools=[privy_tool],
)

# Agent can now perform wallet operations
agent.invoke({"messages": [{"role": "user", "content": "What's my wallet address on Base?"}]})
See the complete example for a full implementation.

Setup

Head to Privy’s dashboard to sign up and create a new app. You’ll receive:
  • App ID - Your application identifier
  • App Secret - Your server-side authentication secret
  1. Install the package:
pip install langchain-privy
  1. Set your credentials:
import os
import getpass

os.environ["PRIVY_APP_ID"] = getpass.getpass("Enter your Privy App ID: ")
os.environ["PRIVY_APP_SECRET"] = getpass.getpass("Enter your Privy App Secret: ")

Instantiation

from langchain_privy import PrivyWalletTool

# Automatically creates a new Ethereum wallet
tool = PrivyWalletTool()

# Or create on a specific chain
base_tool = PrivyWalletTool(chain_type="base")
solana_tool = PrivyWalletTool(chain_type="solana")

# Or reuse an existing wallet
existing_tool = PrivyWalletTool(wallet_id="wal_abc123...")

Invocation

Available operations

# Get wallet address for any chain
tool.invoke({
    "operation": "get_wallet_address",
    "chain": "base"
})

# Sign a message
tool.invoke({
    "operation": "sign_message",
    "message": "Hello from LangChain!",
    "chain": "ethereum"
})

# Check balance
tool.invoke({
    "operation": "get_balance",
    "chain": "base"
})

# Send transaction
tool.invoke({
    "operation": "send_transaction",
    "chain": "base",
    "to": "0x1234567890123456789012345678901234567890",
    "value": "0.001",
    "unit": "ether"
})

Use within an agent

import os
from langchain_privy import PrivyWalletTool
from langchain.agents import create_agent

# Set credentials
os.environ["PRIVY_APP_ID"] = "your-privy-app-id"
os.environ["PRIVY_APP_SECRET"] = "your-privy-app-secret"

# Initialize tools
tools = [PrivyWalletTool()]

# Create agent
agent = create_agent(
    model="claude-sonnet-4-6",
    tools=tools,
)

# Natural language wallet operations
agent.invoke({
    "messages": [{"role": "user", "content": "Sign the message 'Verified by AI Agent' and then check my balance on Base"}]
})

API reference


Morty Proxy This is a proxified and sanitized view of the page, visit original site.