Zenpanik
Scheduling the money: job shops, Hungarian matching and AI agents in paymentsBy Pavel Nikolov, November 8, 2026

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.

  1. 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.
  2. Gather state through tools. Balances by account, open obligations, FX and off-ramp quotes, rail calendars, compliance status.
  3. Write the model. Jobs, operations, machines, costs and penalties for a schedule; a cost matrix for an assignment or a reconciliation.
  4. 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.
  5. Check the plan outside the model, then execute. A separate validator re-checks limits and sanctions, and people approve the irreversible, high-value steps.
  6. 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.
Mandatespend limitsminimum balancesapproval rulesAgent framesreads balances,quotes, calendarsand cut-offs;writes the modelSolver decidesschedule: CP or MILPmatching: Hungarianreturns a planand its boundPolicy checkre-checks limitsand sanctions;people approveirreversible stepsExecuteT2, Fedwire, FedNowSEPA Instantstablecoin railsEventspayment bouncesquote expiresnew obligationpartner pausesapprovedreplanThe two teal boxes are the split this piece argues for.
Figure 6. The agent writes the model, the solver picks the plan. Read it clockwise from the mandate; every event loops back to the agent, which rewrites the model and solves again.

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.

OperationMachineMust finish byPlanned
Approve EUR supplier runApprover16:50 CET16:35 to 16:45
Submit to T2EUR bank17:00 CET customer cut-off16:45
Approve Mexico paymentApproverFriday close16:45 to 16:55
Send USDC to off-ramp, convert to MXNOff-ramp partnerSaturday morningSaturday 09:00 CET
Approve US seller payoutsSecond approverMonday 08:00 ETMonday 07:00 ET
Send FedNow batchUSD bankMonday 09:00 ETMonday 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