Skip to content

100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.

fixed a few bug - travel agent working perfect now

Madhu634ab021714a
diff --git a/ai_agent_tutorials/ai_travel_agent/travel_agent.py b/ai_agent_tutorials/ai_travel_agent/travel_agent.py
index 18db2cf9..eab9bbf5 100644
--- a/ai_agent_tutorials/ai_travel_agent/travel_agent.py
+++ b/ai_agent_tutorials/ai_travel_agent/travel_agent.py
@@ -61,7 +61,21 @@ if openai_api_key and serp_api_key:
num_days = st.number_input("How many days do you want to travel for?", min_value=1, max_value=30, value=7)
if st.button("Generate Itinerary"):
- with st.spinner("Processing..."):
- # Get the response from the assistant
- response = planner.run(f"{destination} for {num_days} days", stream=False)
+ with st.spinner("Researching your destination..."):
+ # First get research results
+ research_results = researcher.run(f"Research {destination} for a {num_days} day trip", stream=False)
+
+ # Show research progress
+ st.write("✓ Research completed")
+
+ with st.spinner("Creating your personalized itinerary..."):
+ # Pass research results to planner
+ prompt = f"""
+ Destination: {destination}
+ Duration: {num_days} days
+ Research Results: {research_results.content}
+
+ Please create a detailed itinerary based on this research.
+ """
+ response = planner.run(prompt, stream=False)
st.write(response.content)
\ No newline at end of file