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.
π€ 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
- Node.js 18+ and npm/yarn
- GAIA API key
- Basic understanding of Solana and TypeScript
# Clone or create the project
mkdir solid-ai-agent-demo
cd solid-ai-agent-demo
# Install dependencies
npm install
# or
yarn installCreate a .env file in the project root:
GAIA_API_KEY=gaia_api_keyCreate 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"]
}solid-ai-agent-demo/
βββ src/
β βββ index.ts # Main agent code
βββ package.json
βββ tsconfig.json
βββ .env
βββ README.md
# Build the project
npm run build
# Run the agent
npm start
# Or run in development mode
npm run devimport { 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);
}- Query: "What is the Solid platform?"
- Response: Comprehensive explanation of Solid's features and workflows
- Query: "How do I register a new user with username 'alice123'?"
- Response: Step-by-step registration instructions with code examples
- Query: "Check the attestation status for wallet [wallet_address]"
- Response: Current KYC status, result, and attestation information
- 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
- Query: "Get user account info for [wallet_address]"
- Response: On-chain user account data from the Solid program
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?"
Modify the connection in src/index.ts:
const connection = new Connection("https://your-custom-rpc-endpoint.com");const llm = new ChatOpenAI({
model: "Qwen3-235B-A22B-Q4_K_M",
configuration: {
apiKey: process.env.GAIA_API_KEY,
baseURL: "https://qwen72b.gaia.domains/v1",
},
});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,
];The agent includes comprehensive error handling for:
- Invalid wallet addresses
- Network connectivity issues
- API rate limits
- Malformed inputs
- 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
-
GAIA API Key Error
- Ensure your API key is correctly set in
.env - Check API key permissions
- Ensure your API key is correctly set in
-
Solana RPC Issues
- Try different RPC endpoints
- Check network connectivity
-
Solid SDK Errors
- Verify wallet addresses are valid base58 strings
- Ensure the Solid program is accessible
Enable verbose logging:
const executor = new AgentExecutor({
agent,
tools,
verbose: true, // Set to true for detailed logs
maxIterations: 3,
});- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details