Jump to content

Recommended Posts

Posted
1 hour ago, islander said:

CP ante direct CA to Hong Kong ee back route aa uncle?

Hyd to Auckland kuda Cathy Pacific masth ainayi.. 5 + 10 hrs daily maku

yes anna..ade

Posted

enni trips estav India ki

Posted
1 hour ago, islander said:

CP ante direct CA to Hong Kong ee back route aa uncle?

Hyd to Auckland kuda Cathy Pacific masth ainayi.. 5 + 10 hrs daily maku

Maaku Lufthansa best anna 8+8 konchem stratch vubtadhi dheenamma oke flight la 15-16 hours ante vaammo 

Posted
Just now, Sucker said:

Maaku Lufthansa best anna 8+8 konchem stratch vubtadhi dheenamma oke flight la 15-16 hours ante vaammo 

Frankfurt layover unte atleast 2+ hrs undetattu chusko. I missed my flight last year from FRA and had to spend 9 hrs in that shitty airport while coming back, flight from Hyd was delayed by 30 mins 

other than that journey is a breeze 

  • Like 1
Posted

I booked business class in Finnair, layover in Helsinki. Booked everything with points. 

Posted
1 hour ago, csrcsr said:

@Sucker @Thokkalee @Paamu just as we were talking tried one more agent through Anthropic agent framework simple python code 

took one api key for $5 from claude based on tokens melliga money cut chestadi

and https://serpapi.com/manage-api-key for free flight searches upto 100 a months  info there are many others which are good and powerful  but paid 

serp api is free was able to develop small agent and play around entire code generated claude modified few things here and there for 30 minutes  you can devleop a agent  in whatever idea you get and make it working

 

 

https://platform.claude.com/settings/keys

this is just for learning and you can add more powerful features like book the ticket with your payment details when price falls this below etc sky is the limit , also you might get doubt why agent is powerful than browser 

nenu emi cheptuna ante if you have any idea @Sucker you can get into producton within days i am java backend cloud dev with little python all written by claude , see the interactions in the white screen 

 

  • Multi-step reasoning - Plans complex trips automatically
  • Price optimization - Finds creative routing to save money
  • Autonomous decision-making - Compares options intelligently
  • Memory & learning - Remembers your preferences
  • Multi-tool orchestration - Uses multiple APIs together
  • Proactive suggestions - Finds deals you didn't know existed

 

 

 

1771013886811-c6f567da-6df2-436c-8fb7-1b

 

one file python code i can check into git hub later or you can prompt and write the code  you have to keep your keys in .env file 

 

 

 

"""
🤖 AGENTIC FLIGHT ASSISTANT - Using REAL Google Flights Data
Via SerpAPI - Actually works like Google Flights!
"""
 
import anthropic
import os
import json
from datetime import datetime, timedelta
from dotenv import load_dotenv
import requests
import time
 
load_dotenv()
 
class AgenticFlightAssistant:
"""AI agent using REAL Google Flights data via SerpAPI"""
 
