The first trustless M2M delegation economy β 18 SDK integration points, 3-level spending hierarchy, <10s settlement, $0.00 gas.
At 3:17 AM, an autonomous AI agent needed premium market data, risk analysis, and a gasless on-chain trade β spending exactly $10.02 of its $50 budget without ever touching the user's wallet.
DelegAI made that possible: 3 agents, 4 delegations, 2 x402 micropayments, 1 gasless relay β all cryptographically constrained by ERC-7710 caveats. The user slept through it.
Grant β Redelegate β Pay β Execute β Settle. The full delegation chain in <10 seconds.
AI agents need to spend money β buying compute, fetching premium data, executing trades. But trust is binary: grant full wallet access (one bug drains everything) or no access at all (the agent can't act).
DelegAI introduces scope-narrowing redelegation β the first trustless M2M spending hierarchy where each level gets LESS power, making the system SAFER as it scales:
User (50 USDC, 5 calls max)
βββ Master Agent (redelegates narrower scope)
βββ Data Worker (10 USDC, 2 calls) β x402 micropayments
βββ Exec Worker (10 USDC, 2 calls) β 1Shot gasless relay
What's now possible: Before DelegAI, AI agents needed either full wallet access (dangerous) or no access at all (useless). DelegAI introduces the first trustless spending hierarchy where worker budgets are cryptographically enforced to never exceed master budgets via ERC-7710 caveats β each redelegation level NARROWS scope. Give an AI $50 and it can hire sub-agents, but none of them can spend more than you authorized.
Deployed and funded on Ethereum Sepolia β every address verifiable on Etherscan:
| Role | Address | Etherscan |
|---|---|---|
| User (HybridDeleGator) | 0x903eF44504F9512E059DaE4228260af4795ccEBB |
Contract β Β· Token Transfers Β· Txns |
| Master Agent (EOA signer) | 0x4984bCedA778862655250ACb5Fe191dD65778B8b |
View β |
| Data Worker (EOA signer) | 0x10F3a6880AB548d232606242D417FB726f009484 |
View β |
| Exec Worker (EOA signer) | 0x4D685F37b5b3839f8cF31A5CEBE67640a3cC2356 |
View β |
Architecture note: Agent EOAs sign delegations off-chain using EIP-712 typed data β no gas needed. Only the final settlement executes on-chain through the User's HybridDeleGator via the DelegationManager. This is why all on-chain activity (USDC transfers, contract calls) appears on the User smart account, not the agent EOAs.
- Smart Account deployed via
SimpleFactory.create2Deploy()β verified contract on Etherscan - Funded with 20 USDC β view token balance
- User EOA holds 0.094 ETH for gas
- β
Delegation chain executed on-chain β
redeemDelegationsTX on Etherscan β 2-level chain (smart account β master β redeemer) transferred USDC via ERC-7710 caveats, 284K gas
18 verified SDK integration points across 4 sponsor technologies:
| Layer | Technology | Integration Points |
|---|---|---|
| Smart Accounts | MetaMask Smart Accounts Kit 1.5.x | createDelegation(), signDelegation(), hashDelegation(), createCaveatBuilder(), createOpenDelegation(), encodeDelegations(), decodeDelegations(), toMetaMaskSmartAccount(Stateless7702), getSmartAccountsEnvironment(), erc7710BundlerActions, erc7715ProviderActions, ScopeType, CaveatType, sendUserOperationWithDelegation |
| Payments | x402 (@x402/core, @x402/evm) |
Full buyer flow + seller flow + Erc7710ExactEvmScheme + EIP-712 verification |
| Relay | 1Shot API (OAuth2, REST) | getFeeData(), sendTransaction(), getStatus() |
| AI Intelligence | Venice AI (llama-3.3-70b) | 3 reasoning calls: budget allocation, data insight, execution decision |
graph TD
U[π€ User EOA] -->|"grantPermission(50 USDC, 5 calls)"| M[π€ Master Agent]
M -->|"redelegate(10 USDC, 2 calls)"| DW[π Data Worker]
M -->|"redelegate(10 USDC, 2 calls)"| EW[π Exec Worker]
DW -->|"x402 payment"| API[π° Premium Data API]
EW -->|"1Shot relay"| CHAIN[βοΈ Sepolia]
M -->|"settle()"| U
V[π§ Venice AI] -->|"private LLM reasoning"| M
V -->|"scope analysis"| DW
V -->|"execution plan"| EW
| Track | Prize | Our Integration |
|---|---|---|
| Best A2A Coordination | $3,000 | 3-level redelegation with parentDelegation linking β agents autonomously hire and scope sub-agents |
| Best Agent | $3,000 | Autonomous agent fleet: orchestrator creates sub-delegations, data worker buys data, exec worker relays transactions |
| Best x402 + ERC-7710 | $3,000 | Full buyer (createOpenDelegation + PAYMENT-SIGNATURE) AND seller (Erc7710ExactEvmScheme + EIP-712 verification) |
| Best Use of Venice AI | $3,000 | 3 real LLM reasoning calls: budget allocation (orchestrator), data insight (data-worker), go/no-go decision (exec-worker) |
| Best 1Shot Relayer | $1,000 | OAuth2 auth, getFeeData, gasless sendTransaction, getStatus polling |
| Feedback | $500 | SDK_FEEDBACK.md β 4 constructive feedback points with code examples |
- Node.js β₯ 20
- npm
# Clone
git clone https://github.com/edycutjong/delegai.git
cd delegai
# Install
npm install
# Configure
cp .env.example .env.local
# Add your VENICE_API_KEY for real LLM reasoning (see .env.example)
# Run
npm run devOpen http://localhost:3000 β click Start Delegation to see the full 5-step flow.
Venice AI is live by default when
VENICE_API_KEYis set β agents produce real, unique LLM reasoning on every run. Get a free key at venice.ai/settings/api.
Set all environment variables in .env.local to enable the complete on-chain flow:
- Real MetaMask Smart Account delegations on Sepolia
- Real x402 micropayments with EIP-712 verification
- Real 1Shot gasless relay transactions
- Real Venice AI reasoning
Set DELEGAI_DEMO=true in .env.local to run without any external dependencies. All integrations use deterministic mock data. Useful for local development only.
DelegAI has two operational modes. Live mode is the default β demo mode is a fallback for development without external dependencies.
| Capability | Live Mode (default) | Demo Mode (DELEGAI_DEMO=true) |
|---|---|---|
| MetaMask Smart Accounts | Real createDelegation() + signDelegation() with ERC-7710 caveats on Sepolia |
Deterministic mock delegation chain |
| x402 Micropayments | Real createOpenDelegation() β 402 handshake β PAYMENT-SIGNATURE header |
Accepts any signature, returns mock data |
| 1Shot Relay | OAuth2 auth β getFeeData() β sendTransaction() β getStatus() polling |
Returns success after 1s delay |
| Venice AI | β
Always live when VENICE_API_KEY is set (even in demo mode) |
Falls back to pre-scripted reasoning |
| EIP-7702 | Real toMetaMaskSmartAccount(Stateless7702) + signAuthorization() |
Returns deterministic mock auth tuple |
| Agent Addresses | Derived from real private keys, verifiable on Etherscan | Deterministic placeholder addresses |
For judges: The deployed URL runs with Venice AI live. Set
VENICE_API_KEYwhen running locally for real LLM reasoning on every agent action.
See .env.example for the complete list with setup instructions.
| Variable | Purpose | Required |
|---|---|---|
VENICE_API_KEY |
Real LLM reasoning in all agents | Recommended β get key |
PRIVATE_KEY_* |
MetaMask Smart Account delegations | Live mode |
ONESHOT_API_KEY / ONESHOT_API_SECRET |
1Shot gasless relay | Live mode |
DELEGAI_DEMO |
Enable mock fallback mode | Optional (false by default) |
npm run lint # Next.js ESLint
npm run typecheck # TypeScript strict check
npm run test # Run Jest suites
npm run test:coverage # Coverage report
npm run ci # Full CI pipeline (lint + typecheck + test)13 test files, 182 tests, 100% coverage. CI runs on every push via GitHub Actions across Node.js [20, 22, 24].
Run the submission verification script to confirm all 18 SDK integration points and project integrity:
npm run verifyπ Verification Output (51/51 passed)
π DelegAI β Submission Verification
π Project Structure:
β
README.md exists
β
LICENSE exists
β
.env.example exists
β
ARCHITECTURE.md exists
β
SDK_FEEDBACK.md exists
β
DEMO_SCRIPT.md exists
β
CI workflow exists
π§ Source Code:
β
Orchestrator agent
β
Data Worker agent
β
Exec Worker agent
β
Delegator (Smart Accounts Kit)
β
Relay (1Shot API)
β
Buyer (x402)
β
Seller (x402)
β
Bundler (ERC-7710)
β
Venice AI client
π SDK Integration Depth (18 points):
β
createDelegation()
β
signDelegation()
β
hashDelegation()
β
createCaveatBuilder()
β
encodeDelegations()
β
createOpenDelegation()
β
getSmartAccountsEnvironment()
β
toMetaMaskSmartAccount(Stateless7702)
β
ScopeType.Erc20TransferAmount
β
CaveatType.LimitedCalls
β
erc7710BundlerActions()
β
erc7715ProviderActions()
β
Erc7710ExactEvmScheme (x402 seller)
β
verifyTypedData (EIP-712)
β
decodeDelegations()
β
1Shot getFeeData()
β
1Shot sendTransaction()
β
Venice AI callVenice()
π§ͺ Test Suite:
β
delegator.test.ts β
orchestrator.test.ts
β
buyer.test.ts β
seller.test.ts
β
relay.test.ts β
bundler.test.ts
β
venice.test.ts β
data-worker.test.ts
β
exec-worker.test.ts β
constants.test.ts
β
events.test.ts β
mock-data.test.ts
β
types.test.ts
π§ Venice AI:
β
VENICE_API_KEY is set
β
Venice always calls API when key present
π Results: 51 passed, 0 failed, 0 warnings
SDK Integration Points: 18/18 verified
Test Files: 13/13
β
DelegAI submission verification passed!
delegai/
βββ docs/ # Documentation & assets
β βββ ARCHITECTURE.md # 18-point integration map
β βββ DEMO_SCRIPT.md # Demo video script
β βββ ONESHOT_SETUP.md # 1Shot relay setup guide
β βββ SDK_FEEDBACK.md # Feedback for SDK teams
β βββ assets/ # Generated images & thumbnails
βββ scripts/ # CLI tools
β βββ deploy-accounts.ts # Deploy HybridDeleGator on Sepolia
β βββ test-delegation.ts # End-to-end delegation test
β βββ show-addresses.ts # Show all agent Etherscan addresses
β βββ verify-submission.ts # 51-check submission verification
β βββ bench.ts # Performance benchmarks
β βββ verify-demo.ts # Demo mode verification
β βββ check-submission.ts # Submission readiness check
βββ src/
β βββ app/ # Next.js 16 App Router
β β βββ page.tsx # Landing page
β β βββ dashboard/ # Delegation command center
β β βββ api/
β β β βββ delegate/ # Delegation CRUD API
β β β βββ events/ # Server-Sent Events endpoint
β β β βββ premium-data/ # x402-protected data (market-feed, defi-yields)
β β β βββ relay/ # 1Shot relay webhook
β β βββ globals.css # Tailwind v4 + design tokens
β βββ components/ # React 19 components
β β βββ DelegationTree # Hierarchical chain viz
β β βββ AgentCard # Agent status cards
β β βββ BudgetMeter # Budget consumption bars
β β βββ ActivityFeed # Live event log
β β βββ AddressBadge # Truncated address display
β β βββ CaveatBadge # Caveat type indicators
β βββ agents/ # Agent logic
β β βββ orchestrator # Master Agent
β β βββ data-worker # x402 buyer
β β βββ exec-worker # 1Shot executor
β βββ lib/ # Shared utilities
β β βββ delegator # Smart account + delegation
β β βββ relay # 1Shot API client
β β βββ buyer # x402 buyer flow
β β βββ seller # x402 seller setup
β β βββ bundler # ERC-7710 bundler actions
β β βββ venice # Venice AI client
β β βββ events # SSE event emitter
β βββ __tests__/ # Jest test suites (13 files, 100% coverage)
βββ public/
β βββ icon.svg # DelegAI logo
β βββ pitch/ # Pitch deck (HTML)
βββ .env.example # Environment template
βββ .github/ # CI workflows
βββ README.md # You are here
MIT Β© 2026 Edy Cu
Built for the MetaMask Smart Accounts Kit Γ 1Shot API Γ Venice AI Dev Cook Off on HackQuest. Thank you to MetaMask, 1Shot, Venice AI, and the x402 team for the SDK access and documentation.
