Understanding the Orchestrator-Worker Pattern

Continuing our journey through agentic AI patterns, today we're diving into a design that lies at the heart of most scalable, robust agentic systems: the orchestrator-worker pattern.

If earlier patterns like reflection loops and prompt chaining helped us build self-improving or linear workflows, this one addresses a different kind of challenge: coordination and specialisation.

What Is the Orchestrator-Worker Pattern?

At a high level, this pattern splits the responsibilities in a multi-step task between two types of agents:

  • Orchestrator: A high-level coordinator responsible for understanding the overarching task, breaking it down into subtasks, assigning those to appropriate workers, and aggregating their results.
  • Workers: Specialised agents (or sub-agents) that execute individual tasks as assigned by the orchestrator. These can range from simple function calls to independent LLM-based agents with their own internal logic.

The design echoes patterns found in other parts of computing, particularly map-reduce and microservice architectures. But in an agentic context, it offers a particularly elegant way of balancing central control with decentralised intelligence.

Why Use This Pattern?

The orchestrator-worker pattern becomes especially useful when dealing with:

  • Complex tasks that can be decomposed into subtasks
  • Tasks requiring different types of expertise

Structural Overview

Here's a simplified breakdown of how the pattern works:

User Request

[ Orchestrator ]

┌─────────────┬─────────────┬─────────────┐
│ Worker A │ Worker B │ Worker C │
│ (Sentiment) │ (Keywords) │ (Trends) │
└─────────────┴─────────────┴─────────────┘

[ Aggregation & Final Response ]

Each worker is responsible for a narrowly-defined role. The orchestrator doesn't need to understand how each worker completes their job-only what input they require and what output they produce.

This separation of concerns is what makes the pattern so powerful.

A Practical Example: Trip Planning with Gemini and Task-Oriented Workers

Let's ground the orchestrator-worker pattern in a real-world scenario: planning a multi-day trip to Paris. This involves:

  • Understanding the traveller's goal
  • Decomposing it into smaller, manageable subtasks
  • Assigning each subtask to the appropriate expert agent (worker)
  • Executing the plan in sequence or parallel, as required

For this, we use Google's Gemini model via the @google/genai SDK, along with a schema to structure and validate our planner's outputs.

Step 1: Define Task & Plan Schemas

We start by describing the shape of our tasks using structured schemas:

const taskSchema = {
type: Type.OBJECT,
properties: {
task_id: { type: Type.NUMBER },
description: { type: Type.STRING },
assigned_to: {
type: Type.STRING,
description: 'Which worker type should handle this? E.g., Trip_Planner, Flight_Agent, Hotel_Agent',
},
},
required: ['task_id', 'description', 'assigned_to'],
};

const planSchema = {
type: Type.OBJECT,
properties: {
goal: { type: Type.STRING },
steps: {
type: Type.ARRAY,
items: taskSchema,
},
},
required: ['goal', 'steps'],
};

Step 2: Planner Prompt & Goal Decomposition

The orchestrator (Gemini in this case) is prompted to take a user's high-level goal and convert it into a structured plan with task assignments:

const userGoal = 'Plan a 3-day trip to Paris, book flights and a hotel within my budget.';

const plannerPrompt = `
You are an expert travel orchestrator. Break the following travel goal into 3–5 sequential subtasks.
Assign each to a worker type like Trip_Planner, Flight_Agent, Hotel_Agent.
Be precise in task descriptions, and ensure budget-awareness.

Goal:
${userGoal}
`
;

This prompt primes the model to think step-wise, be aware of budgetary constraints, and select the appropriate agent type for each subtask.

Step 3: Generate and Execute the Plan

We ask Gemini to respond with JSON matching our schema. Once the plan is returned, we parse and iterate through the tasks:

const result = await ai.models.generateContent({
model: 'gemini-2.5-pro-preview-03-25',
contents: plannerPrompt,
config: {
responseMimeType: 'application/json',
responseSchema: planSchema,
},
});

const raw = result.text;

let plan;
try {
plan = JSON.parse(raw!);
} catch (e) {
console.error('❌ Failed to parse plan response:', raw);
return;
}

for (const step of plan.steps) {
console.log(`Step ${step.task_id}: ${step.description} (Assignee: ${step.assigned_to})`);
}

Each subtask is precise, scoped, and routed to a designated worker class. This is the orchestrator-worker pattern in action: the planner is your orchestrator, and the Trip_Planner, Flight_Agent, and Hotel_Agent are the workers.

Expand here for a full output sequence

Goal: Plan a 3-day trip to Paris, book flights and a hotel within my budget.

Step 1: Clarify travel dates, total budget for the 3-day Paris trip (covering flights, hotel, activities, and food). Research and propose a draft 3-day itinerary outline, considering budget constraints and user preferences for Parisian experiences. (Assignee: Trip_Planner)

Step 2: Based on confirmed travel dates and the flight portion of the budget defined in task 1.0, research and secure round-trip flights to Paris. Prioritize options offering the best value while remaining strictly within the allocated flight budget. (Assignee: Flight_Agent)

Step 3: Based on confirmed travel dates and the accommodation portion of the budget defined in task 1.0, research and book a hotel in Paris for 3 nights. Consider preferred location (e.g., central, proximity to attractions) and ensure the selected hotel adheres to the allocated accommodation budget. (Assignee: Hotel_Agent)

Step 4: With flights and hotel confirmed, finalize the detailed 3-day Paris itinerary. Integrate specific activities, dining recommendations (budget-conscious options), and local transportation plans. Perform a final check to ensure the comprehensive trip cost (flights, hotel, planned activities, estimated daily expenses) aligns with the total established budget. (Assignee: Trip_Planner)

A more robust example

What we have seen so far worked, however it was merely scratching the surface - we only displayed which agent would be doing the task. Let's walk through how a simple travel planner script evolves into a fully agentic system by actually getting the worker agents to do the work. We'll compare specific code decisions and highlight how each contributes to increased modularity, realism, and adaptability.

