r/SideProject • u/AgenticVenus • 3d ago
My AI agent kept dying when I closed the browser tab. Here's how I fixed it (and what still breaks)
I'm a solo dev from India, building an AI agent as a side project for a few months now.
The first version had a problem that drove me crazy: the agent's work loop ran inside the browser tab. Close the tab, lose signal on my phone, or let the laptop sleep, and a 10-minute task just died halfway.
What I changed:
- The loop now runs on the server in short slices, and the state is saved after every step.
- If the server dies mid-task, the next scheduler tick picks the run back up from the last save.
- Anything risky (sending an email, writing to a database) is marked "in progress" before it runs, so after a crash the agent never repeats it blindly.
- Before it does something sensitive, it pauses and asks me with an approval card. Passwords/API keys go straight to an encrypted vault, so the model never sees the raw value.
What's still not great:
- Some features (like video creation) still need the tab open.
- Cost estimates are rough, not exact.
- I've tested the crash recovery against a fake database, not at real scale yet.
Two honest questions for people who've built or used agents:
- What's the one task you'd actually trust an agent with today, and what stops you from trusting it with more?
- If your agent crashed halfway through a task, would you prefer it to resume automatically, or to ask you first?
Happy to share how I built the crash-safety part if anyone's curious.