Travel Planning#

In this example, we’ll walk through the process of creating a sophisticated travel planning system using AgentChat. Our travel planner will utilize multiple AI agents, each with a specific role, to collaboratively create a comprehensive travel itinerary.

First, let us import the necessary modules.

from autogen_agentchat.agents import CodingAssistantAgent
from autogen_agentchat.conditions import TextMentionTermination
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_ext.models import OpenAIChatCompletionClient

Defining Agents#

In the next section we will define the agents that will be used in the travel planning team.

planner_agent = CodingAssistantAgent(
    "planner_agent",
    model_client=OpenAIChatCompletionClient(model="gpt-4"),
    description="A helpful assistant that can plan trips.",
    system_message="You are a helpful assistant that can suggest a travel plan for a user based on their request.",
)

local_agent = CodingAssistantAgent(
    "local_agent",
    model_client=OpenAIChatCompletionClient(model="gpt-4"),
    description="A local assistant that can suggest local activities or places to visit.",
    system_message="You are a helpful assistant that can suggest authentic and interesting local activities or places to visit for a user and can utilize any context information provided.",
)

language_agent = CodingAssistantAgent(
    "language_agent",
    model_client=OpenAIChatCompletionClient(model="gpt-4"),
    description="A helpful assistant that can provide language tips for a given destination.",
    system_message="You are a helpful assistant that can review travel plans, providing feedback on important/critical tips about how best to address language or communication challenges for the given destination. If the plan already includes language tips, you can mention that the plan is satisfactory, with rationale.",
)

travel_summary_agent = CodingAssistantAgent(
    "travel_summary_agent",
    model_client=OpenAIChatCompletionClient(model="gpt-4"),
    description="A helpful assistant that can summarize the travel plan.",
    system_message="You are a helpful assistant that can take in all of the suggestions and advice from the other agents and provide a detailed tfinal travel plan. You must ensure th b at the final plan is integrated and complete. YOUR FINAL RESPONSE MUST BE THE COMPLETE PLAN. When the plan is complete and all perspectives are integrated, you can respond with TERMINATE.",
)
termination = TextMentionTermination("TERMINATE")
group_chat = RoundRobinGroupChat(
    [planner_agent, local_agent, language_agent, travel_summary_agent], termination_condition=termination
)
result = await group_chat.run(task="Plan a 3 day trip to Nepal.")
print(result)
--------------------------------------------------------------------------------
user:
Plan a 3 day trip to Nepal.
--------------------------------------------------------------------------------
planner_agent:
Day 1: Arrival and Sightseeing in Kathmandu

Start your trip upon arrival at Tribhuvan International Airport in Kathmandu. After checking into a hotel, head off for sightseeing in Kathmandu, the cultural heart of Nepal.

First, visit Kathmandu Durbar Square, a UNESCO World Heritage Site. This square is filled with ancient architecture, temples, and has an old Royal Palace site.

Next, make your way to Swayambhunath Stupa (Monkey Temple), perched on a hilltop with panoramic views of Kathmandu city. 

In the evening, visit Thamel, a bustling district known for its shops, food stalls, and nightlife. Enjoy local Nepali cuisine for dinner to experience the local flavors.

Day 2: Explore Bhaktapur and Patan

Take a scenic drive to Bhaktapur, the city of devotees. Start with Bhaktapur Durbar Square, another UNESCO World Heritage Site, and then explore the local pottery square where traditional ceramics are made.

Then, head to Patan city, renowned for its vibrant arts and crafts tradition. Visit Patan Durbar Square, marvel at its architectural brilliance and learn about the unique mix of Buddhism and Hinduism in Nepal.

Day 3: Visit Pokhara

On your final day, take a domestic flight or a scenic 6-hour drive to Pokhara from Kathmandu. Pokhara is known for its stunning landscapes, charming water body - the Phewa lake, and the Himalayan range including the Annapurna massif.

Swing by the charming Lakeside market for some shopping, savor a relaxing boat ride in Phewa lake and visit the Tal Barahi Temple located in the center of the lake. Take the opportunity to visit Davis Falls, a unique waterfall that directly goes into a narrow and deep tunnel leading into a few kilometers long cave.

Please note that this is just a skeletal plan and actual trip might have variances based on your flight timings, weather, and local conditions.

Don't forget to carry essentials like warm clothing (especially if you're visiting in winters), toiletries, good quality trekking shoes; and remember to check about any visa or entry requirements. ALWAYS respect local customs and traditions when visiting religious places.

