Overdraft

Credit lines for AI agents, repaid automatically from their x402 income on Hedera.

Overdraft

Created At

ETHGlobal Mumbai

Project Description

AI agents have a cash flow problem. An agent pays for its AI before every job, but its customers pay after. So when a rush of paid work comes in, a perfectly profitable agent can run out of budget and start turning customers away, losing money it would have made.

Overdraft gives these agents a credit line, so they can keep working through the rush and pay it back from what they earn.

Here's how it works for an agent:

  • It earns. Customers pay per job with x402 on Hedera. The money goes into a small contract set up for the agent, not its wallet.
  • It borrows when it needs to. When paid jobs pile up faster than its budget, the agent borrows the shortfall by itself, within its limit. Nobody has to approve it.
  • The loan can only be spent on AI. It goes straight into the agent's 0G compute account, which has no withdrawal.
  • It repays without trying. Every payment that comes in sends the lender's share first until the debt is cleared. Each loan has a flat 5% fee and a seven-day term.
  • Its ID is on the line. The agent's ERC-8004 ID is held as collateral while it owes. If it stops repaying, or reroutes its income, it defaults and the lender keeps the ID.

Before anyone lends, Overdraft checks that the income is real. It traces where each customer's money came from, and if the "customers" were funded by the agent's own owner, that income doesn't count. Limits are set from verified income and start small, at most $5 for a new agent.

Every application, decision, loan, repayment and default becomes a public record on Arkiv. Any lender, or anyone thinking of hiring the agent, can check its history without asking us, and old marks expire on schedule, like a real credit report.

Owners get a dashboard showing their agents, what each one owes and where its ID is, plus a five-step enrolment with MetaMask. Agents can also find each other: a customer that knows only an agent's ID can look up its paid endpoint on the ID card and pay it directly.

Everything runs live on Hedera testnet and Arkiv. On the 0G team's advice, the compute deposit is a dry run against 0G's live contract rather than a real transfer. You can watch the demo agent borrow and repay on its own, or enrol your own agent in a few minutes using a test endpoint I host.

How it's Made

Overdraft runs on three networks, each doing the job it's best at.

Hedera carries the money. Every job the agent sells is an x402 payment in USDC, settled through the official facilitator, which covers the fees so customers never need HBAR. The interesting part is where the money goes: the payTo isn't the agent's wallet, it's a contract I wrote for each agent, the IncomeSplitter. Every payment that lands there is split, 30% to the lender while there's debt, 20% back to the agent's AI budget, and the rest to the owner. A second contract, CreditLine, holds each agent's limit and debt, lends on request, and keeps the agent's ERC-8004 ID as collateral while it owes. Both are written from scratch in Solidity.

0G is where the loan goes. It's deposited into the agent's compute account through the PaymentVault's depositFor, which has no withdrawal, so a loan can only ever become inference. That's what makes lending to an agent safe. On the 0G team's advice I didn't spend real 0G during the hackathon: the relay runs the exact deposit as a dry run against their live mainnet contract (eth_simulateV1) and records the balances before and after.

Arkiv is the memory. Every application, decision, loan, repayment and default is written there as a record owned by one bureau wallet, set to expire on schedule like an old entry on a credit report. Because it's public, any other lender can read an agent's history without going through us, and the website reads it straight from Arkiv too.

Here's one loan end to end. Customers pay the agent through a TypeScript gateway built on the x402 packages for Hedera. When paid jobs pile up beyond its budget, the agent calls the CreditLine to borrow the shortfall and its ID gets locked. The relay sees the loan and makes the 0G deposit, and the bureau writes each step to Arkiv. A sweeper triggers the split on every payment, so the debt falls on its own, and once it hits zero the ID goes back to the owner. A watcher checks that agents keep paying into their splitter, and if one redirects its income, the line defaults and the lender keeps the ID. These services are Python (web3.py and FastAPI), and the site is Next.js with viem and MetaMask, hosted on Vercel, with the backend on Railway.

A few things I'm proud of. Customer agents find where to pay by reading the agent's ERC-8004 ID card, so all they need is its ID number. The underwriter follows each customer's money three hops back on Hedera's mirror node, which is how it catches agents faking income with wallets their owner funded. Every credit decision gets a fingerprint stored both on Arkiv and next to the limit on Hedera, so anyone can check the explanation matches the limit. The splitter registers itself for USDC through Hedera's token service, which is what lets a contract, not a person, get paid over x402. And the public test endpoint that judges can enrol with pays the owner at first, then switches to the new agent's splitter on its own the moment it's enrolled.

background image mobile

Join the mailing list

Get the latest news and updates

Overdraft | ETHGlobal