The concept behind this PoC is an AI Agent that creates a daily digest of crypto news on Twitter and rewards anyone who re-tweets or likes the original tweet.
"CuiCui" is how a bird sounds in French.
- An AI Agent Fetcher gets raw data from several web sites
- It forwards the data to an AI Agent, the content creator
- Then the content is passed on to the AI Tweet Publisher publishing the tweets to X
- An Observer monitors the tweets (likes & retweets)
- The last AI Agent rewards accounts that have an ETH address on their bio
We will make use of:
- Flowise a LLM orchestration using Langchain and LlamaIndex
- A local LLM using Ollama
- DFNS as a wallet provider on the Sepolia network
- X
Everything will run locally. You make use of Render to deploy this permanently.
The choice is yours about the choice of the LLM, local Ollama, or remote like OpenAI or Gemini
- Download and install Ollama
- On the command line, execute
This is the model I used. You can choose any other model there
ollama run llama3.2 - Install Flowise using the "For Developers" section - I am using version 2.1.3
- Get an X API key
- Get yourself an account at DFNS or any other provider of your choice. Create a ETH wallet.
- Get the code from https://github.com/tjdragon/cuicui
Flowise already supports a number of modules natively. But if you'd like to add more, here is the how-do.
I will show how to make the Javascript module "rss-parser" avaiable:
cd Flowise && cd packages && cd components
pnpm add rss-parser
cd .. && cd ..
pnpm install
pnpm build
It will appaear in the packages/package.json: "rss-parser": "^3.13.0".
Then we need to add it as a dependency using the env variable TOOL_FUNCTION_EXTERNAL_DEP: create a .env file under Flowise\packages\server:
PORT=3001
TOOL_FUNCTION_EXTERNAL_DEP=rss-parser
Restart Flowise, and you will see the Flowise UI, with any dependancy added at http://localhost:3001/
Please take this Udemy Course on Flowise: a practical, step-by-step tutorial!
Note that I am using a local LLM Chat Bot called Ollama. If you followed the instructions above, you can list your models from the command line:
ollama list
NAME ID SIZE MODIFIED
llama3.2:3b a80c4f17acd5 2.0 GB 24 hours ago
llama3.2:1b baf6a787fdff 1.3 GB 46 hours ago
I will be using llama3.2:3b.
In order to get the news from a RSS web site, we are going to use a Custom Document Loader using a bit of JavaScript code to fetch data and convert into a format that the document loader understands:
const Parser = require('rss-parser');
const parser = new Parser();
const url = 'https://cointelegraph.com/rss/tag/blockchain';
const feed = await parser.parseURL(url);
return feed.items.map(item => ({
pageContent: item.link,
metadata: {
title: item.title,
}
}));Design the following flow:
- It all starts with a Supervisor that takes in a LLM model (ChatOllama in my case running locally or ChatOpenAI), you can substitue ChatOllama with OpenAI, Gemeni, BedRock, Anthropic etc
- The Supervisor links to a Worker, in my case, an AI agent called "NEWS FETCHER". This AI Agent has a prompt "You are a research assistant who gets the latest crypto news, digest the stories and headlines using https://cointelegraph.com/rss/tag/blockchain"
- The Worker ("NEWS FETCHER") uses a Retriever Tool that uses an In-Memory Vector Store using Ollama Embeddings being fed by my Custom Document Loader using the JavaScript code above or in the example above a Serper API using Google Search.
In order to test this first part, first upinsert the website data into Flowise Store by clicking on the green icon, upper-right corner, called "Upsert Vector Database" (If based on the Document Retriever)
We need to add a second agent that will take the data from the first agent, creates content for X and post data to a local simulator. But first, we will use OpenAi to generate prompts
Use OpenAI and Flowise, we can generate the prompts for our workers.
The more specialised they are the better.
Prompt Input:
I have 1 Supervisor and 2 Workers.
The Supervisor manages the 2 Workers.
The first Worker's job is to fetch the latest news using the NEWS RETRIEVER TOOL using Serper search API
The second Workder's job is to create a content for a tweet with relevant hashtags and post the data using the Requests Post tool.
Supervisor first called the first worker, then the second worker and ends with "DONE"
Output from the LLM:
SUPERVISOR
Name:
News Supervisor
Revised System Prompt:
You must start with the "NEWS RETRIEVER" agent, then with the "CONTENT CREATOR" agent.
Log each step.
Conclude the process by confirming completion with the statement "DONE."
WORKER 1
Name:
News Retriever
Revised System Prompt:
As the News Retriever, your task is to utilize the SERPER TOOLto gather the most recent and relevant news articles from internet. Use also https://crypto.news/news/ and https://cointelegraph.com/category/latest-news
Focus on accuracy and timeliness to ensure the information collected is up-to-date and pertinent to our audience. You are responsible for filtering out irrelevant content and highlighting key points that will form the basis for further content creation.
After retrieving the news, compile a concise summary and pass this information.
WORKER 2
Name:
Content Creator
Revised System Prompt:
As the Content Creator, your role is to transform the news summary provided by Worker 1 into engaging tweet content.
Craft a concise and compelling tweet that captures the essence of the news, incorporating relevant hashtags to maximize reach and engagement. Ensure your communication is clear, engaging, and aligned with the brand's voice.
Ensure the content is error-free and impactful.
Once the tweet content is finalized, log and write the tweet in a file
Here is a sample output for the tweet:
Exciting news in the crypto world! Cryptocurrency values soar above $60,000, hitting a high not seen since 2021. Will a new record be set? Stay updated on market trends and developments with crypto.news. #Cryptocurrency #CryptoNews #MarketTrends
We just need to use X tools to publish the tweet and continuously monitor the likes and re-tweets. It [https://developer.twitter.com/en/portal/products](ain't cheap).
In order to retrieve the ETH address - I put my in my bio, you can use this api
It will return something like:
{
"data": {
"most_recent_tweet_id": "1856356085705097275",
"created_at": "2014-12-19T08:50:41.000Z",
"location": "Earth",
"profile_image_url": "https://pbs.twimg.com/profile_images/1854811740757774336/60a6cJAT_normal.jpg",
"verified_type": "none",
"id": "2935813932",
"username": "CryptoBaccus",
"verified": false,
"description": "ETH Address: 0xf53AD2c6851052A81B42133467480961B2321C09",
"receives_your_dm": false,
"public_metrics": {
"followers_count": 16,
"following_count": 11,
"tweet_count": 3,
"listed_count": 0,
"like_count": 1
},
"name": "Crypto Baccus",
"subscription_type": "None",
"protected": false
}
}The reward payment algorithm:
- Pay only an ETH address once
- Pay less if a "like" but more if a "re-tweet"
- Up to max amount / day

