Skip to content

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

fix: Update local travel agent to use new output type and adjust context handling

Shubhamsaboo828995333d89
diff --git a/starter_ai_agents/ai_travel_agent/local_travel_agent.py b/starter_ai_agents/ai_travel_agent/local_travel_agent.py
index 25f086dc..ca108b00 100644
--- a/starter_ai_agents/ai_travel_agent/local_travel_agent.py
+++ b/starter_ai_agents/ai_travel_agent/local_travel_agent.py
@@ -1,5 +1,6 @@
from textwrap import dedent
from agno.agent import Agent
+from agno.run.agent import RunOutput
from agno.tools.serpapi import SerpApiTools
import streamlit as st
import re
@@ -88,7 +89,7 @@ if serp_api_key:
"Remember: the quality of the results is important.",
],
tools=[SerpApiTools(api_key=serp_api_key)],
- add_datetime_to_instructions=True,
+ add_datetime_to_context=True,
)
planner = Agent(
name="Planner",
@@ -108,7 +109,7 @@ if serp_api_key:
"Focus on clarity, coherence, and overall quality.",
"Never make up facts or plagiarize. Always provide proper attribution.",
],
- add_datetime_to_instructions=True,
+ add_datetime_to_context=True,
)
# Input fields for the user's destination and the number of days they want to travel for
@@ -121,7 +122,7 @@ if serp_api_key:
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)
+ response: RunOutput = planner.run(f"{destination} for {num_days} days", stream=False)
# Store the response in session state
st.session_state.itinerary = response.content
st.write(response.content)
diff --git a/starter_ai_agents/ai_travel_agent/requirements.txt b/starter_ai_agents/ai_travel_agent/requirements.txt
index 2e438f6a..bdcda49a 100644
--- a/starter_ai_agents/ai_travel_agent/requirements.txt
+++ b/starter_ai_agents/ai_travel_agent/requirements.txt
@@ -1,5 +1,5 @@
streamlit
-agno
+agno>=2.2.10
openai
google-search-results
icalendar
\ No newline at end of file
diff --git a/starter_ai_agents/ai_travel_agent/travel_agent.py b/starter_ai_agents/ai_travel_agent/travel_agent.py
index b43dc532..fbb8068f 100644
--- a/starter_ai_agents/ai_travel_agent/travel_agent.py
+++ b/starter_ai_agents/ai_travel_agent/travel_agent.py
@@ -1,5 +1,6 @@
from textwrap import dedent
from agno.agent import Agent
+from agno.run.agent import RunOutput
from agno.tools.serpapi import SerpApiTools
import streamlit as st
import re
@@ -90,7 +91,7 @@ if openai_api_key and serp_api_key:
"Remember: the quality of the results is important.",
],
tools=[SerpApiTools(api_key=serp_api_key)],
- add_datetime_to_instructions=True,
+ add_datetime_to_context=True,
)
planner = Agent(
name="Planner",
@@ -110,7 +111,7 @@ if openai_api_key and serp_api_key:
"Focus on clarity, coherence, and overall quality.",
"Never make up facts or plagiarize. Always provide proper attribution.",
],
- add_datetime_to_instructions=True,
+ add_datetime_to_context=True,
)
# Input fields for the user's destination and the number of days they want to travel for
@@ -123,7 +124,7 @@ if openai_api_key and serp_api_key:
if st.button("Generate Itinerary"):
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)
+ research_results: RunOutput = researcher.run(f"Research {destination} for a {num_days} day trip", stream=False)
# Show research progress
st.write(" Research completed")
@@ -137,7 +138,7 @@ if openai_api_key and serp_api_key:
Please create a detailed itinerary based on this research.
"""
- response = planner.run(prompt, stream=False)
+ response: RunOutput = planner.run(prompt, stream=False)
# Store the response in session state
st.session_state.itinerary = response.content
st.write(response.content)