Autonomous AI Yield Optimization Agent for Casper Network
Built for the Casper Agentic Buildathon 2026 — $150,000 prize pool.
Casper Yield Sentinel is an autonomous AI agent that:
- Monitors Casper DeFi yield opportunities via CSPR.trade MCP
- Analyzes risk using an LLM-based scoring model
- Executes optimized yield strategies on-chain via a YieldVault smart contract
- Pays for premium data feeds using x402 micropayments
┌─────────────────────────────────────────────────────────┐
│ Yield Sentinel Agent │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐ │
│ │ Monitor │→ │ Risk │→ │ Executor │→ │ x402 │ │
│ │ (yields) │ │ Analyzer │ │ (txns) │ │ Client │ │
│ └────┬─────┘ └──────────┘ └────┬─────┘ └────┬────┘ │
│ │ │ │ │
└───────┼───────────────────────────┼──────────────┼──────┘
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌───────────────────────┐ ┌──────────────┐
│ CSPR.trade │ │ Casper Testnet │ │ x402 │
│ MCP Server │ │ ┌─────────────────┐ │ │ Facilitator │
│ (yield data) │ │ │ YieldVault │ │ │ (payments) │
└───────────────┘ │ │ (Odra/Rust) │ │ └──────────────┘
│ └─────────────────┘ │
│ • deposit() │
│ • withdraw() │
│ • execute_strategy() │
│ • StrategyExecuted │
└───────────────────────┘
casper-agentic-buildathon/
├── contract/ # Odra smart contract (Rust/WASM)
│ ├── Cargo.toml
│ └── src/
│ └── yield_vault.rs
├── agent/ # AI agent (Python)
│ ├── __init__.py
│ ├── config.py # Environment configuration
│ ├── monitor.py # Yield data polling
│ ├── risk.py # LLM risk analysis
│ ├── executor.py # Transaction execution
│ ├── main.py # Orchestrator loop
│ └── x402_client.py # x402 micropayments
├── requirements.txt
├── DESIGN.md
└── README.md
- Python 3.9+
- Rust (for Odra contract compilation)
- Casper Testnet account with CSPR
- Deployed YieldVault contract
# Clone the repo
git clone https://github.com/LuminDev/casper-agentic-buildathon.git
cd casper-agentic-buildathon
# Install Python deps
pip install -r requirements.txtSet environment variables (or create a .env file):
export CASPER_RPC_URL="https://rpc.testnet.casper.network"
export CONTRACT_HASH="<your-deployed-contract-hash>"
export AGENT_PRIVATE_KEY="<ed25519-private-key-hex>"
export AGENT_PUBLIC_KEY="<ed25519-public-key-hex>"
export RISK_THRESHOLD=40 # minimum risk score to act
export POLL_INTERVAL=300 # seconds between checks
export X402_FACILITATOR_URL="https://x402-facilitator.testnet.casper.network"cd contract
# Build the Odra contract
cargo build --release --target wasm32-unknown-unknown
# Deploy to Casper Testnet (using casper-client)
casper-client put-deploy \
--chain-name casper-test \
--session-path target/wasm32-unknown-unknown/release/yield_vault.wasm \
--payment-amount 5000000000 \
--secret-key /path/to/secret_key.pem
# Set CONTRACT_HASH from deploy outputpython -m agent.mainThe agent will:
- Poll yield data every POLL_INTERVAL seconds
- Analyze risk and produce an allocation plan
- Execute strategies by calling YieldVault on-chain
- Pay for premium data via x402
- Deploy the YieldVault contract on Casper Testnet
- Fund the agent account with test CSPR
- Start the agent:
python -m agent.main - Observe the orchestrator loop:
- Monitor phase logs current yields
- Risk analysis shows scored opportunities
- Execution phase produces StrategyExecuted events on-chain
- x402 payments for premium data
- Verify on-chain: check Casper Testnet explorer for transactions
- Event: Casper Agentic Buildathon 2026 — Qualification Round
- Deadline: June 30, 2026
- Prize Pool: $150,000 USD
- Focus: Agentic AI + DeFi + RWA on Casper Network
- Requirements: Working prototype on Testnet, open-source repo, demo video
| Component | Technology |
|---|---|
| Smart Contract | Odra Framework (Rust/WASM) |
| Agent Core | Python 3.9+ |
| Blockchain | Casper Network (Testnet) |
| Payments | x402 Protocol (CEP-18) |
| AI/ML | LLM-based risk scoring |
| Data | CSPR.trade MCP, Casper MCP Server |
Built by LuminDev for the Casper Agentic Buildathon 2026