AI Agent Orchestration: Patterns, Tradeoffs, and a Working Design
Reliable orchestration turns model activity into work you can assign, inspect, recover, and accept. This guide develops a concrete design for a dependency-upgrade assistant and shows where fixed workflows, dynamic delegation, and human decisions belong.
AI-assisted technical guide with linked primary sources. Examples are illustrative unless stated otherwise. How these guides are made.
Orchestration starts with control flow
AI agent orchestration is the coordination layer that decides what work starts, which context and tools it receives, what must finish first, and what counts as an acceptable result. A useful design answers those questions before choosing a framework. Several model conversations running at once do not establish ownership, recovery, or completion.
Anthropic’s architecture guide distinguishes predefined workflows from systems where models choose their next actions. It also describes orchestrator-worker delegation for tasks whose subtasks emerge during execution. These are architectural options, not maturity levels every project must climb.
For a repository maintenance tool, keep package-policy checks deterministic while allowing an agent to investigate an unfamiliar failing test. Letting the model decide whether a policy check is necessary weakens a known requirement. Conversely, hard-coding every investigation step can make diagnosis brittle. Draw the boundary around decisions whose correct sequence you already know.
Choose the smallest useful orchestration pattern
| Task shape | Pattern | Main design question |
|---|---|---|
| Known dependent steps | Sequential workflow | What evidence permits the next step? |
| Independent bounded checks | Parallel fan-out and join | What happens when one check fails? |
| Different known task types | Router with explicit destinations | Can uncertain classification escalate? |
| Subtasks discovered during investigation | Supervisor with workers | Who validates scope and integrates output? |
Apply these distinctions to a proposed dependency upgrade. Static analysis, license-policy checking, and test execution can be separate checks after dependency installation. Two agents independently rewriting the same compatibility layer are a different arrangement: their outputs compete and require reconciliation.
Prefer a fixed pipeline when the task is repeatable. Add model-directed delegation when investigation regularly reveals genuinely different work. Require the supervisor to emit a structured task contract rather than an informal request to “handle the backend.” More participants introduce more contracts to maintain.
A worked design for a dependency-upgrade assistant
Consider an illustrative assistant that proposes a library upgrade without deploying it. Its input is a repository revision, a target package, and allowed version bounds. Its output is a reviewed branch and an evidence bundle. The design below is a proposal, not a tested implementation or a benchmark result.
- Validate: confirm repository identity, clean-worktree policy, allowed package, and available verification commands.
- Plan: let one investigator inspect release notes and relevant usage, then produce bounded subtasks.
- Approve scope: reject plans that require unrelated packages, production credentials, or deployment access.
- Implement: assign a worker an isolated checkout and an explicit file scope.
- Verify: run deterministic checks and an independent diff review against acceptance criteria.
- Present: produce the branch, changed behavior, exact check results, unresolved risks, and a human decision request.
The investigator may discover that a migration requires coordinated source changes. That is a reason to revise the plan, not permission to spawn unlimited workers. If two subtasks own the same manifest, assign that manifest to one integration owner. Treat the shared lockfile as a dependency decision, even when a textual merge appears straightforward.
Keep deployment outside this assistant’s allowed actions. A separate release workflow can consume the verified branch using its own authorization and checks.
Make every delegation a durable contract
A task contract should identify the task, parent run, repository revision, working directory, allowed files, available tools, acceptance checks, deadline, and expected output format. Include the reason a task depends on another result. “Use the latest schema” is ambiguous; a specific artifact revision is inspectable.
{
"task_id": "upgrade-42-compat",
"base_revision": "recorded-before-start",
"scope": ["src/adapter", "tests/adapter"],
"depends_on": ["upgrade-42-investigate"],
"result": ["diff", "checks", "limitations"],
"completion_requires": "integration-owner acceptance"
}This illustrative contract omits provider-specific execution fields intentionally. The important property is that the coordinator can validate a worker result against a recorded assignment. Store the actual base commit in a real run; do not leave the descriptive value above as production configuration.
LangGraph’s persistence documentation distinguishes thread checkpoints from cross-thread stores. Its in-memory checkpoint implementations do not survive process restarts. When using that stack, select storage according to the recovery guarantee you need. More generally, save orchestration state independently of a model’s conversational recollection.
Design recovery around side effects
Suppose a worker finishes writing a branch but the coordinator disconnects before recording success. Starting the entire task again can overwrite useful work. Reconcile the branch and recorded task state first. A timeout means the coordinator lacks timely evidence; it does not prove that the attempted action never happened.
Separate retryable investigation from externally visible effects. Give a write operation a stable identity where the receiving system supports deduplication. Bound retry attempts and preserve the last observed result. For uncertain outcomes, enter a reconciliation state rather than guessing success or failure.
The LangGraph interrupt guide warns that resuming an interrupted node re-runs code before the interrupt. Side effects there need idempotency or a different placement; even post-approval writes need retry handling. That specific behavior illustrates why “the framework saves state” does not establish exactly-once effects.
Cancellation also needs ownership. Stop accepting new subtasks, request termination of active work, inspect remaining processes, and preserve partial artifacts. Never equate closing a supervisor conversation with proving that all of its tools and descendants stopped.
Observe decisions and verify outcomes
Record transitions such as assigned, running, waiting for input, ready for review, rejected, and accepted. Include timestamps and a freshness signal. These are proposed workflow states; a model completion message alone should not move the task to accepted. Acceptance requires the evidence defined by the task contract.
OpenTelemetry traces represent work as spans with operation timing, context, attributes, and parent relationships. For a distributed implementation, use that model to relate a supervisor run, worker attempt, and tool operation. Trace identifiers explain where time went; they do not prove that an upgrade preserved behavior.
For this assistant, retain check commands, exit status, relevant failure summaries, the verified revision, and reviewer findings. Avoid storing unrestricted prompt or tool-output dumps by default. Measure time waiting for humans separately from execution time. If review is the bottleneck, more workers increase the backlog rather than verified delivery.
Keep local coding sessions in view
A developer testing this design may run separate Claude Code or Codex sessions while manually coordinating assignments. Purrvio’s Mac preview can help keep supported local sessions visible and return you to the terminal that needs attention. Its richest session support is for Claude Code and Codex; it reads supported local session records and processes without installing agent hooks.
Purrvio does not schedule these tasks, enforce their contracts, or provide the distributed trace system described above. Those responsibilities remain in your application and development workflow. Session navigation supports Ghostty and Terminal.app; direct replies require Ghostty and Automation permission.
If session visibility is the missing piece, try the free Mac preview. It supports macOS 13 or later on Apple silicon and Intel. Read the installation notes: this locally signed preview is not Apple-notarized.
Check the design before increasing concurrency
- Identify which decisions are fixed rules and which require model judgment.
- Give each worker a bounded scope, revision, tool boundary, and result contract.
- Assign one owner for integration and shared artifacts.
- Persist progress in storage that survives the failures you intend to recover from.
- Test interruption immediately before and after an external write.
- Make approvals specific to the proposed action and its current inputs.
- Distinguish an agent finishing from a reviewer accepting its result.
- Increase parallelism only after checking review capacity and integration failures.
Start with one representative upgrade and deliberately interrupt it. Check whether another operator can determine what happened from the saved state and evidence. A design that recovers clearly from that exercise is a stronger foundation than a large agent graph whose successful demo depends on uninterrupted execution.
Frequently asked questions
Does AI agent orchestration always require multiple agents?
No. A single agent can operate inside an orchestrated workflow with tool boundaries, approval gates, persistence, and verification. Add workers when separable work and measurable outcomes justify the coordination cost.
When should an orchestrator let a model choose the next task?
Use model-directed planning when the necessary subtasks cannot be known before investigation. Keep fixed requirements, permission boundaries, budgets, and acceptance rules in inspectable application logic.
Is Purrvio an orchestration framework?
No. Purrvio provides visibility into supported local coding sessions and supported terminal navigation. Scheduling, task contracts, recovery, permissions, and acceptance remain responsibilities of your workflow or application.
Sources and further reading
Primary references checked for this guide on 10 November 2026. Documentation can change; confirm version-specific behavior before using commands in a production workflow.
- Anthropic: Building effective agents
Primary explanation of predefined workflows, model-directed agents, and orchestrator-worker delegation; used for the architectural distinction, not current product availability.
- LangGraph persistence
Documents checkpoint and store responsibilities and the restart limitations of in-memory checkpoint storage.
- LangGraph interrupts
Documents pause/resume behavior and why re-execution around interrupts requires care with side effects.
- OpenTelemetry traces
Defines spans, parent relationships, context, timing, and attributes used to explain orchestration observability.