Manual Task Output vs. Schema-Guided Planning

In the original version, the planning logic was embedded as a static string, like:

console.log(`Step 1: Clarify travel dates... (Assignee: Trip_Planner)`);
console.log(`Step 2: Book flights... (Assignee: Flight_Agent)`);

There's no logic - just printed lines. No LLM is involved. It's a display format, not a planning system.

In the new version, planning happens dynamically through a planner agent using a structured schema:

const plannerPrompt = `
You are an expert travel orchestrator. Break the following travel goal into 3-5 sequential subtasks.
Assign each to a worker type like Trip_Planner, Flight_Agent, Hotel_Agent.
Be precise in task descriptions, and ensure budget-awareness.
Goal:
${userGoal}
`
;

const planSchema = {
type: Type.OBJECT,
properties: {
goal: { type: Type.STRING, ... },
steps: { type: Type.ARRAY, items: taskSchema, ... },
},
};

Instead of prewriting the steps, the LLM is prompted to generate them, and its response must match the schema. This introduces two key shifts: The plan is goal-driven and dynamic and the system enforces structure via planSchema, ensuring the LLM output is predictable and parseable.

From Labels to Modular Role-Based Execution

Previously, labels like (Assignee: Flight_Agent) were purely descriptive. They had no impact on logic or execution.

In the new code, these roles drive actual agent behavior. Each task is dispatched like this:

for (const step of plan.steps) {
await dispatchToWorker(step, memory);
}

Inside dispatchToWorker, the system uses role-based logic:

const agentPrompt = getAgentPrompt(role, step.description, memory);
// ...
result = await ai.models.generateContent({ model, contents: agentPrompt });

This structure gives each worker its own prompt context and execution logic, effectively turning roles into behavioral units.

For example:

case 'flight_agent':
return `You are a Flight Agent. Previous context: ${memory['trip_planner'] || '[No trip context]'}`;
// Chooses best flight from staticData

Now, roles aren't just tags - they're pluggable, specialized agents.

No State vs. Shared Memory Coordination

The first version had no shared context - each step existed in isolation.

In the agentic version, a shared memory object stores the output of each agent:

memory[role] = (memory[role] || '') + `\n\n[Task ${step.task_id}] ${output}`;

This lets downstream agents access previous decisions:

Previous context:

${memory['trip_planner'] || '[No trip context provided]'}

For example, the Hotel_Agent can see the dates and budget from the Trip_Planner. This supports inter-agent coordination, essential for coherent, realistic outcomes.

No Grounding vs. Data-Backed Decision Making

The first implementation simulated planning but didn't use any actual flight or hotel data.

In the newer code, flights and hotels are pulled from a static JSON file (for simplicity, in a real world app these would have to be tied to real APIs):

const staticData = JSON.parse(readFileSync('./travel.json', 'utf-8'));
// ...
const flights = staticData.flights[city];
const hotels = staticData.hotels[city];

Agents use these options to select concrete results:

result = { text: `Selected flight: ${flights[0].id} - ${flights[0].airline}, $${flights[0].price}` };

This is a foundational shift: the agent isn't just imagining a flight - it's choosing from a real dataset, grounding language in context. You can later extend this to call real APIs (Skyscanner, Booking.com, etc).

Expand here for a full output sequence

Goal: Plan a 3-day trip to Rome, book flights and a hotel within my budget of $1200 total. I like museums and good food.
Generating plan...

Plan for: Plan a 3-day trip to Rome, book flights and a hotel within my budget of $1200 total. I like museums and good food.

Step 1: Contact the user to define specific travel dates for the 3-day Rome trip (starting from or after 02/06/2025), preferred departure city/airport, any airline or hotel chain preferences, desired hotel characteristics (e.g., location, room type), and specific culinary interests or dietary needs. Confirm the total budget of $1200 and discuss a preliminary allocation for flights, accommodation, and activities/food. (Assignee: Trip_Planner)
Step 2: Develop a detailed 3-day Rome itinerary focusing on museums (e.g., Vatican Museums, Colosseum, Borghese Gallery) and authentic food experiences, while adhering to the $1200 total budget. Research and identify specific attractions, restaurants, and transportation options, estimating costs for each. Propose a budget allocation for flights and hotel based on these findings to guide the respective agents. (Assignee: Trip_Planner)
Step 3: Using the confirmed travel dates, departure airport, and the flight budget allocated by the Trip_Planner (derived from the $1200 total budget), search for and secure the best value round-trip flight bookings to Rome. Prioritize options balancing cost, flight duration, and layover convenience. (Assignee: Flight_Agent)
Step 4: Based on the confirmed travel dates, user preferences, and the hotel budget allocated by the Trip_Planner (derived from the $1200 total budget for the duration of the stay), research and book a suitable hotel in Rome. Focus on well-reviewed, budget-friendly options with good accessibility to planned museums and dining spots. (Assignee: Hotel_Agent)
Step 5: Consolidate all booking confirmations (flights, hotel), the finalized 3-day itinerary (including museum timings, restaurant suggestions, and any pre-booked tickets), and a detailed budget breakdown showing adherence to the $1200 total. Prepare a comprehensive travel summary document for the user, including essential travel tips for Rome. (Assignee: Trip_Planner)

Executing Plan...

[Worker: trip_planner] Task: Contact the user to define specific travel dates for the 3-day Rome trip (starting from or after 02/06/2025), preferred departure city/airport, any airline or hotel chain preferences, desired hotel characteristics (e.g., location, room type), and specific culinary interests or dietary needs. Confirm the total budget of $1200 and discuss a preliminary allocation for flights, accommodation, and activities/food.
[trip_planner] LLM Raw Response for "Contact the user to define specific travel dates for the 3-day Rome trip (starting from or after 02/06/2025), preferred departure city/airport, any airline or hotel chain preferences, desired hotel characteristics (e.g., location, room type), and specific culinary interests or dietary needs. Confirm the total budget of $1200 and discuss a preliminary allocation for flights, accommodation, and activities/food.":
{
"budget_total": "1200 USD",
"destination": "Rome",
"duration": "3 days",
"budget_flights": "around 400 USD",
"budget_hotel_per_night": "around 150 USD",
"dates": null,
"interests": "museums and good food"
}
Trip context updated by LLM: {
budget_total: '1200 USD',
destination: 'Rome',
duration: '3 days',
budget_flights: 'around 400 USD',
budget_hotel_per_night: 'around 150 USD',
interests: 'museums and good food'
}
LLM extracted some details, but some essentials might still be missing.
One or more essential details are still missing after LLM attempt or if LLM failed. Prompting user...

