An intelligent multi-agent swarm* system that autonomously discovers, analyzes, and executes optimal yield farming strategies across multiple blockchain networks* using JuliaOS's swarm intelligence and AI capabilities.
- 🎯 Project Overview
- ✨ Core Features
- 🏗️ System Architecture
- 📋 Prerequisites
- 🛠️ Setup & Installation
- 🚀 Running the Application
- 🖥️ Using the Dashboard: A Step-by-Step Guide
- ⚙️ Project Structure
- 📄 License
YieldSwarm is a sophisticated DeFi yield optimization platform built for the JuliaOS bounty. It leverages a powerful combination of a high-performance Julia backend and a Node.js orchestration layer to power a swarm of autonomous AI agents. These agents work together to monitor, analyze, and manage yield strategies across multiple blockchains, aiming to deliver optimized returns while managing risk.
- Autonomous Agent Architecture: Specialized agents for discovery, analysis, and risk management.
- AI-Powered Intelligence: Integrates with Large Language Models (LLMs) for advanced opportunity discovery, filtering, and risk assessment.
- High-Performance Optimization: Utilizes a Julia backend with the
HiGHSsolver for rapid and efficient portfolio optimization. - Multi-Chain Capability: Designed to monitor and operate across various blockchain networks.
- Real-Time Web Dashboard: An intuitive UI for managing the agent swarm and visualizing opportunities, allocations, and alerts in real-time.
- Robust & Resilient: Features fallback mechanisms that allow agents to revert to traditional methods if AI systems are unavailable, ensuring constant operation.
YieldSwarm is built on a three-layer architecture:
- Julia Backend (TCP Server): The computational core that handles portfolio optimization and LLM API calls.
- Node.js Orchestrator (API & WebSocket Server): The central nervous system that manages agents, serves the API, and pushes real-time data to the UI.
- Vanilla JS Frontend (Web Dashboard): The command center for user interaction, management, and real-time data visualization.
Before you begin, ensure you have the following installed:
-
Clone the Repository
git clone https://github.com/DavidNzube101/YieldSwarm.git cd YieldSwarm -
Install Node.js Dependencies
pnpm i
-
Set Up Environment Variables Create a
test.envfile in the root directory by copying the example:cp env.example test.env
Open
test.envand add your Hugging Face API token. This is required for the AI features to work.# ... other variables HF_TOKEN=YOUR_HUGGINGFACE_ACCESS_TOKEN
-
Build the Project This command compiles the TypeScript code and copies the UI files to the
distdirectory.pnpm build
To run YieldSwarm, you need to start both the Julia and Node.js servers in separate terminal windows.
Terminal 1: Start the Julia Backend
julia backend/julia_server.jlYou should see a confirmation message: Julia backend listening on 127.0.0.1:8052.
Terminal 2: Start the Node.js Server
pnpm start:apiYou should see confirmation messages that the Swarm Coordinator is initialized and the API server is listening on port 3000.
Terminal 3: Access the Dashboard Open your web browser and navigate to: http://localhost:3000
The web dashboard is your command center. Here’s how to get the system running.
This agent finds yield opportunities.
- In the Agent Management panel, click the "Create Agent" button.
- Fill out the form:
- Agent Name:
DiscoveryAgent - Agent Type:
discovery - Chain:
solana
- Agent Name:
- Click "Create Agent".
This agent analyzes opportunities and optimizes the portfolio.
- Click "Create Agent" again.
- Fill out the form:
- Agent Name:
AnalysisAgent - Agent Type:
analysis - Chain:
solana
- Agent Name:
- Click "Create Agent".
This agent monitors the portfolio for risks.
- Click "Create Agent" one more time.
- Fill out the form:
- Agent Name:
RiskAgent - Agent Type:
risk - Chain:
solana
- Agent Name:
- Click "Create Agent".
You should now see all three agents listed in the Agent Management panel with a status of stopped.
The swarm will coordinate the agents.
- In the Swarm Management panel, click the "Create Swarm" button.
- Fill out the form:
- Swarm Name:
Swarm1 - Optimization Algorithm:
Morden Portfolio Theory(only algorithm currently supported) - Available Agents: Check the box next to
AnalysisAgent.
- Swarm Name:
- Click "Create Swarm".
Activate the system by starting the swarm and then the individual agents.
- Start the Swarm: In the Swarm Management panel, find
Swarm1and click its "Start" button. - Start the Agents: In the Agent Management panel, click the "Start" button for each of the three agents:
DiscoveryAgent,AnalysisAgent, andRiskAgent. (note: you would need to click the refresh button in the agents panel and swarm panel to refresh their status fromstoppedtorunning.)
The system is now live! You will see the dashboard panels populate in the following order:
- Live Opportunity Feed: The
DiscoveryAgentwill immediately start finding opportunities (using mock data by default), and this panel will fill up. - Portfolio Allocation: After a short delay, the
AnalysisAgentwill collect the opportunities, send them to the Julia backend for optimization, and display the resulting portfolio allocation here. - Risk Alerts: The
RiskAgentwill analyze the new portfolio and post any relevant risk warnings in this panel. - System Logs: This panel provides a real-time log of all major events occurring in the system.
Congratulations, you are now running an autonomous, AI-powered yield optimization swarm!
.
├── backend/ # Node.js backend and Julia server
│ ├── api.ts
│ ├── julia_server.jl
│ └── ...
├── src/
│ ├── agents/ # TypeScript Agent implementations
│ ├── cli/ # Command-line interface
│ ├── defi/ # DeFi protocol integrations
│ ├── swarm/ # Swarm coordination logic
│ └── yieldswarm-ui/ # Frontend dashboard files
├── config/ # Chain and DEX configurations
├── data/ # Data persistence for agents/swarms
├── test/ # Unit and integration tests
├── README.md # This file
└── package.json
This project is licensed under the MIT License. See the LICENSE file for details.
