AI agent orchestration example: trace the workflow from routing to recovery

AI agent orchestration example: trace the workflow from routing to recovery

Key takeaways

  • An AI agent orchestration example should expose control flow, context, state, and error handling.
  • A single well-equipped agent is better than a poorly orchestrated team.
  • Choose a framework by the runtime responsibilities your workload requires, including permissions, recovery, deployment, and evaluation.

A final response alone is insufficient to evaluate an acting system. At Rifty, we treat the execution trajectory as the useful unit of inspection. That means following the work from the first routing decision through state changes, approvals, observations, failures, and recovery.

Our method is to read the workflow as a series of runtime commitments. For each stage, name the controller, the state it reads and writes, the authority it receives, the event it records, and the recovery path available after failure. This turns an agent diagram into an inspectable execution. It also separates model behavior from the harness responsibilities that surround it.

What does an AI agent orchestration example need to expose?

An orchestrator manages four connected concerns: control flow, context assembly, state, and error handling. If an architecture diagram shows only which agent talks to which, it leaves most of the control surface hidden. You still need to see what information enters each step, what state survives the handoff, and what happens when a step does not complete.

This is the practical boundary behind agent orchestration. Control flow answers which step runs. Context assembly determines what that step receives. State preserves what the workflow must remember. Error handling determines how control changes after a failure. Reading all four together prevents a capable model from being mistaken for a complete runtime.

The structure can be deterministic or LLM-driven. Deterministic orchestration is predictable and cheap, but limited. LLM-driven orchestration is flexible, more expensive, and less predictable. Most production systems combine the two: deterministic structure around individual steps that allow LLM flexibility.

That hybrid is more concrete than the usual box-and-arrow view of AI agent orchestration architecture. A model can analyze an input inside a bounded node. The harness can decide when that node runs, what context it receives, which output shape it must return, and where control goes after validation. The distinction is not cosmetic. It tells you which behavior comes from the model and which guarantee must come from the runtime.

The worked example from alert to recovery

Microsoft Agent Framework's fraud-detection workflow exposes the full path in one run.

A fraud alert fans out to usage, location, and billing analyses, routes low risk to auto-clear and high risk to human review, and recovers from saved checkpoints.

The execution trajectory makes the control system visible:

Workflow stageControl and stateScoped work and outputApproval or recovery behavior
Alert intake and fan-outThe incoming alert starts parallel branchesUsage, location, and billing agents receive scoped workEach agent uses scoped MCP tools
Three analysesParallel execution keeps the branches activeEach agent produces its analysisThe branches remain separate until aggregation
Typed aggregation and routingOutputs become a typed risk assessmentThe assessment supplies the routing inputLow risk is auto-cleared; high risk goes to human review
Checkpointing and observationCheckpoints save execution stateType-safe messages carry data between nodesOpenTelemetry and event logs expose the run
Interrupted or failed executionThe workflow resumes from saved stateA failed agent or executor restarts at its node checkpointCompleted steps are not rerun

The useful boundary is between analysis inside the agent nodes and explicit runtime control at fan-out, aggregation, routing, observation, and recovery.

What are common AI agent orchestration patterns?

Common patterns include sequential, parallel, loop, routing, hierarchical, and group-chat structures. These names describe the shape of coordination, but the shape alone does not tell you how state, permissions, or recovery work.

Use the pattern name as the start of an architecture review, not its conclusion. Our AI agent architecture patterns framing keeps the workload and its control boundaries attached to the structure.

A sequential structure passes work through ordered steps. Parallel structures run branches concurrently. Loops repeat work. Routing selects a path. Hierarchical structures delegate through levels, while group-chat structures coordinate through a shared conversation. A workflow can combine these structures, as the fraud example does with parallel analysis followed by aggregation and deterministic routing.

Two separate Microsoft demonstrations show why the pattern should match the work. A plan-first orchestrator describes the available agents and their capabilities to an LLM, creates a bullet-point roadmap, and may decide that some team members do not need to participate. Delegation begins after that plan exists.

An aggregation workflow starts from concurrent work instead. Researcher, marketer, and legal agents analyze a product, and their outputs are combined into a three-sentence executive brief. One example narrows participation before delegation. The other synthesizes parallel results. Both are orchestration, but they place coordination at different points in the execution.

Authority belongs at tool and environment boundaries

Routing work is only half the design. The runtime must also decide which actions require approval and how that decision moves through the system. In the MAF and AG-UI integration, MAF decides whether a tool needs approval. AG-UI transports the approval request to the client and returns the client's decision to the server.

That split identifies separate responsibilities. The agent framework owns the approval decision. The interface layer carries the request and response. Treating “human in the loop” as a single feature would hide both boundaries and make it harder to tell where a missing, delayed, or malformed decision belongs.

Approval is not the first line of containment. Deterministic environment boundaries should be established before model-layer steering. A permitted egress path may look ordinary to the model layer, so model monitoring need not identify it as unusual. The environment still needs to define what the process can reach.

Isolation strength should also reflect whether the user can evaluate the action an agent is about to take. This connects authority to real oversight capacity. An approval screen does not settle the architecture by itself. The system still needs an explicit decision owner, a transport path, a bounded environment, and isolation that matches the user's ability to judge the proposed action.

How should orchestration recover when a side effect may already exist?

