Build trustless AI agents with dstack, ERC-8004 compliance, and seamless deployment on Phala Cloud.
- 🔐 TEE-Derived Keys - Intel TDX attestation via dstack CVM on Phala Cloud
- 🌐 ERC-8004 Compliant - Standard
/agent.json
endpoint - 📜 Real TEE Attestation - Cryptographic proof of execution
- 🔗 On-Chain Registry - Decentralized agent discovery
- 🤖 A2A Protocol - Agent-to-Agent communication
- 🔧 Config-Driven - Easy customization via
agent_config.json
- 🧪 VibeVM Ready - Local development environment
-
Fork or use this template
Click "Use this template" on GitHub or fork this repository
-
Start VibeVM and clone
# Inside your VibeVM environment git clone https://github.com/YOUR_USERNAME/erc-8004-tee-agent.git cd erc-8004-tee-agent
-
Configure environment
cp .env.local.example .env # Edit .env with your settings
-
Install and run
pip3 install -e . python3 deployment/local_agent_server.py
-
Test your agent
See DEPLOYMENT.md for complete deployment instructions.
# 1. Commit your production code
git commit -m "Production ready"
git push origin main
# 2. Note your commit hash
git rev-parse HEAD
# 3. Deploy on phala.com with docker-compose.yml
# 4. Set secrets: GITHUB_REPO, GIT_COMMIT_HASH, AGENT_SALT
# 5. Launch CVM and fund your agent
graph LR
A[Fork Template] --> B[Clone to VibeVM]
B --> C[Local Development]
C --> D[Test & Iterate]
D --> E[Commit to GitHub]
E --> F[Deploy on Phala]
F --> G[Fund & Register]
G --> H[Production Agent Live]
Detailed steps:
- Fork/Template - Create your repository from this template
- VibeVM Development - Clone into VibeVM for local testing
- Customize - Edit
agent_config.json
and add your logic - Test Locally - Run agent in VibeVM, test registration flow
- Commit - Push production-ready code to GitHub
- Deploy - Use
docker-compose.yml
on Phala with your commit hash - Launch - Fund wallet, register on-chain, validate TEE
erc-8004-tee-agent/
├── agent_config.json # Agent metadata & capabilities
├── entrypoint.sh # Build & deploy script (customize this!)
├── docker-compose.yml # Production deployment config
├── .env.example # Production environment template
├── .env.local.example # Local development template
├── DEV_GUIDE.md # Comprehensive developer guide
├── DEPLOYMENT.md # Production deployment checklist
├── contracts/ # Solidity contracts
├── src/agent/ # Core agent logic
│ ├── tee_auth.py # TEE key derivation & auth
│ ├── tee_verifier.py # TEE attestation submission
│ ├── agent_card.py # ERC-8004 card builders
│ ├── registry.py # On-chain registry client
│ └── base.py # Base agent functionality
├── deployment/
│ └── local_agent_server.py # FastAPI server
└── static/ # Web UI assets
┌─────────────┐
│ Wallet │ Fund with Base Sepolia ETH
└─────────────┘
↓
┌─────────────┐
│ Register │ Identity Registry (on-chain)
└─────────────┘
↓
┌─────────────┐
│ TEE Verify │ Attestation + Code Measurement
└─────────────┘
↓
┌─────────────┐
│ Ready │ A2A endpoints active
└─────────────┘
GET /agent.json
- ERC-8004 registration-v1 formatGET /.well-known/agent-card.json
- A2A agent cardGET /api/status
- Agent statusPOST /api/register
- Register on-chainPOST /api/tee/register
- Register TEE keyPOST /api/metadata/update
- Update on-chain metadataPOST /tasks
- A2A task submissionGET /tasks/{id}
- Task status
Base Sepolia:
- IdentityRegistry:
0x8506e13d47faa2DC8c5a0dD49182e74A6131a0e3
(0.0001 ETH fee) - TEERegistry:
0x03eCA4d903Adc96440328C2E3a18B71EB0AFa60D
- Verifier:
0x481ce1a6EEC3016d1E61725B1527D73Df1c393a5
.env
- Runtime config:
AGENT_DOMAIN=your-domain.com
AGENT_SALT=unique-salt
IDENTITY_REGISTRY_ADDRESS=0x8506e13d47faa2DC8c5a0dD49182e74A6131a0e3
TEE_REGISTRY_ADDRESS=0x03eCA4d903Adc96440328C2E3a18B71EB0AFa60D
agent_config.json
- Agent metadata:
{
"name": "Your Agent",
"description": "Agent description",
"endpoints": {
"a2a": {"enabled": true},
"mcp": {"enabled": false, "endpoint": ""},
"ens": {"enabled": false, "endpoint": ""}
},
"evmChains": [
{"name": "Base", "chainId": 8453}
],
"supportedTrust": ["tee-attestation"]
}
Edit agent_config.json
to add endpoints:
Add MCP:
"mcp": {
"enabled": true,
"endpoint": "https://mcp.agent.eth/",
"version": "2025-06-18"
}
Add chains:
{"name": "Polygon", "chainId": 137}
Add trust models:
"supportedTrust": ["tee-attestation", "reputation"]
-
DEV_GUIDE.md - Comprehensive developer guide covering:
- Local development with VibeVM
- Customizing your agent
- Testing and debugging
- Production deployment workflow
-
DEPLOYMENT.md - Production deployment checklist:
- Pre-deployment requirements
- Phala CVM configuration
- Post-deployment validation
-
QUICKSTART.md - Get started in 3 minutes
- Key Derivation - TEE derives wallet from
domain + salt
- Local Development - Test in VibeVM with simulated TEE
- Funding - Add Base Sepolia ETH to derived wallet
- Registration - Register agent on-chain (0.0001 ETH fee)
- TEE Attestation - Submit cryptographic proof to verifier
- Production - Deploy to Phala CVM with real TEE attestation
- Agent Live - Accessible at
/agent.json
endpoint
- TEE: Intel TDX via Phala CVM/dstack
- Blockchain: Base Sepolia (testnet) / Base (mainnet)
- Backend: Python 3, FastAPI
- Contracts: Solidity ^0.8.20
- Development: VibeVM for local testing
- Deployment: Docker, Phala Cloud
✅ Standard /agent.json
endpoint (registration-v1)
✅ CAIP-10 wallet address format
✅ A2A protocol endpoints
✅ TEE attestation support
✅ On-chain registry integration
✅ Verifiable code measurement
Edit agent_config.json:
{
"name": "Your Agent Name",
"description": "What your agent does",
"endpoints": {
"a2a": {"enabled": true},
"mcp": {"enabled": false}
}
}
Modify files in src/agent/:
- Add custom endpoints in
deployment/local_agent_server.py
- Implement custom logic in
src/agent/base.py
- Configure blockchain interactions in
src/agent/registry.py
Update entrypoint.sh for custom setup:
# Add model downloads, DB initialization, etc.
echo "🤖 Downloading ML model..."
wget https://example.com/model.bin -O /app/model.bin
See DEV_GUIDE.md for detailed customization instructions.
Before deploying to production:
- Test thoroughly in VibeVM
- Update
agent_config.json
with production values - Ensure
entrypoint.sh
has all required setup steps - Commit production code to GitHub
- Note commit hash for deployment
- Set secrets on Phala:
GITHUB_REPO
,GIT_COMMIT_HASH
,AGENT_SALT
- Configure CVM (2+ CPU, 4GB+ RAM, 10GB+ storage)
- Fund agent wallet with Base Sepolia ETH
See DEPLOYMENT.md for complete checklist.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Phala Discord: discord.gg/phala
- VibeVM Docs: github.com/Phala-Network/VibeVM
MIT
- ERC-8004 Spec: eips.ethereum.org/EIPS/eip-8004
- Phala Network: phala.network
- VibeVM: github.com/Phala-Network/VibeVM
- Base Sepolia: base.org
- Reference Implementation: dstack-erc8004-poc
Ready to build? Start with DEV_GUIDE.md or jump into QUICKSTART.md 🚀