Skip to content

NectaFi/necta-agents

Repository files navigation

🤖 Necta Agents

An autonomous multi-agent DeFi system for yield optimization and portfolio management, built on Arbitrum. Powered by Bun, Hono, Vercel AI SDK, OpenAI, Brahma's ConsoleKit, Safe Smart Account, Supabase, Stakekit Viem, and more.

Overview 📚

Necta Agents is an AI-powered DeFi automation system that:

  • Monitors market conditions and wallet status
  • Identifies optimal yield opportunities to maximize returns
  • Executes transactions securely through Brahma accounts (powered by Safe Smart Account)
  • Operates autonomously with no human intervention required

System Architecture 🏗️

The system consists of three main AI agents working together:

  1. Sentinel Agent: Market analysis and opportunity detection

    • Monitors market conditions
    • Tracks wallet status
    • Generates intelligence reports
  2. Curator Agent: Strategy formulation and task generation

    • Analyzes Sentinel reports
    • Determines optimal actions
    • Curates executable tasks
  3. Executor Agent: Secure transaction execution

    • Processes tasks into transactions
    • Executes via Brahma ConsoleKit
    • Verifies transaction success

Architectural Diagram

Architecture

User Flow Diagram

User Flow

Core Components

  1. Infrastructure

    • Event Bus: Inter-agent communication system
    • Memory System: Supabase for persistent storage
  2. Data Sources

    • Market Data: Stakekit for Protocol yields and token prices
    • Wallet Status: Account balances and positions
  3. Onchain Execution: Brahma ConsoleKit

Quick Start 🚀

Prerequisites

  • Hono
  • Bun
  • Supabase account
  • ConsoleKit API key
  • OpenAI API key
  • Vercel AI SDK
  • Brahma ConsoleKit
  • Safe Smart Account
  • Stakekit API key

Installation

  1. Clone and install:
git clone https://github.com/NectaFi/necta-agents.git
cd necta-agents
bun install
  1. Configure environment:
cp .env.example .env

Setup Steps

  1. Register Executor (Gasless)
ENABLE_AGENTS=true bun src/index.ts
  1. Create Brahma Account

    • Visit Console.fi
    • Connect wallet (same as executor)
    • Create Brahma account
    • Create subscription with registered executor
    • Fund account with USDC
  2. Add Brahma Account

BRAHMA_ACCOUNT_ADDRESS="0x..."

Security 🛡️

  • Non-custodial: All funds remain in Brahma account
  • Secure execution: ConsoleKit handles transaction security
  • Limited permissions: Executor only signs transaction data
  • Transaction simulation: All transactions are simulated before execution

Development Guide 🛠️

Project Structure

src/
├── agents/                    # Agent implementations
│   ├── agent.ts              # Base agent class
│   ├── index.ts              # Agent system initialization
│   ├── curator/              # Curator agent
│   │   ├── index.ts
│   │   └── toolkit.ts
│   ├── executor/             # Executor agent
│   │   ├── index.ts
│   │   └── toolkit.ts
│   └── sentinel/             # Sentinel agent
│       ├── index.ts
│       └── toolkit.ts
├── services/                 # External services integration
│   └── console-kit/          # ConsoleKit integration
│       ├── index.ts
│       ├── core-actions.ts
│       ├── deploy-automation-account.ts
│       ├── register-executor.ts
│       ├── types.ts
│       └── utils.ts
├── system-prompts/          # Agent behavior definitions
│   ├── index.ts
│   ├── curator-system-prompt.ts
│   ├── executor-system-prompt.ts
│   └── sentinel-system-prompt.ts
├── data/                    # Data fetching and processing
│   ├── index.ts
│   ├── stakekit.ts
│   ├── stakekit.test.ts
│   └── types.ts
├── comms/                   # Inter-agent communication
│   ├── index.ts
│   └── event-bus.ts
├── config/                  # Chain and protocol configs
│   ├── index.ts
│   └── chains.ts
├── app.ts                   # Hono app setup
├── env.ts                   # Environment configuration
├── index.ts                # Main entry point
└── setup.ts                # System initialization

Key Files

  • src/agents/index.ts: Agent system initialization
  • src/services/console-kit/: ConsoleKit integration
  • src/system-prompts/: Agent behavior definitions
  • src/data/: Market data and protocol integrations

Adding New Features

  1. Extend Agent Capabilities

    • Add tools in agent's toolkit
    • Update system prompts
    • Register new event handlers
  2. Add Protocol Support

    • Add protocol addresses
    • Implement data fetching
    • Update transaction building

Frontend

Necta App

Contributing 🤝

License 📄

MIT License - See LICENSE for details

Disclaimer ⚠️

This code is provided as-is with no guarantees. Not audited. Use at your own risk. Not financial advice.

About

Necta Agents: Multi-Agent Autonomous System

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published