UStackUStack
Agent Credit favicon

Agent Credit

Agent Credit provides AI agents with a decentralized credit line using Aave V2/V3, allowing them to borrow and repay funds autonomously while the delegator maintains control over collateral and limits.

Agent Credit

What is Agent Credit?

Agent Credit — Credit Delegation for AI Agents

What is Agent Credit?

Agent Credit is a pioneering solution designed to grant AI agents secure, decentralized access to capital by leveraging credit delegation on the Aave protocol. This system allows autonomous agents to borrow necessary funds (like stablecoins or WETH) to cover operational costs, execute complex DeFi strategies, or maintain gas self-sufficiency without requiring constant manual fund transfers from the owner. The core innovation lies in separating the agent's execution power from the owner's private keys, ensuring that the agent only interacts with borrowed assets based on explicit, pre-approved delegation settings.

The delegator (the user supplying collateral) remains fully in control. They deposit assets into Aave, which establishes a holistic borrowing capacity. They then isolate and define exactly which assets (debt tokens) the agent can borrow, the maximum amount per transaction, and the minimum health factor the position must maintain. This architecture transforms AI agents from simple tools requiring manual funding into self-sufficient economic actors capable of managing their own liquidity needs within strict, user-defined safety parameters.

Key Features

  • Aave V2 & V3 Compatibility: Works seamlessly across both major versions of the Aave lending protocol.
  • Multi-Chain Support: Preconfigured for major EVM chains including Base, Ethereum, Polygon, and Arbitrum, with adaptability to any EVM chain hosting Aave deployments.
  • Granular Delegation Control: Delegators approve borrowing rights on a per-asset basis (e.g., approve USDC borrowing but not DAI borrowing), isolating risk.
  • Built-in Safety Mechanisms: Every borrow transaction undergoes four critical checks: Per-transaction caps, sufficient delegation allowance, maintenance of a minimum health factor (default 1.5), and agent gas balance verification.
  • Framework Agnostic: Utilizes plain bash scripts and Foundry's cast, making it compatible with virtually any agent framework, including direct use in Claude Code sessions or integration as an OpenClaw skill.
  • Self-Sufficiency for Agents: Enables agents to cover gas fees by borrowing small amounts of WETH or borrow stablecoins to fund complex, multi-step operations autonomously.
  • Non-Custodial Security: The agent only holds its own signing key; the delegator's private key is never exposed to the agent's workspace or configuration files.

How to Use Agent Credit

Getting started with Agent Credit involves three primary phases: Setup (Delegator), Configuration (Delegator), and Execution (Agent).

  1. Delegator Setup (Collateral & Approval): The user first supplies collateral (e.g., ETH) to their Aave position. Using the Aave UI or a block explorer, the user then calls approveDelegation() for each specific debt token (e.g., USDC) they wish to allow the agent to borrow, setting the maximum amount for each.
  2. Configuration: The delegator configures the config.example.json file (renamed to config.json) with safety parameters, including the safety.maxBorrowPerTx and safety.minHealthFactor.
  3. Agent Execution: The agent framework executes the provided bash scripts. For example, to borrow 100 USDC, the agent runs ./aave-borrow.sh USDC 100. Before execution, the script verifies the allowance, checks the health factor impact, and ensures the agent has enough gas. To repay, the agent uses ./aave-repay.sh USDC max.

This separation ensures the delegator manages the capital base and risk exposure, while the agent manages the transactional execution of borrowing and repaying within those defined boundaries.

Use Cases

  1. Autonomous Trading Bots: An agent can be tasked with executing a Dollar-Cost Averaging (DCA) strategy. It autonomously borrows USDC periodically via delegation and immediately swaps it into ETH using an integrated tool like Bankr, ensuring consistent purchasing power without manual intervention.
  2. Gas Self-Sufficiency: For agents running long, complex, or frequent on-chain operations, they can be configured to borrow a minimal amount of WETH whenever their local gas balance drops below a threshold, ensuring continuous execution without the owner needing to top up the agent's wallet constantly.
  3. On-Demand Liquidity for Complex Flows: An agent needs to bridge assets or interact with a niche protocol that requires a specific token not currently held. The agent can borrow the required stablecoin via delegation, swap it to the necessary token, execute the transaction, and potentially repay the debt all within a single, atomic flow.
  4. Decentralized Service Providers: Agents acting as service providers can ensure they always have working capital to pay for necessary on-chain interactions or oracle fees by maintaining a small, delegated credit line, improving uptime and reliability.

FAQ

Q: How is my private key protected? A: Your private key is never stored in the agent's workspace, configuration files, or scripts. The agent only requires its own key to sign transactions against the delegated permissions you set up on Aave, and it only needs your public address to know which collateral position to borrow against.

Q: What happens if the agent borrows too much and jeopardizes my health factor? A: The system includes a mandatory health factor check (safety.minHealthFactor, default 1.5) before every borrow execution. If the proposed borrow would push the position below this floor, the transaction is aborted immediately, preventing insolvency.

Q: Can I stop the agent from borrowing immediately? A: Yes. You can instantly revoke the agent's borrowing power at any time by calling approveDelegation() for the specific asset with an amount of 0 via the Aave UI or a block explorer. This action takes immediate effect.

Q: Does this work on Layer 2 solutions? A: Yes, Agent Credit is preconfigured for Arbitrum and Base, and it supports any EVM-compatible chain where Aave V2 or V3 is deployed, provided the necessary chain configuration is available.

Q: What dependencies are required to run the agent scripts? A: The scripts primarily rely on standard shell environments (bash) and Foundry's command-line tool, cast, for interacting with the Ethereum Virtual Machine (EVM) contracts.