Weekly Research Digest Agent
Project Overview
The goal of this project was to create an AI agent to scrape research articles off of arXiv, and write about the real-world applications of the research. In this project, I learned about managing token costs, and setting up agent automation.

Hundreds of papers are posted to arXiv every week across STEM fields. That's far too many to read individually and find the few with real-world impact. An autonomous agent can scan all of them and connect the relevant ones to specific industries in minutes.
In my first design, the agent read every paper, checked it against 100 industries, narrowed the list down to about 10, and wrote a digest on those. I budgeted $3.00 per week and expected it to come in under $1.50. The first run cost nearly $9.00.
I went back to the pipeline to look for savings that wouldn't hurt the quality of the digest. The key idea was simple: the fewer papers that reach the expensive reasoning model, the less the agent spends.
My first fix was to put a cheaper model in front as a gatekeeper, for which I chose the model Haiku. The Haiku model read only the abstracts, rated each paper's relevance, and passed the best ones to the Sonnet model to write the digest. That brought the cost under $2.00, but I thought I could go further.
The next fix was to apply word filters to the papers before they reach the Haiku model. The purpose of the first phase of filters was to determine if something in the paper was really measured, with the assumption that a paper cannot have a real-world connection without an experimental measurement of some kind. This filter used phrases like "we demonstrate, we measure, we report, etc." Most papers make it past this phase, but still about 15% get cut.

Next it goes through another layer of filters, this time filtering out papers that don't have industry relevant phrases. For this layer, I had the heavyweight model Opus generate a key terms document for the 100 different industries, resulting in over 500 key terms. This further reduced the number of papers reaching the lightweight model by another 30%.
Finally, Haiku read each abstract, matched it to an industry, and rated its readiness: how soon the research could be applied. It would then pass it to the Sonnet model which would further cut down the list to the top ten, and write the final report. Using this updated pipeline, I was able to reduce the token usage to between $0.50 and $1.00 per run, less than 33% of what I initially budgeted.

Finally, I had to automate the agent somehow. My first thought was to do this with a small Raspberry Pi Zero 2 W, which typically retails for around $15. Using this I could host my agents locally while having the compute power to host multiple agents if I ever decided to create more. However, due to the skyrocketing use of AI, I was unable to find one in stock or at a reasonable price.
That left two options. I could pay about $8 a month for a hosted server, or I could use GitHub Actions, GitHub's free CI/CD platform. A server is more reliable and runs jobs exactly on schedule, while scheduled GitHub Actions jobs can run hours late. For a weekly digest, a few hours' delay doesn't matter. My code was also already on GitHub, which made setup much simpler. So I chose GitHub Actions.
I've since built a second agent on a similar pipeline, which tracks new developments in AI so I can stay current and find ways to use them in my own projects.