Guides

AI orchestration: what runs, in what order, and who can stop it

By Abdul Asim ·

The short answer

AI orchestration is the layer that decides what runs, in what order, with what data, and who is allowed to stop it. It sits above the model and below your application, and it is where most of the engineering in a production AI system actually lives. The useful question is not which orchestration framework to adopt, but how much freedom the model gets over control flow, and the answer is usually less than teams assume.

What does AI orchestration actually do?

Strip away the tooling and an orchestration layer has four jobs. Every system I have shipped does all four, whether or not anyone named them:

  • Sequencing. Which step runs next. Sometimes that is fixed in code, sometimes the model chooses.
  • Routing. Which tool, retriever or branch handles this particular request.
  • State. What each step is allowed to see, and what carries forward to the next one.
  • Control. Where the work stops: validation gates, human approval, retry limits, cost and step ceilings.

The fourth one is the one that gets added last and should be designed first. A system with no step ceiling and no stop condition is not an autonomous agent, it is an unbounded loop with a billing account. Think of this layer the same way you would any other pipeline in the engineering sense: stages you can test one at a time, with defined behaviour when a stage fails.

Three shapes, and how to pick one

Orchestration in AI comes in three shapes. They differ in exactly one dimension: how much control flow the model owns.

ShapeWhat the model decidesGood forMain risk
Fixed pipelineNothing about control flowKnown inputs, repeatable output, audit requirementsRigid, and every new case needs code
RouterWhich branch or tool handles the requestMixed question types over the same dataA wrong route fails quietly
Agent loopOrder, tool choice, and when to stopOpen-ended tasks with no known pathCost, latency, and hard to reproduce

Anthropic's engineering write-up on building effective agents draws the same line, and it is worth borrowing the vocabulary: a workflow is a system where models and tools are orchestrated through predefined code paths, while an agent is one where the model dynamically directs its own process and tool use. The write-up catalogues the workflow patterns, including prompt chaining, routing, parallelisation, orchestrator-workers and evaluator-optimiser, and recommends the simplest thing that works before adding autonomy. Note it was published in December 2024 and says the tooling has moved since, so take the patterns rather than the tooling advice.

The agent loop itself is not new. The reasoning-and-acting pattern described in ReAct interleaves reasoning traces with actions such as a lookup against an external source, so the model can revise its plan as it gathers information. That is a genuine capability and the right choice when nobody can write the steps down in advance. It is also the most expensive and least reproducible of the three, which is why it should be the shape you arrive at, not the one you start from.

Most systems need less autonomy than they get

The strongest case I can make for fixed pipelines comes from a reporting system, not a chatbot. The AI leadership reporting workflow I built for the Center for Creative Leadership runs in a strict order: report inputs and requests arrive in SharePoint, a data-validation layer runs, a language model drafts, a separate analysis-validation layer checks the result, then the report goes to team leads through an Outlook approval workflow, and only approved reports reach the relevant teams. Reported usage is 1,100 users and approximately 40 leadership reports a week.

Nothing in that system decides its own order, and that is the feature. The model has exactly one job in the middle of a pipeline that was designed around two questions: are the inputs trustworthy, and may this leave the organisation. An agent loop here would add cost and variance while removing the property the client actually needed, which is that every report took the same path and someone signed it off.

When I review an AI build that is behaving unpredictably, the cause is often that a fixed sequence was handed to a model as a set of tools it could call in any order. If you can draw the steps on a whiteboard and the arrows never change, write the arrows in code. Reach for agents when the path genuinely varies per request, and when you do, my guide on multi-agent systems covers the related question of how many agents you actually need, which is usually fewer than the design proposes.

Put the deterministic step in the middle

Good orchestration is often about what the model is kept away from. The MavenIT quoting workflow I built is a pipeline with a hard deterministic core: the model interprets the request and matches it against historical quote records, then defined pricing rules calculate the figure, and a request with no suitable historical match goes to a person rather than getting a plausible substitute. Reported usage is 22 users and an average of 70 quotes a day.

That shape generalises well beyond pricing. Anywhere the output is a number, a commitment or a record that something else depends on, the orchestration layer should route that step to code and keep the model on the language around it. The pattern is worth stating as a rule: let the model decide what to do, and let deterministic steps decide what is true.

The same logic applies to validation. Putting a check before the model and a different check after it, as the reporting workflow does, is an orchestration decision, not a model decision. One step asks whether the inputs are complete. The other asks whether the generated analysis holds against them. Collapsing both into a single review step is how one of them quietly stops happening.

Routing is usually the cheapest win

Between a fixed pipeline and a full agent loop sits routing, and it is where I get the most improvement for the least added risk. The model makes one bounded decision, which branch handles this request, and everything after that is ordinary code.

In Permit Signal, users ask about construction permits and properties across a documented ingestion scope of three million permits and sixty thousand property records. Some questions are about meaning, some carry a permit number, some are about a place, and some need a count. The system routes each message to the retrieval method that fits: semantic search, BM25 keyword retrieval, SQL, or spatial lookup in PostGIS, with location and property filters applied alongside. One embedding index could not serve that traffic, and no amount of prompt work would fix it. Letting retrieval choose its own route is the pattern my agentic RAG guide covers in depth.

The McKissock sales assistant routes on outcome instead of on query type. It answers from product and internal knowledge, and when a request stays unresolved it calls a tool that creates a HubSpot support ticket. One bounded decision, two destinations, and a buyer who is never left stuck. Both builds are agentic in the narrow sense that matters: the model picks the route, not the rules.

What breaks once real traffic arrives

Orchestration failures look different from model failures. The model is usually fine. The system around it lost track of what it was doing.

  • Partial failure. Step four fails after steps one to three had side effects. Decide now what a half-finished run leaves behind, because the answer will not be obvious at three in the morning.
  • Retries without idempotency. A retried step that creates a ticket, sends a mail or writes a record creates it twice. Every step with an external effect needs a key that makes a repeat safe.
  • State that outgrows the context. Long runs accumulate history until the important part is buried in the middle of the prompt, where models are measurably weaker at using it.
  • No ceiling. Step limits, token budgets and wall-clock timeouts per run. An agent loop without these is the single most expensive bug in this field.
  • No per-step traces. If you cannot see which step ran, with what input, in what order, you cannot debug the run, only re-run it and hope.

The third point has evidence behind it: research on how language models use long contexts found that models do best when relevant information sits near the start or end of the input and noticeably worse when it sits in the middle. An orchestration layer that appends every step's output to a growing transcript is manufacturing that failure. Summarise, or pass references instead of full text. The logging discipline that makes any of this debuggable is the same one I describe for production RAG pipelines, and the operational side of getting there is in taking an AI pilot to production.

Choosing the shape for your own system

Work through these in order. In my experience the answers point at a pipeline far more often than teams expect.

  1. Write the steps down as a sequence. If you can, and the sequence does not change per request, build a fixed pipeline and stop here.
  2. Ask what varies. If the inputs vary but the path does not, you need better retrieval, not an agent.
  3. Count the real decision points. One or two bounded choices is a router. Many, with no predictable order, is an agent loop.
  4. Mark every step that must be deterministic: prices, totals, records, anything irreversible. Route those to code.
  5. Name the stop conditions before you build the loop: step ceiling, token budget, timeout, and what the system says when it gives up.
  6. Decide where a human can intervene, and make sure a rejection has somewhere to go.
  7. Decide what a mid-run failure leaves behind, and make every externally visible step safe to retry.

If step three lands on an agent loop, the structure of the agent itself becomes the next question, and my AI agent architecture guide covers planning, memory and tool design. If you are still deciding whether you need an agent at all, AI automation versus AI agents is the better starting point. If you would rather have the shape chosen and built with you, that is what my custom AI agentic system engagement covers.

Key takeaways

  • AI orchestration is sequencing, routing, state and control. Design the control part first, not last.
  • Three shapes exist, separated only by how much control flow the model owns: fixed pipeline, router, agent loop.
  • Start with the simplest shape that works. Autonomy is something you add when the path genuinely varies, not a default.
  • Let the model decide what to do, and let deterministic code decide what is true. Prices, totals and records belong in rules.
  • Routing is the best value in the middle: one bounded model decision, ordinary code either side.
  • Give every loop a step ceiling, a token budget and a timeout before it reaches production.
  • Make externally visible steps idempotent, and trace every step, or you will only be able to re-run failures rather than diagnose them.

Let's talk

Let's ship yours.

AI product, automation bottleneck, RAG use case, or operational workflow. Tell me what's slowing your team down, or what revenue you're leaving on the table.

Abdul Asim, AI / LLM Engineer