def __init__(self😞
self.claude = anthropic.Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
 
# SerpAPI - scrapes Google Flights
self.serpapi_key = os.getenv("SERPAPI_KEY")
 
self.conversation_history = []
self.search_cache = {}
 
if self.serpapi_key:
print(" Connected to SerpAPI (Google Flights)")
else:
print("⚠️ Get free key at: https://serpapi.com")
 
print("🤖 Agentic Assistant ready - REAL Google Flights data!")
 
def search_flights(self, origin, destination, date, return_date=None😞
"""Search using actual Google Flights data via SerpAPI"""
cache_key = f"{origin}-{destination}-{date}-{return_date}"
 
if cache_key in self.search_cache:
print(f"📦 Cached results")
return self.search_cache[cache_key]
 
try:
print(f"🔍 Searching Google Flights: {origin}{destination} on {date}")
 
url = "https://serpapi.com/search"
 
params = {
"engine": "google_flights",
"departure_id": origin,
"arrival_id": destination,
"outbound_date": date,
"currency": "USD",
"hl": "en",
"api_key": self.serpapi_key
}
 
if return_date:
params["return_date"] = return_date
params["type"] = "1" # Round trip
else:
params["type"] = "2" # One way
 
response = requests.get(url, params=params, timeout=30)
response.raise_for_status()
data = response.json()
 
if 'error' in data:
return {
"success": False,
"error": data.get('error', 'API error')
}
 
# Parse best flights
best_flights = data.get('best_flights', [])
other_flights = data.get('other_flights', [])
all_flights = best_flights + other_flights
 
flights = []
for flight in all_flights[:10]:
flights.append({
"price": flight.get('price', 0),
"airline": flight['flights'][0].get('airline') if flight.get('flights') else 'Unknown',
"duration": flight.get('total_duration', 0),
"layovers": len(flight.get('flights', [])) - 1,
"departure_time": flight['flights'][0].get('departure_airport', {}).get('time') if flight.get('flights') else 'N/A',
"arrival_time": flight['flights'][-1].get('arrival_airport', {}).get('time') if flight.get('flights') else 'N/A',
"carbon_emissions": flight.get('carbon_emissions', {}).get('this_flight', 0)
})
 
result = {
"success": True,
"flights": flights,
"count": len(flights),
"route": f"{origin}{destination}",
"cheapest_price": min([f['price'] for f in flights]) if flights else 0
}
 
self.search_cache[cache_key] = result
print(f" Found {len(flights)} flights (cheapest: ${result['cheapest_price']})")
return result
 
except Exception as e:
print(f" Error: {e}")
return {"success": False, "error": str(e)}
 
def find_flexible_dates(self, origin, destination, target_date, days_range=3😞
"""Agent searches multiple dates for best price"""
print(f"\n🤖 AGENT: Searching ±{days_range} days for best price...")
 
target = datetime.strptime(target_date, '%Y-%m-%d')
results = []
 
for offset in range(-days_range, days_range + 1😞
check_date = (target + timedelta(days=offset)).strftime('%Y-%m-%d')
search_result = self.search_flights(origin, destination, check_date)
 
if search_result.get('success') and search_result.get('flights'😞
min_price = search_result.get('cheapest_price', 0)
results.append({
"date": check_date,
"min_price": min_price,
"offset_days": offset,
"savings": 0 # Will calculate after
})
 
time.sleep(2) # Rate limiting
 
if results:
base_price = next((r['min_price'] for r in results if r['offset_days'] == 0), 0)
for r in results:
r['savings'] = base_price - r['min_price']
 
return {
"success": True,
"flexible_dates": results,
"best_date": min(results, key=lambda x: x['min_price']) if results else None,
"worst_date": max(results, key=lambda x: x['min_price']) if results else None
}
 
def analyze_route_budget(self, origin, destination, date, budget😞
"""Agent analyzes budget and finds optimizations"""
print(f"\n🤖 AGENT: Analyzing budget (${budget})...")
 
search = self.search_flights(origin, destination, date)
 
if not search.get('success') or not search.get('flights'😞
return {"success": False, "message": "No flights found"}
 
cheapest = search.get('cheapest_price', 0)
within_budget = cheapest <= budget
 
recommendations = []
 
if not within_budget:
shortage = cheapest - budget
recommendations.append(f"⚠️ Cheapest flight (${cheapest}) is ${shortage:.2f} over budget")
 
# Try flexible dates
flex = self.find_flexible_dates(origin, destination, date, days_range=3)
if flex.get('best_date') and flex['best_date']['min_price'] < cheapest:
best = flex['best_date']
if best['min_price'] <= budget:
recommendations.append(f" Found option within budget: ${best['min_price']} on {best['date']}")
else:
recommendations.append(f"💡 Cheapest option: ${best['min_price']} on {best['date']} (still ${best['min_price'] - budget:.2f} over)")
else:
recommendations.append(f" Within budget! Cheapest: ${cheapest}")
 
return {
"success": True,
"within_budget": within_budget,
"cheapest_option": cheapest,
"budget": budget,
"recommendations": recommendations
}
 
def plan_multi_city(self, cities, start_date, days_per_city😞
"""Agent plans multi-city itinerary"""
print(f"\n🤖 AGENT: Planning {len(cities)}-city trip...")
 
itinerary = []
current_date = datetime.strptime(start_date, '%Y-%m-%d')
total_cost = 0
 
for i in range(len(cities) - 1😞
origin = cities[i]
destination = cities[i + 1]
flight_date = current_date.strftime('%Y-%m-%d')
 
print(f"📍 Leg {i+1}: {origin}{destination}")
 
search = self.search_flights(origin, destination, flight_date)
 
if search.get('success') and search.get('flights'😞
cheapest_price = search.get('cheapest_price', 0)
cheapest_flight = min(search['flights'], key=lambda x: x['price'])
 
itinerary.append({
"leg": i + 1,
"from": origin,
"to": destination,
"date": flight_date,
"price": cheapest_price,
"airline": cheapest_flight.get('airline'),
"duration": cheapest_flight.get('duration')
})
 
total_cost += cheapest_price
 
current_date += timedelta(days=days_per_city)
time.sleep(2)
 
return {
"success": True,
"itinerary": itinerary,
"total_cost": total_cost,
"total_days": len(cities) * days_per_city,
"cost_per_day": total_cost / (len(cities) * days_per_city) if len(cities) > 0 else 0
}
 
def run_agent(self, user_request😞
"""Main agentic loop"""
 
tools = [
{
"name": "search_flights",
"description": "Search REAL Google Flights data with pricing",
"input_schema": {
"type": "object",
"properties": {
"origin": {"type": "string"},
"destination": {"type": "string"},
"date": {"type": "string"},
"return_date": {"type": "string"}
},
"required": ["origin", "destination", "date"]
}
},
{
"name": "find_flexible_dates",
"description": "Agent autonomously searches multiple dates for cheapest option",
"input_schema": {
"type": "object",
"properties": {
"origin": {"type": "string"},
"destination": {"type": "string"},
"target_date": {"type": "string"},
"days_range": {"type": "integer"}
},
"required": ["origin", "destination", "target_date"]
}
},
{
"name": "analyze_route_budget",
"description": "Agent analyzes budget and autonomously finds optimizations",
"input_schema": {
"type": "object",
"properties": {
"origin": {"type": "string"},
"destination": {"type": "string"},
"date": {"type": "string"},
"budget": {"type": "number"}
},
"required": ["origin", "destination", "date", "budget"]
}
},
{
"name": "plan_multi_city",
"description": "Agent plans complete multi-city itinerary with prices",
"input_schema": {
"type": "object",
"properties": {
"cities": {"type": "array", "items": {"type": "string"}},
"start_date": {"type": "string"},
"days_per_city": {"type": "integer"}
},
"required": ["cities", "start_date", "days_per_city"]
}
}
]
 
self.conversation_history.append({
"role": "user",
"content": user_request
})
 
iteration = 0
while iteration < 10:
iteration += 1
 
response = self.claude.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=4000,
system="""You are an agentic AI using REAL Google Flights data.
 
You can:
- Search actual flight prices from Google Flights
- Compare multiple dates autonomously
- Optimize within budget constraints
- Plan complex multi-city trips
- Make intelligent recommendations
 
Be proactive, think multi-step, find creative solutions!""",
tools=tools,
messages=self.conversation_history
)
 
self.conversation_history.append({
"role": "assistant",
"content": response.content
})
 
if response.stop_reason == "tool_use":
tool_results = []
 
for block in response.content:
if block.type == "tool_use":
tool_name = block.name
tool_input = block.input
 
print(f"\n🔧 Tool: {tool_name}")
 
if tool_name == "search_flights":
result = self.search_flights(**tool_input)
elif tool_name == "find_flexible_dates":
result = self.find_flexible_dates(**tool_input)
elif tool_name == "analyze_route_budget":
result = self.analyze_route_budget(**tool_input)
elif tool_name == "plan_multi_city":
result = self.plan_multi_city(**tool_input)
else:
result = {"error": f"Unknown tool"}
 
tool_results.append({
"type": "tool_result",
"tool_use_id": block.id,
"content": json.dumps(result)
})
 
self.conversation_history.append({
"role": "user",
"content": tool_results
})
else:
final_response = ""
for block in response.content:
if hasattr(block, "text"😞
final_response += block.text
return final_response
 
return "Max iterations reached."
 
def main():
print("=" * 80)
print("🤖 AGENTIC FLIGHT ASSISTANT - REAL GOOGLE FLIGHTS DATA")
print("=" * 80)
print("\nUsing SerpAPI to access Google Flights")
print("\n REAL pricing from Google Flights")
print(" ALL routes worldwide")
print(" Same data you see on google.com/flights")
print("\n" + "=" * 80 + "\n")
 
agent = AgenticFlightAssistant()
 
while True:
try:
user_input = input("\n👤 You: ").strip()
 
if user_input.lower() in ['quit', 'exit', 'bye']:
print("\n🤖 Goodbye!")
break
 
if not user_input:
continue
 
print("\n🤖 Agent working...\n")
response = agent.run_agent(user_input)
print(f"\n🤖 Agent: {response}\n")
 
except KeyboardInterrupt:
print("\n\n🤖 Goodbye!")
break
except Exception as e:
print(f"\n Error: {e}")
 
if __name__ == "__main__":
main()

 

 

hmmm... weekend break ivvu anna... Friday bhaya pettaku..... E lekkana team size e level lo tagguthayooo  I can't imagine.

Posted
5 hours ago, Sucker said:

No passport issue not much money issues 

But India trip ante Biz class ani cheppakandi Family motham Biz ante kidney ammali looking for 8 hours to 8 Hours type not single stretch 

I know British airways and Lufthansa are best any other options? 

Oka 1-2 days akkade makaam pettali layover la kuda add on 

Soodi vaddu ... Neeku telsu nee destination ento .. Amsterdam ee kada? KLM ee kada neeku kavalsindi ..

@csrcsr chusava over action?

bhibatsam-brahmanandam.gif

  • Haha 1
Posted
1 minute ago, Konebhar6 said:

Soodi vaddu ... Neeku telsu nee destination ento .. Amsterdam ee kada? KLM ee kada neeku kavalsindi ..

@csrcsr chusava over action?

bhibatsam-brahmanandam.gif

jklsouth-jkltelugu.gif

 

Posted
5 hours ago, Sucker said:

No passport issue not much money issues 

But India trip ante Biz class ani cheppakandi Family motham Biz ante kidney ammali looking for 8 hours to 8 Hours type not single stretch 

I know British airways and Lufthansa are best any other options? 

Oka 1-2 days akkade makaam pettali layover la kuda add on 

 

4 hours ago, Spartan said:

Flying on Sunday.. Cathay Pacific..

I prefer Lufthansa..kaani return lo one more passenger travelling who is not eligible for German travel.

anduke CP teskolvasi vachindi

I am flying on Monday. For 5 weeks. Enjoy your India trip ... 

200w.gif

 

  • Haha 1
  • Upvote 1
Posted
27 minutes ago, Paamu said:

hmmm... weekend break ivvu anna... Friday bhaya pettaku..... E lekkana team size e level lo tagguthayooo  I can't imagine.

Next week stocks dhamal anna ... 

63ec8824c82cddc0e9d6569c7d46d648.gif

  • Sad 1
Posted
5 hours ago, Sucker said:

No passport issue not much money issues 

But India trip ante Biz class ani cheppakandi Family motham Biz ante kidney ammali looking for 8 hours to 8 Hours type not single stretch 

I know British airways and Lufthansa are best any other options? 

Oka 1-2 days akkade makaam pettali layover la kuda add on 

1st world problem reported by a 3rd world person 

sampu1.gif

Posted
3 hours ago, csrcsr said:

@Sucker @Thokkalee @Paamu just as we were talking tried one more agent through Anthropic agent framework simple python code 

took one api key for $5 from claude based on tokens melliga money cut chestadi

and https://serpapi.com/manage-api-key for free flight searches upto 100 a months  info there are many others which are good and powerful  but paid 

serp api is free was able to develop small agent and play around entire code generated claude modified few things here and there for 30 minutes  you can devleop a agent  in whatever idea you get and make it working

 

 

https://platform.claude.com/settings/keys

this is just for learning and you can add more powerful features like book the ticket with your payment details when price falls this below etc sky is the limit , also you might get doubt why agent is powerful than browser 

nenu emi cheptuna ante if you have any idea @Sucker you can get into producton within days i am java backend cloud dev with little python all written by claude , see the interactions in the white screen 

 

  • Multi-step reasoning - Plans complex trips automatically
  • Price optimization - Finds creative routing to save money
  • Autonomous decision-making - Compares options intelligently
  • Memory & learning - Remembers your preferences
  • Multi-tool orchestration - Uses multiple APIs together
  • Proactive suggestions - Finds deals you didn't know existed

 

 

 

1771013886811-c6f567da-6df2-436c-8fb7-1b

 

one file python code i can check into git hub later or you can prompt and write the code  you have to keep your keys in .env file 

 

 

 

"""
🤖 AGENTIC FLIGHT ASSISTANT - Using REAL Google Flights Data
Via SerpAPI - Actually works like Google Flights!
"""
 
import anthropic
import os
import json
from datetime import datetime, timedelta
from dotenv import load_dotenv
import requests
import time
 
load_dotenv()
 
class AgenticFlightAssistant:
"""AI agent using REAL Google Flights data via SerpAPI"""
 
def __init__(self😞
self.claude = anthropic.Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
 
# SerpAPI - scrapes Google Flights
self.serpapi_key = os.getenv("SERPAPI_KEY")
 
self.conversation_history = []
self.search_cache = {}
 
if self.serpapi_key:
print(" Connected to SerpAPI (Google Flights)")
else:
print("⚠️ Get free key at: https://serpapi.com")
 
print("🤖 Agentic Assistant ready - REAL Google Flights data!")
 
def search_flights(self, origin, destination, date, return_date=None😞
"""Search using actual Google Flights data via SerpAPI"""
cache_key = f"{origin}-{destination}-{date}-{return_date}"
 
if cache_key in self.search_cache:
print(f"📦 Cached results")
return self.search_cache[cache_key]
 
try:
print(f"🔍 Searching Google Flights: {origin}{destination} on {date}")
 
url = "https://serpapi.com/search"
 
params = {
"engine": "google_flights",
"departure_id": origin,
"arrival_id": destination,
"outbound_date": date,
"currency": "USD",
"hl": "en",
"api_key": self.serpapi_key
}
 
if return_date:
params["return_date"] = return_date
params["type"] = "1" # Round trip
else:
params["type"] = "2" # One way
 
response = requests.get(url, params=params, timeout=30)
response.raise_for_status()
data = response.json()
 
if 'error' in data:
return {
"success": False,
"error": data.get('error', 'API error')
}
 
# Parse best flights
best_flights = data.get('best_flights', [])
other_flights = data.get('other_flights', [])
all_flights = best_flights + other_flights
 
flights = []
for flight in all_flights[:10]:
flights.append({
"price": flight.get('price', 0),
"airline": flight['flights'][0].get('airline') if flight.get('flights') else 'Unknown',
"duration": flight.get('total_duration', 0),
"layovers": len(flight.get('flights', [])) - 1,
"departure_time": flight['flights'][0].get('departure_airport', {}).get('time') if flight.get('flights') else 'N/A',
"arrival_time": flight['flights'][-1].get('arrival_airport', {}).get('time') if flight.get('flights') else 'N/A',
"carbon_emissions": flight.get('carbon_emissions', {}).get('this_flight', 0)
})
 
result = {
"success": True,
"flights": flights,
"count": len(flights),
"route": f"{origin}{destination}",
"cheapest_price": min([f['price'] for f in flights]) if flights else 0
}
 
self.search_cache[cache_key] = result
print(f" Found {len(flights)} flights (cheapest: ${result['cheapest_price']})")
return result
 
except Exception as e:
print(f" Error: {e}")
return {"success": False, "error": str(e)}
 
def find_flexible_dates(self, origin, destination, target_date, days_range=3😞
"""Agent searches multiple dates for best price"""
print(f"\n🤖 AGENT: Searching ±{days_range} days for best price...")
 
target = datetime.strptime(target_date, '%Y-%m-%d')
results = []
 
for offset in range(-days_range, days_range + 1😞
check_date = (target + timedelta(days=offset)).strftime('%Y-%m-%d')
search_result = self.search_flights(origin, destination, check_date)
 
if search_result.get('success') and search_result.get('flights'😞
min_price = search_result.get('cheapest_price', 0)
results.append({
"date": check_date,
"min_price": min_price,
"offset_days": offset,
"savings": 0 # Will calculate after
})
 
time.sleep(2) # Rate limiting
 
if results:
base_price = next((r['min_price'] for r in results if r['offset_days'] == 0), 0)
for r in results:
r['savings'] = base_price - r['min_price']
 
return {
"success": True,
"flexible_dates": results,
"best_date": min(results, key=lambda x: x['min_price']) if results else None,
"worst_date": max(results, key=lambda x: x['min_price']) if results else None
}
 
def analyze_route_budget(self, origin, destination, date, budget😞
"""Agent analyzes budget and finds optimizations"""
print(f"\n🤖 AGENT: Analyzing budget (${budget})...")
 
search = self.search_flights(origin, destination, date)
 
if not search.get('success') or not search.get('flights'😞
return {"success": False, "message": "No flights found"}
 
cheapest = search.get('cheapest_price', 0)
within_budget = cheapest <= budget
 
recommendations = []
 
if not within_budget:
shortage = cheapest - budget
recommendations.append(f"⚠️ Cheapest flight (${cheapest}) is ${shortage:.2f} over budget")
 
# Try flexible dates
flex = self.find_flexible_dates(origin, destination, date, days_range=3)
if flex.get('best_date') and flex['best_date']['min_price'] < cheapest:
best = flex['best_date']
if best['min_price'] <= budget:
recommendations.append(f" Found option within budget: ${best['min_price']} on {best['date']}")
else:
recommendations.append(f"💡 Cheapest option: ${best['min_price']} on {best['date']} (still ${best['min_price'] - budget:.2f} over)")
else:
recommendations.append(f" Within budget! Cheapest: ${cheapest}")
 
return {
"success": True,
"within_budget": within_budget,
"cheapest_option": cheapest,
"budget": budget,
"recommendations": recommendations
}
 
def plan_multi_city(self, cities, start_date, days_per_city😞
"""Agent plans multi-city itinerary"""
print(f"\n🤖 AGENT: Planning {len(cities)}-city trip...")
 
itinerary = []
current_date = datetime.strptime(start_date, '%Y-%m-%d')
total_cost = 0
 
for i in range(len(cities) - 1😞
origin = cities[i]
destination = cities[i + 1]
flight_date = current_date.strftime('%Y-%m-%d')
 
print(f"📍 Leg {i+1}: {origin}{destination}")
 
search = self.search_flights(origin, destination, flight_date)
 
if search.get('success') and search.get('flights'😞
cheapest_price = search.get('cheapest_price', 0)
cheapest_flight = min(search['flights'], key=lambda x: x['price'])
 
itinerary.append({
"leg": i + 1,
"from": origin,
"to": destination,
"date": flight_date,
"price": cheapest_price,
"airline": cheapest_flight.get('airline'),
"duration": cheapest_flight.get('duration')
})
 
total_cost += cheapest_price
 
current_date += timedelta(days=days_per_city)
time.sleep(2)
 
return {
"success": True,
"itinerary": itinerary,
"total_cost": total_cost,
"total_days": len(cities) * days_per_city,
"cost_per_day": total_cost / (len(cities) * days_per_city) if len(cities) > 0 else 0
}
 
def run_agent(self, user_request😞
"""Main agentic loop"""
 
tools = [
{
"name": "search_flights",
"description": "Search REAL Google Flights data with pricing",
"input_schema": {
"type": "object",
"properties": {
"origin": {"type": "string"},
"destination": {"type": "string"},
"date": {"type": "string"},
"return_date": {"type": "string"}
},
"required": ["origin", "destination", "date"]
}
},
{
"name": "find_flexible_dates",
"description": "Agent autonomously searches multiple dates for cheapest option",
"input_schema": {
"type": "object",
"properties": {
"origin": {"type": "string"},
"destination": {"type": "string"},
"target_date": {"type": "string"},
"days_range": {"type": "integer"}
},
"required": ["origin", "destination", "target_date"]
}
},
{
"name": "analyze_route_budget",
"description": "Agent analyzes budget and autonomously finds optimizations",
"input_schema": {
"type": "object",
"properties": {
"origin": {"type": "string"},
"destination": {"type": "string"},
"date": {"type": "string"},
"budget": {"type": "number"}
},
"required": ["origin", "destination", "date", "budget"]
}
},
{
"name": "plan_multi_city",
"description": "Agent plans complete multi-city itinerary with prices",
"input_schema": {
"type": "object",
"properties": {
"cities": {"type": "array", "items": {"type": "string"}},
"start_date": {"type": "string"},
"days_per_city": {"type": "integer"}
},
"required": ["cities", "start_date", "days_per_city"]
}
}
]
 
self.conversation_history.append({
"role": "user",
"content": user_request
})
 
iteration = 0
while iteration < 10:
iteration += 1
 
response = self.claude.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=4000,
system="""You are an agentic AI using REAL Google Flights data.
 
You can:
- Search actual flight prices from Google Flights
- Compare multiple dates autonomously
- Optimize within budget constraints
- Plan complex multi-city trips
- Make intelligent recommendations
 
Be proactive, think multi-step, find creative solutions!""",
tools=tools,
messages=self.conversation_history
)
 
self.conversation_history.append({
"role": "assistant",
"content": response.content
})
 
if response.stop_reason == "tool_use":
tool_results = []
 
for block in response.content:
if block.type == "tool_use":
tool_name = block.name
tool_input = block.input
 
print(f"\n🔧 Tool: {tool_name}")
 
if tool_name == "search_flights":
result = self.search_flights(**tool_input)
elif tool_name == "find_flexible_dates":
result = self.find_flexible_dates(**tool_input)
elif tool_name == "analyze_route_budget":
result = self.analyze_route_budget(**tool_input)
elif tool_name == "plan_multi_city":
result = self.plan_multi_city(**tool_input)
else:
result = {"error": f"Unknown tool"}
 
tool_results.append({
"type": "tool_result",
"tool_use_id": block.id,
"content": json.dumps(result)
})
 
self.conversation_history.append({
"role": "user",
"content": tool_results
})
else:
final_response = ""
for block in response.content:
if hasattr(block, "text"😞
final_response += block.text
return final_response
 
return "Max iterations reached."
 
def main():
print("=" * 80)
print("🤖 AGENTIC FLIGHT ASSISTANT - REAL GOOGLE FLIGHTS DATA")
print("=" * 80)
print("\nUsing SerpAPI to access Google Flights")
print("\n REAL pricing from Google Flights")
print(" ALL routes worldwide")
print(" Same data you see on google.com/flights")
print("\n" + "=" * 80 + "\n")
 
agent = AgenticFlightAssistant()
 
while True:
try:
user_input = input("\n👤 You: ").strip()
 
if user_input.lower() in ['quit', 'exit', 'bye']:
print("\n🤖 Goodbye!")
break
 
if not user_input:
continue
 
print("\n🤖 Agent working...\n")
response = agent.run_agent(user_input)
print(f"\n🤖 Agent: {response}\n")
 
except KeyboardInterrupt:
print("\n\n🤖 Goodbye!")
break
except Exception as e:
print(f"\n Error: {e}")
 
if __name__ == "__main__":
main()

 

 

ZQdrf4.gif

Posted
7 hours ago, csrcsr said:

safe travels anna tappadu santosham mukyam

4230.gif

anna vadu monnati varakuu amendment, client letter, visa dates kosam chuse @Sucker errifook gadu karma kaali vadiki covid gc vachindhi vadi konchem chepu anna

Posted
4 hours ago, Konebhar6 said:

 

I am flying on Monday. For 5 weeks. Enjoy your India trip ... 

200w.gif

 

You and @Spartan etla brothers ee time lo India traveling for 5 weeks? Already Endalu started anta 30+
Of course better than April and May anyway

Posted
2 minutes ago, islander said:

You and @Spartan etla brothers ee time lo India traveling for 5 weeks? Already Endalu started anta 30+
Of course better than April and May anyway

vellali anna 2 weeks kosam 

malli April lo Banglore trip undi 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...