Orchestration and orchestrators
Orchestration
What order and conditions should the work follow?Orchestrator
The system that connects work in that flowOrchestration sets the order of tasks and tools, decides what comes next based on results, and defines when to stop. It can guide one agent through several tool calls or coordinate results across multiple agents.
An orchestrator is a program or system that runs or manages that workflow. It can provide a workspace for directing several tasks, or it can be a component where code or an agent decides what happens next. Its role and level of automation depend on the implementation and product. OpenAI Agents SDK · Agent orchestration
For example, orchestration defines the sequence “fix search, run the tests, and retry up to twice if they fail.” The orchestrator runs that sequence and manages task status and results.
1. Getting more from AI
A developer can ask an AI agent, “Add search to this existing application.” The agent can inspect the code, change the necessary files, and run tests when it has access to the right tools.
As a feature grows, there is more to check. The developer needs to find the screen where the search box belongs and understand how the searchable data is stored. They also need to check for existing search code and tests. Once changes are made, someone needs to verify that search returns the expected results.
One agent can take on the whole request. The user then reviews which files it read, what it changed, and which checks it ran.
If several parts can be investigated independently, multiple agents can work on them at the same time. One can inspect the UI code while another looks at the data format. Their findings can be reviewed together before implementation begins.
When managing multiple tasks, the goal is to know what is in progress, make sure the right findings reach the next task, and review the final result with better context.
2. Breaking a goal into tasks
Goals and tasks
A goal is the outcome the user wants. If the goal is working search, investigating the screen and checking the data format are tasks that help achieve it.
Before splitting up the work, define what each task needs as input and what it should return.
| Task | What to inspect | What to pass along |
|---|---|---|
| UI review | The screen and code for the search box | Screen and files to change |
| Data review | Search targets and data format | Required data and current handling |
| Test review | Existing tests and coverage gaps | Checks to run after the change |
In this hypothetical example, all three investigations can start independently against the same codebase. Once their findings are available, the agent making the change can use them to implement the feature.
What can run in parallel and what has to wait
The UI and test investigations can start together. Verifying that the changed code works must wait until the change is ready to test.
When one task needs the output of another before it can start, that relationship is called a dependency. Some tasks run in parallel, while others continue after they receive a prior task's results.
An example flow looks like this.
Investigate the UI, data, and tests → Pass along the findings → Change the code → Verify the changes → Human review
Splitting independent work creates opportunities to run tasks together. Actual time and cost depend on the work, execution environment, model, usage, and the effort needed to combine and verify results.
Walk through task breakdown and handoffs in the search example3. Keeping track of the work
If three tasks are assigned separately, the user needs to check where each one stands.
- Is the UI investigation complete?
- Is the data investigation still running?
- Which files did the test investigator check?
- Which findings reached the person or agent making the change?
- Who will follow up if the findings disagree?
When the work grows to ten tasks, there are more statuses to check and more results to pass along. If the user has to remember information scattered across windows and transfer it by hand, managing the work becomes another task of its own.
For example, the UI investigation may be done while the data investigation is still running. Someone needs to know which findings have reached the implementer. If the test investigation fails, someone also needs to determine what to request next.
When statuses are gathered in one place, the user can find completed work, see why something is waiting, and focus first on decisions that need their attention.
Increase the task count and find work that needs inputTask status and handoff context
Task status shows what is done and what is waiting. Context gives the next owner the information they need. For example, the implementer receives the UI findings and data format, and the task view shows whether implementation is running.
Task records help show how far a run got before it stopped. Whether it can resume depends on the saved information and the product's recovery features.
4. What an orchestrator does
An AI coding agent orchestrator is a tool or system that connects work assigned to coding agents and manages the flow, status, and results.
A person sets the goal and constraints. Within their assigned scope, agents read files, change code, or run tools. The orchestrator connects tasks to their owners, tracks which results each task is waiting for, and passes needed results to the next task or back to the user.
Specific behavior depends on the product and its settings. Common capabilities to look for include the following.
Connect tasks and owners
Link a task such as “investigate the UI” to its repository and assigned agent. The user can then find the work associated with a goal.
Show progress
Distinguish states such as waiting, running, completed, and failed. The user can also see when a task needs more information or approval.
Pass results to the next task
Send the file locations found during the UI investigation and the format identified during the data investigation to the implementer. The system may also identify dependencies and manage the order of execution.
Gather results and evidence
Connect changed files, tests run, and failures to their tasks. The user can review those records and decide what to do next.
Let people step in
Some products help people direct each session themselves. Others can delegate assignments to a lead agent or configured rules. Within the capabilities of the product and its settings, users can inspect work, add instructions, and make decisions.
5. Direct and delegated coordination
Direct coordination
Delegated coordination
Even for the same search feature, different participants can decide what to do and start the next step.
When a person coordinates directly
The user opens and directs the UI, data, and test investigations. They check progress, read completed findings, and pass the relevant information to the implementer.
The orchestrator provides a workspace where the user can open and move between tasks and review their status and records. The person takes an active role in assigning work and making decisions.
When coordination is delegated
The user provides a goal and constraints, such as “Add search and verify it.” A lead agent or configured workflow can split up the investigation, receive the findings, and connect them to implementation and testing.
The user reviews progress and results, adding instructions or giving approval when needed. What gets assigned automatically and how far the workflow proceeds depend on the product and its settings.
The two approaches can be combined within one job. For example, a person might choose the investigators and then delegate the order of implementation and testing.
Compare direct and delegated coordination step by step6. Multiple agents and agent types
Running the same agent more than once
The same coding agent can run in multiple sessions, with a different task in each. For example, three sessions of the same agent could investigate the UI, data, and tests.
Here, three refers to the number of running sessions. They can all use the same kind of agent.
Connecting different agents
Some orchestrators provide an environment for connecting and running different coding agents. A user can keep using a familiar agent while trying another, or choose different tools for different tasks.
Check more than the agent names. For each product, look at whether it can start an agent, read its status, send input, or stop it, along with the required authentication and execution environment.
Also check whether one agent can delegate to a different kind of agent and whether the user can launch each agent separately in its own session.
Explore agent session counts and types step by stepBranching and stopping in the search example
Suppose the implementer changes the search code and the tester runs the tests. This example allows up to two retries after a fix if a test fails. The result determines what happens next.
Branching chooses the next action based on the test result. On pass, the user sees the changes and test logs. On failure, the implementer gets the error and the updated code is tested again.
The stop condition in this example is a passing test or reaching the retry limit. If the tests still fail after two retries, automation stops and a person receives the failure record for review. Two retries is the limit chosen for this example.
If the test command never runs, investigate that separately from a failing test. Implementations can choose the next path with a coded condition or an agent decision. OpenAI Agents SDK · Coordination patterns
Try passing, failing, and retrying tests step by step7. Combining and verifying results
File locations found by an investigator can help the implementer. The findings still need to be checked, as does whether the changed code works as expected.
For the search feature, the person or agent verifying the work can do the following.
- Enter a search query in the updated application.
- Check that matching items appear.
- Check the screen when there are no matches.
- Record the tests run and their results.
- Review the changes and test results together.
When an agent reports “done,” the user can inspect the record of what was checked and which version was tested, then decide whether more verification is needed.
Applying this to an out-of-stock indicator
Imagine adding an out-of-stock indicator to a product list. The UI owner builds the display using sample data, while the server owner includes actual stock availability in the response.
If they agree on the data format up front, they can start independently. After the UI and server are connected, both in-stock and out-of-stock cases need to be tested with real data.
If the server sends a field under a different name than the UI expects, pass the actual response and failed check to both owners. Align the format and check again.
8. Platforms and execution environments
Once you understand the orchestrator's role, you can look at three areas for each product.
A. Platform
Where work starts and how it is managed. This includes managed cloud, user-connected execution environments, agent coordination, scheduled tasks, event triggers, team collaboration, APIs, and CLIs.
B. Agents it can run
Which agents can be connected and how far the product can start, monitor, and control each one.
C. Execution environment
Where people operate the work, such as a terminal, desktop app, mobile app, or web browser. Also check the location of the computer or server where the agent actually runs.
Each topic can later have its own detailed page covering definitions, use cases, execution flows, product-specific capabilities, and sources.
Check your understanding
- Look at the first diagram. Which responsibilities can the developer delegate when several agents are working?
- Which search investigations can start together, and which verification step must wait for the changed code?
- As the number of tasks grows, what information does a person need to remember and pass along?
- How can an orchestrator help the user handle that information?
- When coordination is direct or delegated to a lead agent, who decides what happens next?
- How does running the same kind of agent three times differ from connecting three different kinds?
- What records can the user review after an agent reports completion?