EngineeringNov 2026  ·  15 min read

How to Build a Multi-Agent Harness That Reacts to the World

Eight months, six iterations, and one rewrite of the heartbeat: the story of ALOHA, our Agentic Lending Operations Harness.

Consider a home loan application on its sixth day. The voice agent qualified the borrower on day one. The borrower's spouse is the co-applicant, and they have missed two calls. At 11:40 p.m. the borrower uploads three months of bank statements on WhatsApp, and one of them is password-protected. The account aggregator consent is still pending with the vendor. The credit policy can't run until the co-applicant's bureau report arrives. And the relationship manager has just corrected the declared income on the dashboard, which changes what the credit memo should say.

None of these jobs is hard on its own. Each one is a call to an agent or a tool. The hard part is what happens between them. Six events from five sources arrive in any order and at any hour. Any of them can fail, arrive twice, or arrive while the system is already acting on an earlier one. Something has to notice each event, work out which part of the journey it unblocks, and move that part forward. It has to do this exactly once, inside the borrower's calling and messaging hours, and leave a record a regulator can read months later. Now multiply that by thousands of applications open at the same time, for several lenders, on one database.

But most agent frameworks are built around a single conversation or a single task loop. A loan is neither. It is a process that runs for weeks, and the agents in it spend most of their time waiting for the world. The engineering problem is not making each agent smarter. It is building the harness that knows when the world has changed and which agent should act next.

We learned this the hard way. On one afternoon in October, our harness had tens of thousands of runs that were due and not yet started, and the oldest had been due for almost two hours. Borrowers who finished a call or a form waited one to three hours for the next step. Every agent did its own job in under 100 milliseconds. The harness around them was looking at runs one at a time, on a 30-second tick, and each pass through the backlog took 15 minutes.

In this article, we'll explain why lending operations need a multi-agent harness rather than a single agent. We'll show how ALOHA, our Agentic Lending Operations Harness, runs many agents, tools and humans as one durable journey, and walk through the six iterations it took to get here. We'll finish with the production numbers from before and after the rewrite that made it react to the world in seconds.

The Role of Agents in Lending Operations

The journey above involves six kinds of work:

  • Voice agents qualify the lead, collect consent and answer questions.
  • Chat agents continue the conversation on WhatsApp when the borrower prefers to type.
  • Document agents classify, extract and verify bank statements, ITRs, KYC and property papers.
  • Vendor tools call bureaus, account aggregators, e-sign and e-stamp providers, and the lender's own LOS and CRM.
  • Underwriting agents run the credit policy, the BRE and the credit assessment memo.
  • Humans approve, override and step in when the AI cannot help.

Despite the advancements in LLMs, relying on a single agent with a large tool list for this in production is problematic. The journey outlives any context window. Half the work waits on the outside world: a borrower who has not picked up, an upload that has not happened, a vendor that answers in minutes. And every decision has to be explained to a regulator months later.

For a lending harness to be production-grade, it has to be:

  • Reactive: when something changes in the world, the affected step should know in seconds, not on the next tick.
  • Durable: a crash, a deploy or a database restart should lose nothing and run nothing twice.
  • Auditable: every transition, every merged value and every human override should have a provenance record.
  • Respectful of the borrower: calls inside calling hours, messages inside send windows, and nothing at 3 a.m.

Introducing ALOHA

ALOHA is the workflow engine at the heart of our lending platform. A journey is a graph written in a JSON DSL. Each node is a step, either an agent (an LLM loop, a voice call, a chat) or a tool (a vendor API, a form, a document check). Each edge is a pipe: a rule that decides when the run moves and where it goes.

A simplified home-loan journey. Blue nodes are agents, grey nodes are tools, and the teal node is a human.

Figure 1: A simplified home-loan journey. Blue nodes are agents, grey nodes are tools, and the teal node is a human. Labels on edges are pipe types.

Today ALOHA runs 57 step types and five pipe types (direct, conditional, timeout, retry and decision), with cadence and slot-aware gates on top. Journeys for home loans, personal loans, business loans, education loans and collections run on the same engine for many lenders.

Architectural Components of ALOHA

Here's an overview of the architecture as it runs in production today:

The reactive harness. Outside writers set the run's alarm to now, a trigger announces it, and the worker claims it into the lane that matches the step.

