6.3 Model-Driven Orchestration

6 min read

In Lesson 6.2, we divided our Research Agent into three specialists: Discovery, Evidence, and Synthesis.

Each agent had a defined responsibility and structured output contract. However, Python still controlled the execution sequence.

What if the research task changes from one request to another? Sometimes we may need only source discovery. Other times we may need evidence evaluation, additional investigation, or a complete research summary.

Rather than prescribing every step, we can allow an AI agent to decide which specialists to use.

From Fixed Sequences to Dynamic Delegation

In code-driven orchestration, application code explicitly invokes each specialist.

discovery = await Runner.run(discovery_agent, notes)
evidence = await Runner.run(evidence_agent, ...)
synthesis = await Runner.run(synthesis_agent, ...)

In model-driven orchestration, a Coordinator Agent receives the research request and chooses which specialists to invoke.

For example:

  • A request to identify candidate research sources might require only the Discovery Agent.
  • A request to assess existing evidence might require the Evidence Agent.
  • A request for an evidence-backed research summary might involve all three specialists.

The coordinator makes delegation decisions based on its instructions, the available specialist tools, and the research request.

These decisions are not entirely unrestricted. In our lab, the coordinator is instructed to use discovery, evidence evaluation, and synthesis in that order when preparing a complete research summary.

The distinction is where execution control resides. In code-driven orchestration, Python explicitly invokes each specialist in sequence. In model-driven orchestration, the model selects and invokes specialist tools, guided by its instructions. Python does not enforce the sequence in this example.

This allows the coordinator to adapt its approach to different requests, although its decisions may vary between executions.

Two Patterns for Model-Driven Delegation

The OpenAI Agents SDK supports two important approaches.

Agents as tools

A coordinator exposes specialized agents as callable tools.

When it needs a specialist, the coordinator invokes that agent, receives its result, and continues its own work.

The coordinator retains responsibility for the final response.

This pattern is useful when several specialists contribute to one larger result.

Agent handoffs

An agent can also transfer control to another agent through a handoff.

In this pattern, the receiving agent takes over execution of the conversation. The original coordinator does not automatically resume after the specialist responds.

This is useful when a specialist should assume responsibility for the next stage of an interaction, rather than simply return a result to the coordinator.

The important difference is who retains control.

Agents as tools allow the coordinator to remain responsible for the workflow. Handoffs transfer responsibility to another agent.

Neither pattern automatically provides stronger reasoning, reliable evidence, or authorization to perform sensitive actions.

For our research workflow, we’ll start with agents as tools because we want the coordinator to assemble the final research response.

Building a Research Coordinator

We’ll reuse the three specialist responsibilities introduced in Lesson 6.2.

The difference is how they are invoked.

Instead of Python explicitly calling each specialist, we expose them to the Coordinator Agent.

The OpenAI Agents SDK provides the as_tool() method:

discovery_agent.as_tool(
    tool_name="discover_sources",
    tool_description="Extract source claims from supplied notes.",
)

The coordinator can then receive those agent tools in its configuration:

coordinator = Agent(
    name="Research Coordinator",
    instructions="Coordinate specialist research tasks...",
    tools=[
        discovery_agent.as_tool(
            tool_name="discover_sources",
            tool_description="Extract source claims from supplied notes.",
        ),
        evidence_agent.as_tool(
            tool_name="evaluate_evidence",
            tool_description="Assess research evidence.",
        ),
        synthesis_agent.as_tool(
            tool_name="synthesize_findings",
            tool_description="Summarize evaluated evidence.",
        ),
    ],
)

When we run the coordinator, the model decides which tools to invoke and supplies their inputs.

The Agents SDK executes the selected specialists and returns their results to the coordinator.

Python still defines which specialists are available and initiates the overall run, but it no longer contains the fixed sequence of specialist calls.

Model-driven orchestration showing a Research Coordinator selecting Discovery, Evidence, and Synthesis agents as tools, receiving their results, and producing a final research response.
The Coordinator selects specialist agents dynamically and receives their results, while the application defines the available tools and execution boundaries.

Hands-on Lab 6.3: Model-Driven Research Coordination

Exercise files: lab6_3_model_driven_orchestration.py and lab6_3_source_discovery_only.py

We’ll reuse the fictional research notes from Lesson 6.2.

The exercise introduces a Research Coordinator that can call three specialized agents:

  • Discovery Agent
  • Evidence Agent
  • Synthesis Agent

The coordinator is instructed to select the appropriate specialists based on the research request.

For a complete evidence-backed summary, the intended workflow is discovery, evidence evaluation, and synthesis.

Unlike Lesson 6.2, however, the Python application does not explicitly execute those three stages in sequence.

Experiment 1: Complete Research Request

Exercise file: lab6_3_model_driven_orchestration.py

With your virtual environment active:

python lab6_3_model_driven_orchestration.py

The script uses live model calls and may incur API charges.

What to observe

Pay attention to the specialist calls made by the coordinator.

Did it invoke all three specialists? In what order?

Examine the final response. Did the coordinator preserve the limitations identified in the underlying research notes?

Most importantly, compare the implementation with Lesson 6.2.

Previously, Python controlled every specialist invocation. Now the model makes those decisions through the available agent tools, while the SDK carries out the calls.

Experiment 2: Selective Delegation

In our first experiment, the Coordinator Agent was asked to produce a complete evidence-backed research summary. Its instructions encouraged discovery, evidence evaluation, and synthesis.

But what happens when the request requires only source discovery?

We’ll run a second script with the same three specialist agents and the same coordinator instructions. This time, the research request asks only for candidate sources.

Exercise file: lab6_3_source_discovery_only.py

With your Python environment activated, run:

python lab6_3_source_discovery_only.py

The coordinator still has access to Discovery, Evidence, and Synthesis agents. However, it is asked only to identify candidate sources from the supplied notes.

What to observe

Examine the specialist calls printed by the program.

We expect the Coordinator Agent to invoke the Discovery Agent without calling Evidence or Synthesis.

This is an expected outcome, not a guarantee. The coordinator selects tools based on the request and its instructions, and its decisions can vary.

Compare the two experiments:

Observation Complete research request Source discovery only
Expected specialists Discovery, Evidence, Synthesis Discovery
Available specialist tools All three All three
Final response Evidence-backed summary Candidate sources
Orchestration logic Model-driven Model-driven

The important distinction is that we changed the research request without changing the set of available agents or the orchestration logic.

In Lesson 6.2, Python explicitly controlled the sequence of specialist calls. In Lesson 6.3, the Coordinator Agent selects the specialists based on the task.

If the coordinator invokes unnecessary specialists, inspect the delegation trace. Model-driven orchestration provides flexibility, but it does not guarantee optimal tool selection.

What these examples do not yet handle

The coordinator is instructed to use specialists appropriately, but the application does not independently guarantee that every necessary specialist will run.

The specialist outputs still depend on model-generated content, and valid output structures do not establish factual correctness.

Both examples also use prepared research notes rather than live source discovery. They do not persist results or allow the coordinator to bypass human approval.

We’ll examine incomplete delegation, workflow state, and failure handling in Lesson 6.4.

What Did You Learn?

Model-driven orchestration allows an agent to decide how to distribute work among specialists.

With agents as tools, a Coordinator Agent invokes specialists while retaining responsibility for the final response.

With handoffs, control transfers to a specialist.

These patterns provide greater flexibility than a fixed Python sequence, but they also introduce new questions about predictability, execution visibility, and control.

Test Your UnderstandingOptional · 3 questions

Question 1 of 3

What is the main difference between code-driven and model-driven orchestration?