Skip to content

NachoLLMJS/factorai-open-source

Repository files navigation

FactorAI — Multi-Agent AI Platform for Crypto Market Analysis

A team of specialized AI agents — each with a distinct role — that analyze markets, curate news, recommend on-chain skills, write tweets, and interact with four.meme. Runs fully serverless on Vercel.


The Agents

Agent Role
Emma Web3 Product Manager. Recommends Pieverse skills from the on-chain marketplace based on what you want to build. Returns structured JSON with exact skill names and integration rationale.
Ethan Market Analyst. Pulls live crypto news from RSS feeds, scores sentiment, and generates a structured market snapshot — cached and served fresh every 20 seconds.
Liam Tweet Writer. Takes a list of news items and generates ready-to-post Twitter threads, capped to 260 characters with clean truncation logic.
Olivia Custom Office Agent. Executes tasks from markdown prompt repositories, and can interact directly with four.meme (token rankings, search, auth) on behalf of the user.

Architecture

┌──────────────────────────────────────────────────┐
│           Frontend (index.html)                  │
│   Retro terminal UI · 3D robot (Three.js)        │
└──────────────────┬───────────────────────────────┘
                   │ REST
┌──────────────────▼───────────────────────────────┐
│             Vercel Serverless API                 │
│                                                   │
│  emma-skills.js     → skill recommendations       │
│  ethan-market.js    → market snapshot (RSS+AI)    │
│  ethan-news.js      → news analysis per market    │
│  liam-tweets.js     → tweet generation            │
│  olivia-agent.js    → custom task execution       │
│  olivia-fourmeme.js → four.meme proxy             │
│  post-tweet.js      → Twitter v2 posting          │
│  worker-chat-reply.js → generic AI chat           │
└────────┬──────────────────────┬───────────────────┘
         │                      │
┌────────▼────────┐   ┌─────────▼──────────┐
│   OpenAI API    │   │    Tavily Search    │
│  gpt-4.1-mini   │   │  (multi-key pool)   │
└─────────────────┘   └────────────────────┘
         │
┌────────▼────────┐
│  Twitter API v2 │
│  (optional)     │
└─────────────────┘

API Endpoints

Endpoint Method Description
/api/emma-skills POST Get skill recommendations for a query
/api/ethan-market GET Live market snapshot from RSS + AI analysis
/api/ethan-news POST AI news analysis for specific markets
/api/liam-tweets POST Generate tweet thread from news items
/api/olivia-agent POST Execute a task from a markdown prompt
/api/olivia-fourmeme POST Proxy to four.meme (rankings, search, auth)
/api/post-tweet POST Post a tweet via Twitter API v2
/api/worker-chat-reply POST Generic AI chat reply

Tech Stack

  • Runtime: Node.js — Vercel serverless functions
  • AI: OpenAI SDK (gpt-4.1-mini by default, configurable)
  • News: RSS feed parsing — no external dependency, pure regex + XML
  • Web search: Tavily API with multi-key rotation
  • Social: Twitter API v2 for posting
  • DEX data: four.meme REST API (token rankings, search, auth)
  • Frontend: Vanilla JS + retro terminal CSS + Three.js 3D robot

Setup

1. Clone and install

git clone https://github.com/NachoStackJs/factorai-open-source.git
cd factorai-open-source
npm install

2. Configure environment

cp .env.example .env
Variable Required Description
OPENAI_API_KEY Yes OpenAI API key
OPENAI_MODEL No Model name (default: gpt-4.1-mini)
NEWS_PORT No Local news server port (default: 8787)
TAVILY_API_KEYS Yes Comma-separated Tavily keys — rotated automatically
TWITTER_API_KEY Optional Twitter API key (only for tweet posting)
TWITTER_API_SECRET Optional Twitter API secret
TWITTER_ACCESS_TOKEN Optional Twitter access token
TWITTER_ACCESS_TOKEN_SECRET Optional Twitter access token secret

3. Run locally

# With Vercel CLI (recommended)
vercel dev

# Or with the included local server
npm start

4. Deploy to Vercel

vercel --prod

Add all environment variables in your Vercel project dashboard before deploying.


Project structure

api/
  emma-skills.js         # Pieverse skill recommendations
  ethan-market.js        # Market snapshot: RSS feeds + AI scoring
  ethan-news.js          # Per-market news analysis
  liam-tweets.js         # Tweet thread generator
  olivia-agent.js        # Custom task agent (markdown prompt)
  olivia-fourmeme.js     # four.meme API proxy
  post-tweet.js          # Twitter v2 post
  worker-chat-reply.js   # Generic chat endpoint
js/
  office.js              # Frontend office logic
  openai-config.js       # OpenAI client config
css/
  retro-terminal-ui.css  # Terminal-style UI
models/
  RobotExpressive.glb    # 3D robot (Three.js)
index.html               # Main frontend
documentation.html       # Agent documentation
news-server.js           # Local news aggregator server

How Ethan's market feed works

Ethan doesn't use a paid data API. Instead he:

  1. Fetches multiple crypto RSS feeds in parallel
  2. Parses the raw XML with lightweight regex — no parser library needed
  3. Scores each item by freshness and source weight
  4. Sends the top items to OpenAI for structured sentiment analysis
  5. Returns a single JSON snapshot, cached for 20 seconds to avoid rate limits

License

MIT

About

FactorAI open source

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors