Skip to content

tobySolutions/gaia-solid-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Solid AI Agent Demo

An AI agent built with LangChain that helps users interact with the Solid attestation management service on Solana. The agent can help with user registration, KYC verification, and attestation status checking.

Features

πŸ€– AI-Powered Assistant: Natural language interface for Solid platform interactions πŸ” KYC Management: Check status, generate verification URLs πŸ“œ Attestation Queries: Fetch user attestation information πŸ”— User Registration: Generate step-by-step registration instructions πŸ“š Platform Education: Explain Solid platform concepts and workflows

Setup

1. Prerequisites

  • Node.js 18+ and npm/yarn
  • GAIA API key
  • Basic understanding of Solana and TypeScript

2. Installation

# Clone or create the project
mkdir solid-ai-agent-demo
cd solid-ai-agent-demo

# Install dependencies
npm install
# or
yarn install

3. Environment Configuration

Create a .env file in the project root:

GAIA_API_KEY=gaia_api_key

4. TypeScript Configuration

Create a tsconfig.json file:

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "lib": ["ES2020"],
    "outDir": "./dist",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

5. Project Structure

solid-ai-agent-demo/
β”œβ”€β”€ src/
β”‚   └── index.ts          # Main agent code
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ .env
└── README.md

Usage

Basic Usage

# Build the project
npm run build

# Run the agent
npm start

# Or run in development mode
npm run dev

Interactive Usage

import { createSolidAgent } from "./src/index";

async function main() {
  const agent = await createSolidAgent();

  // Ask questions about the Solid platform
  const result = await agent.invoke({
    input: "What is the Solid platform and how does KYC work?",
  });

  console.log(result.output);
}

Available Agent Capabilities

1. Platform Information

  • Query: "What is the Solid platform?"
  • Response: Comprehensive explanation of Solid's features and workflows

2. User Registration

  • Query: "How do I register a new user with username 'alice123'?"
  • Response: Step-by-step registration instructions with code examples

3. Attestation Status Checking

  • Query: "Check the attestation status for wallet [wallet_address]"
  • Response: Current KYC status, result, and attestation information

4. KYC URL Generation

  • Query: "Get a KYC URL for wallet [wallet_address] with redirect to [your_url]"
  • Response: KYC verification URL for the user to complete identity verification

5. User Account Information

  • Query: "Get user account info for [wallet_address]"
  • Response: On-chain user account data from the Solid program

Example Conversations

User: "I want to verify my identity on Solid. How do I start?"

Agent: "I'll help you get started with identity verification on Solid! Here's the process:

1. First, you need to register on the Solid program
2. Then initiate KYC verification
3. Complete the verification process
4. Check your attestation status

Do you already have a Solana wallet address, or would you like me to explain how to register first?"

User: "I have wallet 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU, check my status"

Agent: [Uses check_user_attestation tool to fetch current status]
"Your current KYC status is: NOT_STARTED. You haven't begun the KYC process yet. Would you like me to generate a KYC URL so you can start verification?"

Advanced Configuration

Custom Solana RPC Endpoint

Modify the connection in src/index.ts:

const connection = new Connection("https://your-custom-rpc-endpoint.com");

Different LLM Models

const llm = new ChatOpenAI({
  model: "Qwen3-235B-A22B-Q4_K_M",
  configuration: {
    apiKey: process.env.GAIA_API_KEY,
    baseURL: "https://qwen72b.gaia.domains/v1",
  },
});

Adding Custom Tools

const customTool = new DynamicTool({
  name: "custom_solid_tool",
  description: "Description of what this tool does",
  func: async (input: string) => {
    // Your custom logic here
    return "Tool response";
  },
});

// Add to tools array
const tools = [
  checkAttestationTool,
  getKycUrlTool,
  // ... other tools
  customTool,
];

Error Handling

The agent includes comprehensive error handling for:

  • Invalid wallet addresses
  • Network connectivity issues
  • API rate limits
  • Malformed inputs

Security Considerations

⚠️ Important: This demo is for educational purposes. In production:

  • Never expose private keys in code
  • Use secure wallet connections (like Phantom, Solflare)
  • Implement proper authentication
  • Validate all user inputs
  • Use environment variables for sensitive data

Troubleshooting

Common Issues

  1. GAIA API Key Error

    • Ensure your API key is correctly set in .env
    • Check API key permissions
  2. Solana RPC Issues

    • Try different RPC endpoints
    • Check network connectivity
  3. Solid SDK Errors

    • Verify wallet addresses are valid base58 strings
    • Ensure the Solid program is accessible

Debug Mode

Enable verbose logging:

const executor = new AgentExecutor({
  agent,
  tools,
  verbose: true, // Set to true for detailed logs
  maxIterations: 3,
});

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details

About

A simple demo to showcase Gaia's integration with Solid

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors