Part 4: Agents frame, solvers decide
Part 4 of 5 in a deep dive on money movement as an optimization problem, and how AI agents can use scheduling and matching algorithms. Start with Part 1 if you are new to the series.
Six jobs for the agent, one for the solver
The split I would build gives the agent six jobs and the solver one. The agent reads the instruction, gathers the state, writes the model, checks the plan and runs it. The solver finds the best plan inside the model and says how good it is.
- Read the instruction and the mandate. “Pay every approved invoice due by Monday, keep €2 million in the main EUR account, and get a second approver for anything above $500,000.” Agent payment mandates, such as the ones AP2 carries, already encode spend limits, merchant categories and time windows. In the model they become constraints, so the solver cannot trade them away for a lower fee.
- Gather state through tools. Balances by account, open obligations, FX and off-ramp quotes, rail calendars, compliance status.
- Write the model. Jobs, operations, machines, costs and penalties for a schedule; a cost matrix for an assignment or a reconciliation.
- Call the solver, with a time limit. It returns the best plan found and, for the Hungarian method or a MILP, a bound or certificate showing how close to optimal it is.
- Check the plan outside the model, then execute. A separate validator re-checks limits and sanctions, and people approve the irreversible, high-value steps.
- Replan on events. A payment bounces, a quote expires, a new obligation lands. The agent updates the model and solves again, on a rolling horizon.
The evidence for the split
OptiMUS-0.3, a Stanford system where an LLM writes the optimization model and solver code, beat GPT-4o working alone by over 38% on easy problems and 40% on hard ones. Its authors are also candid that it is difficult to ensure the LLM's model is correct and complete, which is why step 5 exists.
The other direction has been tested too. Researchers at Paris Dauphine fine-tuned an 8-billion-parameter LLaMA model on 130,000 job shop instances written in natural language, and it beat classic priority dispatching rules and a neural baseline. That is a model that learned good rules of thumb. I would use something like it as a fast first guess, and keep the solver as the judge, because only the solver can say how far the plan is from the best one.
The solver also gives you a reproducible record. The same inputs give the same plan, the binding constraints explain each choice, and an auditor can rerun it next quarter.
Back to Friday: the schedule
Part 3 decided which pool pays which obligation. The schedule decides when, and on a Friday the scarcest machine is a person. The mandate requires a second approver above $500,000, and one approver is free until 17:00 CET.
| Operation | Machine | Must finish by | Planned |
|---|---|---|---|
| Approve EUR supplier run | Approver | 16:50 CET | 16:35 to 16:45 |
| Submit to T2 | EUR bank | 17:00 CET customer cut-off | 16:45 |
| Approve Mexico payment | Approver | Friday close | 16:45 to 16:55 |
| Send USDC to off-ramp, convert to MXN | Off-ramp partner | Saturday morning | Saturday 09:00 CET |
| Approve US seller payouts | Second approver | Monday 08:00 ET | Monday 07:00 ET |
| Send FedNow batch | USD bank | Monday 09:00 ET | Monday 07:30 ET |
The largest payment goes last, because it has the most slack and runs on a 24/7 rail. A person ordering by size would send the $6 million first and miss T2's cut-off for the suppliers. When the off-ramp partner pauses withdrawals on Saturday morning, the agent changes one cost to a penalty, solves again, and the new plan shows what moved and why.
That is the design working. Part 5 is about the ways it fails.
Continue to Part 5: Where it breaks