This is a simple agent that fetches the top stories from Hacker News and tweets a summary. Agent orchestration is done using @upstash/workflow agents.
To see the agent in action, follow @hackernewsagent on X.
To learn more about how the agent works, check out our blog post.
git clone https://github.com/upstash/hacker-news-x-agent.git
npm install
Create a .env.local file in the root directory and copy the contents from .env.local.example. Fill these environment variables following the instructions in the next steps.
Go to QStash tab on Upstash Console. Fill the following environment variables in .env.local with the values found in the Environment Keys section:
# To power the workflow
QSTASH_TOKEN=
# To make sure requests are coming from the right source
QSTASH_CURRENT_SIGNING_KEY=
QSTASH_NEXT_SIGNING_KEY=
.env.local with the values found in the REST API section .env tab:# To keep track of the news articles visited
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=
.env.local:# To power the agent
OPENAI_API_KEY=
.env.local:# To generate images
IDEOGRAM_API_KEY=
.env.local with the values found under the Keys and tokens tab:# To be able to tweet
TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_TOKEN_SECRET=
vercel
Go to the Vercel Dashboard -> Your Project -> Environment Variables and paste the contents of .env.local there, you don't need to set them one by one.
Deploy the agent to production.
vercel --prod
# To make sure requests are coming from the right source
QSTASH_CURRENT_SIGNING_KEY=
QSTASH_NEXT_SIGNING_KEY=
0 */2 * * * will run the agent every 2 hours.Check out our Local Development Guide to learn how to work with @upstash/workflow agents locally.
You can run the agent locally with the following command:
npm run dev
212 followers · starred Feb 2025
This is a simple agent that fetches the top stories from Hacker News and tweets a summary. Agent orchestration is done using @upstash/workflow agents.
To see the agent in action, follow @hackernewsagent on X.
To learn more about how the agent works, check out our blog post.
git clone https://github.com/upstash/hacker-news-x-agent.git
npm install
Create a .env.local file in the root directory and copy the contents from .env.local.example. Fill these environment variables following the instructions in the next steps.
Go to QStash tab on Upstash Console. Fill the following environment variables in .env.local with the values found in the Environment Keys section:
# To power the workflow
QSTASH_TOKEN=
# To make sure requests are coming from the right source
QSTASH_CURRENT_SIGNING_KEY=
QSTASH_NEXT_SIGNING_KEY=
.env.local with the values found in the REST API section .env tab:# To keep track of the news articles visited
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=
.env.local:# To power the agent
OPENAI_API_KEY=
.env.local:# To generate images
IDEOGRAM_API_KEY=
.env.local with the values found under the Keys and tokens tab:# To be able to tweet
TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_TOKEN_SECRET=
vercel
Go to the Vercel Dashboard -> Your Project -> Environment Variables and paste the contents of .env.local there, you don't need to set them one by one.
Deploy the agent to production.
vercel --prod
# To make sure requests are coming from the right source
QSTASH_CURRENT_SIGNING_KEY=
QSTASH_NEXT_SIGNING_KEY=
0 */2 * * * will run the agent every 2 hours.Check out our Local Development Guide to learn how to work with @upstash/workflow agents locally.
You can run the agent locally with the following command:
npm run dev
212 followers · starred Feb 2025