< Previous Challenge - Home - Next Challenge >
It’s time to build the first version of WanderAI’s Travel Planner service! In this challenge, you will create a Flask web application that leverages the Microsoft Agent Framework to generate personalized travel itineraries.
Your application will accept user travel preferences through a web form and use an AI agent to create beautiful, customized trip plans. The agent will have access to tools that provide real-time information like weather data and current date/time.
You need to build a Flask web application with the following components:
User Interface:
Backend:
Output:
Your application needs these key pieces:
get_random_destination() - Verify or select a destinationget_weather() - Get current weather for a locationget_datetime() - Return current date/time/ - Serve the home page form/plan - Accept travel preferences, run agent, return resultsChatAgent with toolstemplates/index.html - The form pagetemplates/result.html - The results pagetemplates/error.html - Error pageYour application needs the following environment variables configured in a .env file:
MSFT_FOUNDRY_ENDPOINT - Endpoint URL for Microsoft Foundry (e.g. https://your-resource-name.openai.azure.com/openai/v1/)MSFT_FOUNDRY_API_KEY - API key for LLM accessMODEL_ID - Model to use (e.g., gpt-5-mini)OPENWEATHER_API_KEY (optional) - For real weather dataA starter code file web_app.py with implementation guidance comments is provided in the Resources folder. This file outlines the structure you need to implement but leaves the core logic for you to figure out.
Use your knowledge from Challenge 01 or use a tool like GitHub Copilot to complete the tasks.
The files in your Codespace provide the necessary resources and structure to help you get started. These are not complete implementations but rather scaffolds to guide you in building the application. You will need to fill in the logic for the Flask routes, agent setup, and tool functions based on your understanding of the concepts covered in Challenge 01.
List of existing files in the Codespace:
web_app.py - Starter code for the Flask applicationtemplates/index.html - Starter HTML template for the form pagetemplates/result.html - Starter HTML template for the results pagetemplates/error.html - Starter HTML template for the error pagestatic/styles.css - CSS file for styling the HTML pagesrequirements.txt - Python dependencies for the projectrun.sh - Script to set up environment and run the Flask appTo complete this challenge successfully, you should be able to:
http://localhost:5002Once you have met these criteria, you will have successfully built the MVP for WanderAI’s Travel Planner service! Leverage the run.sh script to start your application. The first time you run it, it will install dependencies and set up the environment. Initially, no .env file will exist, so the script will create one and terminate. Add your API keys and other required environment variables listed above. Run the script again to start the Flask server.
If everything is set up correctly, you should see output indicating the Flask app is running on http://localhost:5002. Open that URL in your web browser to access the travel planner form.

Once you enter your travel preferences and submit the form, the AI agent will process your request and generate a personalized travel itinerary. The results page will display the recommended destinations, activities, accommodations, and other details in a user-friendly format.

agent.run() method must be awaited in an async contextPOST /api/plan) that returns JSON instead of HTML for future mobile app supportOPENWEATHER_API_KEY