Figure 2: The reactive harness. Outside writers set the run's alarm to now, a trigger announces it, and the worker claims it into the lane that matches the step.

  • The run row: one row per borrower journey. It holds the current step, the context, the lane, a single alarm and the claim token with its lease. There is no separate queue, mailbox or inbox table.
  • The wake path: anything that changes a pipe input (a call ending, a form submitted, a lead field edited) sets the alarm to now. A database trigger sends a notification on that tenant and lane.
  • The worker: one always-on process per tenant, with one slot loop per lane. A lane claims only as many runs as it has free slots.
  • The lanes: steps with uncorrelated bandwidth never wait on each other. A slow CRM does not block a WhatsApp send, and an OCR backlog does not block a decision.
  • The control path: every step, whether agent, tool or human, goes through the same decide, write and transition functions, with the same logging and provenance.
  • The outbox: messages are written as rows first and sent by a separate worker, clamped to the send window, so a provider outage never fails a step and a retry never sends twice.

None of this was the first design. Each component exists because an earlier version broke in production in a specific way.

The Iterations That Got Us Here

Six iterations in eight months. Each one was forced by a failure in production, not by a roadmap.

Figure 3: Six iterations in eight months. Each one was forced by a failure in production, not by a roadmap.

Iteration 1: The Tick Loop

ALOHA started as a rename of an internal prototype. The first runner was the simplest thing that could work: one loop per tenant that woke every 30 seconds, fetched runs that were due, evaluated each run's pipes, executed the next step and wrote an audit event.

The original runner. Correct and easy to reason about, but every run waits for every run ahead of it.

Figure 4: The original runner. Correct and easy to reason about, but every run waits for every run ahead of it.

It was correct, and for a pilot with a few hundred leads it was fast enough.

Iteration 2: Pipes as First-Class Edges

The first production journeys showed that the interesting logic lived on the edges, not in the steps. "Call again in four hours, at most three times, then send a WhatsApp" is not a step. In April we made pipes first-class: a retry pipe with bounded attempts and backoff that survives a suspended run re-entering itself, a timeout pipe with its own target, and a decision pipe that routes on a field in the context.

We also separated agents from tools in one step spec registry. An agent step can propose a write, but a proposal parks the run until a human approves it. A tool step runs deterministically. In our experience, this separation matters more than any prompt: it is the line that decides what needs a human signature.

Iteration 3: Durability Before Scale

Before our first campaign of more than 5,000 leads, we found three ways a run could be processed twice or not at all: two workers claiming the same row, a long batch outliving its claim, and a WhatsApp send that succeeded just before a crash and was retried after it. In July we added:

  • A per-run lease with a heartbeat, so a run is owned by exactly one worker and a crashed worker's runs come back.
  • A transactional outbox for WhatsApp and email, with a unique key per run, step and channel, so a re-executed step never sends a second message.
  • Maker-checker on parked runs, with HMAC-signed approve and reject and replay protection on every approval.

Iteration 4: Fork/Join and Provenance

A home loan has co-applicants, and each co-applicant has their own documents, consent and KYC. In August we added fork/join across runs: a parent run spawns one child run per co-applicant and waits for all of them. A run stays a single-token state machine, and the parallelism lives across rows. This kept every existing guarantee intact.

At the same time we made every context merge go through one function that stamps provenance on each key and diverts writes to immutable outputs into a conflicts list. When an auditor asks why a loan was approved, the answer is a chain of records, not a log search.

Iteration 5: One Control Path for Agents, Tools and Humans

By October the runner had grown many ways to move a run: the main loop, the suspended-run resume path, webhooks, manual advance from the dashboard, chat agents closing a journey. Each had slightly different logging and slightly different guards. We decided that all control flow, whether triggered by an agent, a tool or a human, goes through the same decide, write and transition functions. This was the precondition for the next rewrite: you cannot make a loop concurrent while five other code paths also move runs.

Iteration 6: The Reactive Harness

The afternoon described at the start of this article was a large campaign for a housing finance lender, and it exposed the tick loop's real cost. Runner cycles had stretched from 30 seconds to 15 minutes.

The surprising part was where the time went. The step bodies themselves were fast, with a median of 26 to 94 milliseconds. Each run still cost 400 to 1,500 milliseconds, because a step made about ten serial database round trips and every run waited behind every other run. The engine was not slow. It was serial and blind.

We looked at how others solve this: Pregel's vote-to-halt, GraphLab's asynchronous engine, and the Postgres-as-a-queue designs used by DBOS, Absurd and River. The answer was an asynchronous active set: only runs that something has woken are looked at, and they are looked at as soon as they are woken. Global supersteps, which is what our tick loop was, were the thing to remove.

The same event, two engines. The tick loop discovers the change. The harness is told about it.

