Build Log / Entry 003 / Automation
Workflow automation without the subscription.
One Kestra worker node would have cost about $40,000 a year. Our own orchestrator cost half that, and now runs our AI workflows, business logic and CI/CD.
The short version
- Building our own orchestrator cost about $20,000, against roughly $40,000 a year for one Kestra worker.
- Don't dispatch work with Postgres LISTEN/NOTIFY: a missed notification fails silently. Poll instead.
- Claim work with one atomic UPDATE guarded by status, so only one worker can win each task.
- One orchestrator can run AI workflows, business logic and CI/CD: 40 flows, over 200 runs a day, Jenkins retired.
In this entry · 4 sections
Every workflow platform we looked at priced itself per worker node, per execution, or per seat. Kestra, the most capable of them, worked out to roughly $40,000 a year for a single worker, before any of the AI prompt work or CI/CD migration we eventually needed it for. n8n wasn’t a cheaper way to the same place. LangChain was free and open source, but the wrong tool: a library for chaining LLM calls, not somewhere to put durable business logic, schedules, retries and an audit trail.
We built our own instead, for an estimated $20,000 in engineering time. It does exactly what we need, and nothing we’re paying for and not using.
A job is a row, not a message
The first version used PostgreSQL’s LISTEN/NOTIFY to tell workers when there was work to do. It looked right and failed quietly: NOTIFY is fire-and-forget, so a worker whose LISTEN connection was down during a restart, a failover, or a momentary pool exhaustion simply never heard about the work. Flows sat there looking stuck while the rest of the system reported healthy.
We replaced it with polling, which sounds like a step backward and isn’t. Every worker runs the same cycle on a fixed interval: start any flow that’s ready, process finished tasks, and claim pending tasks for its own worker group. The claim itself is one atomic update, guarded by its own WHERE status = 'PENDING' clause, so if two workers reach for the same row only one of them actually changes it:
UPDATE task_execution
SET status = 'CLAIMED', worker_id = :workerId
WHERE id = ANY(:candidateIds) AND status = 'PENDING';
-- Rows affected tells the worker which claims it actually won.Nothing is lost if a worker restarts mid-cycle: the row it would have claimed is still PENDING, and the next poll, on any worker, picks it up. One worker is elected leader, through ShedLock rather than anything bespoke, and only the leader runs the things that must happen once per cluster: cron schedules and the stuck-task safety net. Everything else, every worker does, all the time, against rows any of them can see.
Forty flows, two hundred runs a day
What runs on it now spans further than the name “workflow orchestrator” suggests. Government agency monitoring (the FTC, the EC, national competition regulators, FDA drug shortage notices), financial calendar and corporate-actions ingestion, a dozen different email import pipelines, note classification and summarization for Merger Daily’s AI features, and, more recently, our own CI/CD: a pull request or a merge starts a flow directly, instead of waiting on a dedicated Jenkins server, which we retired.
Forty flows run in production, averaging over 200 executions a day. None of it needed a second platform; it’s the same dispatch loop, the same worker pool, the same place every prompt and every pipeline step is reviewable in one UI.
Growing pains, now settled
It wasn’t smooth the whole way. Running forty flows at this volume surfaced memory allocation problems and errors we hadn’t hit at smaller scale, and there was a small stretch of instability while we tracked them down. It’s stable now, and worth what it cost to get there.
What it says about building software now
Building this ourselves, for a fraction of what a year of Kestra would have cost, is a small, direct example of something larger: AI-assisted development has made it genuinely faster to build infrastructure that used to take a dedicated team and a much longer timeline. That’s a real advantage for a company our size. It’s also a harder thing to sit with than it sounds. The same shift that let us build this cheaply is making the software itself, including tools like the ones we chose not to buy, worth less than it used to be. We’re better off for having built it. We’re not pretending that’s the whole story.