Skip to content

marlinprotocol/solana-agent-integration

Repository files navigation

Solana Agent Server

A server that initializes and manages a Solana Agent for onchain interactions using LangChain and OpenAI.

Features

  • Dynamic agent initialization with configurable LLM parameters
  • Secure wallet generation and management
  • Real-time chat interface with the agent
  • Wallet address retrieval endpoint

API Endpoints

Initialize Agent

POST /init

Request body:

{
    "OPENAI_API_KEY": "your-api-key",
    "RPC_URL": "your-rpc-url",
    "llm": {
        "modelName": "gpt-4o-mini",  // optional, default: "gpt-4o-mini"
        "temperature": 0.7           // optional, default: 0.7
    }
}

Chat with Agent

POST /chat

Request body:

{
    "message": "your message here"
}

Get Wallet Address

GET /wallet

Setup & Running

  1. Install dependencies:
npm install
  1. Start the server:
npm run start

The server will run on port 8000 by default. You can change this by setting the PORT environment variable.

Development

  1. Build the TypeScript code:
npm run build
  1. Run in development mode:
npm run dev

Package & Deploy

1. Create Docker Image

docker build -t solana-agent-kit:latest .
docker save solana-agent-kit:latest -o solana-agent-kit.tar

2. Build Oyster-CVM Image

oyster-cvm build --platform amd64 --docker-compose ./docker-compose.yml --docker-images ./solana-agent-kit.tar

3. Upload Image

Upload the generated result/image.eif to a remote file server that's accessible via HTTP/HTTPS.

4. Deploy to Marlin Hub

oyster-cvm -- deploy \
    --image-url <image-url> \
    --region ap-south-1 \
    --wallet-private-key <wallet-secret> \
    --instance-type c6a.xlarge \
    --operator {operator-addr} \
    --duration-in-minutes 60 \
    --bandwidth 100

Environment Variables

The following variables are set automatically during initialization:

  • OPENAI_API_KEY: OpenAI API key for LLM interactions
  • RPC_URL: Solana RPC URL for blockchain interactions
  • SOLANA_PRIVATE_KEY: Generated wallet's private key (base58 encoded)
  • SOLANA_PUBLIC_KEY: Generated wallet's public key (base58 encoded)

About

Oyster instance for solana agent kit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published