connect any ai agents to solana protocols
Project description
Solana Agent Kit
An open-source toolkit for connecting AI agents to Solana protocols. Now, any agent, using any model can autonomously perform 60+ Solana actions:
- Trade tokens
- Launch new tokens
- Lend assets
- Send compressed airdrops
- Execute blinks
- Launch tokens on AMMs
- And more...
Anyone - whether an SF-based AI researcher or a crypto-native builder - can bring their AI agents trained with any model and seamlessly integrate with Solana.
🔧 Core Blockchain Features
-
Token Operations
- Deploy SPL tokens by Metaplex
- Transfer assets
- Balance checks
- Stake SOL
- Zk compressed Airdrop by Light Protocol and Helius
-
NFTs on 3.Land
- Create your own collection
- NFT creation and automatic listing on 3.land
- List your NFT for sale in any SPL token
-
NFT Management via Metaplex
- Collection deployment
- NFT minting
- Metadata management
- Royalty configuration
-
DeFi Integration
- Jupiter Exchange swaps
- Launch on Pump via PumpPortal
- Raydium pool creation (CPMM, CLMM, AMMv4)
- Orca Whirlpool integration
- Manifest market creation, and limit orders
- Meteora Dynamic AMM, DLMM Pool, and Alpha Vault
- Openbook market creation
- Register and Resolve SNS
- Jito Bundles
- Pyth Price feeds for fetching Asset Prices
- Register/resolve Alldomains
- Perpetuals Trading with Adrena Protocol
- Drift Vaults, Perps, Lending and Borrowing
-
Solana Blinks
- Lending by Lulo (Best APR for USDC)
- Send Arcade Games
- JupSOL staking
- Solayer SOL (sSOL)staking
🤖 AI Integration Features
-
LangChain Integration
- Ready-to-use LangChain tools for blockchain operations
- Autonomous agent support
- Memory management for persistent interactions
- Streaming responses for real-time feedback
-
Autonomous Modes
- Interactive chat mode for guided operations
- Autonomous mode for independent agent actions
- Configurable action intervals
- Built-in error handling and recovery
📃 Documentation
You can view the full documentation of the kit at docs.solanaagentkit.xyz
📦 Installation
pip install solana-agent-kit-py
Quick Start
from solana_agent_kit import SolanaAgentKit, create_solana_tools
# Initialize with private key and optional RPC URL
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
# Create LangChain tools
tools = create_solana_tools(agent)
Usage Examples
Deploy a New Token
from solana_agent_kit import SolanaAgentKit
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
result = await agent.deploy_token(
"my ai token", # name
"uri", # uri
"token", # symbol
9, # decimals
1000000 # initial supply
)
print("Token Mint Address:", result.mint)
import asyncio
asyncio.run(main())
Create NFT Collection
from solana_agent_kit import SolanaAgentKit
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
collection = await agent.deploy_collection({
"name": "My NFT Collection",
"uri": "https://arweave.net/metadata.json",
"royalty_basis_points": 500, # 5%
"creators": [
{
"address": "creator-wallet-address",
"percentage": 100
}
]
})
import asyncio
asyncio.run(main())
Swap Tokens
from solana_agent_kit import SolanaAgentKit
from solders.pubkey import Pubkey
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
signature = await agent.trade(
output_mint=Pubkey.from_string("target-token-mint"),
input_amount=100, # amount
input_mint=Pubkey.from_string("source-token-mint"),
slippage_bps=300 # 3% slippage
)
import asyncio
asyncio.run(main())
Lend Tokens
from solana_agent_kit import SolanaAgentKit
from solders.pubkey import Pubkey
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
signature = await agent.lend_assets(
amount=100 # amount
)
import asyncio
asyncio.run(main())
Stake SOL
from solana_agent_kit import SolanaAgentKit
from solders.pubkey import Pubkey
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
signature = await agent.stake(
amount=1 # amount in SOL
)
import asyncio
asyncio.run(main())
Request Faucet Funds
from solana_agent_kit import SolanaAgentKit
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
response = await agent.request_faucet_funds()
print(response)
import asyncio
asyncio.run(main())
Fetch Current TPS
from solana_agent_kit import SolanaAgentKit
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
tps = await agent.get_tps()
print(f"Current TPS: {tps}")
import asyncio
asyncio.run(main())
Get Token Data by Ticker
from solana_agent_kit import SolanaAgentKit
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
token_data = await agent.get_token_data_by_ticker("SOL")
print(token_data)
import asyncio
asyncio.run(main())
Get Token Data by Address
from solana_agent_kit import SolanaAgentKit
from solders.pubkey import Pubkey
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
token_data = await agent.get_token_data_by_address("your-token-mint-address")
print(token_data)
import asyncio
asyncio.run(main())
Launch Pump Fun Token
from solana_agent_kit import SolanaAgentKit
from solana_agent_kit.types import PumpfunTokenOptions
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
options = PumpfunTokenOptions(
# Add your options here
)
response = await agent.launch_pump_fun_token(
token_name="MyToken",
token_ticker="MTK",
description="This is a fun token",
image_url="https://example.com/image.png",
options=options
)
print(response)
Create Meteora DLMM Pool
from solana_agent_kit import SolanaAgentKit
from solders.pubkey import Pubkey
from solana_agent_kit.utils.meteora_dlmm.types import ActivationType
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
response = await agent.create_meteora_dlmm_pool(
bin_step=1,
token_a_mint=Pubkey.from_string("token-a-mint"),
token_b_mint=Pubkey.from_string("token-b-mint"),
initial_price=1.0,
price_rounding_up=True,
fee_bps=30,
activation_type=ActivationType.Timestamp,
has_alpha_vault=True,
activation_point=None
)
print(response)
import asyncio
asyncio.run(main())
Buy Tokens with Raydium
from solana_agent_kit import SolanaAgentKit
from solders.pubkey import Pubkey
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
confirmed = await agent.buy_with_raydium(
pair_address=Pubkey.from_string("target-pair-address"), # The pair you want to buy from
sol_in=1, # Amount of SOL or input token to spend
slippage=300 # Maximum slippage in basis points (3% here)
)
print(f"Transaction confirmed: {confirmed}")
import asyncio
asyncio.run(main())
Sell Tokens with Raydium
from solana_agent_kit import SolanaAgentKit
from solders.pubkey import Pubkey
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
confirmed = await agent.sell_with_raydium(
input_mint=Pubkey.from_string("source-token-mint"), # The token you want to sell
percentage=100,
slippage_bps=250 # Maximum slippage in basis points (2.5% here)
)
print(f"Transaction confirmed: {confirmed}")
import asyncio
asyncio.run(main())
Burn and Close Token Account
from solana_agent_kit import SolanaAgentKit
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
response = await agent.burn_and_close_accounts("token-account-address")
print("Account burned and closed:", response)
import asyncio
asyncio.run(main())
Batch burn and Close Token Account
from solana_agent_kit import SolanaAgentKit
async def main():
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
token_accounts = ["token-account-address-1", "token-account-address-2"]
responses = await agent.multiple_burn_and_close_accounts(token_accounts)
print("Accounts burned and closed:", responses)
import asyncio
asyncio.run(main())
Dependencies
The toolkit relies on several key Solana and Metaplex libraries:
- solana-py
- spl-token-py
- metaplex-python-sdk
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. Refer to CONTRIBUTING.md for detailed guidelines on how to contribute to this project.
License
Apache-2 License
Funding
If you wanna give back any tokens or donations to the OSS community -- The Public Solana Agent Kit Treasury Address:
Solana Network : EKHTbXpsm6YDgJzMkFxNU1LNXeWcUW7Ezf8mjUNQQ4Pa
Security
This toolkit handles private keys and transactions. Always ensure you're using it in a secure environment and never share your private keys.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file solana_agent_kit_py-1.4.0.tar.gz.
File metadata
- Download URL: solana_agent_kit_py-1.4.0.tar.gz
- Upload date:
- Size: 93.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.0 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae137295544e2150c808ef9dde28ef44ba03162fc67c31ef76fd9fddaaad9dd0
|
|
| MD5 |
e77c5f4745b33e14eeaf174c5b182478
|
|
| BLAKE2b-256 |
202f0438b60f46ded7a83dcf5489cf38eb216307c9c23876c2b60d2c0ab37832
|
File details
Details for the file solana_agent_kit_py-1.4.0-py3-none-any.whl.
File metadata
- Download URL: solana_agent_kit_py-1.4.0-py3-none-any.whl
- Upload date:
- Size: 119.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.0 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e227016f2d027dbda9e28b77c2363ff7920f118fb8cd567c87d4981d05f8f42
|
|
| MD5 |
afbd8eb7808997c33b48f6564a676047
|
|
| BLAKE2b-256 |
994dbfaa4d4c3e3af17a6e4a67aca690867196dee08a9b439003d3bd3bd264aa
|