Skip to main content

Solana Agent Kit

Solana Agent Kit Cover 1 (3)

GitHub forks GitHub License

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.

Release files for solana-agent-kit-py 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solana-agent-kit-py 1.4.0
File Size Uploaded
solana_agent_kit_py-1.4.0.tar.gz 93.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for solana-agent-kit-py 1.4.0
File Interpreter ABI Platform
solana_agent_kit_py-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 212.8 kB

Release files / solana_agent_kit_py-1.4.0.tar.gz

Download URL solana_agent_kit_py-1.4.0.tar.gz
Size 93.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ae137295544e2150c808ef9dde28ef44ba03162fc67c31ef76fd9fddaaad9dd0
BLAKE2b-256 checksum
How to use checksums
202f0438b60f46ded7a83dcf5489cf38eb216307c9c23876c2b60d2c0ab37832
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.13.0 Darwin/24.1.0

Release files / solana_agent_kit_py-1.4.0-py3-none-any.whl

Download URL solana_agent_kit_py-1.4.0-py3-none-any.whl
Size 119.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e227016f2d027dbda9e28b77c2363ff7920f118fb8cd567c87d4981d05f8f42
BLAKE2b-256 checksum
How to use checksums
994dbfaa4d4c3e3af17a6e4a67aca690867196dee08a9b439003d3bd3bd264aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.13.0 Darwin/24.1.0

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 release files

1.3.9

2 release files

1.3.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page