are the talk of the town. We see them everywhere, even being used for the simplest of tasks on our phones. They are convenient, fast, and pretty much reliable, and help us navigate day-to-day life. If you want an easy explanation of a scientific concept, you ask ChatGPT. You want a guide for your picky toddler’s diet plan, so you ask AI. Even the task of planning your complete travel tour can be delegated to AI. And, this is exactly what we are going to do in this tutorial (stay tuned!).
We know about AI Agents, but what if we can build and use different AI Agents for different roles in a bigger project? This is where the multi-agent system concept comes into play. As AI applications become more advanced, we are moving from single AI models that answer simple questions and do straightforward tasks to systems where multiple AI agents work together to solve complex problems. A Multi-Agent System (MAS) is a concept where multiple AI agents collaborate with each other to fulfill a bigger goal. Each of these has a specific role leading to the ultimate goal, and they accomplish it with mutual collaboration.
A Multi-Agent Travel Planning System
In this project, we will be building a Multi-Agent Travel Planning System. So basically, what we will have is that instead of just one AI Agent who will plan our travels, we will have a team of AI agents, each with one specific role, and they will work with one another to make the perfect travel plan for us!
We can think of a Multi-Agent Travel Planning System like a real travel agency. Instead of a single person handling everything, different experts will be handling different tasks as per their expertise and work together. For our AI Travel Planner, we will have the following agents:
- Travel Research Agent: This agent will perform the research tasks. It will explore the destination where the client wants to go and find attractions, hidden places, local experiences, travel tips, etc. It will collect the basic information needed to plan the trip.
- Activity Planning Agent: This agent will plan activities based on the research of the Research Agent. It will be the one to decide which place to visit, when to visit, what activities to do, and how to organize the whole trip!
- Budget Agent: This agent is responsible for proper budgeting. It will analyze the plan shared by the Activity Planning Agent and share the expected costs, affordable options, money-saving tips, and help customize the trip to the client’s budget.
- Final Travel Assistant: Lastly, the final travel assistant will combine the output from all three agents: the research, activities plan, and budget, and create a simple personalized travel itinerary!
This is what the general workflow of the whole project will look like:

We will build this project in Python, using PyCharm IDE. This is an intermediate-level Python project that requires a basic understanding of AI Agents in Python, as well as a preliminary knowledge of Object-Oriented Programming, as we will be creating classes. If you are new to Python and Agentic AI, you can access my beginner-friendly AI Agent tutorial from the following link:
The Ultimate Beginners’ Guide to Building an AI Agent in Python
If you want to learn about Python OOP, you can read the following articles where I have created a Coffee Machine in Python, and then, in the next tutorial, used the concept of OOP to optimize the code:
Implementing the Coffee Machine in Python
Implementing the Coffee Machine Project in Python Using Object-Oriented Programming
All these articles will give you a basic understanding of Python code, and will in turn help you understand the code that comes under this interesting project. Let us start coding the project!
Creating the Project
The first thing is creating the project folder in PyCharm (or IDE of your choice) and naming the project “Multi Agent System” (or anything of your choice).

Installing and Importing the Python Packages
Once the project folder is created, go on and create a “main.py” file where we will do our coding. In the terminal, install OpenAI and then import it into your coding file.
pip install openai

from openai import OpenAI
Connecting Python With the AI Model
In order for our program to communicate with OpenAI and process the code, we need to connect it to the AI platform. In our case, we will use OpenRouter.ai and add its URL. We will also add the API Key to our code, saving it in the api_key variable. This API key will give our program the required permission to use AI models. We will create a client that will communicate with the AI model using the API key we created:
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key="YOUR API KEY"
)
Once you create an API key in OpenRouter.ai, do not share the key with anyone. Just add it in the place of “YOUR API KEY”.
Creating the Agent Class
Now comes the part of coding the AI agents. Since we are not creating just one or two agents, we will not be directly coding. Rather, we will use the concept of OOP, and create a class (or a blueprint in easy words) of the agent category, and then use this blueprint to create each individual agent ahead. The agent will store the name which identifies the agent, and the role, that tells AI how the agent should behave. Additionally, we will also create a function run that will give our AI agents the ability to work, that is, to send tasks to the AI model.
class Agent:
def __init__(self, name, role):
self.name = name
self.role = role
def run(self, task):
print(f"{self.name} is working...")
response = client.chat.completions.create(
model="gpt-4.1-mini",
messages=[
{
"role": "system",
"content": self.role
},
{
"role": "user",
"content": task
}
],
max_tokens=1200
)
return response.choices[0].message.content
The code above will send the following two things to the AI model (which we have also specified):
- The respective agent’s job/role
- The User message taken as input from the user (as you will see later)
We will get the AI Response returned from this code block with the following code return response.choices[0].message.content. This return statement will extract the answer generated by the agent (if you find it difficult to understand this code, refer to my AI Agent beginner guide article linked at the beginning of this article).
Creating Agent Objects
Now that our agent class is created, we will use this blueprint to create our individual AI agents. The following code uses the OOP concept to create agent objects, namely:
- Research Agent
- Activity Agent
- Budget Agent
- Final Agent
research_agent = Agent(
"Research Agent",
"""
You are an expert travel researcher.
Your job:
- Find popular attractions
- Find hidden gems
- Suggest local experiences
- Recommend best places
"""
)
activity_agent = Agent(
"Activity Planner Agent",
"""
You are a professional travel planner.
Your job:
- Create daily activities
- Plan sightseeing
- Recommend food experiences
- Organize activities logically
"""
)
budget_agent = Agent(
"Budget Agent",
"""
You are a travel budget expert.
Calculate:
- Estimated flight cost
- Visa requirements
- Visa fees if needed
- Hotel cost
- Food expenses
- Transport cost
- Activity costs
Create an approximate total trip budget.
Keep response short.
"""
)
final_agent = Agent(
"Final Travel Assistant",
"""
You are a professional travel planner.
Create the final itinerary.
Include:
1. Short trip overview
2. Visa information
3. Estimated flight cost
4. Day-wise plan
5. Food suggestions
6. Total estimated budget
Keep everything under 700 words.
"""
)
This code will create individual AI agents with specific roles as mentioned in the code. The role tells the AI model how it should behave and what task it should focus on.
User Input
The next task is to get the input from the user. We will ask the user the following questions:
- Where are they flying from
- There they are flying to
- Number of days of the trip
- Number of travelers
- Interests
#Get User Travel Details
starting_location = input(
"Where are you flying from? "
)
destination = input(
"Where do you want to travel? "
)
days = input(
"How many days is your trip? "
)
travelers = input(
"How many travelers? "
)
budget = input(
"What is your budget? (low/medium/high) "
)
interests = input(
"What are your interests? "
)
Creating the User Request
After collecting information from the user through the input statements, we combine everything into a single prompt and pass it over to the AI agents.
# Create request for AI agents
user_request = f"""
Create a travel plan with these details:
Flying From:
{starting_location}
Destination:
{destination}
Trip Duration:
{days} days
Number of Travelers:
{travelers}
Budget Level:
{budget}
Interests:
{interests}
Include:
- Visa requirements
- Estimated flight cost
- Places to visit
- Activities
- Food recommendations
- Total estimated budget
"""
print("\nCreating your AI travel plan...\n")
While the AI is running in the backend, we will print the statement “Creating your AI travel plan”, so the user knows that the process is running and the agents have started working.
Multi-Agent Workflow
Now that we have created the user request, by giving it all the details we have taken from the user, let us now get the multi-agent system running. Each agent completes one task and passes its result to the next agent.
The user’s travel details are first sent to the Research Agent. This agent asks the AI model to find the best places to visit, local experiences, and travel information. The result is stored in research. The research output becomes the input for the Activity Agent. It converts travel information into daily activities, sightseeing plans, and food ideas. The result is saved in activities. Then comes the Budget Agent who receives the planned activities and estimates the costs of flights, visas, hotels, transport, etc. The result is stored in budget. The Final Travel Agent receives information from all of the previous agents and combines everything into one complete travel itinerary, which is then output to the user.
#Multi-Agent Workflow
#Agent 1 researches destination
research = research_agent.run(
user_request
)
print("\n--- Research Completed ---")
#Agent 2 creates activities
activities = activity_agent.run(
research
)
print("\n--- Activities Planned ---")
#Agent 3 calculates budget
budget = budget_agent.run(
activities
)
print("\n--- Budget Created ---")
#Agent 4 creates final itinerary
final_plan = final_agent.run(
f"""
Research:
{research}
Activities:
{activities}
Budget:
{budget}
Create final travel plan.
"""
)
print("\n==========================")
print(" FINAL TRAVEL PLAN")
print("==========================\n")
print(final_plan)
Running the Code
By running the code, you can see the program asking for user input. You can add your specific details, answering the questions. It is based on these answers that the AI agents team will make your travel itinerary.