A timeout does not prove whether an external action happened. That uncertainty changes recovery. In the Local Anki agent, an addNote timeout is ambiguous, and blindly retrying the call could create a duplicate.

The recovery procedure does not treat the timeout as a simple failed step. It loads a previously approved run and verifies that the run can resume. It preserves confirmed cards, then reconciles unresolved cards by idempotency tag. Only missing cards are created, and progress is persisted through completion. The idempotency tag gives the recovery path something concrete to reconcile against before another external write occurs.

This example exposes a boundary that ordinary retry logic misses. The system has local knowledge of an attempted call but uncertain knowledge of the external side effect. Reconciliation resolves that uncertainty before creation continues.

Durable execution records completed function steps so work can resume after crashes, restarts, or infrastructure failures without losing state, repeating side effects, or requiring custom retry logic. A durable execution engine handles retries, idempotency, state persistence, and recovery. Those primitives are related, but they do different work: persistence remembers progress, idempotency controls repeated operations, and recovery chooses how execution continues.

The AWS sample orchestrator shows a wider recovery set. Its recovery mechanisms combine state-transition checkpoints, idempotent operations, stuck-task scanning, counter reconciliation, and a dead-letter queue. Checkpoints alone are therefore not the whole recovery contract. A production design may also need to locate stuck work, reconcile accounting state, and move work that cannot proceed into an explicit failure path.

Our preferred test is simple: for every side-effecting node, trace what the runtime knows before the call, after a confirmed response, and after an ambiguous timeout. Write a recovery contract that makes the supported mechanism visible at each state.

Traces connect debugging to evaluation

Workflow traces have two distinct jobs. They can debug an individual run and supply higher-signal examples for systematic evaluation of the agent workflow. The first job asks what happened in one execution. The second uses recorded executions to assess behavior across the system.

An instrumentation plan can grow in stages. It can begin with SDK initialization and error capture, then add LLM and tool tracing. Token and user context can follow. Parent-child spans and handoffs make multi-agent relationships visible, while quality metrics and feedback loops extend observation into evaluation. This progression keeps the trace connected to the execution structure instead of producing a flat stream of unrelated logs.

Monitoring is still one layer in a defense-in-depth stack. It belongs beside complementary evaluations and preventative controls. Logs may show that a tool call occurred, but the permission boundary determines whether the call was allowed. A trace may reveal a bad handoff, while a checkpoint and recovery contract determine what the runtime can safely do about it.

For an execution review, we look for the relationship among parent and child spans, tool activity, state transitions, routing decisions, and recovery events. The goal is not more telemetry for its own sake. It is a legible trajectory that supports debugging and later evaluation.

Coordination costs belong in the architecture

Parallel execution adds coordination costs. It complicates state management and result merging. Agents working on related files can conflict, and concurrent activity can become difficult for users to follow. Those costs appear precisely where a tidy fan-out diagram looks simplest.

Runtime controls put boundaries around that coordination. Orchestration should set iteration limits, validate between steps, manage context aggressively, and design for failure. These controls keep an agent loop from becoming an unbounded source of additional state and work.

Cost and latency belong in the design as constraints. The controls can include retry caps, per-agent token budgets, and workflow-step limits before human escalation. Treat those controls as configurable review prompts for the workload, not universal architecture requirements.

Multi-agent decomposition has to earn its place in the architecture. Parallel branches introduce merging, conflict, legibility, budget, and recovery requirements. If those responsibilities are absent from the architecture, adding agents has expanded the control problem without supplying the controls.

What is the best AI agent orchestrator for your workload?

Choosing an AI agent framework means deciding which parts of the agent runtime your team will own. Fit depends on the intended system's orchestration, state, permissions, recovery, deployment, and evaluation requirements.

Framework selection starts by assigning orchestration, state, permissions, recovery, deployment, and evaluation ownership between the team and the framework.

Use this runtime-ownership checklist before comparing feature lists:

  • Orchestration: Name the control structure the workload requires. Record whether your team or the framework implements its routing, loops, fan-out, and aggregation.
  • State: Identify the execution state that must persist. Assign ownership for saving it, loading it, and carrying it across handoffs.
  • Permissions: Mark where tool and environment authority boundaries are enforced. Keep the approval decision distinct from the transport that carries it.
  • Recovery: Assign ownership for checkpoints, retries, idempotency, reconciliation, and failed-work handling. Include the ambiguous side effects that require reconciliation before another write.
  • Deployment: Record the deployment responsibilities that remain with your team and those supplied by the framework or platform.
  • Evaluation: Identify the execution data used for individual-run debugging and systematic evaluation. Include the spans and handoffs needed to reconstruct the trajectory.

The same test applies to AI agent orchestration open-source projects and AI agent orchestration GitHub repositories. A repository label or coordination demo does not answer who owns state, permission checks, recovery, deployment, and evaluation. Trace those responsibilities through the code and documentation.

An AI agent orchestration platform may be an orchestration framework that builds and runs agents, an observability platform that monitors and debugs them, or a managed platform that supplies full-stack agent infrastructure. These categories assign different runtime work to the platform and to your team.

A single well-equipped agent is better than a poorly orchestrated team. Apply the execution-trajectory worksheet above to one workflow your agents already run. If the ownership gaps point to a runtime decision, compare them against our AI agent orchestration framework guide.

More from Lab Notes.