The AI Bounty Finder Agent, powered by Vity Toolkit and frameworks like Vercel AI, helps you to find bounty, projects, tasks, grants, etc from different platforms like Superteam Earn, Gibwork. It efficiently identifies and extracts bounty which falls under the user's interest and also even give more information about it.
Prerequisites
You will need:
Node JS v22.11.0 or higher
OpenAI API Key
Get Started
In this example, you will create your own Bounty Finder bot in less than 100 lines (it's true). It's really very to create it, just follow the tutorial properly.
1
Create a folder and init your nodejs project
mkdir ai-bounty-finder && cd ai-bounty-finder
npm init -y
2
Install the required packages
npm install vity-toolkit @ai-sdk/openai ai dotenv
3
Environmental Variables
Paste your OpenAI API Key there.
export OPENAI_API_KEY=sk-**********
4
Open the folder in vs code
code .
Open index.tsfile and do as the below says.
5
Importing required packages
import readline from "readline";
import { openai } from "@ai-sdk/openai";
import { streamText, type CoreMessage } from "ai";
import { App, VercelAIToolkit } from "vity-toolkit";
import { configDotenv } from "dotenv";
configDotenv();
6
Initialize tools and define a variable for messages
const toolKit = new VercelAIToolkit();
const messages: CoreMessage[] = []
// define the apps you want to use
const tools = toolKit.getTools({ apps: [App.EARN, App.GIBWORK] });
7
Create the bot function
This function is responsible to take user prompt, pass it to agent and give the agent's response.
const bot = async (prompt: string) => {
try {
messages.push({
role: "user",
content: prompt,
})
const result = streamText({
model: openai("gpt-4o"),
tools,
maxSteps: 10,
system: `Your name is Vity Bounty Finder. You have been made by Vity Toolkit. You are an AI agent responsible for taking actions on Superteam Earn and Gibwork on users' behalf. You need to take action on using their APIs. Use correct tools to run APIs from the given toolkit. Give them the bounties/grants/projects if it comes under there background or interest. Your response should be structured and look beatiful too as it will directly be shown to the user. Be concise and helpful with your responses.
Note:
- When you are giving links for bounties for Superteam Earn, make sure the link has: https://earn.superteam.fun/listings/bounty/*
Usually it will not have '/bounty' slug but add it manually.
`,
messages,
})
let response = "";
for await (const message of result.textStream) {
console.clear();
response += message;
console.log("\nVity Bounty Finder: ", response);
}
const responseMessages = (await result.response).messages;
responseMessages.forEach((msg: CoreMessage) => messages.push(msg));
} catch (error) {
throw error;
}
}
8
Create the main function
const run = async () => {
console.clear();
console.log(`
+----------------------------------------------+
| Welcome to Bounty Finder ! |
+----------------------------------------------+
`);
try {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const q = (prompt: string): Promise<string> =>
new Promise((resolve) => rl.question(prompt, resolve));
const userPrompt = (await q("What are your interests?\n> ")).trim();
rl.close();
await bot(userPrompt);
while (true) {
const rl2 = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const q2 = (prompt: string): Promise<string> =>
new Promise((resolve) => rl2.question(prompt, resolve));
const userPrompt = (await q2("\nAnything else?\n> ")).trim();
rl2.close();
await bot(userPrompt);
}
} catch (error) {
console.error("Failed to run the agent:", error);
throw error;
}
}
import readline from "readline";
import { openai } from "@ai-sdk/openai";
import { streamText, type CoreMessage } from "ai";
import { App, VercelAIToolkit } from "vity-toolkit";
import { configDotenv } from "dotenv";
configDotenv();
const toolKit = new VercelAIToolkit();
const messages: CoreMessage[] = []
// define the apps you want to use
const tools = toolKit.getTools({ apps: [App.EARN, App.GIBWORK] });
const bot = async (prompt: string) => {
try {
messages.push({
role: "user",
content: prompt,
})
const result = streamText({
model: openai("gpt-4o"),
tools,
maxSteps: 10,
system: `Your name is Vity Bounty Finder. You have been made by Vity Toolkit. You are an AI agent responsible for taking actions on Superteam Earn and Gibwork on users' behalf. You need to take action on using their APIs. Use correct tools to run APIs from the given toolkit. Give them the bounties/grants/projects if it comes under there background or interest. Your response should be structured and look beatiful too as it will directly be shown to the user. Be concise and helpful with your responses.
Note:
- When you are giving links for bounties for Superteam Earn, make sure the link has: https://earn.superteam.fun/listings/bounty/*
Usually it will not have '/bounty' slug but add it manually.
`,
messages,
})
let response = "";
for await (const message of result.textStream) {
console.clear();
response += message;
console.log("\nVity Bounty Finder: ", response);
}
const responseMessages = (await result.response).messages;
responseMessages.forEach((msg: CoreMessage) => messages.push(msg));
} catch (error) {
throw error;
}
}
const run = async () => {
console.clear();
console.log(`
+----------------------------------------------+
| Welcome to Bounty Finder ! |
+----------------------------------------------+
`);
try {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const q = (prompt: string): Promise<string> =>
new Promise((resolve) => rl.question(prompt, resolve));
const userPrompt = (await q("What are your interests?\n> ")).trim();
rl.close();
await bot(userPrompt);
while (true) {
const rl2 = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const q2 = (prompt: string): Promise<string> =>
new Promise((resolve) => rl2.question(prompt, resolve));
const userPrompt = (await q2("\nAnything else?\n> ")).trim();
rl2.close();
await bot(userPrompt);
}
} catch (error) {
console.error("Failed to run the agent:", error);
throw error;
}
}
if (require.main === module) {
run().catch((error) => {
console.error("Fatal error:", error);
process.exit(1);
});
}
11
Run the program
npm run index.ts
Congratulations , now you have your personal assistant to help you find your next winning opportunity. Start chatting with it .