Orchestrator-Workers with Spring AI: Let the Model Decide the Subtasks
Most LLM workflows I have built start the same way. I know the steps before I write the code. I call the model once to extract something, once to transform it, once to check it, and the control flow is hard-coded in Java. That works well until the input shape changes and the steps change with it. A product description needs a different breakdown than a legal summary, and a bug report needs a different breakdown than a feature request.
The orchestrator-workers pattern addresses exactly that gap. Instead of fixing the subtasks at design time, you ask a central model to look at the task and decide what pieces of work are needed. Specialized worker calls then execute those pieces, and the results are gathered into one answer.…