
Weekend Agent Challenge: Stargazer
An agent that alerts the user in time for any note-worthy nights for stargazing.
My son likes astronomy and likes to look at sky when a planet or satellite is clearly visible. But many a times, I come to know about a meteor shower or a planet appearing clearly in the sky too late. Or we get excited for an astronomy event but turns out the night is cloudy. Nights when everything aligns in favour are rare, and I built this agent to never miss those nights.
Vision & What the Agent Does
Stargazer is an always-on AWS agent that watches the sky for me. It runs in the morning, checks whether tonight is actually worth stepping outside for, and stays completely silent unless the answer is yes.
The problem it solves: stargazing-worthy nights are rare and easy to miss — you need clear skies, something interesting to look at (an ISS pass, a bright planet, an active meteor shower), and free time on your calendar that evening, all at once. It is difficult to check four four different data sources every day just in case. Stargazer does that check automatically and only interrupts you when it's genuinely worth it.
What triggers it: an EventBridge Scheduler fires once daily in the early evening (DST-safe).
What it does on its own, with no human in the loop:
- Checks tonight's weather (cloud cover during the actual dark-sky window, not just "today's forecast")
- Checks for a visible ISS pass, bright planets, meteor showers, and Moon phase/illumination
- Checks Google Calendar for a free evening block
- Applies a deterministic rule (no AI, no guessing): only proceeds if the sky is clear, there's free time that overlaps the dark window, and there's at least one notable sky event
- If all of that lines up, an LLM (Amazon Bedrock, Nova Micro) writes a short, human-readable summary of what to go look at and when.
- Sends that summary as an email via SNS
How it reports back: a single email, only on nights that clear the bar. On every other night it keeps quiet.
How I built it
I researched the free APIs I could use to get the information I needed. Then I described the full system as a design spec up front — six components, the exact rule logic, the JSON contracts between each stage — and built it out with Claude Code end to end: infrastructure, five Lambda handlers, the Step Functions workflow, tests, and then live deployment and debugging against a real AWS account.
Key decisions:
EventBridge Scheduler, instead of EventBridge Rules. Rules only understand UTC cron; Scheduler supports IANA timezones directly, which handles daylight saving time for free.
No Hardcoded Credentials: Google Calendar OAuth and the AstronomyAPI credentials are both stored as secrets, referenced by name, with least-privilege IAM grants scoped to exactly the one Lambda that needs each one.
Decision logic is 100% rule-based, not AI: only the final message-writing step touches an LLM. Keeping the "should we notify" gate deterministic makes it testable and makes false positives/negatives debuggable, and keeps AI costs as low as possible.
Challenges encountered, and how I got past them
First I was trying to use the
open-notify.org API but it was not working for me, so I went with Pollux Labs' ISS Pass API which is a modern replacement to it and it also tells me whether ISS is visible to naked eye. The Google OAuth local redirect server silently failed the first time: it bound to the hostname
localhost , which macOS/browsers can resolve to the IPv6 loopback ( ::1 ) while Python's HTTPServer only listens on IPv4 by default — the browser's redirect landed on an address nothing was listening on. Fixed by using the literal 127.0.0.1 everywhere instead of the hostnameAWS Services Used

EventBridge Scheduler - triggers the step function workflow.
Step function runs the 3 data gathering lamdbas in parallel.
Weather lambda - Gets cloud cover data during the night sky watching hours
SkyObjects lambda - Gets possibility of ISS, planets or other celestial bodies during the hours.
Google calendar lambda - Checks calendar for free time.
Decision Lambda - Checks the lambda outputs and evaluates whether it is a go or no-go.
Compose Lambda - Uses Nova Micro from Bedrock to generate a nice email and sends to SNS topic.
SNS Topic - has the user email subscribed to it and has the info. Time to get the blankets and telecope.
Scheduler triggered the step function:

And Here's how the email from agent looks like:

Learnings:
EventBridge Scheduler vs. EventBridge Rules: I hadn't previously needed the distinction; Rules' UTC-only cron does not know about the DST. Scheduler's native IANA timezone support solves that outright.
Silence by Default needs its own testing: Some false negatives and positives can happen when you have a code branch not doing anything.
Clear skies and good luck to all of you!
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article