Figure 5: The same event, two engines. The tick loop discovers the change. The harness is told about it.

The harness is built on five rules:

  1. One owner per run. The claim sets a token and a two-minute lease, renewed every 60 seconds. Every write compares the token.
  2. One alarm per run. The alarm means "look at me next". An outside write sets it to now. When nothing matches, the run sleeps until its earliest pipe deadline, unless a wake landed while it was being processed.
  3. One lane per step. Each lane has its own claim, slot cap and optional rate limit.
  4. Step logic is unchanged. The decide, write and transition path from iteration 5 stays the only control path.
  5. Claims stay two queries, one for runnable runs and one for suspended runs, with the same gates as before.

The second rule hides the subtle part. A run can be woken while it is being processed, for example when a call ends while the run is evaluating its pipes. If the release then wrote the next deadline unconditionally, it would overwrite that wake and the run would sleep through it. The release is a guarded write:

UPDATE runs SET owner = NULL, alarm = CASE WHEN alarm IS DISTINCT FROM :alarm_at_claim THEN alarm -- a wake landed: keep it ELSE now() + least(:next_deadline, :recheck) END WHERE id = :run AND owner = :token;

Wakes come from database triggers on the data that workflow rules actually read: a call reaching a final status, a form or document being submitted, a field on the borrower's record being edited. We scanned every workflow definition to build the list of watched fields, so a trigger never fires on changes that no rule reads.

We also fixed the event loop itself. A payment gateway call with no timeout, synchronous object-storage reads inside document steps and PDF rendering on the loop could each stall every lane at once. These moved to threads, the default executor went from 6 threads to 64, and a watchdog now logs the loop's stack whenever it is blocked for more than 500 milliseconds.

What we did not build. No new queue table, no actor framework, no LangGraph, no separate service per lane, no new database. The run row, its alarm and the existing outbox covered every requirement. Each thing we skipped has a named trigger for when we would add it, such as separate processes per lane only if the watchdog keeps finding blockers.

Comparing Results: Before and After the Reactive Harness

We shipped the harness switched off, byte-for-byte the old loop, and enabled it for one tenant at a time. Below are the numbers for the housing finance tenant, comparing the eight days before the switch with the days after it, on a single worker.

MetricBeforeAfter
Median time from a finished call to the next step69–91 minutes2–5 seconds
Runs moved within one minute of a finished call0%65–76%
Peak steps per minute187–207480–782
More than a thousandfold reduction in the time a borrower waits after a call. The bars use a log scale.

Figure 6: More than a thousandfold reduction in the time a borrower waits after a call. The bars use a log scale, since a linear scale would make the second bar invisible.

How we measured. "Time to next step" is the gap between a voice call reaching a terminal status and the next step starting on the same run, taken from the audit trail. The after-window excludes the first days of the rollout and a day when a second worker also ran the harness, which roughly doubled capacity and would have flattered the result.

Speed was the goal, but correctness was the bar. Over the same period we checked that:

  • no step ran twice at the same time;
  • no runs were lost, and every overdue run was held by a campaign or lead-window rule, not by the harness;
  • no messages went out outside the send window;
  • the harness recovered on its own from an unplanned database restart;
  • the connection pool reported no errors.

The moves that still take more than a minute are not waiting on the design. They are bounded by how much concurrency we allow each lane, which we are raising gradually as we watch the shared database.

Lessons From Six Iterations

  • The edges are the product. Most of a lending journey is waiting, and the rules for waiting (retries, timeouts, slots, cadences) deserve to be first-class, validated and audited.
  • Make it durable before you make it fast. Leases, the outbox and maker-checker came months before concurrency. Without them, the reactive harness would only have made duplicate sends happen faster.
  • One control path, then concurrency. You cannot reason about a concurrent engine while several code paths move runs in slightly different ways.
  • Be told, don't discover. A tick loop asks every run whether anything changed. A reactive harness lets the change announce itself and keeps a slow poll only as a safety net.
  • Isolate bandwidth, not code. Lanes are not microservices. They are slot caps in one process that stop a slow vendor from becoming everyone's problem.

A multi-agent harness that delivers outcomes is less about the agents than about the harness. The voice agent, the chat agent and the underwriting agent were good months ago. What changed for the borrower is that the moment one of them finishes, the next one starts, inside the borrower's hours, exactly once, with a record of why. The time a borrower waits after a call has gone from more than an hour to a few seconds, and the rest of the journey has followed.

Redefine Lending
with Agentic AI

Harness conversational AI and Machine Learning to deliver faster business growth, higher recoveries, at lower costs.