Credits of the image to Anthropic

Overview

In the orchestrator-workers workflow, a central LLM dynamically breaks down tasks, delegates them to worker LLMs, and synthesizes their results.

The key difference from parallelization is its flexibility—subtasks aren’t pre-defined, but determined by the orchestrator based on the specific input.

When to use

This workflow is well-suited for complex tasks where you can’t predict the subtasks needed (in research, for example, the specific sources to investigate and the nature of analysis required depend on what information is discovered along the way).

Using orchestrator-workers in Latitude

Research Intelligence Report
---
provider: openai
model: gpt-4.1
temperature: 0.3
maxSteps: 15
---

<step as="research_plan" schema={{
  type: "object",
  properties: {
    subtasks: {
      type: "array",
      items: {
        type: "object",
        properties: {
          id: { type: "string" },
          description: { type: "string" },
          type: { type: "string", enum: ["web_search", "academic_search", "expert_analysis", "data_synthesis", "fact_verification"] },
          priority: { type: "string", enum: ["high", "medium", "low"] },
          estimated_depth: { type: "string", enum: ["surface", "moderate", "deep"] }
        },
        required: ["id", "description", "type"]
      }
    },
  },
  required: ["subtasks"]
}}>
  You are a research orchestrator. Analyze the research question and break it down into specific, targeted search and analysis subtasks.

  Consider what types of sources need to be searched, what information needs to be gathered, what analysis is required, and how findings should be verified.

  <user>
    Research question: {{ research_query }}

    Context and background: {{ research_context }}

    Break this down into specific research subtasks that can be handled by specialized workers. Consider:
    1. What web sources need to be searched (news, official sites, reports)
    2. What academic or technical sources should be consulted
    3. What expert analysis or domain-specific investigation is needed
    4. How information should be synthesized and cross-referenced
    5. What fact-checking and verification is required
  </user>
</step>

/* NOTE: We initalize a list of possible responses */
{{ responses = [] }}

{{ for subtask in research_plan.subtasks }}
  {{ if subtask.type == "web_search" }}
    <step as="response" isolate>
      You are a web research specialist. Search and analyze web sources to gather comprehensive, current information on the specified topic.

      <user>
        Subtask: {{ subtask.description }}

        Research context: {{ research_query }}

        Conduct thorough web research and provide:
        1. Key findings from authoritative sources
        2. Recent developments and trends
        3. Different perspectives and viewpoints
        4. Relevant statistics and data points
        5. Source credibility assessment
        6. Information gaps or conflicting reports

        Focus on finding reliable, up-to-date information from reputable sources.
      </user>
    </step>
    {{ responses.push({ type: subtask.type, result: response }) }}
  {{ endif }}

  {{ if subtask.type == "academic_search" }}
    <step as="response" isolate>
      You are an academic research specialist. Analyze scholarly sources, research papers, and technical documentation related to the topic.

      <user>
        Subtask: {{ subtask.description }}

        Research context: {{ research_query }}

        Analyze academic and technical sources to provide:
        1. Peer-reviewed research findings
        2. Theoretical frameworks and methodologies
        3. Technical specifications or standards
        4. Research gaps and ongoing studies
        5. Expert opinions and consensus views
        6. Historical context and evolution of understanding
      </user>
    </step>
    {{ responses.push({ type: subtask.type, result: response }) }}
  {{ endif }}

  {{ if subtask.type == "expert_analysis" }}
    <step as="response" isolate>
      <s>
        You are a domain expert analyst. Provide deep, specialized analysis of the topic drawing on domain-specific knowledge and expertise.
      </s>

      <user>
        Subtask: {{ subtask.description }}

        Research context: {{ research_query }}

        Provide expert analysis including:
        1. Technical interpretation of findings
        2. Industry context and implications
        3. Risk assessment and considerations
        4. Best practices and recommendations
        5. Future trends and predictions
        6. Critical evaluation of available information
      </user>
    </step>
    {{ responses.push({ type: subtask.type, result: response }) }}
  {{ endif }}

  {{ if subtask.type == "data_synthesis" }}
    <step as="response" isolate>
      You are a data synthesis specialist. Integrate and analyze information from multiple sources to identify patterns, relationships, and insights.

      <user>
        Subtask: {{ subtask.description }}

        Research context: {{ research_query }}

        Synthesize information to provide:
        1. Cross-source pattern identification
        2. Correlation and causation analysis
        3. Trend identification and projections
        4. Comparative analysis between sources
        5. Unified timeline or framework
        6. Key insights and takeaways
      </user>
    </step>

    {{ responses.push({ type: subtask.type, result: response }) }}
  {{ endif }}

  {{ if subtask.type == "fact_verification" }}
    <step as="response" isolate>
      You are a fact-checking specialist. Verify claims, cross-reference sources, and assess the reliability of information gathered.

      <user>
        Subtask: {{ subtask.description }}

        Research context: {{ research_query }}

        Conduct fact-checking and provide:
        1. Verification of key claims and statistics
        2. Source reliability assessment
        3. Identification of conflicting information
        4. Confidence levels for different findings
        5. Recommendations for additional verification
        6. Red flags or questionable sources
      </user>
    </step>

    {{ responses.push({ type: subtask.type, result: response }) }}
  {{ endif }}
{{ endfor }}

You are the research orchestrator. Synthesize all research findings into a comprehensive, well-structured intelligence report.

<user>
  Original research question: {{ research_query }}
  Research plan executed. Worker findings:

  {{ for response in responses }}
    {{ response.type }}:
    {{ response.result }}
  {{ endfor }}

  Synthesize these findings into a comprehensive research report including:
  1. Executive summary of key findings
  2. Detailed analysis organized by topic/theme
  3. Source evaluation and credibility assessment
  4. Conflicting information and limitations
  5. Actionable insights and recommendations
  6. Areas requiring further investigation
  7. Complete source bibliography with credibility ratings
</user>

Note the use of isolate steps in all of the steps. Doing this we have a clean final synthesis of the workers’ results, without any interference from previous steps. This is crucial in orchestrator-workers workflows, as each worker’s output needs to be treated independently before the final synthesis.

This pattern is particularly effective when you have complex research questions that require different types of expertise and where the specific information sources can’t be predetermined, allowing the orchestrator to adapt the research strategy based on what information is discovered during the investigation.