> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Privy integration

> Integrate with the Privy tool using LangChain Python.

[Privy](https://privy.io) 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

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
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](https://github.com/privy-io/langchain-privy/tree/main/examples) for a full implementation.

## Setup

Head to [Privy's dashboard](https://dashboard.privy.io) 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:

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pip install langchain-privy
```

2. Set your credentials:

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
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

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
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

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
# 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

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
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

* For complete documentation, see the [langchain-privy GitHub repository](https://github.com/privy-io/langchain-privy)
* For more information on Privy, see [Privy Documentation](https://docs.privy.io)

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/tools/privy.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
