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
- Bridge tokens across chains
- 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.

Replit template created by Arpit Singh
🔧 Core Blockchain Features
🤖 AI Integration Features
📃 Documentation
You can view the full documentation of the kit at docs.sendai.fun
📦 Core Installation
npm install solana-agent-kit
📦 Plugin Installation
You can choose to install any of the plugins listed below or you could choose to install all of them to experience the full power of the Solana Agent Kit.
- Token plugin (
@solana-agent-kit/plugin-token): Token operations for SPL tokens such as transferring assets, swapping, bridging, and rug checking.
- NFT plugin (
@solana-agent-kit/plugin-nft): NFT operations for Metaplex NFTs such as minting, listing, and metadata management.
- DeFi plugin (
@solana-agent-kit/plugin-defi): DeFi operations for Solana protocols such as staking, lending, borrowing, and spot and perpetual trading.
- Misc plugin (
@solana-agent-kit/plugin-misc): Miscellaneous operations such as airdrops, price feeds, coingecko token information, and domain registration.
- Blinks plugin (
@solana-agent-kit/plugin-blinks): Blinks operations for Solana protocols such as arcade games and more soon to come.
npm install @solana-agent-kit/plugin-token @solana-agent-kit/plugin-nft @solana-agent-kit/plugin-defi @solana-agent-kit/plugin-misc @solana-agent-kit/plugin-blinks
Quick Start
Initializing the wallet interface and agent with plugins:
import { SolanaAgentKit, createVercelAITools, KeypairWallet } from "solana-agent-kit";
import TokenPlugin from "@solana-agent-kit/plugin-token";
import NFTPlugin from "@solana-agent-kit/plugin-nft";
import DefiPlugin from "@solana-agent-kit/plugin-defi";
import MiscPlugin from "@solana-agent-kit/plugin-misc";
import BlinksPlugin from "@solana-agent-kit/plugin-blinks";
const keyPair = Keypair.fromSecretKey(bs58.decode("YOUR_SECRET_KEY"))
const wallet = new KeypairWallet(keyPair)
const agent = new SolanaAgentKit(
wallet,
"YOUR_RPC_URL",
{
OPENAI_API_KEY: "YOUR_OPENAI_API_KEY",
}
)
.use(TokenPlugin)
.use(NFTPlugin)
.use(DefiPlugin)
.use(MiscPlugin)
.use(BlinksPlugin);
const tools = createVercelAITools(agent, agent.actions);
You can also make use of the wallet interface provided by the Solana wallet adapter for embedded wallets.
Usage Examples Using Tools From The Token, Defi, and Other Plugins
Deploy a New Token
const result = await agent.methods.deployToken(
agent,
"my ai token",
"uri",
"token",
9,
{
mintAuthority: null,
freezeAuthority: null,
updateAuthority: undefined,
isMutable: false
},
1000000
);
console.log("Token Mint Address:", result.mint.toString());
Deploy a New Token2022
const result = await agent.methods.deployToken2022(
"my ai token 2022",
"uri",
"token2022",
9,
{
mintAuthority: null,
freezeAuthority: null,
updateAuthority: undefined,
isMutable: false
},
1000000
);
console.log("Token2022 Mint Address:", result.mint.toString());
Create NFT Collection on 3Land
const isDevnet = false;
const priorityFeeParam = 1000000;
const collectionOpts: CreateCollectionOptions = {
collectionName: "",
collectionSymbol: "",
collectionDescription: "",
mainImageUrl: ""
};
const result = await agent.methods.create3LandCollection(
collectionOpts,
isDevnet,
priorityFeeParam,
);
Create NFT on 3Land
When creating an NFT using 3Land's tool, it automatically goes for sale on 3.land website
const isDevnet = true;
const withPool = true;
const priorityFeeParam = 1000000;
const collectionAccount = "";
const createItemOptions: CreateSingleOptions = {
itemName: "",
sellerFee: 500,
itemAmount: 100,
itemSymbol: "",
itemDescription: "",
traits: [
{ trait_type: "", value: "" },
],
price: 0,
splHash: "",
poolName: "",
mainImageUrl: "",
};
const result = await agent.methods.create3LandSingle(
{},
collectionAccount,
createItemOptions,
isDevnet,
withPool
priorityFeeParam,
);
Create NFT Collection
const collection = await agent.methods.deployCollection(agent, {
name: "My NFT Collection",
uri: "https://arweave.net/metadata.json",
royaltyBasisPoints: 500,
creators: [
{
address: "creator-wallet-address",
percentage: 100,
},
],
});
Swap Tokens
import { PublicKey } from "@solana/web3.js";
const signature = await agent.methods.trade(
agent,
new PublicKey("target-token-mint"),
100,
new PublicKey("source-token-mint"),
300
);
Lend Tokens
import { PublicKey } from "@solana/web3.js";
const signature = await agent.methods.lendAssets(
agent,
100
);
Stake SOL
const signature = await agent.methods.stakeWithJup(
agent,
1
);
Stake SOL on Solayer
const signature = await agent.methods.stakeWithSolayer(
agent,
1
);
Send an SPL Token Airdrop via ZK Compression
import { PublicKey } from "@solana/web3.js";
(async () => {
console.log(
"~Airdrop cost estimate:",
getAirdropCostEstimate(
1000,
30_000
)
);
const signature = await agent.methods.sendCompressedAirdrop(
agent,
new PublicKey("JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN"),
42,
9,
[
new PublicKey("1nc1nerator11111111111111111111111111111111"),
],
30_000
);
})();
Fetch Price Data from Pyth
const priceFeedID = await agent.methods.fetchPythPriceFeedID("SOL");
const price = await agent.methods.fetchPythPrice(priceFeedID);
console.log("Price of SOL/USD:", price);
Open PERP Trade
import { PublicKey } from "@solana/web3.js";
const signature = await agent.methods.openPerpTradeLong({
agent: agent,
price: 300,
collateralAmount: 10,
collateralMint: new PublicKey("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"),
leverage: 50000,
tradeMint: new PublicKey("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"),
slippage: 0.3,
});
Close PERP Trade
import { PublicKey } from "@solana/web3.js";
const signature = await agent.methods.closePerpTradeLong({
agent: agent,
price: 200,
tradeMint: new PublicKey("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"),
});
Close Empty Token Accounts
const { signature } = await agent.methods.closeEmptyTokenAccounts(agent);
Create a Drift account
Create a drift account with an initial token deposit.
const result = await agent.methods.createDriftUserAccount(
agent,
100,
"USDC"
)
Create a Drift Vault
Create a drift vault.
const signature = await agent.methods.createDriftVault(agent, {
name: "my-drift-vault",
marketName: "USDC-SPOT",
redeemPeriod: 1,
maxTokens: 100000,
minDepositAmount: 5,
managementFee: 1,
profitShare: 10,
hurdleRate: 5,
permissioned: false,
})
Deposit into a Drift Vault
Deposit tokens into a drift vault.
const signature = await agent.methods.depositIntoDriftVault(agent, 100, "41Y8C4oxk4zgJT1KXyQr35UhZcfsp5mP86Z2G7UUzojU")
Deposit into your Drift account
Deposit tokens into your drift account.
const {txSig} = await agent.methods.depositToDriftUserAccount(agent, 100, "USDC")
Derive a Drift Vault address
Derive a drift vault address.
const vaultPublicKey = await agent.methods.deriveDriftVaultAddress(agent, "my-drift-vault")
Do you have a Drift account
Check if agent has a drift account.
const {hasAccount, account} = await agent.methods.doesUserHaveDriftAccount(agent)
Get Drift account information
Get drift account information.
const accountInfo = await agent.methods.driftUserAccountInfo(agent)
Request withdrawal from Drift vault
Request withdrawal from drift vault.
const signature = await agent.methods.requestWithdrawalFromDriftVault(agent, 100, "41Y8C4oxk4zgJT1KXyQr35UhZcfsp5mP86Z2G7UUzojU")
Carry out a perpetual trade using a Drift vault
Open a perpetual trade using a drift vault that is delegated to you.
const signature = await agent.methods.tradeUsingDelegatedDriftVault(agent, {
vault: "41Y8C4oxk4zgJT1KXyQr35UhZcfsp5mP86Z2G7UUzojU",
amount: 500,
symbol: "SOL",
action: "long",
type: "limit",
price: 180
})
Carry out a perpetual trade using your Drift account
Open a perpetual trade using your drift account.
const signature = await agent.methods.driftPerpTrade(agent, {
amount: 500,
symbol: "SOL",
action: "long",
type: "limit",
price: 180
})
Update Drift vault parameters
Update drift vault parameters.
const signature = await agent.methods.updateDriftVault(agent, {
name: "my-drift-vault",
marketName: "USDC-SPOT",
redeemPeriod: 1,
maxTokens: 100000,
minDepositAmount: 5,
managementFee: 1,
profitShare: 10,
hurdleRate: 5,
permissioned: false,
})
Withdraw from Drift account
Withdraw tokens from your drift account.
const {txSig} = await agent.methods.withdrawFromDriftUserAccount(agent, 100, "USDC")
Borrow from Drift
Borrow tokens from drift.
const {txSig} = await agent.methods.withdrawFromDriftUserAccount(agent, 1, "SOL", true)
Repay Drift loan
Repay a loan from drift.
const {txSig} = await agent.methods.depositToDriftUserAccount(agent, 1, "SOL", true)
Withdraw from Drift vault
Withdraw tokens from a drift vault after the redemption period has elapsed.
const signature = await agent.methods.withdrawFromDriftVault(agent, "41Y8C4oxk4zgJT1KXyQr35UhZcfsp5mP86Z2G7UUzojU")
Update the address a Drift vault is delegated to
Update the address a drift vault is delegated to.
const signature = await agent.methods.updateDriftVaultDelegate(agent, "41Y8C4oxk4zgJT1KXyQr35UhZcfsp5mP86Z2G7UUzojU", "new-address")
Get Voltr Vault Position Values
Get the current position values and total value of assets in a Voltr vault.
const values = await agent.methods.voltrGetPositionValues(agent, "7opUkqYtxmQRriZvwZkPcg6LqmGjAh1RSEsVrdsGDx5K")
Deposit into Voltr Strategy
Deposit assets into a specific strategy within a Voltr vault.
const signature = await agent.methods.voltrDepositStrategy(
agent,
new BN("1000000000"),
"7opUkqYtxmQRriZvwZkPcg6LqmGjAh1RSEsVrdsGDx5K",
"9ZQQYvr4x7AMqd6abVa1f5duGjti5wk1MHsX6hogPsLk"
)
Withdraw from Voltr Strategy
Withdraw assets from a specific strategy within a Voltr vault.
const signature = await agent.methods.voltrWithdrawStrategy(
agent,
new BN("1000000000"),
"7opUkqYtxmQRriZvwZkPcg6LqmGjAh1RSEsVrdsGDx5K",
"9ZQQYvr4x7AMqd6abVa1f5duGjti5wk1MHsX6hogPsLk"
)
Get a Solana asset by its ID
const asset = await agent.methods.getAsset(agent, "41Y8C4oxk4zgJT1KXyQr35UhZcfsp5mP86Z2G7UUzojU")
Get a price inference from Allora
Get the price for a given token and timeframe from Allora's API
const sol5mPrice = await agent.methods.getPriceInference("SOL", "5m");
console.log("5m price inference of SOL/USD:", sol5mPrice);
List all topics from Allora
const topics = await agent.methods.getAllTopics();
console.log("Allora topics:", topics);
Get an inference for an specific topic from Allora
const inference = await agent.methods.getInferenceByTopicId(42);
console.log("Allora inference for topic 42:", inference);
Simulate a Switchboard feed
Simulate a given Switchboard feed. Find or create feeds here.
const value = await agent.methods.simulateSwitchboardFeed(
"9wcBMATS8bGLQ2UcRuYjsRAD7TPqB1CMhqfueBx78Uj2",
"http://crossbar.switchboard.xyz");;
console.log("Simulation resulted in the following value:", value);
### Cross-Chain Bridge via deBridge
The Solana Agent Kit supports cross-chain token transfers using deBridge's DLN protocol. Here's how to use it:
1. Check supported chains:
```typescript
const chains = await agent.methods.getDebridgeSupportedChains();
console.log("Available chains:", chains);
// Example output: { chains: [{ chainId: "1", chainName: "Ethereum" }, { chainId: "7565164", chainName: "Solana" }] }
- Get available tokens (optional):
const tokens = await agent.methods.getDebridgeTokensInfo("1", "USDC");
console.log("Available tokens:", tokens);
- Create bridge order (SOL -> ETH):
const orderInput = {
srcChainId: "7565164",
srcChainTokenIn: "11111111111111111111111111111111",
srcChainTokenInAmount: "1000000000",
dstChainId: "1",
dstChainTokenOut: "0x0000000000000000000000000000000000000000",
dstChainTokenOutRecipient: "0x23C279e58ddF1018C3B9D0C224534fA2a83fb1d2"
};
const order = await agent.methods.createDebridgeOrder(orderInput);
console.log("Order created:", order);
- Execute the bridge order:
const signature = await agent.methods.executeDebridgeOrder(order.tx.data);
console.log("Bridge transaction sent:", signature);
const status = await agent.methods.checkDebridgeTransactionStatus(signature);
console.log("Bridge status:", status);
Note: When bridging between chains:
- To Solana: Use base58 addresses for recipients and token mints
- From Solana: Use EVM addresses for recipients and ERC-20 format for tokens
- Always verify addresses and amounts before executing bridge transactions
Get Token Price Data from CoinGecko
const priceData = await agent.methods.getTokenPriceData([
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
]);
console.log("Token prices:", priceData);
Get Trending Tokens
const trendingTokens = await agent.methods.getTrendingTokens();
console.log("Trending tokens:", trendingTokens);
Get Latest Pools
const latestPools = await agent.methods.getLatestPools();
console.log("Latest pools:", latestPools);
Get Token Information
const tokenInfo = await agent.methods.getTokenInfo("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
console.log("Token info:", tokenInfo);
Get Top Gainers
const topGainers = await agent.methods.getTopGainers("24h", "all");
console.log("Top gainers:", topGainers);
Get Trending Pools
const trendingPools = await agent.methods.getTrendingPools("24h");
console.log("Trending pools:", trendingPools);
Parse Instruction Data
const parsedData = await agent.methods.parseInstruction(
"<programId>",
"<instructionData>"
)
console.log("parsed data:", parsedData)
Parse Instruction Data
const parsedData = await agent.methods.parseAccount(
"<programId>",
"<accountData>"
)
console.log("parsed data:", parsedData)
Get Sanctum LST Price
const prices = await agent.methods.getSanctumLSTPrice([
"bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",
"7Q2afV64in6N6SeZsAAB81TJzwDoD6zpqmHkzi9Dcavn"
])
console.log('prices', prices)
Get Sanctum LST APY
const apys = await agent.methods.getSanctumLSTAPY([
"bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",
"7Q2afV64in6N6SeZsAAB81TJzwDoD6zpqmHkzi9Dcavn"
])
console.log('apys', apys)
Get Sanctum LST TVL
const tvls = await agent.methods.getSanctumLSTTVL([
"bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",
"7Q2afV64in6N6SeZsAAB81TJzwDoD6zpqmHkzi9Dcavn"
])
console.log('tvls', tvls)
Get Sanctum Owend LST
const lsts = await agent.methods.getSanctumOwnedLST()
console.log('lsts', lsts)
Add Liquidity to Sanctum Infinite Pool
const txId = await agent.methods.addSanctumLiquidity(
"So11111111111111111111111111111111111111112",
"1000000000",
"1100000000",
5000
)
console.log('txId', txId)
Remove Liquidity from Sanctum Infinite Pool
const txId = await agent.methods.removeSanctumLiquidity(
"So11111111111111111111111111111111111111112",
"1000000000",
"1100000000",
5000
)
console.log('txId', txId)
Swap Sanctum LST
const txId = await agent.methods.swapSanctumLST(
"So11111111111111111111111111111111111111112",
"1000000000",
"1100000000",
5000,
"7Q2afV64in6N6SeZsAAB81TJzwDoD6zpqmHkzi9Dcavn"
)
console.log('txId', txId)
Get Chain Data
Note: To use OKX DEX integration, you need to set up the following environment variables: Get OKX API keys from the [OKX Developer Portal] (https://www.okx.com/web3/build/dev-portal)
OKX_API_KEY
OKX_SECRET_KEY
OKX_API_PASSPHRASE
OKX_PROJECT_ID
RPC_URL
SOLANA_PRIVATE_KEY
SOLANA_WALLET_ADDRESS
Examples
LangGraph Multi-Agent System
The repository includes an advanced example of building a multi-agent system using LangGraph and Solana Agent Kit. Located in examples/agent-kit-langgraph, this example demonstrates:
- Multi-agent architecture using LangGraph's StateGraph
- Specialized agents for different tasks:
- General purpose agent for basic queries
- Transfer/Swap agent for transaction operations
- Read agent for blockchain data queries
- Manager agent for routing and orchestration
- Fully typed TypeScript implementation
- Environment-based configuration
Check out the LangGraph example for a complete implementation of an advanced Solana agent system.
Dependencies
The toolkit relies on several key Solana and Metaplex libraries:
- @solana/web3.js
- @solana/spl-token
- @metaplex-foundation/digital-asset-standard-api
- @metaplex-foundation/mpl-token-metadata
- @metaplex-foundation/mpl-core
- @metaplex-foundation/umi
- @lightprotocol/compressed-token
- @lightprotocol/stateless.js
- @coingecko/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.
Contributors
Star History

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 transaction generation, signing and sending, using provided wallets. Always ensure you're using it in a secure environment and never share your private keys.