megadheera1 Posted 6 hours ago Report Posted 6 hours ago 52 minutes 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 Go with any Middle East airline uncle.. Quote
suckerannafan2 Posted 6 hours ago Report Posted 6 hours ago 48 minutes ago, Sucker said: Problem yenti ante 14-16 hours flight anna. Adhi lekunda 8 +8 chusthunna. For now Lufthansa ne best la vundhi KLM and Air France also 8+8 sucker anna. Very good. Paris/Germany/Amsterdam layover. 1 Quote
Junior_ Posted 5 hours ago Report Posted 5 hours ago Ewr to dubai emirates ki Greece lo lay over undi. You can try that. 1 Quote
islander Posted 4 hours ago Report Posted 4 hours ago 2 hours ago, Spartan said: nenu Jan lo ne book chesa 976$ padindi. velletappudu u play catch up kabatti 15 okat 5 inkoti. return lo 4.5 okati and 12 inkoti. 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 Quote
islander Posted 4 hours ago Report Posted 4 hours ago 2 hours ago, Sucker said: Maa kids count thelse matladuthunnara @The_Mentalist @LadiesTailor @islander @perugu_vada @megadheera1 Aasthulu ammali andarni biz class ante Bro ivanni waste gaani oka cruise koni padey aipothadi..asale Florida lo untav.eskoni po kudirinappudalla 1 Quote
Sucker Posted 4 hours ago Author Report Posted 4 hours ago 9 minutes ago, islander said: Bro ivanni waste gaani oka cruise koni padey aipothadi..asale Florida lo untav.eskoni po kudirinappudalla Quote
csrcsr Posted 4 hours ago Report Posted 4 hours ago @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 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() 1 Quote
Popular Post Sucker Posted 4 hours ago Author Popular Post Report Posted 4 hours ago 4 minutes 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 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() Odiyamma prathi thed la 3 Quote
csrcsr Posted 3 hours ago Report Posted 3 hours ago 1 minute ago, Sucker said: Odiyamma prathi thed la Based on your prompt i played with personal antgropic key give me my 5 dollars rofl 1 Quote
csrcsr Posted 3 hours ago Report Posted 3 hours ago 5 minutes ago, Sucker said: Odiyamma prathi thed la 1 Quote
BattalaSathi Posted 3 hours ago Report Posted 3 hours ago 7 minutes 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 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() deenamma endhi vayya ee coding post lu..fafala sankala theddulu vese @DaatarBabu2 fans gaa memu eee anyayanni khandisthunnam..ikkada kooda AI/ML ante undamantaara 10ngeymantaara ani aduguthunna db senior kaamists 1 Quote
Sucker Posted 3 hours ago Author Report Posted 3 hours ago 4 minutes ago, csrcsr said: Based on your prompt i played with personal antgropic key give me my 5 dollars rofl Nenu ippude oka deployment success chesa just vachina error ichi nee ishtam vachindhi chesko but company ni mrodda kudapaku just do it in my branch nee ishtam vachindhi ani cheppa. Deployment succes ayyindhi last week motham kottukunna verri faffa la 2 Quote
csrcsr Posted 3 hours ago Report Posted 3 hours ago 1 minute ago, BattalaSathi said: deenamma endhi vayya ee coding post lu..fafala sankala theddulu vese @DaatarBabu2 fans gaa memu eee anyayanni khandisthunnam..ikkada kooda AI/ML ante undamantaara 10ngeymantaara ani aduguthunna db senior kaamists ML ledu louda ledu anna its very simple ani cheptiuna how agents can become more and more powerful with these multi billion dollar shelling and ekadiki potado talchukunte bayam estundi Quote
Sucker Posted 3 hours ago Author Report Posted 3 hours ago Topic started with traveling ending with AI and bommal disco Quote
TOM_BHAYYA Posted 3 hours ago Report Posted 3 hours ago 3 hours ago, Sucker said: Maa kids count thelse matladuthunnara @The_Mentalist @LadiesTailor @islander @perugu_vada @megadheera1 Aasthulu ammali andarni biz class ante Musugu annagari fan vi anna halwa mundhu nunde chepthunde.. nene nammale 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.