--- Let's confirm or gather missing trip details ---
Based on your initial goal: "Plan a 3-day trip to Rome, book flights and a hotel within my budget of $1200 total. I like museums and good food."
And current information: {
"budget_total": "1200 USD",
"destination": "Rome",
"duration": "3 days",
"budget_flights": "around 400 USD",
"budget_hotel_per_night": "around 150 USD",
"interests": "museums and good food"
}

Destination City (current: "Rome"). Press Enter to keep, or type a new value:
Travel dates (e.g., YYYY-MM-DD - YYYY-MM-DD or "next Monday for 3 days"): from tomorrow for 3 days
Trip duration (current: "3 days"). Press Enter to keep, or type a new value:
Overall budget (current: "1200 USD"). Press Enter to keep, or type a new value:
Flight budget (can be approximate) (current: "around 400 USD"). Press Enter to keep, or type a new value:
Hotel budget per night (can be approximate) (current: "around 150 USD"). Press Enter to keep, or type a new value:
Key interests (current: "museums and good food"). Press Enter to keep, or type a new value:

--- Trip details updated ---
{
"budget_total": "1200 USD",
"destination": "Rome",
"duration": "3 days",
"budget_flights": "around 400 USD",
"budget_hotel_per_night": "around 150 USD",
"interests": "museums and good food",
"dates": "from tomorrow for 3 days"
}

[Worker: trip_planner] Task: Develop a detailed 3-day Rome itinerary focusing on museums (e.g., Vatican Museums, Colosseum, Borghese Gallery) and authentic food experiences, while adhering to the $1200 total budget. Research and identify specific attractions, restaurants, and transportation options, estimating costs for each. Propose a budget allocation for flights and hotel based on these findings to guide the respective agents.
[trip_planner] LLM Raw Response for "Develop a detailed 3-day Rome itinerary focusing on museums (e.g., Vatican Museums, Colosseum, Borghese Gallery) and authentic food experiences, while adhering to the $1200 total budget. Research and identify specific attractions, restaurants, and transportation options, estimating costs for each. Propose a budget allocation for flights and hotel based on these findings to guide the respective agents.":
Okay, this is an exciting challenge, especially with the "from tomorrow" timeline! We'll need to be smart and quick. Given the short notice, flexibility will be key, especially for museum bookings like the Borghese Gallery.

Here's a detailed 3-day Rome itinerary focusing on museums and authentic food, with a budget breakdown.

Total Budget: $1200 USD

