In Module 5, we built a Research Agent capable of discovering sources, evaluating evidence, proposing findings, and saving approved records.
Until now, we’ve treated this as one agent with access to different tools and instructions.
But what happens when the work becomes more complex, and different parts of the task benefit from different expertise?
Why Do We Need Orchestration?
Consider a research request:
Investigate whether AI coding tools are changing how product managers work, using credible sources and identifying conflicting evidence.
Completing this task involves several different responsibilities:
- Discover relevant research and articles.
- Evaluate source credibility and supporting evidence.
- Compare findings and identify contradictions.
- Prepare a coherent conclusion for review.
A single agent could perform all these activities. But as the workflow becomes larger, it becomes harder to manage the responsibilities independently, inspect intermediate results, and respond when one step is unsuccessful.
We could instead introduce specialized agents, each with a narrower responsibility.
But that creates a new architectural problem: Who decides which agent runs, what information it receives, and what happens next?
That’s the role of orchestration.
Orchestration coordinates the execution of agents and tools within a larger workflow, including task sequencing, delegation, information exchange, and handling results.
Orchestration can also coordinate tools and execution steps within a single-agent workflow. In this module, we’ll focus specifically on multi-agent orchestration.
Different Approaches to Orchestration
There are two primary approaches to orchestrating multiple agents: code-driven and model-driven. These can also be combined into a hybrid design.
Code-driven orchestration
Application code determines which agent runs and in what order.
Example: In a loan processing system, a Document Extraction Agent extracts application information, a Verification Agent examines supporting documents, and a Summary Agent prepares a recommendation for a loan officer.
Python controls the sequence. Each agent performs its assigned task but does not decide which agent runs next.
Advantages: Predictable execution, easier testing, debugging, and auditing.
Limitation: Less flexible when the necessary steps cannot be determined in advance.
Model-driven orchestration
An AI agent decides when and how to delegate work to other agents.
Example: A Research Coordinator investigating an emerging technology decides whether it needs additional market research, technical analysis, or investigation of conflicting evidence.
The coordinator can select specialists based on the request and what it discovers during execution.
Advantages: Flexible, adaptive, and suitable for exploratory tasks.
Limitations: Less predictable execution, potentially higher costs, and more challenging evaluation.
Hybrid orchestration
Application code establishes boundaries while agents make selected delegation decisions.
Example: A customer support coordinator decides whether an issue requires billing investigation or technical troubleshooting. However, application code enforces authentication and approval before sensitive account changes.
Advantages: Combines flexible delegation with explicit business controls.
Limitation: Adds architectural complexity because responsibilities must be divided carefully between application code and agents.
Which Approach Is More Common or Advanced?
There is no established universal ranking of which orchestration approach is most common in production.
Code-driven orchestration is well suited to predictable business workflows. Model-driven orchestration is particularly useful for open-ended tasks where the necessary steps cannot always be known in advance.
Hybrid designs are especially relevant to enterprise systems, where agents may make decisions within boundaries enforced by application code.
More autonomy does not necessarily mean a better or more mature architecture.
The right choice depends on how predictable the workflow is, how much flexibility it requires, and what controls must remain outside the model.
Why We’ll Start with Code-Driven Orchestration
Before allowing an AI coordinator to decide how agents collaborate, we need to understand what coordination actually involves.
We’ll begin with a simple example using two specialized agents:
- Source Analysis Agent: Examines supplied research material and identifies claims, supporting evidence, and limitations.
- Summary Agent: Converts the analysis into a concise research summary while preserving uncertainty.
Python controls the sequence:
Python → Source Analysis Agent → Python → Summary Agent → Python

The first agent doesn’t call the second agent. It returns its result to Python, which then passes that result to the second agent.
This makes it easier to see where execution control resides and how information moves between agents.
Later in the module, we’ll explore what changes when a Coordinator Agent makes delegation decisions dynamically.
Hands-on Lab 6.1: Your First Orchestrated Workflow
In this exercise, we’ll use the OpenAI Agents SDK to run two agents sequentially.
The example uses prepared research material rather than live discovery, keeping our attention on orchestration itself.
Exercise file: lab6_1_code_orchestration.py
The script defines two agents and uses Python to coordinate their execution.
The essential orchestration logic is:
analysis = await Runner.run(
source_agent,
research_material
)
summary = await Runner.run(
summary_agent,
str(analysis.final_output)
)
Notice that the second Runner.run() call uses the first agent’s output as its input.
The Python application explicitly controls both calls.
Run the Exercise
Open a terminal in the extracted lab-06 folder. Create and activate a virtual environment there and set your API key, as described in the lab’s README.md, then install the lab’s requirements and run the exercise:
python -m pip install -r requirements.txt
python lab6_1_code_orchestration.py
The remaining Module 6 exercises use this same environment.
The script makes live model calls and may incur API charges. The research material is synthetic and should not be interpreted as verified evidence of productivity improvement.
What to Observe
The program executes two steps.
Step 1: Source Analysis Agent
The first agent examines a prepared research note describing an illustrative reduction in prototype development time from 15 to 5 days.
In our test execution, it identified the main claim and appropriately highlighted limitations, including the lack of a control group and the absence of maintenance-quality evaluation.
Step 2: Summary Agent
Python passes the analysis to the Summary Agent.
In our test, the second agent produced a concise summary that preserved the uncertainty and did not present the reported improvement as a proven causal result.
The exact wording may vary between executions.
The important observation is that neither agent calls the other.
Python controls when each agent executes and what information is passed between them.
The Agents SDK Runner manages each individual agent execution, including its internal interactions with the model. Our Python application coordinates the sequence between those runs.
What This Example Does Not Yet Handle
Our orchestrator controls the execution sequence, but it does not validate the information exchanged between agents.
The Source Analysis Agent returns free-form text, which Python passes directly to the Summary Agent without checking its completeness or quality.
If the first agent returned incomplete or misleading analysis, the current orchestration code would not independently detect the problem before forwarding it.
The exercise also uses predefined research material rather than discovering external sources. It does not yet use MCP tools, shared persistent state, or autonomous agent delegation.
These are deliberate simplifications.
In the next lesson, we’ll introduce specialized research agents and structured output contracts to make information exchange more predictable. Later, we’ll examine how orchestration handles incomplete results and execution failures.
What Did You Learn?
Orchestration coordinates the execution of agents and tools within a larger workflow.
In our first example, two specialized agents performed different responsibilities, but Python remained in control of execution and information transfer.
We also introduced three architectural approaches:
- Code-driven: Application code controls execution.
- Model-driven: Agents make delegation decisions.
- Hybrid: Application controls coexist with agent-directed work.
Each approach has advantages and tradeoffs. The appropriate choice depends on the workflow and the level of flexibility and control required.
Test Your Understanding
Question 1 of 3
What is the primary responsibility of an orchestrator?