# therealharpaljadeja/blockchain-agnostic-agent-prtoocol architecture

> Architecture diagram of the GitHub repository therealharpaljadeja/blockchain-agnostic-agent-prtoocol, 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/therealharpaljadeja/blockchain-agnostic-agent-prtoocol
- Repository: https://github.com/therealharpaljadeja/blockchain-agnostic-agent-prtoocol

## Overview

##### Main Components Structure

a) Client Layer
- Entry points (API/SDK interface)
- LangGraph Studio interface connection

b) Core Agent System
- Chief Router (Central Controller)
- Blockchain Chief
- Generalist Agent
- Specialized Agent Managers:
- Solana Manager
- Base Manager
- DeFi Manager
- Read Manager

c) Tool Layer
- DeFi Tools
- Analytics Tools
- Search Tools
- Blockchain Interaction Tools

d) External Services Layer
- Solana Blockchain
- OpenAI/Anthropic APIs
- Protocol Integrations (Jupiter, Lulo, Pump.Fun)
- Cross-chain Services (Wormhole)

##### Component Relationships

- Client → Chief Router
- Chief Router → Specialized Managers
- Managers → Individual Agents

- Agents ↔ Tools
- Tools ↔ External Services

- State management connections between components using the state.ts utility

##### Specific Implementation Details

a) DeFi Operations Hub:
- Connections between defiManager.ts and its specialized agents:
- Bridge Agent
- Lending Agent
- NFT Agent
- Transfer/Swap Agent
- PumpFun Agent

b) Analytics System:
- Detail the read manager's connection to:
- Top Coins Analysis
- Trader Analysis
- Market Data Collection

##### Technical Stack Indicators

- TypeScript
- LangGraph.js
- Solana
- OpenAI/Anthropic
- Jupiter/Lulo/Pump.Fun

##### Important Notes

- Version/environment requirements
- Configuration dependencies (env variables, API keys)
- Error handling and fallback paths
- Asynchronous operations distinctly

##### Architectural Patterns to Highlight

- Agent hierarchy pattern
- Tool composition pattern
- Demonstrate the prompt management system
- Routing logic flow

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        API[API/SDK Interface]
        LangStudio[LangGraph Studio]
    end

    subgraph Core["Core Agent System"]
        ChiefRouter["Chief Router"]:::chief
        BlockchainChief["Blockchain Chief"]:::chief
        GeneralistAgent["Generalist Agent"]:::agent

        subgraph Managers["Specialized Managers"]
            SolanaManager["Solana Manager"]:::manager
            BaseManager["Base Manager"]:::manager
            DeFiManager["DeFi Manager"]:::manager
            ReadManager["Read Manager"]:::manager
        end

        subgraph DeFiAgents["DeFi Agents"]
            BridgeAgent["Bridge Agent"]:::agent
            LendingAgent["Lending Agent"]:::agent
            NFTAgent["NFT Agent"]:::agent
            TransferSwapAgent["Transfer/Swap Agent"]:::agent
            PumpFunAgent["PumpFun Agent"]:::agent
        end
    end

    subgraph Tools["Tool Layer"]
        DeFiTools["DeFi Tools"]:::tool
        AnalyticsTools["Analytics Tools"]:::tool
        SearchTools["Search Tools"]:::tool
        BlockchainTools["Blockchain Tools"]:::tool
    end

    subgraph External["External Services Layer"]
        Solana["Solana Blockchain"]:::external
        AI["OpenAI/Anthropic"]:::external
        Protocols["Jupiter/Lulo/Pump.Fun"]:::external
        CrossChain["Wormhole"]:::external
    end

    %% Connections
    API --> ChiefRouter
    LangStudio --> ChiefRouter
    ChiefRouter --> BlockchainChief
    BlockchainChief --> GeneralistAgent
    BlockchainChief --> Managers
    DeFiManager --> DeFiAgents
    DeFiAgents --> Tools
    Tools -.-> External

    %% Click Events
    click ChiefRouter "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/cheif.ts"
    click BlockchainChief "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/blockchainChief.ts"
    click GeneralistAgent "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/generalist.ts"
    click SolanaManager "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/solana/solanaManager.ts"
    click BaseManager "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/base/baseManager.ts"
    click DeFiManager "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/solana/defi/defiManager.ts"
    click ReadManager "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/solana/read/readManager.ts"
    click BridgeAgent "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/solana/defi/bridgeAgent.ts"
    click LendingAgent "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/solana/defi/lendingAgent.ts"
    click NFTAgent "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/solana/defi/nftAgent.ts"
    click TransferSwapAgent "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/solana/defi/transferSwapAgent.ts"
    click PumpFunAgent "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/agent/solana/defi/pumpfunAgent.ts"
    click DeFiTools "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/tree/main/src/tools/solana/defi"
    click SearchTools "https://github.com/therealharpaljadeja/Blockchain-Agnostic-Agent-Prtoocol/blob/main/src/tools/search.ts"

    %% Styling
    classDef chief fill:#3498db
    classDef manager fill:#2ecc71
    classDef agent fill:#e74c3c
    classDef tool fill:#f1c40f
    classDef external fill:#9b59b6
```