Proposed Budget Allocation (for Agents):

  1. Flights: $350 - $450 USD (Your agent will need to find the best last-minute deal. This is tight but potentially doable with budget airlines or good connections if you're flexible with airports/times).
  2. Hotel (2 nights): $280 - $320 USD total ($140 - $160 USD/night). Your agent should look for well-located, clean, and safe budget-friendly hotels or B&Bs, possibly near Termini station for good transport links, or in areas like Monti or Trastevere (though Trastevere can be pricier).
    • Initial Agent Search Parameters: $400 (flights) + $300 (hotel) = $700.
    • This leaves $500 USD for food, attractions, and local transport for 3 days. (Approx. $166/day or €150/day).

      ---

      Detailed 3-Day Rome Itinerary

      Important Notes Before We Start:

  • BOOK MUSEUMS IMMEDIATELY! Especially the Borghese Gallery and Vatican Museums. Tickets sell out weeks/months in advance. "Tomorrow" is extremely challenging. You might need to look for last-minute tour operator slots which can be pricier, or be prepared to queue for a very long time (if any same-day tickets are available, which is rare for these).
  • Currency: Italy uses the Euro (€). Assume an exchange rate of roughly 1 USD = 0.90-0.92 EUR. For simplicity in planning, I'll use a mix, but budget calculations are in USD.
  • Local Transport: Rome is walkable, but for efficiency, use the Metro. A single ticket (BIT) costs €1.50 (valid for 100 mins on buses/trams, 1 metro ride). A 72-hour pass is €18. For this itinerary, pay-as-you-go might be sufficient, or consider the 72-hour pass.
  • City Tax: Hotels in Rome charge a city tax per person per night (usually €3-€7 depending on hotel star rating), payable at the hotel. Factor this in.
  • Water: Public water fountains ("nasoni") offer free, drinkable water. Bring a reusable bottle.
  • Food Costs:
    • Breakfast: €5-€10 (coffee & pastry)
    • Lunch: €10-€20 (pizza al taglio, panino, simple pasta)
    • Dinner: €25-€40 (trattoria with pasta/main, wine)
    • Gelato/Snacks: €5-€10

      ---

      Day 1: Ancient Rome & Trastevere Charm

  • Morning (9:00 AM - 1:00 PM): Colosseum & Roman Forum/Palatine Hill

    • Attraction: Colosseum, Roman Forum, Palatine Hill. These are usually a combined ticket.
    • Action: BOOK ONLINE NOW. If official tickets are sold out, check third-party tour operators for "skip-the-line" guided tours (might be pricier but necessary).
    • Estimated Cost: Standard ticket ~€18-€24 (plus online booking fee). Tour: €50-€70.
    • Budget: Let's allocate $30 (ticket) - $75 (last-minute tour).

  • Lunch (1:00 PM - 2:00 PM): Quick & Roman

    • Experience: Grab Pizza al Taglio (pizza by the slice) or a Supplì (fried rice ball) from a "Forno" (bakery) or "Pizzeria al Taglio" near the Forum.
    • Suggestions: Forno Campo de' Fiori (a bit of a walk, but iconic), or any local spot.
    • Estimated Cost: €10-€15.
    • Budget: $15

  • Afternoon (2:30 PM - 5:30 PM): Pantheon, Trevi Fountain & Capitoline Hill views

    • Attractions:
      • Walk to the Pantheon (free entry, but recently started charging €5 - check current status).
      • Toss a coin in the Trevi Fountain (free).
      • Walk up to Capitoline Hill (Piazza del Campidoglio designed by Michelangelo) for stunning views over the Roman Forum (free). The Capitoline Museums are here if you have extra budget/time (€15), but the view is free.
    • Estimated Cost: €0-€5 (if Pantheon has entry fee).
    • Budget: $5

  • Evening (7:30 PM onwards): Dinner in Trastevere

    • Experience: Authentic Roman dinner in the charming Trastevere neighborhood. Try classic dishes like Cacio e Pepe, Carbonara, or Saltimbocca.
    • Suggestions:
      • Tonnarello (popular, expect a queue)
      • Da Enzo al 29 (small, traditional, book ahead if possible)
      • Grazia & Graziella (lively atmosphere)
    • Estimated Cost: €25-€40 per person.
    • Budget: $40

  • Local Transport: Metro to Colosseo, then mostly walking. Maybe a bus/tram to/from Trastevere.
    • Budget: $5

      Day 1 Estimated Cost: $95 - $140

      ---

      Day 2: Vatican City & Artistic Wonders

  • Morning (8:30 AM - 1:00 PM): Vatican Museums & Sistine Chapel

    • Attraction: Vatican Museums, including the Raphael Rooms and Sistine Chapel.
    • Action: BOOK ONLINE IMMEDIATELY. Aim for the earliest possible slot. If official tickets are sold out, look for "skip-the-line" guided tours.
    • Estimated Cost: Standard ticket ~€17-€25 (plus online booking fee). Tour: €50-€80.
    • Budget: $30 (ticket) - $85 (last-minute tour).

  • Late Morning/Early Afternoon (1:00 PM - 2:30 PM): St. Peter's Basilica

    • Attraction: St. Peter's Basilica (entry is free, but security lines can be long. Dress code: shoulders and knees covered). Climbing the Dome is extra (€8-€10).
    • Estimated Cost: Free (Basilica only).
    • Budget: $0 (or $10 for Dome)

  • Lunch (2:30 PM - 3:30 PM): Near Vatican

    • Experience: Many tourist traps here. Look for simpler spots slightly away from St. Peter's Square. Pizza al taglio or a simple trattoria.
    • Suggestions: Pizzarium Bonci (gourmet pizza al taglio, a bit of a walk/metro ride but worth it if time allows) or Hostaria Dino e Toni (traditional, no-frills).
    • Estimated Cost: €15-€20.
    • Budget: $20

  • Afternoon (4:00 PM - 6:00 PM): Castel Sant'Angelo & Ponte Sant'Angelo

    • Attraction: Walk towards Castel Sant'Angelo (Hadrian's Mausoleum). Admire from outside and cross the beautiful Ponte Sant'Angelo with Bernini's angel statues. Entry to Castel Sant'Angelo is optional (€12-€14).
    • Estimated Cost: Free (exterior) or €14 for entry.
    • Budget: $0 (or $15 for entry)

  • Evening (7:30 PM onwards): Dinner in Monti or Testaccio

    • Experience:
      • Monti: Bohemian, charming, good for foodies. Try La Taverna dei Fori Imperiali (book ahead!) or Ai Tre Scalini (wine bar with food).
      • Testaccio: Authentic, less touristy, known for traditional Roman cuisine (especially offal, if you're adventurous, but plenty of other options). Try Flavio al Velavevodetto or Da Felice a Testaccio (book well ahead for Felice).
    • Estimated Cost: €30-€45.
    • Budget: $45

  • Local Transport: Metro to Ottaviano-S. Pietro (Vatican), walking, bus/metro for dinner.
    • Budget: $5

      Day 2 Estimated Cost: $100 - $165 (depending on tour/entry choices)

      ---

      Day 3: Borghese Gallery, Gardens & Departure Prep

  • Morning (9:00 AM - 11:00 AM or timed slot): Borghese Gallery and Museum

    • Attraction: Home to masterpieces by Bernini and Caravaggio. Timed entry is mandatory (usually 2-hour slots).
    • Action: BOOK ONLINE NOW! THIS IS THE HARDEST TO GET LAST MINUTE. If official site is sold out, check third-party sellers (often bundled with a short tour or audio guide, and more expensive). If completely unavailable, consider Palazzo Doria Pamphilj or Palazzo Barberini as alternatives for art lovers.
    • Estimated Cost: Standard ticket ~€13-€15 (plus €2 booking fee). Third-party: €30-€50.
    • Budget: $20 (ticket) - $55 (last-minute reseller)

  • Late Morning (11:00 AM - 12:30 PM): Borghese Gardens & Pincio Terrace

    • Attraction: Stroll through the beautiful Borghese Gardens. Head to the Pincio Terrace for panoramic views over Piazza del Popolo and Rome.
    • Estimated Cost: Free.
    • Budget: $0

  • Lunch (12:30 PM - 1:30 PM): Near Spanish Steps / Piazza del Popolo

    • Experience: Many options from quick panini to sit-down restaurants.
    • Suggestions: Ginger Sapore e Salute (healthy options, can be pricey), or find a local alimentari for a fresh panino.
    • Estimated Cost: €15-€25.
    • Budget: $20

  • Afternoon (1:30 PM - 4:00 PM): Spanish Steps, Shopping Window Stroll & Last Gelato

    • Attractions: See the Spanish Steps (free). Window shop along Via Condotti (luxury brands) or browse more affordable shops on Via del Corso.
    • Experience: Grab a final artisanal gelato.
    • Suggestions (Gelato): Giolitti (historic, near Pantheon), Gelateria La Romana, Fatamorgana.
    • Estimated Cost: €5-€10 for gelato.
    • Budget: $10

  • Late Afternoon (4:00 PM onwards): Depart for Airport

    • Transport:
      • Leonardo Express train from Termini to Fiumicino (FCO): ~€14 (30 mins).
      • Bus (e.g., Terravision, SIT Bus Shuttle) from Termini to FCO/Ciampino: ~€6-€8 (45-70 mins).
    • Budget: $15 (for bus option)

  • Local Transport: Bus/Metro to Borghese, walking, bus/metro to Termini for airport transfer.
    • Budget: $5

      Day 3 Estimated Cost: $60 - $105 (plus airport transfer)

      ---

      Total Estimated Itinerary Spending (Food, Attractions, Local Transport):

  • Day 1: ~$95 - $140
  • Day 2: ~$100 - $165
  • Day 3: ~$60 - $105
  • Subtotal for 3 days: $255 - $410
  • Airport Transfer (round trip, budget bus option): ~$30
  • Total Itinerary Spending: $285 - $440

    This leaves $60 - $215 from the $500 activities/food budget, which is a healthy contingency for:

  • Slightly pricier meals.
  • Souvenirs.
  • Unexpected transport (e.g., a taxi if running late).
  • City tax for the hotel.
  • A coffee here and there.

    ---

    Advice for the User:

  1. Book Flights & Hotel NOW: Instruct your agents immediately. Flexibility with flight times/airports will be crucial for budget.
  2. Book Museums NOW:
  3. Be Flexible: If a specific museum is fully booked, have backup plans (e.g., Palazzo Doria Pamphilj, Capitoline Museums, National Roman Museum).
  4. Wear Comfortable Shoes: You'll be doing a LOT of walking.
  5. Enjoy the Food! Don't be afraid to try small, local places. "Aperitivo" (pre-dinner drinks with snacks) can also be a budget-friendly way to have a light evening meal.

    This plan is ambitious for a "from tomorrow" trip but provides a solid framework. Good luck with the bookings!
    Trip Planner (other task) Result: Okay, this is an exciting challenge, especially with the "from tomorrow" timeline! We'll need to be smart and quick. Given the short notice, flexibility will be key, especially for museum bookings like the Borghese Gallery.

    Here's a detailed 3-day Rome itinerary focusing on museums and authentic food, with a budget breakdown.

    Total Budget: $1200 USD

    Proposed Budget Allocation (for Agents):

  6. Flights: $350 - $450 USD (Your agent will need to find the best last-minute deal. This is tight but potentially doable with budget airlines or good connections if you're flexible with airports/times).
  7. Hotel (2 nights): $280 - $320 USD total ($140 - $160 USD/night). Your agent should look for well-located, clean, and safe budget-friendly hotels or B&Bs, possibly near Termini station for good transport links, or in areas like Monti or Trastevere (though Trastevere can be pricier).
    • Initial Agent Search Parameters: $400 (flights) + $300 (hotel) = $700.
    • This leaves $500 USD for food, attractions, and local transport for 3 days. (Approx. $166/day or €150/day).

      ---

      Detailed 3-Day Rome Itinerary

      Important Notes Before We Start:

  • BOOK MUSEUMS IMMEDIATELY! Especially the Borghese Gallery and Vatican Museums. Tickets sell out weeks/months in advance. "Tomorrow" is extremely challenging. You might need to look for last-minute tour operator slots which can be pricier, or be prepared to queue for a very long time (if any same-day tickets are available, which is rare for these).
  • Currency: Italy uses the Euro (€). Assume an exchange rate of roughly 1 USD = 0.90-0.92 EUR. For simplicity in planning, I'll use a mix, but budget calculations are in USD.
  • Local Transport: Rome is walkable, but for efficiency, use the Metro. A single ticket (BIT) costs €1.50 (valid for 100 mins on buses/trams, 1 metro ride). A 72-hour pass is €18. For this itinerary, pay-as-you-go might be sufficient, or consider the 72-hour pass.
  • City Tax: Hotels in Rome charge a city tax per person per night (usually €3-€7 depending on hotel star rating), payable at the hotel. Factor this in.
  • Water: Public water fountains ("nasoni") offer free, drinkable water. Bring a reusable bottle.
  • Food Costs:
    • Breakfast: €5-€10 (coffee & pastry)
    • Lunch: €10-€20 (pizza al taglio, panino, simple pasta)
    • Dinner: €25-€40 (trattoria with pasta/main, wine)
    • Gelato/Snacks: €5-€10

      ---

      Day 1: Ancient Rome & Trastevere Charm

  • Morning (9:00 AM - 1:00 PM): Colosseum & Roman Forum/Palatine Hill

    • Attraction: Colosseum, Roman Forum, Palatine Hill. These are usually a combined ticket.
    • Action: BOOK ONLINE NOW. If official tickets are sold out, check third-party tour operators for "skip-the-line" guided tours (might be pricier but necessary).
    • Estimated Cost: Standard ticket ~€18-€24 (plus online booking fee). Tour: €50-€70.
    • Budget: Let's allocate $30 (ticket) - $75 (last-minute tour).

  • Lunch (1:00 PM - 2:00 PM): Quick & Roman

    • Experience: Grab Pizza al Taglio (pizza by the slice) or a Supplì (fried rice ball) from a "Forno" (bakery) or "Pizzeria al Taglio" near the Forum.
    • Suggestions: Forno Campo de' Fiori (a bit of a walk, but iconic), or any local spot.
    • Estimated Cost: €10-€15.
    • Budget: $15

  • Afternoon (2:30 PM - 5:30 PM): Pantheon, Trevi Fountain & Capitoline Hill views

    • Attractions:
      • Walk to the Pantheon (free entry, but recently started charging €5 - check current status).
      • Toss a coin in the Trevi Fountain (free).
      • Walk up to Capitoline Hill (Piazza del Campidoglio designed by Michelangelo) for stunning views over the Roman Forum (free). The Capitoline Museums are here if you have extra budget/time (€15), but the view is free.
    • Estimated Cost: €0-€5 (if Pantheon has entry fee).
    • Budget: $5

  • Evening (7:30 PM onwards): Dinner in Trastevere

    • Experience: Authentic Roman dinner in the charming Trastevere neighborhood. Try classic dishes like Cacio e Pepe, Carbonara, or Saltimbocca.
    • Suggestions:
      • Tonnarello (popular, expect a queue)
      • Da Enzo al 29 (small, traditional, book ahead if possible)
      • Grazia & Graziella (lively atmosphere)
    • Estimated Cost: €25-€40 per person.
    • Budget: $40

  • Local Transport: Metro to Colosseo, then mostly walking. Maybe a bus/tram to/from Trastevere.
    • Budget: $5

      Day 1 Estimated Cost: $95 - $140

      ---

      Day 2: Vatican City & Artistic Wonders

  • Morning (8:30 AM - 1:00 PM): Vatican Museums & Sistine Chapel

    • Attraction: Vatican Museums, including the Raphael Rooms and Sistine Chapel.
    • Action: BOOK ONLINE IMMEDIATELY. Aim for the earliest possible slot. If official tickets are sold out, look for "skip-the-line" guided tours.
    • Estimated Cost: Standard ticket ~€17-€25 (plus online booking fee). Tour: €50-€80.
    • Budget: $30 (ticket) - $85 (last-minute tour).

  • Late Morning/Early Afternoon (1:00 PM - 2:30 PM): St. Peter's Basilica

    • Attraction: St. Peter's Basilica (entry is free, but security lines can be long. Dress code: shoulders and knees covered). Climbing the Dome is extra (€8-€10).
    • Estimated Cost: Free (Basilica only).
    • Budget: $0 (or $10 for Dome)

  • Lunch (2:30 PM - 3:30 PM): Near Vatican

    • Experience: Many tourist traps here. Look for simpler spots slightly away from St. Peter's Square. Pizza al taglio or a simple trattoria.
    • Suggestions: Pizzarium Bonci (gourmet pizza al taglio, a bit of a walk/metro ride but worth it if time allows) or Hostaria Dino e Toni (traditional, no-frills).
    • Estimated Cost: €15-€20.
    • Budget: $20

  • Afternoon (4:00 PM - 6:00 PM): Castel Sant'Angelo & Ponte Sant'Angelo

    • Attraction: Walk towards Castel Sant'Angelo (Hadrian's Mausoleum). Admire from outside and cross the beautiful Ponte Sant'Angelo with Bernini's angel statues. Entry to Castel Sant'Angelo is optional (€12-€14).
    • Estimated Cost: Free (exterior) or €14 for entry.
    • Budget: $0 (or $15 for entry)

  • Evening (7:30 PM onwards): Dinner in Monti or Testaccio

    • Experience:
      • Monti: Bohemian, charming, good for foodies. Try La Taverna dei Fori Imperiali (book ahead!) or Ai Tre Scalini (wine bar with food).
      • Testaccio: Authentic, less touristy, known for traditional Roman cuisine (especially offal, if you're adventurous, but plenty of other options). Try Flavio al Velavevodetto or Da Felice a Testaccio (book well ahead for Felice).
    • Estimated Cost: €30-€45.
    • Budget: $45

  • Local Transport: Metro to Ottaviano-S. Pietro (Vatican), walking, bus/metro for dinner.
    • Budget: $5

      Day 2 Estimated Cost: $100 - $165 (depending on tour/entry choices)

      ---

      Day 3: Borghese Gallery, Gardens & Departure Prep

  • Morning (9:00 AM - 11:00 AM or timed slot): Borghese Gallery and Museum

    • Attraction: Home to masterpieces by Bernini and Caravaggio. Timed entry is mandatory (usually 2-hour slots).
    • Action: BOOK ONLINE NOW! THIS IS THE HARDEST TO GET LAST MINUTE. If official site is sold out, check third-party sellers (often bundled with a short tour or audio guide, and more expensive). If completely unavailable, consider Palazzo Doria Pamphilj or Palazzo Barberini as alternatives for art lovers.
    • Estimated Cost: Standard ticket ~€13-€15 (plus €2 booking fee). Third-party: €30-€50.
    • Budget: $20 (ticket) - $55 (last-minute reseller)

  • Late Morning (11:00 AM - 12:30 PM): Borghese Gardens & Pincio Terrace

    • Attraction: Stroll through the beautiful Borghese Gardens. Head to the Pincio Terrace for panoramic views over Piazza del Popolo and Rome.
    • Estimated Cost: Free.
    • Budget: $0

  • Lunch (12:30 PM - 1:30 PM): Near Spanish Steps / Piazza del Popolo

    • Experience: Many options from quick panini to sit-down restaurants.
    • Suggestions: Ginger Sapore e Salute (healthy options, can be pricey), or find a local alimentari for a fresh panino.
    • Estimated Cost: €15-€25.
    • Budget: $20

  • Afternoon (1:30 PM - 4:00 PM): Spanish Steps, Shopping Window Stroll & Last Gelato

    • Attractions: See the Spanish Steps (free). Window shop along Via Condotti (luxury brands) or browse more affordable shops on Via del Corso.
    • Experience: Grab a final artisanal gelato.
    • Suggestions (Gelato): Giolitti (historic, near Pantheon), Gelateria La Romana, Fatamorgana.
    • Estimated Cost: €5-€10 for gelato.
    • Budget: $10

  • Late Afternoon (4:00 PM onwards): Depart for Airport

    • Transport:
      • Leonardo Express train from Termini to Fiumicino (FCO): ~€14 (30 mins).
      • Bus (e.g., Terravision, SIT Bus Shuttle) from Termini to FCO/Ciampino: ~€6-€8 (45-70 mins).
    • Budget: $15 (for bus option)

  • Local Transport: Bus/Metro to Borghese, walking, bus/metro to Termini for airport transfer.
    • Budget: $5

      Day 3 Estimated Cost: $60 - $105 (plus airport transfer)

      ---

      Total Estimated Itinerary Spending (Food, Attractions, Local Transport):

  • Day 1: ~$95 - $140
  • Day 2: ~$100 - $165
  • Day 3: ~$60 - $105
  • Subtotal for 3 days: $255 - $410
  • Airport Transfer (round trip, budget bus option): ~$30
  • Total Itinerary Spending: $285 - $440

    This leaves $60 - $215 from the $500 activities/food budget, which is a healthy contingency for:

  • Slightly pricier meals.
  • Souvenirs.
  • Unexpected transport (e.g., a taxi if running late).
  • City tax for the hotel.
  • A coffee here and there.

    ---

    Advice for the User:

  1. Book Flights & Hotel NOW: Instruct your agents immediately. Flexibility with flight times/airports will be crucial for budget.
  2. Book Museums NOW:
  3. Be Flexible: If a specific museum is fully booked, have backup plans (e.g., Palazzo Doria Pamphilj, Capitoline Museums, National Roman Museum).
  4. Wear Comfortable Shoes: You'll be doing a LOT of walking.
  5. Enjoy the Food! Don't be afraid to try small, local places. "Aperitivo" (pre-dinner drinks with snacks) can also be a budget-friendly way to have a light evening meal.

    This plan is ambitious for a "from tomorrow" trip but provides a solid framework. Good luck with the bookings!

    [Worker: flight_agent] Task: Using the confirmed travel dates, departure airport, and the flight budget allocated by the Trip_Planner (derived from the $1200 total budget), search for and secure the best value round-trip flight bookings to Rome. Prioritize options balancing cost, flight duration, and layover convenience.
    Flight Agent Result: Selected flight: FL_ROM_001 - Airline 1, $600

    [Worker: hotel_agent] Task: Based on the confirmed travel dates, user preferences, and the hotel budget allocated by the Trip_Planner (derived from the $1200 total budget for the duration of the stay), research and book a suitable hotel in Rome. Focus on well-reviewed, budget-friendly options with good accessibility to planned museums and dining spots.
    Hotel Agent Result: Selected hotel: Roma Hotel 1, $140/night

    [Worker: trip_planner] Task: Consolidate all booking confirmations (flights, hotel), the finalized 3-day itinerary (including museum timings, restaurant suggestions, and any pre-booked tickets), and a detailed budget breakdown showing adherence to the $1200 total. Prepare a comprehensive travel summary document for the user, including essential travel tips for Rome.
    [trip_planner] LLM Raw Response for "Consolidate all booking confirmations (flights, hotel), the finalized 3-day itinerary (including museum timings, restaurant suggestions, and any pre-booked tickets), and a detailed budget breakdown showing adherence to the $1200 total. Prepare a comprehensive travel summary document for the user, including essential travel tips for Rome.":
    Okay, here is the complete trip plan summary:

    Trip Plan Summary: Rome Adventure

  • Destination: Rome, Italy
  • Dates: Starting "tomorrow" (as per planning context).
  • Duration: 3 days, 2 nights.
  • Total Budget: $1200 USD

  • Selected Flight: FL_ROM_001 - Airline 1, $600
  • Selected Hotel: Roma Hotel 1, $140/night (for 2 nights = $280 total)

  • Key Interests: Museums (Vatican Museums, Colosseum, Borghese Gallery) and experiencing good, authentic food.

    Notable Outcomes and Notes from Planning:

  1. Budget Allocation & Impact:

    • The selected flight ($600) is significantly higher than the initially proposed budget of $350-$450.
    • The selected hotel ($140/night) fits within the proposed budget.
    • With flight and hotel costs totaling $880 ($600 + $280), this leaves $320 from the $1200 total budget for all food, attractions, local transport, city tax, and any other expenses for 3 days.
    • The detailed itinerary estimated daily expenses (food, attractions, local transport) to be between $285 - $440 before considering the hotel city tax. This means the remaining $320 will be very tight, and careful management will be needed, likely requiring sticking to the lower end of meal/attraction cost estimates or making some cuts. The original contingency is largely eliminated.

  2. Extreme Urgency for Museum Bookings:

    • Given the trip starts "tomorrow," booking tickets for the Vatican Museums and especially the Borghese Gallery is CRITICAL and must be done IMMEDIATELY. These sell out far in advance, and last-minute availability is rare. Third-party vendors or tours might be the only option if official tickets are gone, potentially at a higher cost.
    • Colosseum tickets also require immediate booking.

  3. Itinerary Focus:

    • A detailed 3-day itinerary has been developed, focusing on:
      • Day 1: Ancient Rome (Colosseum, Roman Forum, Palatine Hill, Pantheon, Trevi Fountain) and dinner in Trastevere.
      • Day 2: Vatican City (Vatican Museums, Sistine Chapel, St. Peter's Basilica) and Castel Sant'Angelo, with dinner in Monti or Testaccio.
      • Day 3: Borghese Gallery and Gardens, Spanish Steps, and departure preparations.
    • The itinerary includes suggestions for authentic Roman food experiences and estimates costs for meals and attractions.

  4. Additional Costs to Consider:

    • Hotel City Tax: An additional city tax (typically €3-€7 per person, per night) will be payable directly at the hotel and is not included in the $140/night rate. This will further strain the remaining $320.
    • Airport Transfer: The itinerary budgets ~$15 each way for a budget bus airport transfer.

  5. Flexibility Required: Due to the short notice, flexibility with the itinerary (e.g., having backup museum options if primary choices are unavailable) will be essential.

  6. Practical Tips: The plan advises using public transport (Metro), taking advantage of free drinking water from "nasoni" fountains, and wearing comfortable shoes.
    Trip Planner Summary Result: Okay, here is the complete trip plan summary:

    Trip Plan Summary: Rome Adventure

  • Destination: Rome, Italy
  • Dates: Starting "tomorrow" (as per planning context).
  • Duration: 3 days, 2 nights.
  • Total Budget: $1200 USD

  • Selected Flight: FL_ROM_001 - Airline 1, $600
  • Selected Hotel: Roma Hotel 1, $140/night (for 2 nights = $280 total)

  • Key Interests: Museums (Vatican Museums, Colosseum, Borghese Gallery) and experiencing good, authentic food.

    Notable Outcomes and Notes from Planning:

  1. Budget Allocation & Impact:

    • The selected flight ($600) is significantly higher than the initially proposed budget of $350-$450.
    • The selected hotel ($140/night) fits within the proposed budget.
    • With flight and hotel costs totaling $880 ($600 + $280), this leaves $320 from the $1200 total budget for all food, attractions, local transport, city tax, and any other expenses for 3 days.
    • The detailed itinerary estimated daily expenses (food, attractions, local transport) to be between $285 - $440 before considering the hotel city tax. This means the remaining $320 will be very tight, and careful management will be needed, likely requiring sticking to the lower end of meal/attraction cost estimates or making some cuts. The original contingency is largely eliminated.

  2. Extreme Urgency for Museum Bookings:

    • Given the trip starts "tomorrow," booking tickets for the Vatican Museums and especially the Borghese Gallery is CRITICAL and must be done IMMEDIATELY. These sell out far in advance, and last-minute availability is rare. Third-party vendors or tours might be the only option if official tickets are gone, potentially at a higher cost.
    • Colosseum tickets also require immediate booking.

  3. Itinerary Focus:

    • A detailed 3-day itinerary has been developed, focusing on:
      • Day 1: Ancient Rome (Colosseum, Roman Forum, Palatine Hill, Pantheon, Trevi Fountain) and dinner in Trastevere.
      • Day 2: Vatican City (Vatican Museums, Sistine Chapel, St. Peter's Basilica) and Castel Sant'Angelo, with dinner in Monti or Testaccio.
      • Day 3: Borghese Gallery and Gardens, Spanish Steps, and departure preparations.
    • The itinerary includes suggestions for authentic Roman food experiences and estimates costs for meals and attractions.

  4. Additional Costs to Consider:

    • Hotel City Tax: An additional city tax (typically €3-€7 per person, per night) will be payable directly at the hotel and is not included in the $140/night rate. This will further strain the remaining $320.
    • Airport Transfer: The itinerary budgets ~$15 each way for a budget bus airport transfer.

  5. Flexibility Required: Due to the short notice, flexibility with the itinerary (e.g., having backup museum options if primary choices are unavailable) will be essential.

  6. Practical Tips: The plan advises using public transport (Metro), taking advantage of free drinking water from "nasoni" fountains, and wearing comfortable shoes.

    Final Trip Plan Summary:

    Okay, here is the complete trip plan summary:

    Trip Plan Summary: Rome Adventure

  • Destination: Rome, Italy
  • Dates: Starting "tomorrow" (as per planning context).
  • Duration: 3 days, 2 nights.
  • Total Budget: $1200 USD

  • Selected Flight: FL_ROM_001 - Airline 1, $600
  • Selected Hotel: Roma Hotel 1, $140/night (for 2 nights = $280 total)

  • Key Interests: Museums (Vatican Museums, Colosseum, Borghese Gallery) and experiencing good, authentic food.

    Notable Outcomes and Notes from Planning:

  1. Budget Allocation & Impact:

    • The selected flight ($600) is significantly higher than the initially proposed budget of $350-$450.
    • The selected hotel ($140/night) fits within the proposed budget.
    • With flight and hotel costs totaling $880 ($600 + $280), this leaves $320 from the $1200 total budget for all food, attractions, local transport, city tax, and any other expenses for 3 days.
    • The detailed itinerary estimated daily expenses (food, attractions, local transport) to be between $285 - $440 before considering the hotel city tax. This means the remaining $320 will be very tight, and careful management will be needed, likely requiring sticking to the lower end of meal/attraction cost estimates or making some cuts. The original contingency is largely eliminated.

  2. Extreme Urgency for Museum Bookings:

    • Given the trip starts "tomorrow," booking tickets for the Vatican Museums and especially the Borghese Gallery is CRITICAL and must be done IMMEDIATELY. These sell out far in advance, and last-minute availability is rare. Third-party vendors or tours might be the only option if official tickets are gone, potentially at a higher cost.
    • Colosseum tickets also require immediate booking.

  3. Itinerary Focus:

    • A detailed 3-day itinerary has been developed, focusing on:
      • Day 1: Ancient Rome (Colosseum, Roman Forum, Palatine Hill, Pantheon, Trevi Fountain) and dinner in Trastevere.
      • Day 2: Vatican City (Vatican Museums, Sistine Chapel, St. Peter's Basilica) and Castel Sant'Angelo, with dinner in Monti or Testaccio.
      • Day 3: Borghese Gallery and Gardens, Spanish Steps, and departure preparations.
    • The itinerary includes suggestions for authentic Roman food experiences and estimates costs for meals and attractions.

  4. Additional Costs to Consider:

    • Hotel City Tax: An additional city tax (typically €3-€7 per person, per night) will be payable directly at the hotel and is not included in the $140/night rate. This will further strain the remaining $320.
    • Airport Transfer: The itinerary budgets ~$15 each way for a budget bus airport transfer.

  5. Flexibility Required: Due to the short notice, flexibility with the itinerary (e.g., having backup museum options if primary choices are unavailable) will be essential.

  6. Practical Tips: The plan advises using public transport (Metro), taking advantage of free drinking water from "nasoni" fountains, and wearing comfortable shoes.

Conclusion

The orchestrator-worker pattern is deceptively simple but profoundly useful as it enforces separation of concerns, allows for scalability, and introduces parallelism into agentic workflows.

In practice, this pattern is also easier to debug and extend than monolithic agent chains. Need better sentiment analysis? Just swap out the sentiment worker. Want more detail in your report? Add a new worker for it. You get the idea!