Demo
https://www.loom.com/share/9951ee29e82b457d85dd3e7f4e7da1ec?sid=1ce94e08-77b0-44ce-91d5-beec12e710ca
Explanation
Final email
The agent produces a digest of relevant AI news daily, divided into categories, and linked to source
Workflow
- Retrieves Relevant Emails
- Filtering to reduce data added to context window.
- Gmail does the first layer of filtering by adding the label “AI-news” to any email with AI in the contents.
- GPT-4o has a 128k token window, which is roughly 50 large emails. My personal inbox received 100+ emails a day (RIP).
- Download emails with Gmail label is managed with a tool in Relevance
- Getting label ID for Gmail was surprisingly involved. You need to use the Google Apps Scrips to find the system assigned label (it’s not just the name).
- ChatGPT helped me work it out. Here’s a summary “Use Google’s OAuth 2.0 Playground to authorise Gmail API access, then send a GET request to https://gmail.googleapis.com/gmail/v1/users/me/labels to retrieve the internal ID for your “AI News” label.”
- Only reads emails from this label to avoid unrelated clutter and stay within token limits.
- Summarises the Content
- A prompt encouraged the LLM to extracts key AI news and categorises it into:
- AI investment news - particularly in Sydney, my home
- Produce updates
- Thought pieces/articles
- AI jobs (non engineering)
- Emails the Summary
- Automatically sends the summarised newsletter to me at 8am each day
Challenges
- Gmail Label ID: This was a chore but manageable. I used Google Apps Scrips to find the label ID which is seemly inaccessible otherwise.
- Fragmentary reporting: There’s a wibbly-wobbliness to prompting agents that makes it hard to fully achieve your objective. I don’t want every news story — just every one about AI. The prompt gives me most of them. One ends up stuck between writing a single prompt that does a decent job, or building a convoluted workflow that forces completeness at the cost of flexibility.
- Born yesterday: The agent has no idea what it told me yesterday so it repeats news stories. Ideally the system would remember what it had told me and only give updates rather than reporting the same item multiple times.