# sendaifun/solana-agent-kit architecture

> Architecture diagram of the GitHub repository sendaifun/solana-agent-kit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sendaifun/solana-agent-kit
- Repository: https://github.com/sendaifun/solana-agent-kit

## Overview

##### Main Components

a) Core Layer:
- SolanaAgentKit Class (Central Component)
- Action Executor System
- Wallet/Keypair Management
- Transaction Handler

b) Integration Layers:
- LangChain Integration Module
- Vercel AI SDK Integration Module
- Multi-Agent System Support

c) Feature Modules:
- Token Operations Module
- NFT Management Module
- DeFi Integration Module
- Solana Blinks Module
- AI Tools Module

**[AI Integration Layer]**
- ↓
**[Core Agent Layer]**
- ↓
**[Feature Modules Layer]**
- ↓
**[Blockchain Integration Layer]**

##### Component Relationships

- Data flow between components
- Dependencies between modules
- Integration points with external services

##### Specific Implementation Details

a) Core Layer Details:
**[SolanaAgentKit]**
- Action Executor
- Wallet Management
- Transaction Handler

b) Tools Organization:
**[Tools Module]**
- Blockchain Tools
- Token Operations
- NFT Management
- DeFi Operations
- AI Tools
- DALL-E Integration
- Natural Language Processing

##### External Integrations

Connections to:
- Solana RPC nodes
- Jupiter Exchange
- Metaplex
- OpenAI (for DALL-E)
- Other Solana protocols (Raydium, Orca, etc.)

##### Implementation Notes

- Version/environment indicators
- Security boundaries

##### Documentation References

References to:
- Source code locations
- Configuration files
- External documentation

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph AI_Integration
        LangChain["LangChain Integration"]:::ai
        VercelAI["Vercel AI SDK"]:::ai
        MultiAgent["Multi-Agent System"]:::ai
    end

    subgraph Core_Layer
        SAK["SolanaAgentKit"]:::core
        ActionEx["Action Executor"]:::core
        WalletMgmt["Wallet Management"]:::core
        TxHandler["Transaction Handler"]:::core
    end

    subgraph Feature_Modules
        subgraph TokenOps
            TokenDeploy["Token Operations"]:::feature
        end

        subgraph NFTOps
            NFTMint["NFT Management"]:::feature
        end

        subgraph DeFiOps
            Trading["Trading"]:::feature
            Lending["Lending"]:::feature
            Staking["Staking"]:::feature
        end

        subgraph AITools
            DALLE["DALL-E Integration"]:::feature
            NLP["Natural Language Processing"]:::feature
        end
    end

    subgraph External_Services
        SolanaRPC["Solana RPC"]:::external
        Jupiter["Jupiter Exchange"]:::external
        Metaplex["Metaplex"]:::external
        OpenAI["OpenAI"]:::external
    end

    %% Core Relationships
    LangChain --> SAK
    VercelAI --> SAK
    MultiAgent --> SAK
    SAK --> ActionEx
    SAK --> WalletMgmt
    SAK --> TxHandler

    %% Feature Module Relationships
    ActionEx --> TokenOps
    ActionEx --> NFTOps
    ActionEx --> DeFiOps
    ActionEx --> AITools

    %% External Service Relationships
    TxHandler --> SolanaRPC
    DeFiOps --> Jupiter
    NFTOps --> Metaplex
    AITools --> OpenAI

    %% Click Events
    click SAK "https://github.com/sendaifun/solana-agent-kit/blob/main/src/agent/index.ts"
    click ActionEx "https://github.com/sendaifun/solana-agent-kit/blob/main/src/utils/actionExecutor.ts"
    click WalletMgmt "https://github.com/sendaifun/solana-agent-kit/blob/main/src/utils/keypair.ts"
    click TxHandler "https://github.com/sendaifun/solana-agent-kit/blob/main/src/utils/send_tx.ts"
    click LangChain "https://github.com/sendaifun/solana-agent-kit/blob/main/src/langchain/index.ts"
    click VercelAI "https://github.com/sendaifun/solana-agent-kit/blob/main/src/vercel-ai/index.ts"
    click MultiAgent "https://github.com/sendaifun/solana-agent-kit/tree/main/examples/agent-kit-langgraph/"
    click TokenDeploy "https://github.com/sendaifun/solana-agent-kit/blob/main/src/actions/deployToken.ts"
    click NFTMint "https://github.com/sendaifun/solana-agent-kit/blob/main/src/actions/mintNFT.ts"
    click Trading "https://github.com/sendaifun/solana-agent-kit/blob/main/src/tools/trade.ts"
    click Lending "https://github.com/sendaifun/solana-agent-kit/blob/main/src/tools/lend.ts"
    click Staking "https://github.com/sendaifun/solana-agent-kit/blob/main/src/tools/stake_with_jup.ts"
    click DALLE "https://github.com/sendaifun/solana-agent-kit/blob/main/src/actions/createImage.ts"

    %% Styling
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef ai fill:#2ecc71,stroke:#27ae60,color:white
    classDef feature fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["AI Integration"]:::ai
        L3["Feature Modules"]:::feature
        L4["External Services"]:::external
    end
```