Please talk to local travel operators for transport, guide, and tickets to various tourist and heritage spots. Enjoy your trip!
--------------------------------------------------------------------------------
local_agent:
Day 1: Arrival and Sightseeing in Kathmandu

Start your trip upon arrival at Tribhuvan International Airport in Kathmandu. After checking into a hotel, head off for sightseeing in Kathmandu, the cultural heart of Nepal.

First, visit Kathmandu Durbar Square, a UNESCO World Heritage Site. This square is filled with ancient architecture, temples, and has an old Royal Palace site.

Next, make your way to Swayambhunath Stupa (Monkey Temple), perched on a hilltop with panoramic views of Kathmandu city. 

In the evening, visit Thamel, a bustling district known for its shops, food stalls, and nightlife. Enjoy local Nepali cuisine for dinner to experience the local flavors.

Day 2: Explore Bhaktapur and Patan

Take a scenic drive to Bhaktapur, the city of devotees. Start with Bhaktapur Durbar Square, another UNESCO World Heritage Site, and then explore the local pottery square where traditional ceramics are made.

Then, head to Patan city, renowned for its vibrant arts and crafts tradition. Visit Patan Durbar Square, marvel at its architectural brilliance and learn about the unique mix of Buddhism and Hinduism in Nepal.

Day 3: Visit Pokhara

On your final day, take a domestic flight or a scenic 6-hour drive to Pokhara from Kathmandu. Pokhara is known for its stunning landscapes, charming water body - the Phewa lake, and the Himalayan range including the Annapurna massif.

Swing by the charming Lakeside market for some shopping, savor a relaxing boat ride in Phewa lake and visit the Tal Barahi Temple located in the center of the lake. Take the opportunity to visit Davis Falls, a unique waterfall that directly goes into a narrow and deep tunnel leading into a few kilometers long cave.

Please note that this is just a skeletal plan and actual trip might have variances based on your flight timings, weather, and local conditions.

Don't forget to carry essentials like warm clothing (especially if you're visiting in winters), toiletries, good quality trekking shoes; and remember to check about any visa or entry requirements. ALWAYS respect local customs and traditions when visiting religious places.

Please talk to local travel operators for transport, guide, and tickets to various tourist and heritage spots. Enjoy your trip!
--------------------------------------------------------------------------------
language_agent:
Looking at your plan, it seems very detailed and well-thought-out. However, you have not addressed the critical language or communication aspect of travelling in Nepal. Here are some points to add:

1. The official language of Nepal is Nepali and is spoken by a majority of the population. English is also commonly understood and spoken in urban areas and tourist centres, but do not expect everyone to be fluent or comfortable communicating in English.

2. Before your trip, it might be worth learning a few basic Nepali words or phrases. Things like "hello" or "Namaste" (greeting), "dhanyabad" (thank you), or "kati ho?" (how much?) can go a long way.

3. Consider bringing a pocket-sized Nepali phrasebook or downloading a language app on your phone for translation assistance when needed.

4. For guided tours or when hiring taxis, ensure to hire English-speaking guides or drivers, which can usually be arranged through your hotel or local tourism agencies.

By considering these language and communication tips, you can ensure that your trip is both enjoyable and easy to navigate.
--------------------------------------------------------------------------------
travel_summary_agent:
Day 1: Arrival and Kathmandu Sightseeing

After landing at Tribhuvan International Airport, Kathmandu, move to your hotel for a quick refresh. Commence your tour with a visit to Kathmandu Durbar Square, a UNESCO World Heritage Site. Explore the historic architectures and temples here, along with the ancient Royal Palace.

Proceed to Swayambhunath Stupa (Monkey Temple), situated on a hilltop with stunning views of the city. 

Afterwards, stroll through the bustling district of Thamel, known for shops and food stalls, and enjoy a dinner with local Nepali flavors.

Day 2: Tour of Bhaktapur and Patan

Embark on a scenic drive to Bhaktapur, often called the city of devotees. Spend your morning at Bhaktapur Durbar Square, another UNESCO World Heritage Site, and take some time to explore the local pottery square.

In the afternoon, visit Patan City, known for its rich tradition of arts and crafts. Visit Patan Durbar Square, marvel at its architectural brilliance, and explore the confluence of Buddhism and Hinduism in Nepal.

Day 3: Discover Pokhara

On your final day, take a domestic flight or a 6-hour drive to Pokhara, a city renowned for its beautiful landscapes and the Phewa Lake overlooked by the towering Annapurna massif.

Visit the lakeside market for shopping, enjoy a calming boat ride on Phewa Lake, and visit the Tal Barahi Temple in the middle of the lake. Conclude your tour with a visit to Davis Falls, a unique waterfall that flows directly into a deep, narrow tunnel.

