Real-time DeFi protocol risk analysis powered by multi-specialist LLM agents on AMD ROCm
DeFiGuard Multi-Agent Pipeline
┌──────────┐ ┌──────────┐ ┌─────────────────────────────────┐ ┌───────────┐ ┌────────┐
│ Input │──▶│ Chunking │──▶│ Agent Fan-out │──▶│ Synthesis │──▶│ Report │
│ Sources │ │ Engine │ │ │ │ Agent │ │ PDF │
└──────────┘ └──────────┘ │ ┌─────────┐ ┌─────────────┐ │ └───────────┘ └────────┘
- Token docs - Smart │ │ Risk │ │ Tokenomics │ │ - Consensus
- Gov forums contracts │ │ Agent │ │ Agent │ │ scoring
- On-chain - Forum │ └─────────┘ └─────────────┘ │ - Conflict
data posts │ ┌─────────┐ ┌─────────────┐ │ resolution
- Audit - News │ │Governance│ │ Thesis │ │ - Final
reports articles │ │ Agent │ │ Agent │ │ narrative
- Proposals │ └─────────┘ └─────────────┘ │
────────── └─────────────────────────────────┘
4 specialist agents run in parallel
Each agent sees full chunked context
consuming 20-80K tokens per analysis
DeFiGuard's multi-agent architecture is a natural fit for AMD ROCm GPUs, and here's why:
Each of our 4 specialist agents processes the full chunked context of a DeFi protocol simultaneously. A single analysis run loads:
- Smart contract source code (5-30K tokens)
- Governance forum history (10-50K tokens)
- On-chain metrics and audit reports (5-20K tokens)
The MI300X's 192GB HBM3 allows us to keep multiple agent contexts in VRAM without paging, enabling true parallel inference across all 4 agents.
- No vendor lock-in: ROCm's open-source stack means we can profile, debug, and optimize every layer
- vLLM/TGI native support: Drop-in compatibility with existing LLM serving infrastructure
- PyTorch-native: Our entire agent orchestration layer runs on standard PyTorch with ROCm backend
At scale, ROCm GPUs deliver 2-3x better token/$ compared to equivalent NVIDIA hardware, which is critical for our use case where a single research desk can burn 6M+ tokens/day.
DeFiGuard's multi-agent architecture naturally consumes large volumes of tokens. Each analysis fans out to 4 agents, each processing the full chunked context independently.
| Scenario | Items | Chunks | Agents | Tokens/Day |
|---|---|---|---|---|
| Single deep dive | 1 | 4 | 4 | ~100K |
| Daily analyst | 5 | 20 | 4 | ~500K |
| Research desk | 15 | 60 | 4 | ~2M |
| Continuous monitoring | 25+ | 100+ | 4+chat | ~6M+ |
Why so many tokens? Each agent receives the full context window. A 5-chunk analysis with 4 agents = 20 LLM calls minimum. Add synthesis, follow-ups, and monitoring, and a research desk easily hits 2M tokens/day.
# 1. Install dependencies
pip install -r requirements.txt
# 2. Configure environment
cp .env.example .env
# Edit .env with your API keys and ROCm settings
# 3. Start the server
uvicorn app.main:app --host 0.0.0.0 --port 8000
# 4. Open the dashboard
# Navigate to http://localhost:8000 in your browser# LLM Backend (ROCm)
LLM_BASE_URL=http://localhost:8080/v1
LLM_MODEL=defiguard-70b
LLM_API_KEY=your-key-here
# Data Sources
DEFILLAMA_API_KEY=...
ETHERSCAN_API_KEY=...
SNAPSHOT_SPACE_ID=...
# Application
LOG_LEVEL=INFO
MAX_CONCURRENT_AGENTS=4
CHUNK_SIZE=4096| Method | Endpoint | Description |
|---|---|---|
POST |
/api/analyze |
Trigger full multi-agent analysis of a protocol |
GET |
/api/analysis/{id} |
Retrieve analysis results and report |
GET |
/api/analysis/{id}/status |
Check analysis progress |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/protocols |
List all tracked protocols |
GET |
/api/protocols/{slug} |
Get protocol details and latest risk score |
GET |
/api/protocols/{slug}/history |
Historical risk scores |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/reports |
List generated reports |
GET |
/api/reports/{id} |
Download report (PDF/JSON) |
GET |
/api/reports/{id}/agents |
Per-agent breakdown of report |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/monitor |
Add protocol to continuous monitoring |
DELETE |
/api/monitor/{slug} |
Remove from monitoring |
GET |
/api/monitor/alerts |
Get active alerts |
Analyzes smart contract security, audit history, TVL trends, and exploit vectors. Cross-references known vulnerability databases and flags patterns similar to past exploits.
Models supply dynamics, emission schedules, vesting cliffs, and economic incentive alignment. Identifies potential death spirals, inflation risks, and misaligned token mechanics.
Scans Snapshot proposals, on-chain voting records, and forum discussions. Detects governance attacks, whale concentration, quorum risks, and proposal manipulation.
Synthesizes qualitative narrative: team credibility, competitive positioning, ecosystem partnerships, and market sentiment. Provides the "story" that contextualizes the quantitative signals.
Not a domain specialist — this agent reconciles outputs from all 4 agents, resolves conflicting signals, and produces the final consensus risk score and executive summary.
| Dashboard | Analysis View | Report PDF |
|---|---|---|
![]() |
![]() |
![]() |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-agent) - Commit your changes (
git commit -m 'Add amazing agent') - Push to the branch (
git push origin feature/amazing-agent) - Open a Pull Request
Please read CONTRIBUTING.md for detailed guidelines on code style, testing, and agent development.
This project is licensed under the MIT License — see the LICENSE file for details.
Copyright (c) 2026 Owonftt


