Analyze DeFi strategies by leveraging AI and intrinsic metric data along with efficient operations.
The DeFi market has matured significantly with the emergence of diverse protocols including AMMs, lending platforms, route aggregators, and automated yield optimization strategies. However, significant gaps remain for both retail and institutional users, from beginners to experienced traders.
The proliferation of protocols within each category creates increasing complexity. Even within the same protocol type, mechanisms can vary substantially - for instance, Uniswap v3's introduction of concentrated liquidity fundamentally changed AMM dynamics. This complexity creates substantial barriers for newcomers.
Cross-chain functionality remains a persistent challenge. Liquidity fragmentation across different blockchains increases execution costs and complicates optimal strategy selection, even for experienced users and institutions.
While attractive yield opportunities exist across various protocols, users face persistent risks including smart contract vulnerabilities, extreme market conditions, and malicious projects that can result in significant losses.
Given the conceptual complexity and dynamic market conditions, even institutional investors and seasoned traders struggle to effectively analyze risk-return profiles and execute custom strategies efficiently.
All of these factors create barriers to wider on-chain finance adoption.
Based on above situations, This protocol empowers users and institutions to develop comprehensive understanding of their risk profiles and investment strategies. By leveraging AI-driven analysis of real-time market data and sophisticated protocol metrics, users can dynamically assess risks and opportunities across DeFi protocols. The platform provides modular DeFi building blocks that enable users to construct customized strategies aligned with their specific objectives.
For Researchers: Construct sophisticated strategies using primitive building blocks or advanced composable modules, with simulation capabilities to validate research hypotheses and strategy performance.
For Beginners: Access intuitive metrics and educational tools that demystify DeFi mechanisms, providing clear risk-return analysis to facilitate informed decision-making and learning progression.
For Experienced Users: Monitor existing strategies with real-time protocol metrics, identify emerging opportunities, and optimize risk-adjusted returns through advanced analytics.
For Institutions: Deploy customized strategy modules tailored to institutional requirements, such as capital preservation, stable yield generation, or risk-controlled growth strategies for large-scale deployments.
MetricsFlow leverages AI to address users’ diverse questions while supporting real-time metric information and smart contract operations on supported protocols.
The AI agent combines on-chain finance knowledge with supported protocol information, using Python metta to build the necessary knowledge base tailored to user-specific queries.
Example 1 (Beginner) If a user asks “What are gas fees?”, the system augments the prompt before sending it to the OpenAI:
“Transaction costs on blockchain can range from $5–100+ on Ethereum during congestion.”
Example 2 (Researcher) If the user is a researcher exploring passive income strategies, the system adds additional context, such as:
“lending, staking, stablecoin LP.”
After receiving the response from OpenAI, MetricsFlow does not return the content directly. Instead, it combines the output with supported protocol information, then generates standardized strategy data. This strategy data is then used for:
AI Agent Design:

The MetricsFlow front end supports:
When a user starts a conversation, the front end sends the query to the agent through the API.
If the standard strategy returned by AI is empty, no metric monitoring or smart contract operations are shown.
If the output includes supported protocols (e.g., Uniswap V3 ETH/WETH pool), the front end:
Workflow Diagram:

For smart contract execution, MetricsFlow applies an Abstract Contract design pattern using E.
Uniswap V3 swap + liquidity provision).Smart Contract Design:

Partnering with Artificial Superintelligence Alliance (ASI) brought key advantages to the development of MetricsFlow.
By leveraging the mailbox mode agent, the system can be easily debugged and tested in a local development environment, significantly improving iteration speed and developer productivity.
The reference implementation from provided a valuable blueprint for adapting the agent to MetricsFlow.
Based on this logic, I extended the implementation by adding a standard strategy object, which acts as a bridge between the AI agent, metrics monitoring, and smart contract operations. This enables:
Partnering with Envio was equally impactful. Envio’s high-speed indexing and hosted service infrastructure make it possible to construct custom metrics directly from raw blockchain data, in real time.
This allows MetricsFlow to:
Envio’s performance significantly enhances both the responsiveness and analytical power of the platform.
How to achive efficiency Implementation of Complex Operations in Smart Contracts?
Step 1 — Abstract Contract Design: Using an Abstract Contract (EIP-4337), defined the complex operation functions.
Step 2 — Handling Protocol Diversity: Different on-chain financial protocols have different characteristics. Even within the same protocol type, implementations can vary. This presents a major challenge — not only integrating multiple protocols but also requiring a deep understanding of the related protocols.
My current solution is to build dedicated contracts or libraries to handle a single type of operation. For example, UniswapProvideLibrary provides functions for swap and mint LP operations. The main smart contract can call these helper libraries as needed. In the future, more complex operations can be added by: Creating additional libraries for other protocols, or Extending the existing libraries with new functionality.
Due to insufficient data on the testnet, a forked test environment was used to implement and execute the corresponding test cases.

