Overview

The Solana Agent Kit allows developers to build AI-driven agents that interact with Solana and Solayer seamlessly. It enables AI agents to perform on-chain transactions, including staking SOL on Solayer (sSOL staking) using Solana Blinks.

With the Solana Agent Kit, AI-powered automation can integrate directly with Solayer’s DeFi ecosystem, supporting actions like staking, yield strategies, and more.


Installation

To install the Solana Agent Kit, use npm:

npm install solana-agent-kit

Quick Start Guide

Import & Initialize the Agent

First, import the required modules and initialize the Solana Agent Kit with your wallet private key, Solana RPC URL, and OpenAI API key.

import { SolanaAgentKit, createSolanaTools } from "solana-agent-kit";

// Initialize with private key and optional RPC URL
const agent = new SolanaAgentKit(
  "your-wallet-private-key-as-base58",
  "https://api.mainnet-beta.solana.com",
  "your-openai-api-key"
);

// Create LangChain tools
const tools = createSolanaTools(agent);

Stake SOL on Solayer (sSOL Staking)

To stake SOL on Solayer using the AI agent, call the restake function:

const signature = await agent.restake(
  1 // amount in SOL to stake
);

Additional Features & Documentation

The Solana Agent Kit is continuously evolving to support more DeFi integrations and automated smart contract interactions.

For detailed documentation, examples, and latest updates, visit the GitHub repository:
Solana Agent Kit on GitHub