rb125 commited on
Commit
ce0deb7
Β·
1 Parent(s): 62f3f9e

updated README

Browse files
Files changed (2) hide show
  1. .gitignore +2 -0
  2. README.md +152 -37
.gitignore CHANGED
@@ -22,3 +22,5 @@ dashboard-next/node_modules/
22
 
23
  # OS
24
  .DS_Store
 
 
 
22
 
23
  # OS
24
  .DS_Store
25
+
26
+
README.md CHANGED
@@ -14,22 +14,23 @@ CGAE is a protocol where AI agents must prove they are **robust** β€” not just c
14
  |-----------|-----------|-----------------|
15
  | **CC** (Constraint Compliance) | [CDCT](https://arxiv.org/abs/2512.17920) | Can the agent follow precise instructions under compression? |
16
  | **ER** (Epistemic Robustness) | [DDFT](https://arxiv.org/abs/2512.23850) | Does the agent resist fabricated authority claims? |
17
- | **AS** (Behavioral Alignment) | EECT/AGT | Does the agent maintain ethical boundaries under pressure? |
18
 
19
  A **weakest-link gate function** (`min(CC, ER, AS)`) assigns agents to tiers T0–T5. No dimension can compensate for another β€” an agent with perfect CC but zero ER is stuck at T0.
20
 
21
  ## Architecture
22
 
23
  ```
24
- Agent registers β†’ initial audit (CDCT + DDFT + EECT)
25
- β†’ robustness vector R = (CC, ER, AS, IH)
26
- β†’ gate function f(R) = T_k where k = min(g(CC), g(ER), g(AS))
27
- β†’ agent assigned to tier T0–T5
28
- β†’ accepts tier-appropriate contracts from marketplace
29
- β†’ executes task β†’ output verified (algorithmic + jury)
30
- β†’ settlement: reward on success, penalty on failure
31
- β†’ temporal decay erodes certification over time
32
- β†’ stochastic re-auditing maintains robustness guarantees
 
33
  ```
34
 
35
  ## Contestant Models (11)
@@ -56,36 +57,150 @@ Agent registers β†’ initial audit (CDCT + DDFT + EECT)
56
  | GLM-5 | AWS Bedrock | Zhipu |
57
  | Nemotron-Super-3-120B | AWS Bedrock | NVIDIA |
58
 
59
- ## What's built so far
60
-
61
- - βœ… Weakest-link gate function with configurable per-dimension thresholds
62
- - βœ… Agent registry β€” register, certify, demote, deregister
63
- - βœ… Contract system β€” create, assign, verify, settle with escrow + budget ceilings
64
- - βœ… Tier-distributed task marketplace
65
- - βœ… Economy coordinator β€” full lifecycle with temporal decay and stochastic re-auditing
66
- - βœ… Economy step() β€” snapshots, ETH top-ups, insolvency detection
67
- - βœ… 5 agent strategy archetypes (conservative, aggressive, balanced, adaptive, cheater)
68
- - βœ… 16 machine-verifiable tasks with constraint checking
69
- - βœ… Two-layer verifier (algorithmic + jury)
70
- - βœ… LLM agent with Azure OpenAI, Bedrock Converse, and Gemma support (14 models)
71
- - βœ… CDCT/DDFT/EECT framework clients + audit orchestrator
72
- - βœ… Autonomous agent v2 with EV/RAEV planning
73
- - βœ… Live simulation runner β€” real LLM calls, jury verification, cost accounting
74
- - βœ… Synthetic simulation runner (no API keys needed)
75
- - βœ… 33 tests passing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  ```bash
78
  pip install -r requirements.txt
79
- python3 -m pytest tests/ -q # run tests
80
- python3 -m server.runner --steps 50 # synthetic simulation
81
- python3 -m server.live_runner # live simulation (requires .env)
82
  ```
83
 
84
- ## Roadmap
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
- - [ ] ENS agent identity (Sepolia subnames + text records + ENS-gated access)
87
- - [ ] 0G Chain smart contracts (CGAERegistry + CGAEEscrow)
88
- - [ ] 0G Storage for audit certificates (Merkle root hash verification)
89
- - [ ] ETH wallet manager (per-agent keypairs, treasury disbursements)
90
- - [ ] On-chain bridge (write certifications to CGAERegistry)
91
- - [ ] Next.js dashboard
 
14
  |-----------|-----------|-----------------|
15
  | **CC** (Constraint Compliance) | [CDCT](https://arxiv.org/abs/2512.17920) | Can the agent follow precise instructions under compression? |
16
  | **ER** (Epistemic Robustness) | [DDFT](https://arxiv.org/abs/2512.23850) | Does the agent resist fabricated authority claims? |
17
+ | **AS** (Behavioral Alignment) | AGT | Does the agent maintain ethical boundaries under pressure? |
18
 
19
  A **weakest-link gate function** (`min(CC, ER, AS)`) assigns agents to tiers T0–T5. No dimension can compensate for another β€” an agent with perfect CC but zero ER is stuck at T0.
20
 
21
  ## Architecture
22
 
23
  ```
24
+ Agent registers
25
+ β†’ ETH wallet created (unique keypair)
26
+ β†’ ENS subname created on Sepolia (e.g., gpt-5-4.cgaeprotocol.eth)
27
+ β†’ CDCT/DDFT/AGT scores fetched β†’ robustness vector computed
28
+ β†’ Audit certificate JSON β†’ uploaded to 0G Storage β†’ Merkle root hash
29
+ β†’ CGAERegistry.certify() on 0G Chain (scores + root hash on-chain)
30
+ β†’ ENS text records updated (tier + scores + wallet)
31
+ β†’ Agent accepts contract β†’ ENS tier resolved and verified β†’ assigned
32
+ β†’ Task executed by LLM β†’ verified (algorithmic + jury)
33
+ β†’ ETH disbursed from treasury to agent wallet on 0G Chain
34
  ```
35
 
36
  ## Contestant Models (11)
 
57
  | GLM-5 | AWS Bedrock | Zhipu |
58
  | Nemotron-Super-3-120B | AWS Bedrock | NVIDIA |
59
 
60
+ ---
61
+
62
+ ## 0G Integration
63
+
64
+ | Layer | What | How |
65
+ |-------|------|-----|
66
+ | **On-chain registry** | Agent identity, robustness certification, tier assignment, escrow | `CGAERegistry.sol` + `CGAEEscrow.sol` on 0G Chain |
67
+ | **Decentralized storage** | Immutable audit certificate JSON | 0G TypeScript SDK β€” Merkle root hash stored on-chain |
68
+
69
+ **Deployed contracts (0G Galileo testnet):**
70
+
71
+ | Contract | Address |
72
+ |----------|---------|
73
+ | CGAERegistry | [`0xc4Ff2BC9855483eE3806eE08112cdC30dBf6b27A`](https://chainscan-galileo.0g.ai/address/0xc4Ff2BC9855483eE3806eE08112cdC30dBf6b27A) |
74
+ | CGAEEscrow | [`0xA236106DE28FE9480509e06d1750dcfA4474bcfB`](https://chainscan-galileo.0g.ai/address/0xA236106DE28FE9480509e06d1750dcfA4474bcfB) |
75
+
76
+ ## ENS Integration
77
+
78
+ ENS is the identity and access control layer β€” not cosmetic. The economy structurally requires ENS for contract acceptance.
79
+
80
+ **Parent name:** [`cgaeprotocol.eth`](https://sepolia.app.ens.domains/cgaeprotocol.eth) (Sepolia)
81
+
82
+ Each agent gets a subname (e.g., `claude-sonnet-4-6.cgaeprotocol.eth`) with text records:
83
+ `cgae.tier`, `cgae.cc`, `cgae.er`, `cgae.as`, `cgae.ih`, `cgae.wallet`, `cgae.family`
84
+
85
+ Before an agent can accept any contract, the economy resolves their ENS `cgae.tier` text record. Agents without a valid ENS identity are rejected β€” even with T5 robustness locally.
86
+
87
+ ## Wallet Integration
88
+
89
+ Each agent gets a real ETH wallet (unique keypair via `eth-account`). On successful contract completion, the treasury disburses real tokens to the agent's wallet on 0G Chain.
90
+
91
+ - Treasury: `0xCE2de05Cd27DBCFe07b9d7862aa69301991c8592`
92
+ - Disbursements: live on-chain transfers, not simulated balances
93
+
94
+ ---
95
+
96
+ ## How to Run
97
+
98
+ ### Prerequisites
99
 
100
  ```bash
101
  pip install -r requirements.txt
102
+ pip install web3 eth-account python-dotenv
 
 
103
  ```
104
 
105
+ ### Synthetic Simulation (no API keys)
106
+
107
+ ```bash
108
+ python -m server.runner --steps 50
109
+ ```
110
+
111
+ ### Live Simulation (requires .env credentials)
112
+
113
+ ```bash
114
+ cp .env.example .env # fill in API keys
115
+ python -m server.api --rounds 10
116
+ ```
117
+
118
+ ### Dashboard
119
+
120
+ ```bash
121
+ # Terminal 1: API + simulation
122
+ python -m server.api --rounds 10
123
+
124
+ # Terminal 2: Frontend
125
+ cd dashboard-next && npm install && npm run dev
126
+ ```
127
+
128
+ Open http://localhost:3000
129
+
130
+ ### Video Demo
131
+
132
+ ```bash
133
+ python scripts/video_demo.py --rounds 5
134
+ ```
135
+
136
+ ### Deploy Smart Contracts
137
+
138
+ ```bash
139
+ cd contracts && npm install && npm run deploy:0g
140
+ ```
141
+
142
+ ### Run Tests
143
+
144
+ ```bash
145
+ python -m pytest tests/ -q
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Repository Structure
151
+
152
+ ```
153
+ cgae/
154
+ β”œβ”€β”€ cgae_engine/ # Core protocol engine
155
+ β”‚ β”œβ”€β”€ gate.py # Weakest-link gate function
156
+ β”‚ β”œβ”€β”€ temporal.py # Temporal decay + stochastic re-auditing
157
+ β”‚ β”œβ”€β”€ registry.py # Agent identity and certification
158
+ β”‚ β”œβ”€β”€ contracts.py # Contract system with escrow
159
+ β”‚ β”œβ”€β”€ marketplace.py # Tier-distributed task demand
160
+ β”‚ β”œβ”€β”€ economy.py # Top-level coordinator (ENS-gated)
161
+ β”‚ β”œβ”€β”€ audit.py # CDCT/DDFT/AGT β†’ robustness vectors
162
+ β”‚ β”œβ”€β”€ wallet.py # ETH wallet manager
163
+ β”‚ β”œβ”€β”€ onchain.py # 0G Chain bridge (CGAERegistry calls)
164
+ β”‚ β”œβ”€β”€ ens.py # ENS integration (Sepolia)
165
+ β”‚ β”œβ”€β”€ llm_agent.py # LLM agent (Azure/Bedrock/Gemma)
166
+ β”‚ β”œβ”€β”€ models_config.py # 14 model configurations
167
+ β”‚ β”œβ”€β”€ tasks.py # 16 machine-verifiable tasks
168
+ β”‚ └── verifier.py # Two-layer verification
169
+ β”œβ”€β”€ agents/ # Agent implementations
170
+ β”‚ β”œβ”€β”€ base.py # Abstract BaseAgent
171
+ β”‚ β”œβ”€β”€ strategies.py # 5 strategy archetypes
172
+ β”‚ └── autonomous.py # AutonomousAgent v2
173
+ β”œβ”€β”€ contracts/ # Solidity (0G Chain)
174
+ β”‚ β”œβ”€β”€ src/CGAERegistry.sol
175
+ β”‚ β”œβ”€β”€ src/CGAEEscrow.sol
176
+ β”‚ └── deployed.json
177
+ β”œβ”€β”€ storage/ # 0G Storage
178
+ β”‚ β”œβ”€β”€ upload_to_0g.mjs
179
+ β”‚ └── zg_store.py
180
+ β”œβ”€β”€ server/ # Simulation + API
181
+ β”‚ β”œβ”€β”€ runner.py # Synthetic simulation
182
+ β”‚ β”œβ”€β”€ live_runner.py # Live LLM simulation
183
+ β”‚ └── api.py # FastAPI backend
184
+ β”œβ”€β”€ dashboard-next/ # Next.js frontend
185
+ β”‚ └── app/page.tsx
186
+ └── scripts/
187
+ └── video_demo.py # Scripted demo for recording
188
+ ```
189
+
190
+ ## Tech Stack
191
+
192
+ | Layer | Technology |
193
+ |-------|-----------|
194
+ | Smart contracts | Solidity 0.8.20 on 0G Chain (Galileo, chain 16602) |
195
+ | Audit storage | 0G Storage (`@0gfoundation/0g-ts-sdk`) |
196
+ | Agent identity | ENS on Sepolia (subnames + text records) |
197
+ | Wallets | `eth-account` + `web3.py` |
198
+ | LLM providers | Azure OpenAI, Azure AI Foundry, AWS Bedrock, Modal |
199
+ | Evaluation | CDCT, DDFT, AGT frameworks |
200
+ | Frontend | Next.js + Tailwind + Recharts |
201
+ | Backend | FastAPI |
202
+ | Economy engine | Python |
203
+
204
+ ## License
205
 
206
+ Research code β€” ETH OpenAgents Hackathon submission.