Superior AI Agents Implementation Guide

This guide will walk you through implementing your own autonomous trading and marketing agent. Everything needed to get started can be found in our open source Github repo here: https://github.com/SuperiorAgents/superior-agents

Why Use Superior Agents?

Key Capabilities

  • Research: Analyze market trends, tokenomics, and narratives.

  • Strategy Formulation: Make intelligent, data-backed investment decisions.

  • Automated Trading: Buy and sell crypto assets autonomously.

  • Marketing & Promotion: Market holdings to increase assets under management (AUM).

  • Promote (or FUD): Influence market sentiment to their advantage.

  • Assess their own performance: Measure profitability and adapt.

  • Self-improve daily: Learn from successes and failures, refining strategies over time.

Benefits

  • Autonomous Operation: The agent handles both trading and marketing functions without manual intervention.

  • Flexibility: Customize agent behavior using configuration JSON files.

  • Robust Integration: Interact with Ethereum smart contracts via ABI files and connect with various external APIs.

  • Containerized Deployment: Docker support simplifies the deployment and management of the agent in different environments.

How to Implement Superior Agent

Follow these steps to set up and run the Superior Agent framework.

1. Installation Prerequisites


2. Agent-Side Setup

a. Create and Activate a Python Virtual Environment

# Create python virtual environment (recommended)
python -m venv agent-venv

# Activate the virtual environment
source agent-venv/bin/activate

b. Install Agent Dependencies

# Navigate to the agent directory
cd agent

# Install all required dependencies
pip install .

c. Configure Environment Variables

  1. Copy the example environment file:

    cp .env.example .env
  2. Open the .env file and configure your settings (API keys, private keys, etc.).


3. ABI Files (Optional for Trading Functionality)

If you plan to use trading functionality, ensure you have the following ABI files:

  • erc_20_abi.json

  • uniswap_router_abi.json

File Structure

Place these files in the following directory structure:

Copysuperior-agents/
  ├── agent/
  │   ├── docker/
  │   │   ├── erc_20_abi.json
  │   │   └── uniswap_router_abi.json
  │   └── ...
  └── ...

Why They Are Needed:

  • Contract Interaction: To decode smart contract functions and events.

  • Trading Operations: To read token balances, execute trades, monitor transactions, and manage liquidity positions.


4. Configuration JSON Files

The marketing.json and trading.json files located in the agent/starter/ directory are used to define the default prompts and behaviors for the agents.

Customization options include:

  • Agent Identification: Set a unique agent_id for tracking and management

  • Model Selection: Choose the AI model (e.g., "claude") for generating strategies

  • Role Definition: Define the agent's role and persona

  • Time Horizon: Set the duration for strategy execution

  • Metric Goals: Specify the key performance metric (e.g., "followers" or "wallet")

  • Research Tools: List available APIs and research resources

  • Prompts: Detailed, customizable prompt templates for:

    • System initialization

    • Strategy generation

    • Code implementation

    • Error handling and code regeneration

These JSON files provide a flexible configuration mechanism to control agent behavior without changing the core code.


5. Python Server-Side Setup

a. Create and Activate a Python Virtual Environment

# Create the virtual environment (recommended)
python -m venv api-db-venv

# Activate the virtual environment
source api-db-venv/bin/activate

b. Install Dependencies

# Navigate to the api_db directory
cd api_db

# Install all required dependencies
pip install -r requirements.txt

c. Configure the Environment

  1. Copy the example environment file:

    cp .env.example .env
  2. Update the .env file with the necessary variables:

    TWITTER_API_KEY=
    TWITTER_API_SECRET=
    TWITTER_BEARER_TOKEN=
    TWITTER_ACCESS_TOKEN=
    TWITTER_ACCESS_TOKEN_SECRET=
    ETHER_PRIVATE_KEY=
    ETHER_ADDRESS=
    INFURA_PROJECT_ID=
    ETHERSCAN_KEY=
    COINGECKO_KEY=
    ONEINCH_API_KEY=
    DEEPSEEK_OPENROUTER_KEY=
    ANTHROPIC_API_KEY=
    DEEPSEEK_KEY=
    DEEPSEEK_KEY_2=

d. Initialize the Database

python init_db.py

6. Quick Start

a. Run the Agent Docker Container

# Navigate to the docker configuration directory
cd agent/docker

# Create and start the container locally
docker compose up -d

b. Run the Python Server (FastAPI Backend)

You have two options to start the backend. For example, using Uvicorn:

# Activate the server virtual environment
source api-db-venv/bin/activate

# Navigate to the api_db directory
cd api_db

# Start the FastAPI backend
uvicorn routes.api:app --port 9020

c. Run the Agent Scripts

For the Trading Bot:

# Activate the agent virtual environment
source agent-venv/bin/activate

# Run the trading agent (replace <agent_id> with your agent identifier)
python -m scripts.main trading <agent_id>

# Example:
python -m scripts.main trading agent_007

For the Marketing Bot:

# Activate the agent virtual environment
source agent-venv/bin/activate

# Run the marketing agent (replace <agent_id> with your agent identifier)
python -m scripts.main marketing <agent_id>

# Example:
python -m scripts.main marketing agent_007

7. Additional Resources

  • Python Server API Documentation: Detailed API documentation is available in the /api_db directory.

  • Notification Scraper (Optional): A notification service is provided to aggregate data from multiple sources for the agents. Refer to the /notification directory for documentation.

Support

Last updated