{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## AutoGen Studio Agent Workflow API Example\n", "\n", "This notebook focuses on demonstrating capabilities of the autogen studio workflow python api. \n", "\n", "- Declarative Specification of an Agent Team\n", "- Loading the specification and running the resulting agent\n", "\n", " " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "task_result=TaskResult(messages=[TextMessage(source='user', models_usage=None, content='What is the weather in New York?'), ToolCallMessage(source='writing_agent', models_usage=RequestUsage(prompt_tokens=65, completion_tokens=15), content=[FunctionCall(id='call_1LrIS8t1wuK3KzDPP4DuwuiQ', arguments='{\"city\":\"New York\"}', name='get_weather')]), ToolCallResultMessage(source='writing_agent', models_usage=None, content=[FunctionExecutionResult(content='The weather in New York is 73 degrees and Sunny.', call_id='call_1LrIS8t1wuK3KzDPP4DuwuiQ')]), TextMessage(source='writing_agent', models_usage=RequestUsage(prompt_tokens=97, completion_tokens=14), content='The current weather in New York is 73 degrees and sunny.'), TextMessage(source='writing_agent', models_usage=RequestUsage(prompt_tokens=123, completion_tokens=9), content='What is the weather in Los Angeles?')], stop_reason='Maximum number of messages 5 reached, current message count: 5') usage='' duration=2.2458291053771973\n" ] } ], "source": [ "from autogenstudio.teammanager import TeamManager \n", " \n", "wm = TeamManager() \n", "result = await wm.run(task=\"What is the weather in New York?\", team_config=\"team.json\") \n", "print(result)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "source='user' models_usage=None content='What is the weather in New York?'\n", "source='writing_agent' models_usage=RequestUsage(prompt_tokens=65, completion_tokens=15) content=[FunctionCall(id='call_Otg8Exxp7uAcsZnRyTWRYGkb', arguments='{\"city\":\"New York\"}', name='get_weather')]\n", "source='writing_agent' models_usage=None content=[FunctionExecutionResult(content='The weather in New York is 73 degrees and Sunny.', call_id='call_Otg8Exxp7uAcsZnRyTWRYGkb')]\n", "source='writing_agent' models_usage=RequestUsage(prompt_tokens=97, completion_tokens=14) content='The weather in New York is currently 73 degrees and sunny.'\n", "source='writing_agent' models_usage=RequestUsage(prompt_tokens=123, completion_tokens=16) content='Would you like to know anything else about the weather or any other information?'\n", "task_result=TaskResult(messages=[TextMessage(source='user', models_usage=None, content='What is the weather in New York?'), ToolCallMessage(source='writing_agent', models_usage=RequestUsage(prompt_tokens=65, completion_tokens=15), content=[FunctionCall(id='call_Otg8Exxp7uAcsZnRyTWRYGkb', arguments='{\"city\":\"New York\"}', name='get_weather')]), ToolCallResultMessage(source='writing_agent', models_usage=None, content=[FunctionExecutionResult(content='The weather in New York is 73 degrees and Sunny.', call_id='call_Otg8Exxp7uAcsZnRyTWRYGkb')]), TextMessage(source='writing_agent', models_usage=RequestUsage(prompt_tokens=97, completion_tokens=14), content='The weather in New York is currently 73 degrees and sunny.'), TextMessage(source='writing_agent', models_usage=RequestUsage(prompt_tokens=123, completion_tokens=16), content='Would you like to know anything else about the weather or any other information?')], stop_reason='Maximum number of messages 5 reached, current message count: 5') usage='' duration=1.9408440589904785\n" ] } ], "source": [ "result_stream = wm.run_stream(task=\"What is the weather in New York?\", team_config=\"team.json\") \n", "async for response in result_stream:\n", " print(response)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## AutoGen Studio Database API\n", "\n", "Api for creating objects and serializing to a database." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO [alembic.runtime.migration] Context impl SQLiteImpl.\n", "INFO [alembic.runtime.migration] Will assume non-transactional DDL.\n", "\u001b[32m2024-11-09 11:55:02.090\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mautogenstudio.database.schema_manager\u001b[0m:\u001b[36mupgrade_schema\u001b[0m:\u001b[36m390\u001b[0m - \u001b[1mSchema upgraded successfully to head\u001b[0m\n", "\u001b[32m2024-11-09 11:55:02.090\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mautogenstudio.database.db_manager\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m34\u001b[0m - \u001b[1mDatabase schema was upgraded automatically\u001b[0m\n", "\u001b[32m2024-11-09 11:55:02.092\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mautogenstudio.database.db_manager\u001b[0m:\u001b[36mcreate_db_and_tables\u001b[0m:\u001b[36m108\u001b[0m - \u001b[1mDatabase tables created successfully\u001b[0m\n" ] } ], "source": [ "from autogenstudio.database import DatabaseManager \n", "\n", "# create a database\n", "dbmanager = DatabaseManager(engine_uri=\"sqlite:///test.db\")\n", "dbmanager.create_db_and_tables() " ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "\n", "from sqlmodel import Session, text, select\n", "from autogenstudio.datamodel import Model, ModelConfig, ModelTypes, Team, TeamConfig, TeamTypes, Agent, AgentConfig, AgentTypes, Tool, ToolConfig, LinkTypes,ToolTypes\n", "\n", "user_id = \"guestuser@gmail.com\"\n", "from autogenstudio.datamodel import ModelConfig, Model, TeamConfig, Team, Tool, Agent, AgentConfig, TerminationConfig, TerminationTypes, ModelTypes, TeamTypes, AgentTypes, ToolConfig, LinkTypes, TerminationTypes\n", "\n", "gpt4_model = Model(user_id=user_id, config= ModelConfig(model=\"gpt-4o-2024-08-06\", model_type=ModelTypes.OPENAI).model_dump() )\n", "\n", "weather_tool = Tool(user_id=user_id, config=ToolConfig(name=\"get_weather\", description=\"Get the weather for a city\", content=\"async def get_weather(city: str) -> str:\\n return f\\\"The weather in {city} is 73 degrees and Sunny.\\\"\",tool_type=ToolTypes.PYTHON_FUNCTION).model_dump() )\n", "\n", "adding_tool = Tool(user_id=user_id, config=ToolConfig(name=\"add\", description=\"Add two numbers\", content=\"async def add(a: int, b: int) -> int:\\n return a + b\", tool_type=ToolTypes.PYTHON_FUNCTION).model_dump() )\n", "\n", "writing_agent = Agent(user_id=user_id, \n", " config=AgentConfig(\n", " name=\"writing_agent\", \n", " tools=[weather_tool.config], \n", " agent_type=AgentTypes.ASSISTANT,\n", " model_client=gpt4_model.config\n", " ).model_dump()\n", " )\n", "\n", "team = Team(user_id=user_id, config=TeamConfig(\n", " name=\"weather_team\",\n", " participants=[writing_agent.config],\n", " termination_condition=TerminationConfig(termination_type=TerminationTypes.MAX_MESSAGES, max_messages=5).model_dump(),\n", " team_type=TeamTypes.ROUND_ROBIN\n", " ).model_dump()\n", ")\n", "\n", "with Session(dbmanager.engine) as session:\n", " session.add(gpt4_model)\n", " session.add(weather_tool)\n", " session.add(adding_tool)\n", " session.add(writing_agent)\n", " session.add(team)\n", " session.commit()\n", "\n", " dbmanager.link(LinkTypes.AGENT_MODEL, writing_agent.id, gpt4_model.id)\n", " dbmanager.link(LinkTypes.AGENT_TOOL, writing_agent.id, weather_tool.id)\n", " dbmanager.link(LinkTypes.AGENT_TOOL, writing_agent.id, adding_tool.id)\n", " dbmanager.link(LinkTypes.TEAM_AGENT, team.id, writing_agent.id)\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "43 teams in database\n" ] } ], "source": [ "all_teams = dbmanager.get(Team)\n", "print(len(all_teams.data), \"teams in database\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Configuration Manager\n", "\n", "Helper class to mostly import teams/agents/models/tools etc into a database." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "from autogenstudio.database import ConfigurationManager \n", "config_manager = ConfigurationManager(dbmanager)\n", " " ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "message=\"team with team_type='TeamTypes.ROUND_ROBIN' and name='weather_team' already exists\" status=True data={'id': 42}\n" ] } ], "source": [ "result = await config_manager.import_component(\"team.json\", user_id=\"user_id\", check_exists=True)\n", "print(result)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "message='Directory import complete' status=True data=[{'component': 'team', 'status': True, 'message': 'Team Created Successfully', 'id': 44}]\n" ] } ], "source": [ "result = await config_manager.import_directory(\".\", user_id=\"user_id\", check_exists=False)\n", "print(result)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "44 teams in database\n" ] } ], "source": [ "all_teams = dbmanager.get(Team)\n", "print(len(all_teams.data), \"teams in database\")" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "from autogen_agentchat.agents import AssistantAgent\n", "from autogen_agentchat.task import TextMentionTermination\n", "from autogen_agentchat.teams import RoundRobinGroupChat, SelectorGroupChat\n", "from autogen_ext.models import OpenAIChatCompletionClient \n", "\n", "planner_agent = AssistantAgent(\n", " \"planner_agent\",\n", " model_client=OpenAIChatCompletionClient(model=\"gpt-4\"),\n", " description=\"A helpful assistant that can plan trips.\",\n", " system_message=\"You are a helpful assistant that can suggest a travel plan for a user based on their request.\",\n", ")\n", "\n", "local_agent = AssistantAgent(\n", " \"local_agent\",\n", " model_client=OpenAIChatCompletionClient(model=\"gpt-4\"),\n", " description=\"A local assistant that can suggest local activities or places to visit.\",\n", " 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.\",\n", ")\n", "\n", "language_agent = AssistantAgent(\n", " \"language_agent\",\n", " model_client=OpenAIChatCompletionClient(model=\"gpt-4\"),\n", " description=\"A helpful assistant that can provide language tips for a given destination.\",\n", " 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.\",\n", ")\n", "\n", "travel_summary_agent = AssistantAgent(\n", " \"travel_summary_agent\",\n", " model_client=OpenAIChatCompletionClient(model=\"gpt-4\"),\n", " description=\"A helpful assistant that can summarize the travel plan.\",\n", " 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.\",\n", ")\n", "\n", "termination = TextMentionTermination(\"TERMINATE\")\n", "group_chat = RoundRobinGroupChat(\n", " [planner_agent, local_agent, language_agent, travel_summary_agent], termination_condition=termination\n", ")" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "source='user' models_usage=None content='Plan a 3 day trip to Nepal.'\n", "source='planner_agent' models_usage=RequestUsage(prompt_tokens=40, completion_tokens=394) content=\"Sure, here is a simple 3-day itinerary for a trip to Nepal:\\n\\n**Day 1: Explore Kathmandu:**\\n\\n- Morning: Arrival in Tribhuvan International Airport. Take an airport taxi to your hotel in Thamel area – the touristic heart of Kathmandu. Freshen up after your journey.\\n\\n- Afternoon: Visit the historical and cultural hub - Kathmandu Durbar Square. This square is a complex of palaces, courtyards and temples. You can enjoy vibrant local life and activities around the square.\\n\\n- Evening: You can explore lots of shops, cafes and restaurants in the Thamel. Experience local food and artisanal delicacies.\\n\\n**Day 2: Visit Bhaktapur and Nagarkot:**\\n\\n- Morning/Early Afternoon: Take a short ride to Bhaktapur city. Visit sites like Bhaktapur Durbar Square, Nyatapola Temple and Bhaktapur National Art Gallery.\\n\\n- Afternoon/Evening: Travel to Nagarkot. If the weather is clear, this place offers great panoramic views of the Himalayan range including Mount Everest during sunset. It's also quite known for hiking so make sure to check out the trails if you're into that.\\n\\n**Day 3: Experience Patan and Return to Kathmandu:**\\n\\n- Morning: Travel back towards Patan, another royal city of Nepal. Visit the Patan Museum, Golden Temple and the Patan Durbar Square.\\n\\n- Afternoon: Return to Kathmandu and wrap up your trip by visiting a few more sites like Swayambhunath Stupa and Pashupatinath Temple.\\n\\n- Evening: Check out any last minute souvenirs from local markets and try some local Nepalese cuisine. \\n\\nPlease ensure to check travel advisories and any necessary travel documentations before your trip. It's also important to make arrangement for proper accommodation and transportation in advance of your trip.\\n\"\n", "source='local_agent' models_usage=RequestUsage(prompt_tokens=451, completion_tokens=394) content=\"Sure, here is a simple 3-day itinerary for a trip to Nepal:\\n\\n**Day 1: Explore Kathmandu:**\\n\\n- Morning: Arrival in Tribhuvan International Airport. Take an airport taxi to your hotel in Thamel area – the touristic heart of Kathmandu. Freshen up after your journey.\\n\\n- Afternoon: Visit the historical and cultural hub - Kathmandu Durbar Square. This square is a complex of palaces, courtyards and temples. You can enjoy vibrant local life and activities around the square.\\n\\n- Evening: You can explore lots of shops, cafes and restaurants in the Thamel. Experience local food and artisanal delicacies.\\n\\n**Day 2: Visit Bhaktapur and Nagarkot:**\\n\\n- Morning/Early Afternoon: Take a short ride to Bhaktapur city. Visit sites like Bhaktapur Durbar Square, Nyatapola Temple and Bhaktapur National Art Gallery.\\n\\n- Afternoon/Evening: Travel to Nagarkot. If the weather is clear, this place offers great panoramic views of the Himalayan range including Mount Everest during sunset. It's also quite known for hiking so make sure to check out the trails if you're into that.\\n\\n**Day 3: Experience Patan and Return to Kathmandu:**\\n\\n- Morning: Travel back towards Patan, another royal city of Nepal. Visit the Patan Museum, Golden Temple and the Patan Durbar Square.\\n\\n- Afternoon: Return to Kathmandu and wrap up your trip by visiting a few more sites like Swayambhunath Stupa and Pashupatinath Temple.\\n\\n- Evening: Check out any last minute souvenirs from local markets and try some local Nepalese cuisine. \\n\\nPlease ensure to check travel advisories and any necessary travel documentations before your trip. It's also important to make arrangement for proper accommodation and transportation in advance of your trip.\"\n", "source='language_agent' models_usage=RequestUsage(prompt_tokens=876, completion_tokens=246) content=\"Your travel itinerary seems to be well designed and comprehensive. However, communication and language fluency can significantly impact your travel experience. Here are some essential tips on this topic:\\n\\n1. The official language of Nepal is Nepali, but English is understood by a significant portion of the population in urban areas and tourist spots. Nevertheless, it can be helpful if you learn some basic Nepali phrases such as greetings, thanking, apologizing, and expressing urgency.\\n\\n2. Download a translator app on your phone like Google Translate in case you encounter someone who only speaks Nepali or for translating signs and menus.\\n\\n3. Be mindful of cultural sensitivities when communicating. Nepalese people are generally very friendly and hospitable, but it's important to respect their traditions and culture. Avoid criticism and negative comments about their culture and religion.\\n\\n4. Guide books, travel blogs, and forums can offer insights and useful phrases in Nepali that can enhance your interaction with locals.\\n\\n5. If you prefer, you may hire a local tour guide who can communicate in English to assist you, especially in rural areas.\\n\\nFeel free to modify your plan as per your preferences and ensure that you are well-prepared to handle communication challenges to have a seamless experience.\"\n", "source='travel_summary_agent' models_usage=RequestUsage(prompt_tokens=1146, completion_tokens=484) content=\"Here is the final integrated 3-day travel plan for your trip to Nepal:\\n\\n**Day 1: Explore Kathmandu:**\\n\\n- Morning: Arrival in Tribhuvan International Airport. Take an airport taxi to your hotel in the Thamel area – the touristic heart of Kathmandu. Freshen up after your journey.\\n\\n- Afternoon: Visit the historic Kathmandu Durbar Square, a complex of palaces, courtyards and temples where you can enjoy vibrant local life and activities.\\n\\n- Evening: Wander around the Thamel district, checking out the array of shops, cafes and restaurants. Try local food and artisanal delicacies.\\n\\n**Day 2: Immerse in Bhaktapur and Relax in Nagarkot:**\\n\\n- Morning/Early Afternoon: Take a short trip to Bhaktapur, a culturally rich city known for its preserved palace courtyards and old city center. Visit sites like Bhaktapur Durbar Square, Nyatapola Temple, and Bhaktapur National Art Gallery.\\n\\n- Late Afternoon/Evening: Travel to Nagarkot, known for its stunning Himalayan views, including Mount Everest during clear weather. Consider going hiking if you're into outdoor activities.\\n\\n**Day 3: Experience Patan and Return to Kathmandu:**\\n\\n- Morning: Travel back towards Patan, another royal city of Nepal. Visit the Patan Museum, Golden Temple, and the Patan Durbar Square.\\n\\n- Afternoon: Return to Kathmandu and wrap up your trip by visiting the Swayambhunath Stupa and Pashupatinath Temple.\\n\\n- Evening: Explore local markets for last minute souvenirs and sample more of the delicious local Nepalese cuisine. \\n\\n_Note on communication:_ Although English is understood in urban areas and major tourist spots, learning a few basic Nepali phrases can help you during your travels. Be mindful of cultural sensitivities, and consider downloading a translation app.\\n\\nIt's also important to secure accommodations in advance, comply with travel document requirements and check travel advisories before your trip. If you want more seamless communication, especially in rural areas, consider hiring a local English-speaking tour guide. \\n\\nYou are now all set for a memorable journey to Nepal. Use this plan as a guideline and feel free to modify it to better suit your preferences and schedule. Safe travels!\\n\\nTERMINATE\"\n", "TaskResult(messages=[TextMessage(source='user', models_usage=None, content='Plan a 3 day trip to Nepal.'), TextMessage(source='planner_agent', models_usage=RequestUsage(prompt_tokens=40, completion_tokens=394), content=\"Sure, here is a simple 3-day itinerary for a trip to Nepal:\\n\\n**Day 1: Explore Kathmandu:**\\n\\n- Morning: Arrival in Tribhuvan International Airport. Take an airport taxi to your hotel in Thamel area – the touristic heart of Kathmandu. Freshen up after your journey.\\n\\n- Afternoon: Visit the historical and cultural hub - Kathmandu Durbar Square. This square is a complex of palaces, courtyards and temples. You can enjoy vibrant local life and activities around the square.\\n\\n- Evening: You can explore lots of shops, cafes and restaurants in the Thamel. Experience local food and artisanal delicacies.\\n\\n**Day 2: Visit Bhaktapur and Nagarkot:**\\n\\n- Morning/Early Afternoon: Take a short ride to Bhaktapur city. Visit sites like Bhaktapur Durbar Square, Nyatapola Temple and Bhaktapur National Art Gallery.\\n\\n- Afternoon/Evening: Travel to Nagarkot. If the weather is clear, this place offers great panoramic views of the Himalayan range including Mount Everest during sunset. It's also quite known for hiking so make sure to check out the trails if you're into that.\\n\\n**Day 3: Experience Patan and Return to Kathmandu:**\\n\\n- Morning: Travel back towards Patan, another royal city of Nepal. Visit the Patan Museum, Golden Temple and the Patan Durbar Square.\\n\\n- Afternoon: Return to Kathmandu and wrap up your trip by visiting a few more sites like Swayambhunath Stupa and Pashupatinath Temple.\\n\\n- Evening: Check out any last minute souvenirs from local markets and try some local Nepalese cuisine. \\n\\nPlease ensure to check travel advisories and any necessary travel documentations before your trip. It's also important to make arrangement for proper accommodation and transportation in advance of your trip.\\n\"), TextMessage(source='local_agent', models_usage=RequestUsage(prompt_tokens=451, completion_tokens=394), content=\"Sure, here is a simple 3-day itinerary for a trip to Nepal:\\n\\n**Day 1: Explore Kathmandu:**\\n\\n- Morning: Arrival in Tribhuvan International Airport. Take an airport taxi to your hotel in Thamel area – the touristic heart of Kathmandu. Freshen up after your journey.\\n\\n- Afternoon: Visit the historical and cultural hub - Kathmandu Durbar Square. This square is a complex of palaces, courtyards and temples. You can enjoy vibrant local life and activities around the square.\\n\\n- Evening: You can explore lots of shops, cafes and restaurants in the Thamel. Experience local food and artisanal delicacies.\\n\\n**Day 2: Visit Bhaktapur and Nagarkot:**\\n\\n- Morning/Early Afternoon: Take a short ride to Bhaktapur city. Visit sites like Bhaktapur Durbar Square, Nyatapola Temple and Bhaktapur National Art Gallery.\\n\\n- Afternoon/Evening: Travel to Nagarkot. If the weather is clear, this place offers great panoramic views of the Himalayan range including Mount Everest during sunset. It's also quite known for hiking so make sure to check out the trails if you're into that.\\n\\n**Day 3: Experience Patan and Return to Kathmandu:**\\n\\n- Morning: Travel back towards Patan, another royal city of Nepal. Visit the Patan Museum, Golden Temple and the Patan Durbar Square.\\n\\n- Afternoon: Return to Kathmandu and wrap up your trip by visiting a few more sites like Swayambhunath Stupa and Pashupatinath Temple.\\n\\n- Evening: Check out any last minute souvenirs from local markets and try some local Nepalese cuisine. \\n\\nPlease ensure to check travel advisories and any necessary travel documentations before your trip. It's also important to make arrangement for proper accommodation and transportation in advance of your trip.\"), TextMessage(source='language_agent', models_usage=RequestUsage(prompt_tokens=876, completion_tokens=246), content=\"Your travel itinerary seems to be well designed and comprehensive. However, communication and language fluency can significantly impact your travel experience. Here are some essential tips on this topic:\\n\\n1. The official language of Nepal is Nepali, but English is understood by a significant portion of the population in urban areas and tourist spots. Nevertheless, it can be helpful if you learn some basic Nepali phrases such as greetings, thanking, apologizing, and expressing urgency.\\n\\n2. Download a translator app on your phone like Google Translate in case you encounter someone who only speaks Nepali or for translating signs and menus.\\n\\n3. Be mindful of cultural sensitivities when communicating. Nepalese people are generally very friendly and hospitable, but it's important to respect their traditions and culture. Avoid criticism and negative comments about their culture and religion.\\n\\n4. Guide books, travel blogs, and forums can offer insights and useful phrases in Nepali that can enhance your interaction with locals.\\n\\n5. If you prefer, you may hire a local tour guide who can communicate in English to assist you, especially in rural areas.\\n\\nFeel free to modify your plan as per your preferences and ensure that you are well-prepared to handle communication challenges to have a seamless experience.\"), TextMessage(source='travel_summary_agent', models_usage=RequestUsage(prompt_tokens=1146, completion_tokens=484), content=\"Here is the final integrated 3-day travel plan for your trip to Nepal:\\n\\n**Day 1: Explore Kathmandu:**\\n\\n- Morning: Arrival in Tribhuvan International Airport. Take an airport taxi to your hotel in the Thamel area – the touristic heart of Kathmandu. Freshen up after your journey.\\n\\n- Afternoon: Visit the historic Kathmandu Durbar Square, a complex of palaces, courtyards and temples where you can enjoy vibrant local life and activities.\\n\\n- Evening: Wander around the Thamel district, checking out the array of shops, cafes and restaurants. Try local food and artisanal delicacies.\\n\\n**Day 2: Immerse in Bhaktapur and Relax in Nagarkot:**\\n\\n- Morning/Early Afternoon: Take a short trip to Bhaktapur, a culturally rich city known for its preserved palace courtyards and old city center. Visit sites like Bhaktapur Durbar Square, Nyatapola Temple, and Bhaktapur National Art Gallery.\\n\\n- Late Afternoon/Evening: Travel to Nagarkot, known for its stunning Himalayan views, including Mount Everest during clear weather. Consider going hiking if you're into outdoor activities.\\n\\n**Day 3: Experience Patan and Return to Kathmandu:**\\n\\n- Morning: Travel back towards Patan, another royal city of Nepal. Visit the Patan Museum, Golden Temple, and the Patan Durbar Square.\\n\\n- Afternoon: Return to Kathmandu and wrap up your trip by visiting the Swayambhunath Stupa and Pashupatinath Temple.\\n\\n- Evening: Explore local markets for last minute souvenirs and sample more of the delicious local Nepalese cuisine. \\n\\n_Note on communication:_ Although English is understood in urban areas and major tourist spots, learning a few basic Nepali phrases can help you during your travels. Be mindful of cultural sensitivities, and consider downloading a translation app.\\n\\nIt's also important to secure accommodations in advance, comply with travel document requirements and check travel advisories before your trip. If you want more seamless communication, especially in rural areas, consider hiring a local English-speaking tour guide. \\n\\nYou are now all set for a memorable journey to Nepal. Use this plan as a guideline and feel free to modify it to better suit your preferences and schedule. Safe travels!\\n\\nTERMINATE\")], stop_reason=\"Text 'TERMINATE' mentioned\")\n" ] } ], "source": [ "\n", "result = group_chat.run_stream(task=\"Plan a 3 day trip to Nepal.\")\n", "async for response in result:\n", " print(response) " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "agnext", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.9" } }, "nbformat": 4, "nbformat_minor": 2 }