← Selected work

Regulated financial services

An LLM workflow tool used by 40,000 people

Orchestrated LLM workflows at scale — and ~30% fewer database queries on the same platform.

Contribution
Senior engineer on the product team. The query-volume reduction and a crucial system component were individually owned.
Stack
Python · FastAPI · SQLAlchemy · React · LLM orchestration
Service
AI-Driven Process Automation
Two planes. Above, design time: an administrator authors the orchestrator — a graph of steps in which the step currently executing has three successors whose rules are met, drawn solid and bracketed as eligible now, and a fourth drawn dashed because its rule is not met from here. The steps, their instructions and their transition rules are persisted with the run's state in PostgreSQL. Below, runtime: every chat interaction fires two separate LLM calls. One decides the flow — reading the chat history, the run state and only the steps the rules allow — and returns three ranked next steps. The other executes the current step on the chat history plus that step's own instructions, and may retrieve from a knowledge base or call an internal API where the step was configured for it, reaching internal systems only. Both outputs land in the chat, where the user clicks one suggestion at an approval gate; nothing proceeds unattended, and the chosen step becomes the current step.

The problem

A workflow tool in regulated financial services, built in two halves. An administrator authors the process itself — the steps, the instructions each step runs on, and the rules deciding which step may legally follow which. The people doing the work never open that builder: they are in a chat, and an LLM decides what should happen next inside a process somebody else defined.

By the time of this work the product was past the question most AI products are still asking. It had roughly 40,000 unique users, which turns the problem inside out: the job is no longer to prove the idea, it is to keep a system fast while shipping into it, with priorities and team composition changing underneath the work.

The approach

Delivery across the stack

Delivery ran across the whole stack — Python and FastAPI with SQLAlchemy over PostgreSQL on the server, React and TypeScript on the client — so features landed end to end rather than being handed across a boundary halfway.

The queries nobody counted

The performance work was a separate exercise in reading what the application actually did, as opposed to what the code appeared to say. At scale, the expensive thing is rarely a slow query; it is the number of queries nobody counted — the same data fetched twice a request, work done per row that could be done per set, calls that exist because a function three layers up did not trust its caller. Removing those, rather than optimising them, cut query volume by around 30% and raised backend throughput by the same mechanism: the fastest database call is the one that is never made.

Two calls, two jobs

The other individually owned piece is the one the diagram above shows: the flow that decides what the user should do next. Every interaction in the chat fires two separate LLM calls with different inputs and different jobs. One executes the current step — the chat history plus that step’s own authored instructions, with retrieval or an internal tool call where the administrator configured the step for it — and produces the answer. The other decides the flow: it reads the run’s state and the steps the authored rules currently allow, then returns two or three ranked suggestions for what to do next. The user clicks one. Nothing advances unattended, and the model cannot propose a step a human did not already make legal.

The constraint is the design

That constraint is the design, not a safety wrapper around it, and it is what lets a feature like this through a review in regulated financial services: the set of legal moves is computed from rules somebody accountable wrote, and the model exercises judgement strictly inside it. The same applies to what a step may do — retrieval and tool calls exist on a step only where they were configured, and reach internal systems only.

Where selection breaks down

One honest limit, because anyone who has shipped an LLM feature will ask. The authored graph can nest to any depth, and selection quality falls away as it gets deeper: the more structure an administrator built, the stranger the model’s choices became. That is an argument for keeping the legal set small and computed rather than for trusting a larger context window — and it is the reason the narrowing happens in the rules before the model is ever called.

What shipped

This component was delivered ahead of its deadline and at quality, through repeated shifts in priority and in who was on the team. What it does is suggest and await approval; the extension planned beyond that was never built.

The result

  • A product used by ~40,000 unique people.
  • ~30% fewer database queries on that platform, with throughput up accordingly.
  • The decision-and-recommendation flow delivered early, under conditions that usually produce the opposite.

Two notes on honesty, since this is a study about someone else’s product. The 40,000 is adoption of the product, not of a feature built alone — it is stated here as the scale the work happened at, not as a personal score. The ~30% is directly attributable.

Have a system shaped like this one?

Thirty minutes, no pitch deck. You describe the problem; I tell you honestly whether I’m the right person to solve it.

Book a 30-min discovery call
Book a call