ERC-8464 Agent priority repayment recipient (Agent Repay-First Payees)

Draft · Vaults & DeFi · created 2026-10-20

A standard that normalizes the payee address into which an AI agent's earnings arrive, so that at sweep time, registered creditors are repaid in priority order and only the remaining money is sent to the owner.

Why it is needed

When lending money against an AI agent's earnings as collateral, the safest approach is for repayment to happen automatically as soon as the earnings arrive. However, an agent's earnings today only arrive at an address the agent itself designates, such as the receiving address for x402 payments, the provider address for ERC-8183 tasks, or an ERC-8004 wallet, with nothing defined about how that money is used once it arrives. Even if a lender intercepts the earnings with its own contract, that contract can only be trusted by the lender itself, and no one else can check whether that address is already pledged as collateral. Without a common standard, multiple lenders have no way to share a single earnings address with a defined priority order, a newly arriving lender cannot check existing claims already placed on it, and the agent must change the very address it gets paid at every time it switches lenders.

What to implement

In depth

The relationship between the payee and the identity

identityRegistry() and agentId() do not change after deployment. The owner is, at the time of each call, the address that the registry's ownerOf(agentId()) points to. beneficiary() returns the address the current owner set via setBeneficiary if one has been set; if none has been set or the owner has changed, it returns the current owner. If the identity is burned and ownerOf reverts, it returns the last address that was set (regardless of who set it), or the zero address if none was ever set, and does not revert. The payee does not accept ether force-sent without a call, and pays out token balances only through sweep.

Adding and removing creditors

addCreditor can only be called by the owner, and rejects an already registered address, the zero address, or a maxShareBps that is 0 or exceeds 10000. A new creditor is always added after the existing creditors, at the lowest seniority. removeCreditor always succeeds when called by the creditor itself, but when called by the owner it fails if that creditor's hasClaim() is true or reverts. Once removed, any reserve that creditor had accumulated across all tokens disappears (it reverts to the distributable amount at the next settlement), and if re-added, it starts with no reserve. A creditor's share and seniority do not change while it remains registered.

The settlement algorithm of sweep

sweep(token) first reads each creditor's amountOwed and, if its reserve exceeds that, reduces the reserve. The distributable amount B is the payee's token balance minus the reduced reserves. Going in order of seniority, for each creditor the amount to pay first (give) is set to the minimum of 'the amount owed minus the reserve', 'B multiplied by its share (bps)', and 'the remaining B'; it then approves an offer equal to the reserve plus give, calls collect, resets the approval back to 0, and finally counts only what was actually pulled as paid, adding the remainder back to the reserve. After processing all creditors, the remaining B is sent to the beneficiary, but if the beneficiary is the zero address or the transfer fails, it stays in the payee.

How the creditor interface behaves

amountOwed is a value the creditor self-reports as the amount it can receive right now; for a loan that only accepts full repayment, it returns the amount that pays off the entire debt. hasClaim is true whenever a claim remains outstanding, whether or not the repayment deadline has passed. collect pulls at most amount from the payee, applies it to the debt, and returns only the amount actually applied; it must not pull funds in advance that cannot be applied right now, and that portion stays in the payee's reserve to be offered again at the next settlement.

Acting as an ERC-8183 job provider (optional)

ERC-8183 pays the escrow to the provider once a job is completed, and accepts result submission only from the provider. If the payee also acts as this provider, the owner or operator calls setJobBudget and submitJob, which in turn call the commerce contract's setBudget and submit respectively. The operator is designated by the owner via setOperator, and operator privileges disappear together when the owner changes. The payee must not make any other call on behalf of the owner or operator beyond these two, so job payment arriving is just an ordinary token transfer, and is afterward handled the same as any other revenue through sweep.

Distributing residual revenue to ERC-7254 token holders (optional)

If the owner designates a token implementing ERC-7254 and IHoldersAfterCreditors as the beneficiary, the money left over after all creditors have been paid is passed to that token. This token cannot become a creditor; anyone can call syncFromPayee, which accrues as rewards the amount of newly arrived assets in the token, emitting RevenueFromPayee on accrual. Attempting to sync an unregistered asset fails, and nothing accrues when total supply is 0. This token's recognition as beneficiary is also valid only while the owner who designated it still holds the identity.

Design rationale: why the reserve stays inside the payee

A loan that accepts only full repayment does not reduce the debt if it accepts a partial payment, so if sweep handed that portion to the owner, it could never be repaid. That is why the portion not taken stays as a reserve inside the payee contract rather than with the creditor, is offered again at every settlement, and is repaid in full the moment the accumulated amount covers the entire debt. The creditor's seniority is also fixed by registration order, so the owner cannot later reorder it to push out an existing lender, and because ERC-8004's agentWallet requires a signature from the new wallet, a payee that does not verify signatures cannot be used in that role.

Proposal status

This standard is in Draft status as of October 2026, and its details may still change or adoption may stall during community discussion and review.

Things to watch out for

Original ERC · ← ERCs