A ready-to-use scaffold that demonstrates how to build a verifiable AI agent using Layr Labs' AgentKit adapters. This project integrates:
- Opacity for verifiable AI inference (zkTLS proofs)
- EigenDA for data availability logging
- Witnesschain for location verification
-
Clone the repository
git clone https://github.com/Layr-Labs/eigenai-quickstart.git cd eigenai-quickstart
-
Install dependencies
npm install # or pnpm install
-
Set up environment variables
cp .env.example .env
Then edit
.env
and fill in your API keys and configuration values:- Opacity:
OPACITY_API_KEY
,OPACITY_TEAM_ID
,OPACITY_TEAM_NAME
,OPACITY_PROVER_URL
- EigenDA:
EIGENDA_PRIVATE_KEY
,EIGENDA_API_URL
,EIGENDA_BASE_RPC_URL
,EIGENDA_CREDITS_CONTRACT
- Witnesschain:
WITNESSCHAIN_API_KEY
,WITNESSCHAIN_API_URL
,WITNESSCHAIN_PRIVATE_KEY
- Opacity:
-
Run the demo
CLI Demo:
npm run build npm start
Express Server:
npm run dev
eigenai-quickstart/
├── src/
│ ├── agent/
│ │ └── createAgent.ts # Core agent implementation
│ ├── utils/
│ ├── index.ts # CLI demo
│ └── server.ts # Express API
├── package.json
├── tsconfig.json
└── .env.example
The CLI demo showcases basic usage of the agent:
- Generating verifiable text
- Verifying location
- Logging information to EigenDA
Run it with:
npm start
The Express server provides the following endpoints:
-
Generate Verifiable Text
curl -X POST http://localhost:3000/api/generate \ -H "Content-Type: application/json" \ -d '{"prompt": "What is the capital of France?"}'
-
Verify Location
curl -X POST http://localhost:3000/api/verify-location \ -H "Content-Type: application/json" \ -d '{"latitude": 48.8566, "longitude": 2.3522}'
-
Health Check
curl http://localhost:3000/health
The createAgent.ts
file is the heart of this project. It:
- Initializes all three adapters (Opacity, EigenDA, Witnesschain)
- Provides methods for text generation and location verification
- Handles automatic logging to EigenDA
- Includes error handling and proper type definitions
The Express server provides a REST API interface to the agent's capabilities:
- CORS enabled
- JSON request body parsing
- Error handling
- Health check endpoint
- Clear API documentation
Here are some ways you can extend this project:
-
Add More Adapters
- Integrate Reclaim for credential verification
-
Enhance Functionality
- Add rate limiting
- Implement caching
- Add authentication
- Expand API endpoints
-
Improve Developer Experience
- Add tests
- Add CI/CD
- Add API documentation (Swagger/OpenAPI)
- Add monitoring and logging
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.