Please note:

- This is just an indicative plan; actual trip might vary based on your flight timings, weather, and local conditions.
- Don't forget to pack essentials such as warm clothing (especially for winters), toiletries, and sturdy trekking shoes. Prioritize checking visa or entry requirements, if any.
- Always respect local customs and traditions, specifically when visiting religious places.
- Consult with local travel operators for transportation, travel guides, and tickets to heritage spots.

Language Tips:

- The official language is Nepali. English is generally understood and spoken in urban areas and by people associated with tourism, but do not anticipate everyone to be fluent.
- Familiarize yourself with basic Nepali phrases like "Namaste" (Hello), "Dhanyabad" (Thank you), "Kati Ho?" (How much?), etc.
- Consider carrying a Nepali phrasebook or installing a language translation app.
- For guided tours or taxis, hire English-speaking guides or drivers. This can be arranged through your hotel or local tourism agencies. 

Enjoy your trip! 

TERMINATE
TeamRunResult(messages=[TextMessage(source='user', content='Plan a 3 day trip to Nepal.'), TextMessage(source='planner_agent', content="Day 1: Arrival and Sightseeing in Kathmandu\n\nStart your trip upon arrival at Tribhuvan International Airport in Kathmandu. After checking into a hotel, head off for sightseeing in Kathmandu, the cultural heart of Nepal.\n\nFirst, visit Kathmandu Durbar Square, a UNESCO World Heritage Site. This square is filled with ancient architecture, temples, and has an old Royal Palace site.\n\nNext, make your way to Swayambhunath Stupa (Monkey Temple), perched on a hilltop with panoramic views of Kathmandu city. \n\nIn the evening, visit Thamel, a bustling district known for its shops, food stalls, and nightlife. Enjoy local Nepali cuisine for dinner to experience the local flavors.\n\nDay 2: Explore Bhaktapur and Patan\n\nTake a scenic drive to Bhaktapur, the city of devotees. Start with Bhaktapur Durbar Square, another UNESCO World Heritage Site, and then explore the local pottery square where traditional ceramics are made.\n\nThen, head to Patan city, renowned for its vibrant arts and crafts tradition. Visit Patan Durbar Square, marvel at its architectural brilliance and learn about the unique mix of Buddhism and Hinduism in Nepal.\n\nDay 3: Visit Pokhara\n\nOn your final day, take a domestic flight or a scenic 6-hour drive to Pokhara from Kathmandu. Pokhara is known for its stunning landscapes, charming water body - the Phewa lake, and the Himalayan range including the Annapurna massif.\n\nSwing by the charming Lakeside market for some shopping, savor a relaxing boat ride in Phewa lake and visit the Tal Barahi Temple located in the center of the lake. Take the opportunity to visit Davis Falls, a unique waterfall that directly goes into a narrow and deep tunnel leading into a few kilometers long cave.\n\nPlease note that this is just a skeletal plan and actual trip might have variances based on your flight timings, weather, and local conditions.\n\nDon't forget to carry essentials like warm clothing (especially if you're visiting in winters), toiletries, good quality trekking shoes; and remember to check about any visa or entry requirements. ALWAYS respect local customs and traditions when visiting religious places.\n\nPlease talk to local travel operators for transport, guide, and tickets to various tourist and heritage spots. Enjoy your trip!"), TextMessage(source='local_agent', content="Day 1: Arrival and Sightseeing in Kathmandu\n\nStart your trip upon arrival at Tribhuvan International Airport in Kathmandu. After checking into a hotel, head off for sightseeing in Kathmandu, the cultural heart of Nepal.\n\nFirst, visit Kathmandu Durbar Square, a UNESCO World Heritage Site. This square is filled with ancient architecture, temples, and has an old Royal Palace site.\n\nNext, make your way to Swayambhunath Stupa (Monkey Temple), perched on a hilltop with panoramic views of Kathmandu city. \n\nIn the evening, visit Thamel, a bustling district known for its shops, food stalls, and nightlife. Enjoy local Nepali cuisine for dinner to experience the local flavors.\n\nDay 2: Explore Bhaktapur and Patan\n\nTake a scenic drive to Bhaktapur, the city of devotees. Start with Bhaktapur Durbar Square, another UNESCO World Heritage Site, and then explore the local pottery square where traditional ceramics are made.\n\nThen, head to Patan city, renowned for its vibrant arts and crafts tradition. Visit Patan Durbar Square, marvel at its architectural brilliance and learn about the unique mix of Buddhism and Hinduism in Nepal.\n\nDay 3: Visit Pokhara\n\nOn your final day, take a domestic flight or a scenic 6-hour drive to Pokhara from Kathmandu. Pokhara is known for its stunning landscapes, charming water body - the Phewa lake, and the Himalayan range including the Annapurna massif.\n\nSwing by the charming Lakeside market for some shopping, savor a relaxing boat ride in Phewa lake and visit the Tal Barahi Temple located in the center of the lake. Take the opportunity to visit Davis Falls, a unique waterfall that directly goes into a narrow and deep tunnel leading into a few kilometers long cave.\n\nPlease note that this is just a skeletal plan and actual trip might have variances based on your flight timings, weather, and local conditions.\n\nDon't forget to carry essentials like warm clothing (especially if you're visiting in winters), toiletries, good quality trekking shoes; and remember to check about any visa or entry requirements. ALWAYS respect local customs and traditions when visiting religious places.\n\nPlease talk to local travel operators for transport, guide, and tickets to various tourist and heritage spots. Enjoy your trip!"), TextMessage(source='language_agent', content='Looking at your plan, it seems very detailed and well-thought-out. However, you have not addressed the critical language or communication aspect of travelling in Nepal. Here are some points to add:\n\n1. The official language of Nepal is Nepali and is spoken by a majority of the population. English is also commonly understood and spoken in urban areas and tourist centres, but do not expect everyone to be fluent or comfortable communicating in English.\n\n2. Before your trip, it might be worth learning a few basic Nepali words or phrases. Things like "hello" or "Namaste" (greeting), "dhanyabad" (thank you), or "kati ho?" (how much?) can go a long way.\n\n3. Consider bringing a pocket-sized Nepali phrasebook or downloading a language app on your phone for translation assistance when needed.\n\n4. For guided tours or when hiring taxis, ensure to hire English-speaking guides or drivers, which can usually be arranged through your hotel or local tourism agencies.\n\nBy considering these language and communication tips, you can ensure that your trip is both enjoyable and easy to navigate.'), StopMessage(source='travel_summary_agent', content='Day 1: Arrival and Kathmandu Sightseeing\n\nAfter landing at Tribhuvan International Airport, Kathmandu, move to your hotel for a quick refresh. Commence your tour with a visit to Kathmandu Durbar Square, a UNESCO World Heritage Site. Explore the historic architectures and temples here, along with the ancient Royal Palace.\n\nProceed to Swayambhunath Stupa (Monkey Temple), situated on a hilltop with stunning views of the city. \n\nAfterwards, stroll through the bustling district of Thamel, known for shops and food stalls, and enjoy a dinner with local Nepali flavors.\n\nDay 2: Tour of Bhaktapur and Patan\n\nEmbark on a scenic drive to Bhaktapur, often called the city of devotees. Spend your morning at Bhaktapur Durbar Square, another UNESCO World Heritage Site, and take some time to explore the local pottery square.\n\nIn the afternoon, visit Patan City, known for its rich tradition of arts and crafts. Visit Patan Durbar Square, marvel at its architectural brilliance, and explore the confluence of Buddhism and Hinduism in Nepal.\n\nDay 3: Discover Pokhara\n\nOn your final day, take a domestic flight or a 6-hour drive to Pokhara, a city renowned for its beautiful landscapes and the Phewa Lake overlooked by the towering Annapurna massif.\n\nVisit the lakeside market for shopping, enjoy a calming boat ride on Phewa Lake, and visit the Tal Barahi Temple in the middle of the lake. Conclude your tour with a visit to Davis Falls, a unique waterfall that flows directly into a deep, narrow tunnel.\n\nPlease note:\n\n- This is just an indicative plan; actual trip might vary based on your flight timings, weather, and local conditions.\n- Don\'t forget to pack essentials such as warm clothing (especially for winters), toiletries, and sturdy trekking shoes. Prioritize checking visa or entry requirements, if any.\n- Always respect local customs and traditions, specifically when visiting religious places.\n- Consult with local travel operators for transportation, travel guides, and tickets to heritage spots.\n\nLanguage Tips:\n\n- The official language is Nepali. English is generally understood and spoken in urban areas and by people associated with tourism, but do not anticipate everyone to be fluent.\n- Familiarize yourself with basic Nepali phrases like "Namaste" (Hello), "Dhanyabad" (Thank you), "Kati Ho?" (How much?), etc.\n- Consider carrying a Nepali phrasebook or installing a language translation app.\n- For guided tours or taxis, hire English-speaking guides or drivers. This can be arranged through your hotel or local tourism agencies. \n\nEnjoy your trip! \n\nTERMINATE')])