"C:\Users\Mahnoor Javed\PycharmProjects\Multi Agent System\.venv\Scripts\python.exe" "C:\Users\Mahnoor Javed\PycharmProjects\Multi Agent System\main.py"
Where are you flying from? islamabad
Where do you want to travel? istanbul
How many days is your trip? 3
How many travelers? 4
What is your budget? (low/medium/high) $4k
What are your interests? kid frinedly
Creating your AI travel plan...
Research Agent is working...
--- Research Completed ---
Activity Planner Agent is working...
--- Activities Planned ---
Budget Agent is working...
--- Budget Created ---
Final Travel Assistant is working...
==========================
FINAL TRAVEL PLAN
==========================
### 3-Day Family-Friendly Itinerary: Islamabad to Istanbul
---
#### Trip Overview
Discover Istanbul’s captivating blend of history, culture, and family-friendly fun on this 3-day trip from Islamabad. Explore iconic landmarks like Hagia Sophia and Topkapi Palace, dive into interactive experiences at Istanbul Aquarium and KidZania, and unwind in beautiful parks and bustling bazaars. This itinerary balances cultural discovery with engaging activities perfect for kids, ensuring memories for the entire family.
---
#### Visa Information
- **For Pakistani Citizens:** Turkish e-Visa required
- **Application:** Apply online before travel at [e-Visa Turkey official website]
- **Cost:** Approx. $50 per person
- **Processing time:** Usually 24-48 hours
- **Tip:** Carry a printout or e-copy of the e-Visa during travel.
---
#### Estimated Flight Cost
- **Route:** Islamabad (ISB) – Istanbul (IST) round-trip
- **Cost:** $350 - $450 per person in economy class
- **For 4 travelers:** Approx. $1,400 - $1,800 total
- **Tip:** Book 2-3 months in advance to secure better deals.
---
### Day-wise Itinerary
**Day 1: Historic and Iconic Sights**
- **Morning:**
- Arrive Istanbul, transfer and check-in at a family-friendly hotel near Sultanahmet.
- Visit **Hagia Sophia**, immersing in the grandeur of this iconic monument.
- Walk to **Topkapi Palace**, exploring expansive gardens and kid-friendly spaces.
- **Afternoon:**
- Relax and play at **Sultanahmet Square**; kids enjoy ample open space.
- Hop on the nostalgic **Sultanahmet tram** for a charming ride around the historic district.
- **Evening:**
- Enjoy a **Bosphorus dinner cruise** featuring family entertainment and kid activities alongside delicious Turkish cuisine.
---
**Day 2: Interactive Fun and Exploration**
- **Morning:**
- Visit **Istanbul Aquarium (Florya)** to see diverse marine life, touch pools, and themed zones.
- Lunch at aquarium’s family-friendly café or nearby **Forum Istanbul Mall**.
- **Afternoon:**
- Interact and play at **KidZania Istanbul** inside the mall where children role-play professions and learn through fun.
- Enjoy mall playgrounds and snack breaks.
- **Evening:**
- Try famous **Maraş dondurma** (Turkish ice cream) with entertaining vendor shows.
- Leisurely mall or park walk before returning to hotel.
---
**Day 3: Parks, Museums, Markets & Local Flavors**
- **Morning:**
- Picnic and playtime at **Gülhane Park** with pony rides for children.
- Explore the **Rahmi M. Koç Museum** featuring interactive exhibits including vehicles, toys, and a submarine.
- **Afternoon:**
- Short visit to the **Grand Bazaar** focusing on kid-friendly souvenir shops.
- Sample local street food: **simit** (sesame bagels) and **gözleme** (savory crepes).
- **Evening:**
- Dinner at **Çiya Sofrası** for mild traditional dishes or try **Saray Muhallebicisi** for authentic Turkish desserts like sütlaç (rice pudding).
---
### Food Suggestions
- **Çiya Sofrası (Kadıköy):** Authentic Turkish with kid-friendly options
- **Saray Muhallebicisi:** Traditional desserts perfect for family treats
- **Midpoint/Cookshop:** Casual dining with international and local menus suitable for children
- **Street Food:** Try simit, lahmacun (Turkish pizza), and borek pastries at local vendors
---
### Estimated Budget (4 Persons)
| Category | Estimated Cost (USD) |
|---------------------------|-------------------------------|
| Flights (Round-trip) | $1,400 - $1,800 |
| Visa Fees | $200 |
| Accommodation (3 nights) | $600 - $800 |
| Food | $300 - $400 |
| Transport (Istanbulkart, taxis) | $100 |
| Entrance Fees & Activities| $300 |
| Miscellaneous | $200 |
| **Total Estimate** | **~$3,100 - $3,800** |
*Note: Budget can vary depending on hotel choice and dining preferences.*
---
### Additional Tips
- Book tickets online in advance for popular attractions to skip queues.
- Purchase an **Istanbulkart** for convenient and discounted travel on public transport.
- Pack comfortable shoes and sun protection for children.
- Opt for accommodations with family amenities and close proximity to tram or metro stations in Sultanahmet or Beyoğlu districts.
- Many restaurants provide kids’ menus and high chairs—ask beforehand.
---
Would you like personalized hotel recommendations and help with booking flights? Also, I can assist you with local transport details or restaurant reservations. Just let me know!
Process finished with exit code 0
The above is the output of the code. You can see how personalized the travel itinerary is!
Conclusion
In this project, we have successfully used our knowledge of building AI agents in Python to build something that is practical and has real-life applications. This is how real-world problems are: we already have a system running, but we need to optimize it and make it more efficient, and these can be easily done by implementing some basic concepts.
We could have built this travel planner using a single AI agent and asked it to handle everything. However, by creating a multi-agent system, we divided the work among specialized agents, each focusing on one specific task. This approach makes the system more organized, efficient, and closer to how real-world teams solve problems. Instead of one AI trying to do everything, multiple AI agents collaborate to create a better and more personalized result for the user.
By adding memory, external tools, APIs, and real-time data, these agents can become even more powerful and solve complex real-world problems; a project for next time!