Almost every fast-moving AI project eventually hits the same wall: a five-step run has already paid for three frontier model calls, hits a timeout on step four, or pauses until Monday morning for human sign-off. Teams that cram that state into a volatile cache or a homegrown background loop end up losing jobs, billing tokens twice, or losing track of what actually ran.

In spring 2025, Andrej Karpathy wrote candidly while building MenuGen about how sharp the jump from prototype to real software still is. As long as everything runs inside an open browser request, refreshing the tab wipes out work in flight; once real users arrive, you need a database and dependable background execution. Multi-step AI pipelines sharpen that problem because single steps run for minutes, providers throw rate limits, and humans have to approve budgets or releases mid-run.

I run PostgreSQL, Redis, NATS, and Temporal side by side every day. I just refuse to bend one into doing another's job.

Friday Evening at the Budget Gate, Sunday Morning Reboot

In the earliest phase of ForgeCenter, there was no workflow engine at all: just PostgreSQL for business records, Redis for queues and locks, and a separate project board in the UI. For short linear tasks, that looked fine for weeks.

Then the real mechanics of a multi-step software delivery pipeline collided. At five on Friday afternoon, a work item finishes its requirements and architecture stages, having spent real token budget on a frontier model, and pauses before step four awaiting my approval. At three on Sunday morning, a host reboots for maintenance or a background worker restarts mid-task.

Right at that seam, stretching a cache and a custom queue breaks down. Services poll every few seconds to check whether a stage finished. After a restart, stale locks linger in Redis while PostgreSQL shows the job half-complete and the separate UI board displays a third version of reality. Two sources of truth tracking one lifecycle always contradict each other eventually. By Monday morning, you are either scrubbing orphaned status rows by hand or restarting from zero and paying for the first three model calls twice. Plenty of software developers avoid a workflow engine there because it looks heavy, then spend months writing half of a buggy one out of timers, retry counters, and cron sweeps. It rarely ends well.

Fig. 1: A 48-hour weekend pause after three paid model steps. A volatile cache loses the thread across a Sunday reboot; Temporal sleeps at zero CPU load and resumes at step four on Monday.
Fig. 1: A 48-hour weekend pause after three paid model steps. A volatile cache loses the thread across a Sunday reboot; Temporal sleeps at zero CPU load and resumes at step four on Monday.

Four Tools, Four Distinct Jobs

In ForgeCenter today, every piece of state has one home so no service carries foreign baggage:

  • PostgreSQL: Role in ForgeCenter: Permanent system of record for projects, cost ledger, permissions, and audit trail · Restart & Failure Behavior: Survives every reboot; authoritative source for billing and recovery
  • Temporal: Role in ForgeCenter: Durable workflow memory (durable execution) for multi-step AI runs and human gates · Restart & Failure Behavior: Replays exact last completed step from PostgreSQL; zero duplicate billing
  • NATS: Role in ForgeCenter: Lightweight message bus (JetStream) for fast signals like Git pushes and verdicts · Restart & Failure Behavior: Delivers compact pointers asynchronously; never owns business truth
  • Redis: Role in ForgeCenter: Volatile in-memory cache checking worker slots and atomic daily spend caps in milliseconds · Restart & Failure Behavior: Allowed to forget anytime; rebuilds daily counters from PostgreSQL

With that split, Redis went back to doing what an in-memory store does best. Before any worker fires a costly model request, Redis checks in under a millisecond whether our daily cost cap has headroom and a sandbox slot is free. Auditing that check early on exposed a classic trap. Many engineers wire cache checks fail-open so a brief Redis hiccup waves traffic through rather than blocking calls. On an AI cost brake, fail-open is backwards: the moment infrastructure stumbles, your spending cap switches off silently. Ours runs strictly fail-closed. If Redis is down, zero paid calls leave the box, and once it recovers it reloads the day's total straight from PostgreSQL.

Splitting those roles also ended UI drift overnight. My Kanban view in the operator console keeps no separate status column of its own; it queries live state directly from Temporal instead of mirroring rows in a second table. If a running workflow rejects a click because a budget check or precondition failed, the card snaps right back in the browser without leaving stale UI state behind. NATS meanwhile acts purely as a fast background courier passing compact pointers like UUIDs, sandbox paths, or commit hashes between services, with zero temptation to park multi-day human approvals inside a message queue.

Durable Execution and Two Sharp Edges in Production

In July 2025, Cornelia Davis at Temporal called AI agents distributed systems on steroids, and the reason is obvious in operation: one user request fans out into dozens of external model calls, container runs, and tool invocations, any of which can stall or hit a rate limit. Durable execution, a runtime that persists every completed step before advancing, matches that failure profile cleanly.

The core rule sits between outer Workflow code and individual Activities. Workflow code defines only the deterministic sequence: validate scope, reserve budget, await approval, launch sandbox checks. Every unpredictable external operation, especially model calls and test suites, lives isolated inside an Activity with explicit timeout and retry policies. When a run pauses Friday evening for my sign-off, it sits at zero CPU and zero polling all weekend, then wakes on the exact next line Monday at 08:15.

Running Temporal in production has real sharp edges, though. Two cost me real debugging time. First, our background workers initially spiked hard on RAM at boot because each worker bundled TypeScript workflow code dynamically in memory while holding dozens of old schedules open. Bigger servers would only have hidden the waste; pre-bundling workflow code during our regular build flattened startup memory right away.

Second, recurring schedule workflows append every event since day one to a single history by default, growing without bound over months until recovery lags. Temporal solves that with ContinueAsNew, like closing a full accounting ledger at quarter-end and carrying only the current balance onto page one of a fresh book. Add a real team learning curve: calling the system clock, random numbers, or direct network I/O inside outer Workflow code breaks deterministic replay on restart. Without a build linter blocking those calls, nearly every engineer trips that wire once.

Fig. 2: How the four state roles fit together. PostgreSQL keeps permanent records, Temporal carries long-lived runs, NATS couriers signals, and Redis enforces sub-millisecond cost brakes.
Fig. 2: How the four state roles fit together. PostgreSQL keeps permanent records, Temporal carries long-lived runs, NATS couriers signals, and Redis enforces sub-millisecond cost brakes.

When a Plain PostgreSQL Table Is All You Need

Seeing how cleanly Temporal handled multi-day gates in ForgeCenter, it would be easy to drop it into every new repo by habit. I deliberately avoid that.

When I built immoHunter to score real-estate listings automatically, the same question came up: pull listings, run deterministic financial formulas, deduplicate records, and write a brief summary. Nothing there waits over a weekend for a human click or coordinates external sandboxes for forty minutes.

Adding a workflow engine there would have been pure overhead. Instead, immoHunter runs nightly batches off one plain job table in PostgreSQL guarded by an advisory lock, a lightweight database lock ensuring two workers never grab the same pending row twice. If a malformed listing fails at two in the morning, the error sits cleanly on that row, and the next run continues with zero extra containers in the stack.

My rule of thumb in architecture reviews is straightforward. Under three sequential steps, finishing in minutes with zero multi-day human pauses, a plain PostgreSQL job table with an advisory lock beats running extra orchestration machinery every time. Once paid multi-step AI loops, multi-day human budget or release gates, and strict restart recovery collide in the same pipeline, Temporal pays back its learning curve twice over. A cache is built to be fast and allowed to forget; a business workflow still has to know Monday morning what was already paid for on Friday afternoon.