DEV Community

Richard Smith
Richard Smith

Posted on

What I Learned Building an Automation That Runs While I Sleep

Last month I built an agent that reads our Slack channels and GitHub pull requests each morning and posts a brief to our team channel. Simple idea. Took about a week to get right.

The hard part isn't making an agent that can read sources and write a summary. That's table stakes. The hard part is making something that runs on a schedule, in the background, without someone watching it—and actually works.

I hit three failure modes that kept breaking the system. First, I had the agent read a fixed time window like "the last 24 hours." But if a run was delayed, items fell through the gap. If it ran early, items repeated. The fix was counterintuitive: give the agent a bookmark per source and have it remember where it left off. Each run starts exactly where the last one ended.

Second, I assumed a successful API call meant a successful post. It doesn't. The post could fail silently and the agent would still move on. Now it waits for Slack's explicit confirmation before recording anything.

Third, stale memory. The agent runs in a fresh sandbox each time. Without a ledger, it forgets what's already been reported. With a bad ledger, it reports items as "still open" after they're resolved.

These aren't edge cases. They're the baseline problem of making automation actually reliable. I keep thinking about what this means for the broader idea of AI agents doing work autonomously. The model is often the easy part. The hard part is everything around it: state, confirmation, trust.

The framework I landed on has six rules. Read from bookmarks. Report failures explicitly. Re-check items before posting. Confirm before recording. Keep preferences in a separate read-only store. And cap spending per run. That's it. Not elegant, but it works.

If you're building something similar, I'd want to know: what broke first for you?

Top comments (0)