What is DeFAI? Transforming Decentralized Finance With Agents

DeFAI integrates AI with DeFi to reduce complexity and improve UX through automation and personalization.

What is DeFAI?

DeFAI is the combination of DeFi and AI. DeFAI unlocks natural language commands, personalized investing strategies, and a better user experience by introducing AI automation, efficiency, and decision-making to decentralized finance. This is the next evolution of DeFi. Let’s explore

Why Do We Need DeFAI?

DeFi has long struggled with complexity. Wallets, bridges, gas, slippage, seed phrases, multi-step transactions, fragmented liquidity, the list goes on. Only cryptonatives or masochists were ever likely to adopt DeFi in its present form. 

DeFAI represents massive upgrade potential. With AI agents, it's possible to abstract away the messy blockchain bits and improve outcomes. Users can focus on what they want to achieve rather than all the steps required to get there. This has obvious applications in areas like automated trading, yield optimization, and fraud prevention.

While most of “DeFAI” is currently in the early stages, the endgame is simple: intents plus agents. That is, codified intent, context-aware execution, access to free markets, and limited counterparty risk through verification mechanisms (e.g., teeML). Something like a personalized OTC desk where the agent can reliably do complex things with little supervision. 

How Does DeFAI Work? 

DeFAI adds automation and a non-deterministic element. The automation part is mainly about reducing friction. For example, if a user wants to swap some tokens, the AI parses the request, routes it to the best liquidity source, generates the transaction data, and pings the user for wallet approval. 

This is already a drastic improvement. But there’s more. 

The non-deterministic part just means that AI can make a wider range of decisions instead of following rigid, preset rules. This is moving toward fully autonomous agents, a future where AI systems manage a hot wallet, exercise judgment, and leverage a natural language-to-transaction framework to carry out intricate strategies.

For example, consider using a DEX with your own personal DeFi agent. If the goal is to provide liquidity to a trading pair, traditionally, the user deposits equal values of both tokens into a pool, and smart contracts determine trading fees and rewards while the user has to administer the position manually. With DeFAI, the flow could run like this:

  1. The user expresses their intent “provide liquidity to ETH-USDC on Uniswap” in natural language, which the embedded agent instantly picks up.
  2. The LP smart contract is integrated with the AI module, likely hosted off-chain for efficiency, that continuously pulls data from onchain sources (e.g., trading volume) and off-chain oracles (e.g., market volatility indices). 
  3. The AI uses these inputs to assess real-time market conditions. When it detects heightened volatility or other issues, it triggers an onchain action via a relayer or oracle network to adjust the position.
  4. The agent repositions the user’s liquidity range, narrowing it during volatility spikes to boost fee accrual or migrate funds to a higher fee pool. It can also recalculate rewards, such as gas costs and impermanent loss. 

Use Cases of DeFAI in DeFi

Trading: 

  • AI-powered trading offers many benefits, including simplified execution, better timing, cost-efficiency, predictive analytics, and contextual strategies. 
  • Agents can also uncover arbitrage opportunities, enable new flavors of automated, high-frequency trading, and holistically optimize a user’s portfolio.

Yield Farming: 

  • A DeFi agent can adjust yield farming strategies to individual preferences, factoring in things like risk tolerance, portfolio size, and market conditions.
  • AI could recommend staking in a specific liquidity pool (e.g., ETH-USDC), and dynamically rebalancing assets as the situation changes.

Risk Management: 

  • Agents can offer protection by monitoring volatility, tx patterns, and smart contract interactions to identify things like rug pulls or flash loan attacks before they occur.
  • They can also reduce risk by adjusting liquidity positions to minimize impermanent loss, optimizing gas costs, and steering users clear of shady protocols.

Data & Insights: 

  • From onchain data, protocol documentation, and community sentiment to macro things like interest rates, there’s a mountain of information traders need to consider.
  • A DeFAI agent can act like a tireless research assistant, sifting through this flood of information to deliver insights or act on it themselves.

Governance: 

  • AI can help fix protocol governance participation by simplifying DAO engagement, enabling user involvement minus the usual hassle.
  • They can track events, summarize proposals, forecast impacts, and auto-vote based on user preference, all while serving goals like maximizing staking rewards.

Challenges For DeFAI Adoption

Like any nascent technology, DeFAI has technical problems and obstacles to overcome. One of the biggest is verifiability. Most agents today require high levels of human intervention and have few verification mechanisms. This creates a trust problem where users have to take it on faith that:

  • A particular model is being used 
  • A request was executed as expected 
  • Data sources from external APIs are accurate
  • Private keys & treasury are properly managed

Without verifiability, agents operate as black boxes, making it hard/impossible to ensure their decisions or outputs are correct, unbiased, or even aligned with user interests. For uses like DeFi that involve large sums of capital, this is a nonstarter. 

Then there’s the hallucination problem. Agents have every capacity to generate false information, make mistakes, or form incorrect conclusions. This is due to issues in training data or limited reasoning and can lead to erratic behavior. The good news is that this is likely to be refined with time. The bad news is that there are a million ways this can go wrong in the short term. 

Privacy is a final key problem. Off-chain AI models processing or storing sensitive info, such as prompts, balances, or trading strategies, are vulnerable to hacks, leaks, and various forms of abuse, while onchain actions expose transaction patterns to a public ledger. This lack of privacy can result in:

  • Doxing: Connecting wallet addresses and real-world identities, making users targets for phishing or extortion.
  • Manipulation: Unencrypted transaction data allows malicious actors or other agents to front-run or otherwise manipulate trades. 
  • Loss of Competitive Edge: DeFAI agents handling proprietary strategies without privacy run the risk of leaking valuable insights. 

How Oasis Enhances AI-Powered DeFi

Many people are working to make DeFAI agents performant and trustworthy. These efforts include using technologies like MPC, zkTLS, and trusted execution environments (TEEs). Oasis Protocol has been building with TEEs for years and has expanded to off-chain compute with Runtime Offchain Logic (ROFL), a framework that enables agents to function in a decentralized, verifiable way.

ROFL makes the custom offchain logic needed for agents verifiable through TEEs. Deploying a DeFi agent inside a TEE keeps its processes secure, verifiable, and insulated from interference. This proves which model it's running on and that actions originate from the model in question.

The data inside the TEE is inaccessible to outside parties, guaranteeing the protection of sensitive information. TEEs can also solve the issue of private key custody. An agent's private key can exist as a secret inside a smart contract and get passed to the TEE so that not even the hardware owner can view the secret. If an account is generated within a smart contract on Sapphire, then the user can rest assured that no one can access the wallet besides the agent. 

The Future of DeFAI

DeFAI is not just about automation, fancy triggers, or a new interface. It’s a paradigm shift that could create a more relatable and user-centric version of DeFi. It also starts us down a path to a future where users can take their hands off the wheel. 

What starts as simple automation turns into executing complex, condition-based strategies without human oversight. Challenges remain, but by embedding machine intelligence into DeFi, DeFAI could signal an era where blockchain finally escapes its echo chamber.

How we use cookies?
At Oasis Foundation we believe in your privacy, so you can choose to browse our site without any tracking or by clicking “Accept”, you help us to improve our site and help us grow our ecosystem. View our Privacy Policy for more information.