Connection between Tasks and Agents

Hi everyone,

I’m new to CrewAI and am currently exploring how to build agents to accomplish tasks effectively. I’m struggling with understanding how to handle tasks that involve multiple agents.

For instance, let’s say I want to create a task to make a reservation. This could include booking flights, hotels, and car rentals. I’ve created three agents:

  • FlightsBookingAgent
  • HotelBookingAgent
  • CarRentalBookingAgent

The challenge I’m facing is:

  1. Should I map all these agents to the single “Make a Reservation” task?
  2. Or would it be better to create one comprehensive agent (e.g., BookingAgent) that handles all these subtasks internally?

I’m looking for advice on the right way to structure this.

Thanks in advance for your insights.

Best,
Nil

It’s good practice to create focused agents and tasks rather than general agents. Focused agents often perform better. This means have different agents to do the different types of bookings with specific tasks and instructions for each

Your goal: To make reservation

But to accomplish these, the three following tasks have to be done.

  1. Book a flight
  2. Book a hotel
  3. Rent a car

So you employed three highly skilled individuals who are specialists in their field, and they are:

  1. FlightBookingAgent
  2. HotelBookingAgent
  3. CarRentalAgent

You assign the task for each of the agent

FlightBookingAgent: To search for available flights and book a ticket based on the user’s origin, destination, and travel dates

HotelBookingAgent: Search for available hotels near the destination and book a room for the required dates

CarRentalAgent: Search for car rental options at the destination and book a car for the required dates

You brought this agent together to create a crew and assign a manager to coordinate their actions using

Process.hierarchial

This ability to create highly specialized agents and make them collaborate with each other is what gives multi-agent the ability to solve complex task

This is great. Thank you. One more question. How can i customize the crew? For example, what if one reservation requires just flight and hotel, no care rental. How do i specify that when i kickoff the crew?