DeFAI Multiagent System
Architecture of Neko’s DeFAI Multiagent System
At the heart of Neko’s intelligent operation, particularly for managing sophisticated Earn strategies, lies the DeFAi Multiagent System. This system acts as the primary execution engine, taking high-level directives (often coordinated by the central Neko Orchestrator) and translating them into optimized, risk-managed on-chain actions within HyperEVM and Hyperliquid.
Instead of relying on static logic, each Neko Earn vault strategy (e.g., LHYPE vault, stablecoin arbitrage strategy) is actively managed by a dedicated team of four specialized AI agents working in concert. This ensures dynamic adaptation to market conditions and adherence to the specific goals of the deposited capital.
The Core Agent Workflow
When triggered by an event (such as a user deposit, a scheduled rebalance, or a significant market shift), the agents responsible for a specific vault execute a collaborative workflow:
- Planner Agent: Initiates the process by analyzing the current state, the trigger event, and the vault’s objectives. It drafts a preliminary plan of action (e.g., “deploy new capital,” “adjust allocation,” “harvest rewards”).
- Replanner Agent: Critically reviews the initial plan. It iterates on the strategy, considering potential risks, alternative approaches, and market data to refine the plan for optimal outcomes and safety.
- Executor Agent: Prepares for the execution phase. It identifies the necessary “tools”—specific smart contract interactions (like swaps via Shogun, lending via integrated protocols), API calls, or internal Neko functions required to implement the refined plan.
- Action-Planner Agent: Performs the final validation. Using the refined plan and the tool readiness information from the Executor, it constructs the precise sequence of on-chain transactions needed (e.g., exact swap amounts, lending parameters) and confirms the final execution steps, especially for complex multi-step actions.
Data-Driven Decision Making
This entire workflow is deeply informed by a rich tapestry of on-chain and off-chain data, allowing the agents to make contextually relevant and timely decisions. Before planning and replanning, agents retrieve critical information using Neko’s core AI capabilities:
- RAG Database (Semantic Context): Agents query the Retrieval-Augmented Generation database for relevant knowledge, similar past scenarios, or contextual information based on semantic similarity.
- Time-Series Database (Market & Prediction Data): Agents access real-time and historical market data (prices, volume), protocol states, and potentially predictive analytics derived from models.
- Time-Series Database (Agent Transaction History): Agents review their own past actions and outcomes for the specific vault (long-term memory), enabling learning and strategy refinement over time.
(This data retrieval process is conceptually illustrated in the AI Agent System diagram within the Architecture Overview).
Underlying Technology
The DeFAI Multiagent System leverages a high-performance, secure technology stack optimized for demanding DeFi operations:
- RIG Agent Framework: A Rust-based agent framework provides the core structure, ensuring fast runtime and efficient execution critical for timely market interactions.
- Large Language Models (LLMs): Advanced models (like experimental Google Gemini versions) power the reasoning, planning, and decision-making capabilities of the specialized agents (Planner, Replanner, Action-Planner).
- Rust Nucleus SDK: Serves as the primary mechanism for secure and controlled “tool calling,” enabling agents to interact reliably with whitelisted smart contracts (like those within the Nucleus vault framework), internal services, and external APIs (e.g., Hypernative for security checks).
- RAG & CAG Databases: These form the core memory system. The Retrieval-Augmented Generation (RAG) database provides semantic context and relevant knowledge, while the Context-Augmented Generation (CAG) database stores heuristics, learned best practices, and long-term transaction history (agent memory).
- Time-Series Database: Provides essential real-time and historical market data, protocol states, and predictive analytics used throughout the decision-making process.
- Event-Driven Architecture & Scheduling: The system operates based on triggers (user actions, market events, scheduled routines like rebalancing), indicating an underlying mechanism for event handling and task scheduling.
This modular Rust-based architecture is designed for performance, security, and adaptability, allowing components like LLMs or data sources to be updated as technology progresses.
Outcome
This sophisticated multi-agent approach allows Neko Earn vaults to transcend static strategies. It enables dynamic, adaptive portfolio management aimed at optimizing yield and managing risk according to real-time market conditions and the unique parameters of each defined vault strategy, truly bringing the vision of ambient, intelligent finance to life.