← Back to Blog
Case Study· 4 min read

From 12 to 70 Replies a Day: Debugging an Autonomous Agent

DM
Dmitrii Malakhov

A few weeks into running the agent at scale, the numbers stopped adding up. I'd set the target at 50 to 70 replies a day on X. Some days it did 12.

It wasn't crashing. There were no errors where I'd normally look. It just quietly did a fraction of the work and treated that as fine. That's the kind of bug that costs you a week before you even believe it's a bug.

The symptom

Twelve replies on a day that should have been sixty. The agent ran, posted a few things, went quiet. The daily budget was set to 70 and rarely came close.

When automation underperforms quietly, you can lose days assuming it's a tuning problem. I tried wider queries and shorter cadences. The number didn't move, because the bottleneck was never the throughput config. It was a lock.

The root cause

The search step pulls candidates from Apify, and for that it needs an API token. We fetched that token through our secrets manager on every run.

Under load, the secrets CLI didn't fail when it hit a rate limit. It just retried, silently, for minutes. So the search job would hang for the full 90-minute watchdog window before anything killed it, and pull zero candidates.

The expensive part was the lock. That hung job held the browser profile lock the whole time, so one stuck search blocked the entire loop for about six hours a day. Everything else queued up behind a job that was doing nothing.

What finally cracked it: the search step creates its working directory early in the run. If there's no directory but there is a tick receipt, the job died before it started real work. That pointed straight at the token fetch, before any browser action happened.

The fix

Three changes, roughly in order of how much they helped:

  • Moved secrets into a .env file loaded at boot, so the hot path never calls the secrets manager under load.
  • Cut the watchdog from 90 minutes to 20, so a stuck job can't sit on the lock for hours.
  • Split discovery onto its own timer, so pulling candidates can't block publishing.

After that the loop stopped starving. The queue filled up and the daily number started climbing toward the cap.

Moving to a server that doesn't sleep

Around the same time I moved the whole system off my local machine onto a dedicated always-on server, running in containers with durable state and hourly backups.

That mattered more than it sounds. Browser automation that depends on a laptop being awake isn't a 24/7 system, it's a demo. On the server the agent runs around the clock, and a deploy is a rebuild instead of a babysitting session.

Getting to 70

With the lock fixed and the box stable, the math finally worked out. Feed engagement runs twelve cycles of four, search runs six cycles of four, and notification replies fill in the rest. That lands around seventy-two candidates a day against a hard cap of seventy.

Two things keep that number honest.

The agent rewrites its own search queries based on what happens. Every published reply gets traced back to the query that surfaced the conversation, so queries that find real engagement earn more weight and dead ones drop off. That runs on its own loop and shifts the topic mix without me redeploying anything.

A daily spend governor caps model cost per brand, with a hard gate before every call. As the volume grew, that's what kept the cost flat instead of climbing with the reply count.

What this took

The annoying truth is that the throughput problem looked like a tuning issue for way longer than it should have. The instinct is to turn knobs. The real fix was finding the one job that sat on a lock while doing nothing.

What I took away: instrument the moment a step starts work, not just when it finishes. That "directory exists but nothing came out" signal is what turned a vague "output is low" complaint into a specific bug I could actually fix.

The agent runs at its cap now, on a box that doesn't sleep, tuning its own search as it goes. Twelve to seventy.


If you're a solo founder or agency owner tired of the posting treadmill, book a 30-minute demo and watch the system run live. Or grab the playbook, a free PDF on how we run SMM for $10 a day.