rajsinghparihar commited on
Commit
936b827
·
1 Parent(s): 900795e

first iteration: flight search

Browse files
Files changed (4) hide show
  1. .gitignore +5 -0
  2. app.py +28 -4
  3. flight_results.json +1304 -0
  4. script.py +57 -0
.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ .env
2
+ *.ipynb
3
+ *.pyc
4
+ __pycache__/
5
+ .json
app.py CHANGED
@@ -1,7 +1,31 @@
1
  import gradio as gr
 
 
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
1
  import gradio as gr
2
+ import os
3
+ from dotenv import load_dotenv
4
+ import serpapi
5
+ load_dotenv()
6
 
7
+ def search_flights(departure_id: str, arrival_id: str, outbound_date: str, return_date: str, currency: str):
8
+ """
9
+ Uses Google Flights API to search for flights, giving price insights, best flights and airport information
10
+ params:
11
+ departure_id (str): The departure airport IATA code.
12
+ arrival_id (str): The arrival airport IATA code.
13
+ outbound_date (str): The outbound date in YYYY-MM-DD format.
14
+ return_date (str): The return date in YYYY-MM-DD format.
15
+ currency (str): The currency code.
16
+ """
17
+ params = {
18
+ "engine": "google_flights",
19
+ "departure_id": departure_id,
20
+ "arrival_id": arrival_id,
21
+ "outbound_date": outbound_date,
22
+ "return_date": return_date,
23
+ "currency": currency,
24
+ "hl": "en",
25
+ "api_key": os.getenv("SERP_API_KEY"),
26
+ }
27
+ result = serpapi.search(params)
28
+ return result.as_dict()
29
 
30
+ demo = gr.Interface(fn=search_flights, inputs=["text", "text", "text", "text", "text"], outputs=gr.JSON())
31
+ demo.launch(mcp_server=True)
flight_results.json ADDED
@@ -0,0 +1,1304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "search_metadata": {
3
+ "id": "68473f85f680d18a1e536bee",
4
+ "status": "Success",
5
+ "json_endpoint": "https://serpapi.com/searches/47ff092a51a38c1e/68473f85f680d18a1e536bee.json",
6
+ "created_at": "2025-06-09 20:09:41 UTC",
7
+ "processed_at": "2025-06-09 20:09:41 UTC",
8
+ "google_flights_url": "https://www.google.com/travel/flights?hl=en&gl=us&curr=USD&tfs=CBwQAhoeEgoyMDI1LTA2LTEwagcIARIDUEVLcgcIARIDQVVTGh4SCjIwMjUtMDYtMTZqBwgBEgNBVVNyBwgBEgNQRUtCAQFIAXABmAEB&tfu=EgIIAQ",
9
+ "raw_html_file": "https://serpapi.com/searches/47ff092a51a38c1e/68473f85f680d18a1e536bee.html",
10
+ "prettify_html_file": "https://serpapi.com/searches/47ff092a51a38c1e/68473f85f680d18a1e536bee.prettify",
11
+ "total_time_taken": 0.58
12
+ },
13
+ "search_parameters": {
14
+ "engine": "google_flights",
15
+ "hl": "en",
16
+ "gl": "us",
17
+ "departure_id": "PEK",
18
+ "arrival_id": "AUS",
19
+ "outbound_date": "2025-06-10",
20
+ "return_date": "2025-06-16",
21
+ "currency": "USD"
22
+ },
23
+ "best_flights": [
24
+ {
25
+ "flights": [
26
+ {
27
+ "departure_airport": {
28
+ "name": "Beijing Capital International Airport",
29
+ "id": "PEK",
30
+ "time": "2025-06-10 17:25"
31
+ },
32
+ "arrival_airport": {
33
+ "name": "San Francisco International Airport",
34
+ "id": "SFO",
35
+ "time": "2025-06-10 14:20"
36
+ },
37
+ "duration": 715,
38
+ "airplane": "Boeing 777",
39
+ "airline": "United",
40
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/UA.png",
41
+ "travel_class": "Economy",
42
+ "flight_number": "UA 889",
43
+ "legroom": "31 in",
44
+ "extensions": [
45
+ "Average legroom (31 in)",
46
+ "Wi-Fi for a fee",
47
+ "In-seat power & USB outlets",
48
+ "On-demand video",
49
+ "Carbon emissions estimate: 643 kg"
50
+ ],
51
+ "overnight": true,
52
+ "often_delayed_by_over_30_min": true
53
+ },
54
+ {
55
+ "departure_airport": {
56
+ "name": "San Francisco International Airport",
57
+ "id": "SFO",
58
+ "time": "2025-06-10 16:30"
59
+ },
60
+ "arrival_airport": {
61
+ "name": "Austin-Bergstrom International Airport",
62
+ "id": "AUS",
63
+ "time": "2025-06-10 22:11"
64
+ },
65
+ "duration": 221,
66
+ "airplane": "Airbus A319",
67
+ "airline": "United",
68
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/UA.png",
69
+ "travel_class": "Economy",
70
+ "flight_number": "UA 2332",
71
+ "legroom": "30 in",
72
+ "extensions": [
73
+ "Average legroom (30 in)",
74
+ "Wi-Fi for a fee",
75
+ "In-seat power & USB outlets",
76
+ "Stream media to your device",
77
+ "Carbon emissions estimate: 242 kg"
78
+ ]
79
+ }
80
+ ],
81
+ "layovers": [
82
+ {
83
+ "duration": 130,
84
+ "name": "San Francisco International Airport",
85
+ "id": "SFO"
86
+ }
87
+ ],
88
+ "total_duration": 1066,
89
+ "carbon_emissions": {
90
+ "this_flight": 885000,
91
+ "typical_for_this_route": 978000,
92
+ "difference_percent": -10
93
+ },
94
+ "price": 1515,
95
+ "type": "Round trip",
96
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/UA.png",
97
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFZ3hWUVRnNE9YeFZRVEl6TXpJYUN3aVlud2tRQWhvRFZWTkVPQnh3bUo4SiIsW1siUEVLIiwiMjAyNS0wNi0xMCIsIlNGTyIsbnVsbCwiVUEiLCI4ODkiXSxbIlNGTyIsIjIwMjUtMDYtMTAiLCJBVVMiLG51bGwsIlVBIiwiMjMzMiJdXV0="
98
+ },
99
+ {
100
+ "flights": [
101
+ {
102
+ "departure_airport": {
103
+ "name": "Beijing Capital International Airport",
104
+ "id": "PEK",
105
+ "time": "2025-06-10 08:20"
106
+ },
107
+ "arrival_airport": {
108
+ "name": "Haneda Airport",
109
+ "id": "HND",
110
+ "time": "2025-06-10 12:55"
111
+ },
112
+ "duration": 215,
113
+ "airplane": "Boeing 767",
114
+ "airline": "ANA",
115
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/NH.png",
116
+ "travel_class": "Economy",
117
+ "flight_number": "NH 964",
118
+ "legroom": "31 in",
119
+ "extensions": [
120
+ "Average legroom (31 in)",
121
+ "In-seat power & USB outlets",
122
+ "On-demand video",
123
+ "Carbon emissions estimate: 215 kg"
124
+ ]
125
+ },
126
+ {
127
+ "departure_airport": {
128
+ "name": "Haneda Airport",
129
+ "id": "HND",
130
+ "time": "2025-06-10 15:50"
131
+ },
132
+ "arrival_airport": {
133
+ "name": "San Francisco International Airport",
134
+ "id": "SFO",
135
+ "time": "2025-06-10 09:45"
136
+ },
137
+ "duration": 595,
138
+ "airplane": "Boeing 777",
139
+ "airline": "United",
140
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/UA.png",
141
+ "travel_class": "Economy",
142
+ "flight_number": "UA 876",
143
+ "ticket_also_sold_by": ["ANA"],
144
+ "legroom": "31 in",
145
+ "extensions": [
146
+ "Average legroom (31 in)",
147
+ "Wi-Fi for a fee",
148
+ "In-seat power & USB outlets",
149
+ "On-demand video",
150
+ "Carbon emissions estimate: 408 kg"
151
+ ],
152
+ "overnight": true
153
+ },
154
+ {
155
+ "departure_airport": {
156
+ "name": "San Francisco International Airport",
157
+ "id": "SFO",
158
+ "time": "2025-06-10 13:05"
159
+ },
160
+ "arrival_airport": {
161
+ "name": "Austin-Bergstrom International Airport",
162
+ "id": "AUS",
163
+ "time": "2025-06-10 18:46"
164
+ },
165
+ "duration": 221,
166
+ "airplane": "Airbus A320",
167
+ "airline": "United",
168
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/UA.png",
169
+ "travel_class": "Economy",
170
+ "flight_number": "UA 1998",
171
+ "ticket_also_sold_by": ["ANA"],
172
+ "legroom": "30 in",
173
+ "extensions": [
174
+ "Average legroom (30 in)",
175
+ "Wi-Fi for a fee",
176
+ "In-seat power & USB outlets",
177
+ "Stream media to your device",
178
+ "Carbon emissions estimate: 228 kg"
179
+ ]
180
+ }
181
+ ],
182
+ "layovers": [
183
+ { "duration": 175, "name": "Haneda Airport", "id": "HND" },
184
+ {
185
+ "duration": 200,
186
+ "name": "San Francisco International Airport",
187
+ "id": "SFO"
188
+ }
189
+ ],
190
+ "total_duration": 1406,
191
+ "carbon_emissions": {
192
+ "this_flight": 853000,
193
+ "typical_for_this_route": 978000,
194
+ "difference_percent": -13
195
+ },
196
+ "price": 1781,
197
+ "type": "Round trip",
198
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
199
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFaEpPU0RrMk5IeFZRVGczTm54VlFURTVPVGdhQ3dpTjd3b1FBaG9EVlZORU9CeHdqZThLIixbWyJQRUsiLCIyMDI1LTA2LTEwIiwiSE5EIixudWxsLCJOSCIsIjk2NCJdLFsiSE5EIiwiMjAyNS0wNi0xMCIsIlNGTyIsbnVsbCwiVUEiLCI4NzYiXSxbIlNGTyIsIjIwMjUtMDYtMTAiLCJBVVMiLG51bGwsIlVBIiwiMTk5OCJdXV0="
200
+ },
201
+ {
202
+ "flights": [
203
+ {
204
+ "departure_airport": {
205
+ "name": "Beijing Capital International Airport",
206
+ "id": "PEK",
207
+ "time": "2025-06-10 10:00"
208
+ },
209
+ "arrival_airport": {
210
+ "name": "Hong Kong International Airport",
211
+ "id": "HKG",
212
+ "time": "2025-06-10 13:50"
213
+ },
214
+ "duration": 230,
215
+ "airplane": "Airbus A330",
216
+ "airline": "Cathay Pacific",
217
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/CX.png",
218
+ "travel_class": "Economy",
219
+ "flight_number": "CX 347",
220
+ "legroom": "31 in",
221
+ "extensions": [
222
+ "Average legroom (31 in)",
223
+ "In-seat power & USB outlets",
224
+ "On-demand video",
225
+ "Carbon emissions estimate: 138 kg"
226
+ ]
227
+ },
228
+ {
229
+ "departure_airport": {
230
+ "name": "Hong Kong International Airport",
231
+ "id": "HKG",
232
+ "time": "2025-06-10 16:05"
233
+ },
234
+ "arrival_airport": {
235
+ "name": "Dallas Fort Worth International Airport",
236
+ "id": "DFW",
237
+ "time": "2025-06-10 17:55"
238
+ },
239
+ "duration": 890,
240
+ "airplane": "Airbus A350",
241
+ "airline": "Cathay Pacific",
242
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/CX.png",
243
+ "travel_class": "Economy",
244
+ "flight_number": "CX 876",
245
+ "legroom": "32 in",
246
+ "extensions": [
247
+ "Above average legroom (32 in)",
248
+ "Wi-Fi for a fee",
249
+ "In-seat power & USB outlets",
250
+ "On-demand video",
251
+ "Carbon emissions estimate: 675 kg"
252
+ ],
253
+ "overnight": true
254
+ },
255
+ {
256
+ "departure_airport": {
257
+ "name": "Dallas Fort Worth International Airport",
258
+ "id": "DFW",
259
+ "time": "2025-06-10 20:00"
260
+ },
261
+ "arrival_airport": {
262
+ "name": "Austin-Bergstrom International Airport",
263
+ "id": "AUS",
264
+ "time": "2025-06-10 21:00"
265
+ },
266
+ "duration": 60,
267
+ "airplane": "Boeing 737",
268
+ "airline": "American",
269
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AA.png",
270
+ "travel_class": "Economy",
271
+ "flight_number": "AA 2707",
272
+ "legroom": "30 in",
273
+ "extensions": [
274
+ "Average legroom (30 in)",
275
+ "Wi-Fi for a fee",
276
+ "In-seat power & USB outlets",
277
+ "Stream media to your device",
278
+ "Carbon emissions estimate: 52 kg"
279
+ ]
280
+ }
281
+ ],
282
+ "layovers": [
283
+ {
284
+ "duration": 135,
285
+ "name": "Hong Kong International Airport",
286
+ "id": "HKG"
287
+ },
288
+ {
289
+ "duration": 125,
290
+ "name": "Dallas Fort Worth International Airport",
291
+ "id": "DFW"
292
+ }
293
+ ],
294
+ "total_duration": 1440,
295
+ "carbon_emissions": {
296
+ "this_flight": 867000,
297
+ "typical_for_this_route": 978000,
298
+ "difference_percent": -11
299
+ },
300
+ "price": 2333,
301
+ "type": "Round trip",
302
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
303
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFaEpEV0RNME4zeERXRGczTm54QlFUSTNNRGNhQ3dpeG5nNFFBaG9EVlZORU9CeHdzWjRPIixbWyJQRUsiLCIyMDI1LTA2LTEwIiwiSEtHIixudWxsLCJDWCIsIjM0NyJdLFsiSEtHIiwiMjAyNS0wNi0xMCIsIkRGVyIsbnVsbCwiQ1giLCI4NzYiXSxbIkRGVyIsIjIwMjUtMDYtMTAiLCJBVVMiLG51bGwsIkFBIiwiMjcwNyJdXV0="
304
+ },
305
+ {
306
+ "flights": [
307
+ {
308
+ "departure_airport": {
309
+ "name": "Beijing Capital International Airport",
310
+ "id": "PEK",
311
+ "time": "2025-06-10 07:00"
312
+ },
313
+ "arrival_airport": {
314
+ "name": "Shanghai Pudong International Airport",
315
+ "id": "PVG",
316
+ "time": "2025-06-10 09:20"
317
+ },
318
+ "duration": 140,
319
+ "airplane": "Airbus A320",
320
+ "airline": "China Eastern",
321
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/MU.png",
322
+ "travel_class": "Economy",
323
+ "flight_number": "MU 5100",
324
+ "legroom": "31 in",
325
+ "extensions": [
326
+ "Average legroom (31 in)",
327
+ "Carbon emissions estimate: 114 kg"
328
+ ]
329
+ },
330
+ {
331
+ "departure_airport": {
332
+ "name": "Shanghai Pudong International Airport",
333
+ "id": "PVG",
334
+ "time": "2025-06-10 12:10"
335
+ },
336
+ "arrival_airport": {
337
+ "name": "San Francisco International Airport",
338
+ "id": "SFO",
339
+ "time": "2025-06-10 08:40"
340
+ },
341
+ "duration": 690,
342
+ "airplane": "Boeing 777",
343
+ "airline": "United",
344
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/UA.png",
345
+ "travel_class": "Economy",
346
+ "flight_number": "UA 858",
347
+ "legroom": "31 in",
348
+ "extensions": [
349
+ "Average legroom (31 in)",
350
+ "Wi-Fi for a fee",
351
+ "In-seat power & USB outlets",
352
+ "On-demand video",
353
+ "Carbon emissions estimate: 621 kg"
354
+ ],
355
+ "overnight": true
356
+ },
357
+ {
358
+ "departure_airport": {
359
+ "name": "San Francisco International Airport",
360
+ "id": "SFO",
361
+ "time": "2025-06-10 13:05"
362
+ },
363
+ "arrival_airport": {
364
+ "name": "Austin-Bergstrom International Airport",
365
+ "id": "AUS",
366
+ "time": "2025-06-10 18:46"
367
+ },
368
+ "duration": 221,
369
+ "airplane": "Airbus A320",
370
+ "airline": "United",
371
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/UA.png",
372
+ "travel_class": "Economy",
373
+ "flight_number": "UA 1998",
374
+ "legroom": "30 in",
375
+ "extensions": [
376
+ "Average legroom (30 in)",
377
+ "Wi-Fi for a fee",
378
+ "In-seat power & USB outlets",
379
+ "Stream media to your device",
380
+ "Carbon emissions estimate: 228 kg"
381
+ ]
382
+ }
383
+ ],
384
+ "layovers": [
385
+ {
386
+ "duration": 170,
387
+ "name": "Shanghai Pudong International Airport",
388
+ "id": "PVG"
389
+ },
390
+ {
391
+ "duration": 265,
392
+ "name": "San Francisco International Airport",
393
+ "id": "SFO"
394
+ }
395
+ ],
396
+ "total_duration": 1486,
397
+ "carbon_emissions": {
398
+ "this_flight": 965000,
399
+ "typical_for_this_route": 978000,
400
+ "difference_percent": -1
401
+ },
402
+ "price": 2360,
403
+ "type": "Round trip",
404
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
405
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFaE5OVlRVeE1EQjhWVUU0TlRoOFZVRXhPVGs0R2dzSXpMTU9FQUlhQTFWVFJEZ2NjTXl6RGc9PSIsW1siUEVLIiwiMjAyNS0wNi0xMCIsIlBWRyIsbnVsbCwiTVUiLCI1MTAwIl0sWyJQVkciLCIyMDI1LTA2LTEwIiwiU0ZPIixudWxsLCJVQSIsIjg1OCJdLFsiU0ZPIiwiMjAyNS0wNi0xMCIsIkFVUyIsbnVsbCwiVUEiLCIxOTk4Il1dXQ=="
406
+ },
407
+ {
408
+ "flights": [
409
+ {
410
+ "departure_airport": {
411
+ "name": "Beijing Capital International Airport",
412
+ "id": "PEK",
413
+ "time": "2025-06-10 13:20"
414
+ },
415
+ "arrival_airport": {
416
+ "name": "Seattle\u2013Tacoma International Airport",
417
+ "id": "SEA",
418
+ "time": "2025-06-10 09:00"
419
+ },
420
+ "duration": 640,
421
+ "airplane": "Boeing 787",
422
+ "airline": "Hainan",
423
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/HU.png",
424
+ "travel_class": "Economy",
425
+ "flight_number": "HU 495",
426
+ "legroom": "31 in",
427
+ "extensions": [
428
+ "Average legroom (31 in)",
429
+ "Wi-Fi for a fee",
430
+ "In-seat power & USB outlets",
431
+ "On-demand video",
432
+ "Carbon emissions estimate: 452 kg"
433
+ ],
434
+ "overnight": true
435
+ },
436
+ {
437
+ "departure_airport": {
438
+ "name": "Seattle\u2013Tacoma International Airport",
439
+ "id": "SEA",
440
+ "time": "2025-06-10 17:52"
441
+ },
442
+ "arrival_airport": {
443
+ "name": "Austin-Bergstrom International Airport",
444
+ "id": "AUS",
445
+ "time": "2025-06-10 23:59"
446
+ },
447
+ "duration": 247,
448
+ "airplane": "Boeing 737",
449
+ "airline": "Alaska",
450
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AS.png",
451
+ "travel_class": "Economy",
452
+ "flight_number": "AS 526",
453
+ "ticket_also_sold_by": ["Hawaiian"],
454
+ "legroom": "31 in",
455
+ "extensions": [
456
+ "Average legroom (31 in)",
457
+ "Wi-Fi for a fee",
458
+ "In-seat power & USB outlets",
459
+ "Stream media to your device",
460
+ "Carbon emissions estimate: 234 kg"
461
+ ]
462
+ }
463
+ ],
464
+ "layovers": [
465
+ {
466
+ "duration": 532,
467
+ "name": "Seattle\u2013Tacoma International Airport",
468
+ "id": "SEA"
469
+ }
470
+ ],
471
+ "total_duration": 1419,
472
+ "carbon_emissions": {
473
+ "this_flight": 687000,
474
+ "typical_for_this_route": 978000,
475
+ "difference_percent": -30
476
+ },
477
+ "price": 2659,
478
+ "type": "Round trip",
479
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
480
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFZ3RJVlRRNU5YeEJVelV5TmhvTENLYWRFQkFDR2dOVlUwUTRISENtblJBPSIsW1siUEVLIiwiMjAyNS0wNi0xMCIsIlNFQSIsbnVsbCwiSFUiLCI0OTUiXSxbIlNFQSIsIjIwMjUtMDYtMTAiLCJBVVMiLG51bGwsIkFTIiwiNTI2Il1dXQ=="
481
+ }
482
+ ],
483
+ "other_flights": [
484
+ {
485
+ "flights": [
486
+ {
487
+ "departure_airport": {
488
+ "name": "Beijing Capital International Airport",
489
+ "id": "PEK",
490
+ "time": "2025-06-10 13:30"
491
+ },
492
+ "arrival_airport": {
493
+ "name": "Frankfurt Airport",
494
+ "id": "FRA",
495
+ "time": "2025-06-10 18:00"
496
+ },
497
+ "duration": 630,
498
+ "airplane": "Boeing 777",
499
+ "airline": "Air China",
500
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/CA.png",
501
+ "travel_class": "Economy",
502
+ "flight_number": "CA 931",
503
+ "ticket_also_sold_by": ["Lufthansa"],
504
+ "legroom": "32 in",
505
+ "extensions": [
506
+ "Above average legroom (32 in)",
507
+ "In-seat power outlet",
508
+ "On-demand video",
509
+ "Carbon emissions estimate: 564 kg"
510
+ ]
511
+ },
512
+ {
513
+ "departure_airport": {
514
+ "name": "Frankfurt Airport",
515
+ "id": "FRA",
516
+ "time": "2025-06-11 10:05"
517
+ },
518
+ "arrival_airport": {
519
+ "name": "Austin-Bergstrom International Airport",
520
+ "id": "AUS",
521
+ "time": "2025-06-11 14:20"
522
+ },
523
+ "duration": 675,
524
+ "airplane": "Airbus A330",
525
+ "airline": "Lufthansa",
526
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/LH.png",
527
+ "travel_class": "Economy",
528
+ "flight_number": "LH 468",
529
+ "legroom": "31 in",
530
+ "extensions": [
531
+ "Average legroom (31 in)",
532
+ "Wi-Fi for a fee",
533
+ "In-seat power & USB outlets",
534
+ "On-demand video",
535
+ "Carbon emissions estimate: 513 kg"
536
+ ]
537
+ }
538
+ ],
539
+ "layovers": [
540
+ {
541
+ "duration": 965,
542
+ "name": "Frankfurt Airport",
543
+ "id": "FRA",
544
+ "overnight": true
545
+ }
546
+ ],
547
+ "total_duration": 2270,
548
+ "carbon_emissions": {
549
+ "this_flight": 1078000,
550
+ "typical_for_this_route": 978000,
551
+ "difference_percent": 10
552
+ },
553
+ "price": 2460,
554
+ "type": "Round trip",
555
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
556
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFZ3REUVRrek1YeE1TRFEyT0JvTENOdUJEeEFDR2dOVlUwUTRISERiZ1E4PSIsW1siUEVLIiwiMjAyNS0wNi0xMCIsIkZSQSIsbnVsbCwiQ0EiLCI5MzEiXSxbIkZSQSIsIjIwMjUtMDYtMTEiLCJBVVMiLG51bGwsIkxIIiwiNDY4Il1dXQ=="
557
+ },
558
+ {
559
+ "flights": [
560
+ {
561
+ "departure_airport": {
562
+ "name": "Beijing Capital International Airport",
563
+ "id": "PEK",
564
+ "time": "2025-06-10 23:05"
565
+ },
566
+ "arrival_airport": {
567
+ "name": "Paris Charles de Gaulle Airport",
568
+ "id": "CDG",
569
+ "time": "2025-06-11 06:00"
570
+ },
571
+ "duration": 775,
572
+ "airplane": "Boeing 787",
573
+ "airline": "Air France",
574
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AF.png",
575
+ "travel_class": "Economy",
576
+ "flight_number": "AF 201",
577
+ "legroom": "31 in",
578
+ "extensions": [
579
+ "Average legroom (31 in)",
580
+ "Wi-Fi for a fee",
581
+ "In-seat power & USB outlets",
582
+ "On-demand video",
583
+ "Carbon emissions estimate: 439 kg"
584
+ ],
585
+ "overnight": true
586
+ },
587
+ {
588
+ "departure_airport": {
589
+ "name": "Paris Charles de Gaulle Airport",
590
+ "id": "CDG",
591
+ "time": "2025-06-11 09:15"
592
+ },
593
+ "arrival_airport": {
594
+ "name": "Amsterdam Airport Schiphol",
595
+ "id": "AMS",
596
+ "time": "2025-06-11 10:40"
597
+ },
598
+ "duration": 85,
599
+ "airplane": "Airbus A220-300 Passenger",
600
+ "airline": "Air France",
601
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AF.png",
602
+ "travel_class": "Economy",
603
+ "flight_number": "AF 1444",
604
+ "legroom": "30 in",
605
+ "extensions": [
606
+ "Average legroom (30 in)",
607
+ "Wi-Fi for a fee",
608
+ "In-seat USB outlet",
609
+ "Carbon emissions estimate: 59 kg"
610
+ ]
611
+ },
612
+ {
613
+ "departure_airport": {
614
+ "name": "Amsterdam Airport Schiphol",
615
+ "id": "AMS",
616
+ "time": "2025-06-11 12:40"
617
+ },
618
+ "arrival_airport": {
619
+ "name": "Austin-Bergstrom International Airport",
620
+ "id": "AUS",
621
+ "time": "2025-06-11 16:10"
622
+ },
623
+ "duration": 630,
624
+ "airplane": "Boeing 777",
625
+ "airline": "KLM",
626
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/KL.png",
627
+ "travel_class": "Economy",
628
+ "flight_number": "KL 667",
629
+ "ticket_also_sold_by": ["Air France"],
630
+ "legroom": "31 in",
631
+ "extensions": [
632
+ "Average legroom (31 in)",
633
+ "Wi-Fi for a fee",
634
+ "In-seat USB outlet",
635
+ "On-demand video",
636
+ "Carbon emissions estimate: 521 kg"
637
+ ]
638
+ }
639
+ ],
640
+ "layovers": [
641
+ {
642
+ "duration": 195,
643
+ "name": "Paris Charles de Gaulle Airport",
644
+ "id": "CDG"
645
+ },
646
+ { "duration": 120, "name": "Amsterdam Airport Schiphol", "id": "AMS" }
647
+ ],
648
+ "total_duration": 1805,
649
+ "carbon_emissions": {
650
+ "this_flight": 1020000,
651
+ "typical_for_this_route": 978000,
652
+ "difference_percent": 4
653
+ },
654
+ "price": 2698,
655
+ "type": "Round trip",
656
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
657
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFaEpCUmpJd01YeEJSakUwTkRSOFMwdzJOamNhQ3dqRnV4QVFBaG9EVlZORU9CeHd4YnNRIixbWyJQRUsiLCIyMDI1LTA2LTEwIiwiQ0RHIixudWxsLCJBRiIsIjIwMSJdLFsiQ0RHIiwiMjAyNS0wNi0xMSIsIkFNUyIsbnVsbCwiQUYiLCIxNDQ0Il0sWyJBTVMiLCIyMDI1LTA2LTExIiwiQVVTIixudWxsLCJLTCIsIjY2NyJdXV0="
658
+ },
659
+ {
660
+ "flights": [
661
+ {
662
+ "departure_airport": {
663
+ "name": "Beijing Capital International Airport",
664
+ "id": "PEK",
665
+ "time": "2025-06-10 23:05"
666
+ },
667
+ "arrival_airport": {
668
+ "name": "Paris Charles de Gaulle Airport",
669
+ "id": "CDG",
670
+ "time": "2025-06-11 06:00"
671
+ },
672
+ "duration": 775,
673
+ "airplane": "Boeing 787",
674
+ "airline": "Air France",
675
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AF.png",
676
+ "travel_class": "Economy",
677
+ "flight_number": "AF 201",
678
+ "legroom": "31 in",
679
+ "extensions": [
680
+ "Average legroom (31 in)",
681
+ "Wi-Fi for a fee",
682
+ "In-seat power & USB outlets",
683
+ "On-demand video",
684
+ "Carbon emissions estimate: 439 kg"
685
+ ],
686
+ "overnight": true
687
+ },
688
+ {
689
+ "departure_airport": {
690
+ "name": "Paris Charles de Gaulle Airport",
691
+ "id": "CDG",
692
+ "time": "2025-06-11 07:10"
693
+ },
694
+ "arrival_airport": {
695
+ "name": "Amsterdam Airport Schiphol",
696
+ "id": "AMS",
697
+ "time": "2025-06-11 08:35"
698
+ },
699
+ "duration": 85,
700
+ "airplane": "Airbus A320",
701
+ "airline": "Air France",
702
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AF.png",
703
+ "travel_class": "Economy",
704
+ "flight_number": "AF 1240",
705
+ "legroom": "29 in",
706
+ "extensions": [
707
+ "Below average legroom (29 in)",
708
+ "Wi-Fi for a fee",
709
+ "In-seat USB outlet",
710
+ "Carbon emissions estimate: 57 kg"
711
+ ]
712
+ },
713
+ {
714
+ "departure_airport": {
715
+ "name": "Amsterdam Airport Schiphol",
716
+ "id": "AMS",
717
+ "time": "2025-06-11 12:40"
718
+ },
719
+ "arrival_airport": {
720
+ "name": "Austin-Bergstrom International Airport",
721
+ "id": "AUS",
722
+ "time": "2025-06-11 16:10"
723
+ },
724
+ "duration": 630,
725
+ "airplane": "Boeing 777",
726
+ "airline": "KLM",
727
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/KL.png",
728
+ "travel_class": "Economy",
729
+ "flight_number": "KL 667",
730
+ "ticket_also_sold_by": ["Air France"],
731
+ "legroom": "31 in",
732
+ "extensions": [
733
+ "Average legroom (31 in)",
734
+ "Wi-Fi for a fee",
735
+ "In-seat USB outlet",
736
+ "On-demand video",
737
+ "Carbon emissions estimate: 521 kg"
738
+ ]
739
+ }
740
+ ],
741
+ "layovers": [
742
+ {
743
+ "duration": 70,
744
+ "name": "Paris Charles de Gaulle Airport",
745
+ "id": "CDG"
746
+ },
747
+ { "duration": 245, "name": "Amsterdam Airport Schiphol", "id": "AMS" }
748
+ ],
749
+ "total_duration": 1805,
750
+ "carbon_emissions": {
751
+ "this_flight": 1018000,
752
+ "typical_for_this_route": 978000,
753
+ "difference_percent": 4
754
+ },
755
+ "price": 2698,
756
+ "type": "Round trip",
757
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
758
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFaEpCUmpJd01YeEJSakV5TkRCOFMwdzJOamNhQ3dqRnV4QVFBaG9EVlZORU9CeHd4YnNRIixbWyJQRUsiLCIyMDI1LTA2LTEwIiwiQ0RHIixudWxsLCJBRiIsIjIwMSJdLFsiQ0RHIiwiMjAyNS0wNi0xMSIsIkFNUyIsbnVsbCwiQUYiLCIxMjQwIl0sWyJBTVMiLCIyMDI1LTA2LTExIiwiQVVTIixudWxsLCJLTCIsIjY2NyJdXV0="
759
+ },
760
+ {
761
+ "flights": [
762
+ {
763
+ "departure_airport": {
764
+ "name": "Beijing Capital International Airport",
765
+ "id": "PEK",
766
+ "time": "2025-06-10 23:05"
767
+ },
768
+ "arrival_airport": {
769
+ "name": "Paris Charles de Gaulle Airport",
770
+ "id": "CDG",
771
+ "time": "2025-06-11 06:00"
772
+ },
773
+ "duration": 775,
774
+ "airplane": "Boeing 787",
775
+ "airline": "Air France",
776
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AF.png",
777
+ "travel_class": "Economy",
778
+ "flight_number": "AF 201",
779
+ "legroom": "31 in",
780
+ "extensions": [
781
+ "Average legroom (31 in)",
782
+ "Wi-Fi for a fee",
783
+ "In-seat power & USB outlets",
784
+ "On-demand video",
785
+ "Carbon emissions estimate: 439 kg"
786
+ ],
787
+ "overnight": true
788
+ },
789
+ {
790
+ "departure_airport": {
791
+ "name": "Paris Charles de Gaulle Airport",
792
+ "id": "CDG",
793
+ "time": "2025-06-11 08:15"
794
+ },
795
+ "arrival_airport": {
796
+ "name": "Amsterdam Airport Schiphol",
797
+ "id": "AMS",
798
+ "time": "2025-06-11 09:40"
799
+ },
800
+ "duration": 85,
801
+ "airplane": "Airbus A321",
802
+ "airline": "Air France",
803
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AF.png",
804
+ "travel_class": "Economy",
805
+ "flight_number": "AF 1340",
806
+ "legroom": "29 in",
807
+ "extensions": [
808
+ "Below average legroom (29 in)",
809
+ "Wi-Fi for a fee",
810
+ "In-seat USB outlet",
811
+ "Carbon emissions estimate: 61 kg"
812
+ ]
813
+ },
814
+ {
815
+ "departure_airport": {
816
+ "name": "Amsterdam Airport Schiphol",
817
+ "id": "AMS",
818
+ "time": "2025-06-11 12:40"
819
+ },
820
+ "arrival_airport": {
821
+ "name": "Austin-Bergstrom International Airport",
822
+ "id": "AUS",
823
+ "time": "2025-06-11 16:10"
824
+ },
825
+ "duration": 630,
826
+ "airplane": "Boeing 777",
827
+ "airline": "KLM",
828
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/KL.png",
829
+ "travel_class": "Economy",
830
+ "flight_number": "KL 667",
831
+ "ticket_also_sold_by": ["Air France"],
832
+ "legroom": "31 in",
833
+ "extensions": [
834
+ "Average legroom (31 in)",
835
+ "Wi-Fi for a fee",
836
+ "In-seat USB outlet",
837
+ "On-demand video",
838
+ "Carbon emissions estimate: 521 kg"
839
+ ]
840
+ }
841
+ ],
842
+ "layovers": [
843
+ {
844
+ "duration": 135,
845
+ "name": "Paris Charles de Gaulle Airport",
846
+ "id": "CDG"
847
+ },
848
+ { "duration": 180, "name": "Amsterdam Airport Schiphol", "id": "AMS" }
849
+ ],
850
+ "total_duration": 1805,
851
+ "carbon_emissions": {
852
+ "this_flight": 1022000,
853
+ "typical_for_this_route": 978000,
854
+ "difference_percent": 4
855
+ },
856
+ "price": 2698,
857
+ "type": "Round trip",
858
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
859
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFaEpCUmpJd01YeEJSakV6TkRCOFMwdzJOamNhQ3dqRnV4QVFBaG9EVlZORU9CeHd4YnNRIixbWyJQRUsiLCIyMDI1LTA2LTEwIiwiQ0RHIixudWxsLCJBRiIsIjIwMSJdLFsiQ0RHIiwiMjAyNS0wNi0xMSIsIkFNUyIsbnVsbCwiQUYiLCIxMzQwIl0sWyJBTVMiLCIyMDI1LTA2LTExIiwiQVVTIixudWxsLCJLTCIsIjY2NyJdXV0="
860
+ },
861
+ {
862
+ "flights": [
863
+ {
864
+ "departure_airport": {
865
+ "name": "Beijing Capital International Airport",
866
+ "id": "PEK",
867
+ "time": "2025-06-10 16:50"
868
+ },
869
+ "arrival_airport": {
870
+ "name": "Incheon International Airport",
871
+ "id": "ICN",
872
+ "time": "2025-06-10 20:05"
873
+ },
874
+ "duration": 135,
875
+ "airplane": "Airbus A321",
876
+ "airline": "Asiana Airlines",
877
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/OZ.png",
878
+ "travel_class": "Economy",
879
+ "flight_number": "OZ 336",
880
+ "legroom": "31 in",
881
+ "extensions": [
882
+ "Average legroom (31 in)",
883
+ "In-seat power & USB outlets",
884
+ "On-demand video",
885
+ "Carbon emissions estimate: 117 kg"
886
+ ]
887
+ },
888
+ {
889
+ "departure_airport": {
890
+ "name": "Incheon International Airport",
891
+ "id": "ICN",
892
+ "time": "2025-06-10 20:55"
893
+ },
894
+ "arrival_airport": {
895
+ "name": "San Francisco International Airport",
896
+ "id": "SFO",
897
+ "time": "2025-06-10 15:30"
898
+ },
899
+ "duration": 635,
900
+ "airplane": "Airbus A350",
901
+ "airline": "Asiana Airlines",
902
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/OZ.png",
903
+ "travel_class": "Economy",
904
+ "flight_number": "OZ 212",
905
+ "legroom": "32 in",
906
+ "extensions": [
907
+ "Above average legroom (32 in)",
908
+ "Wi-Fi for a fee",
909
+ "In-seat power & USB outlets",
910
+ "On-demand video",
911
+ "Carbon emissions estimate: 465 kg"
912
+ ],
913
+ "overnight": true
914
+ },
915
+ {
916
+ "departure_airport": {
917
+ "name": "San Francisco International Airport",
918
+ "id": "SFO",
919
+ "time": "2025-06-10 18:54"
920
+ },
921
+ "arrival_airport": {
922
+ "name": "Austin-Bergstrom International Airport",
923
+ "id": "AUS",
924
+ "time": "2025-06-11 00:30"
925
+ },
926
+ "duration": 216,
927
+ "airplane": "Boeing 737",
928
+ "airline": "Alaska",
929
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AS.png",
930
+ "travel_class": "Economy",
931
+ "flight_number": "AS 534",
932
+ "legroom": "31 in",
933
+ "extensions": [
934
+ "Average legroom (31 in)",
935
+ "Wi-Fi for a fee",
936
+ "In-seat power & USB outlets",
937
+ "Stream media to your device",
938
+ "Carbon emissions estimate: 211 kg"
939
+ ],
940
+ "often_delayed_by_over_30_min": true
941
+ }
942
+ ],
943
+ "layovers": [
944
+ {
945
+ "duration": 50,
946
+ "name": "Incheon International Airport",
947
+ "id": "ICN"
948
+ },
949
+ {
950
+ "duration": 204,
951
+ "name": "San Francisco International Airport",
952
+ "id": "SFO"
953
+ }
954
+ ],
955
+ "total_duration": 1240,
956
+ "carbon_emissions": {
957
+ "this_flight": 794000,
958
+ "typical_for_this_route": 978000,
959
+ "difference_percent": -19
960
+ },
961
+ "price": 2780,
962
+ "type": "Round trip",
963
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
964
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFaEZQV2pNek5ueFBXakl4TW54QlV6VXpOQm9MQ0pqN0VCQUNHZ05WVTBRNEhIQ1kreEE9IixbWyJQRUsiLCIyMDI1LTA2LTEwIiwiSUNOIixudWxsLCJPWiIsIjMzNiJdLFsiSUNOIiwiMjAyNS0wNi0xMCIsIlNGTyIsbnVsbCwiT1oiLCIyMTIiXSxbIlNGTyIsIjIwMjUtMDYtMTAiLCJBVVMiLG51bGwsIkFTIiwiNTM0Il1dXQ=="
965
+ },
966
+ {
967
+ "flights": [
968
+ {
969
+ "departure_airport": {
970
+ "name": "Beijing Capital International Airport",
971
+ "id": "PEK",
972
+ "time": "2025-06-10 10:40"
973
+ },
974
+ "arrival_airport": {
975
+ "name": "Incheon International Airport",
976
+ "id": "ICN",
977
+ "time": "2025-06-10 13:50"
978
+ },
979
+ "duration": 130,
980
+ "airplane": "Airbus A330",
981
+ "airline": "Asiana Airlines",
982
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/OZ.png",
983
+ "travel_class": "Economy",
984
+ "flight_number": "OZ 332",
985
+ "legroom": "31 in",
986
+ "extensions": [
987
+ "Average legroom (31 in)",
988
+ "In-seat power outlet",
989
+ "On-demand video",
990
+ "Carbon emissions estimate: 93 kg"
991
+ ]
992
+ },
993
+ {
994
+ "departure_airport": {
995
+ "name": "Incheon International Airport",
996
+ "id": "ICN",
997
+ "time": "2025-06-10 16:00"
998
+ },
999
+ "arrival_airport": {
1000
+ "name": "San Francisco International Airport",
1001
+ "id": "SFO",
1002
+ "time": "2025-06-10 10:40"
1003
+ },
1004
+ "duration": 640,
1005
+ "airplane": "Boeing 777",
1006
+ "airline": "Korean Air",
1007
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/KE.png",
1008
+ "travel_class": "Economy",
1009
+ "flight_number": "KE 23",
1010
+ "legroom": "33 in",
1011
+ "extensions": [
1012
+ "Above average legroom (33 in)",
1013
+ "In-seat power & USB outlets",
1014
+ "On-demand video",
1015
+ "Carbon emissions estimate: 600 kg"
1016
+ ],
1017
+ "overnight": true,
1018
+ "often_delayed_by_over_30_min": true
1019
+ },
1020
+ {
1021
+ "departure_airport": {
1022
+ "name": "San Francisco International Airport",
1023
+ "id": "SFO",
1024
+ "time": "2025-06-10 13:15"
1025
+ },
1026
+ "arrival_airport": {
1027
+ "name": "Austin-Bergstrom International Airport",
1028
+ "id": "AUS",
1029
+ "time": "2025-06-10 18:56"
1030
+ },
1031
+ "duration": 221,
1032
+ "airplane": "Airbus A220-300 Passenger",
1033
+ "airline": "Delta",
1034
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/DL.png",
1035
+ "travel_class": "Economy",
1036
+ "flight_number": "DL 381",
1037
+ "ticket_also_sold_by": ["Korean Air"],
1038
+ "legroom": "31 in",
1039
+ "extensions": [
1040
+ "Average legroom (31 in)",
1041
+ "Free Wi-Fi",
1042
+ "In-seat power & USB outlets",
1043
+ "Live TV",
1044
+ "Carbon emissions estimate: 231 kg"
1045
+ ]
1046
+ }
1047
+ ],
1048
+ "layovers": [
1049
+ {
1050
+ "duration": 130,
1051
+ "name": "Incheon International Airport",
1052
+ "id": "ICN"
1053
+ },
1054
+ {
1055
+ "duration": 155,
1056
+ "name": "San Francisco International Airport",
1057
+ "id": "SFO"
1058
+ }
1059
+ ],
1060
+ "total_duration": 1276,
1061
+ "carbon_emissions": {
1062
+ "this_flight": 925000,
1063
+ "typical_for_this_route": 978000,
1064
+ "difference_percent": -5
1065
+ },
1066
+ "price": 3210,
1067
+ "type": "Round trip",
1068
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
1069
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFaEJQV2pNek1ueExSVEl6ZkVSTU16Z3hHZ3NJc01zVEVBSWFBMVZUUkRnY2NMRExFdz09IixbWyJQRUsiLCIyMDI1LTA2LTEwIiwiSUNOIixudWxsLCJPWiIsIjMzMiJdLFsiSUNOIiwiMjAyNS0wNi0xMCIsIlNGTyIsbnVsbCwiS0UiLCIyMyJdLFsiU0ZPIiwiMjAyNS0wNi0xMCIsIkFVUyIsbnVsbCwiREwiLCIzODEiXV1d"
1070
+ },
1071
+ {
1072
+ "flights": [
1073
+ {
1074
+ "departure_airport": {
1075
+ "name": "Beijing Capital International Airport",
1076
+ "id": "PEK",
1077
+ "time": "2025-06-10 16:50"
1078
+ },
1079
+ "arrival_airport": {
1080
+ "name": "Incheon International Airport",
1081
+ "id": "ICN",
1082
+ "time": "2025-06-10 20:05"
1083
+ },
1084
+ "duration": 135,
1085
+ "airplane": "Airbus A321",
1086
+ "airline": "Asiana Airlines",
1087
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/OZ.png",
1088
+ "travel_class": "Economy",
1089
+ "flight_number": "OZ 336",
1090
+ "legroom": "31 in",
1091
+ "extensions": [
1092
+ "Average legroom (31 in)",
1093
+ "In-seat power & USB outlets",
1094
+ "On-demand video",
1095
+ "Carbon emissions estimate: 117 kg"
1096
+ ]
1097
+ },
1098
+ {
1099
+ "departure_airport": {
1100
+ "name": "Incheon International Airport",
1101
+ "id": "ICN",
1102
+ "time": "2025-06-10 20:55"
1103
+ },
1104
+ "arrival_airport": {
1105
+ "name": "San Francisco International Airport",
1106
+ "id": "SFO",
1107
+ "time": "2025-06-10 15:30"
1108
+ },
1109
+ "duration": 635,
1110
+ "airplane": "Airbus A350",
1111
+ "airline": "Asiana Airlines",
1112
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/OZ.png",
1113
+ "travel_class": "Economy",
1114
+ "flight_number": "OZ 212",
1115
+ "legroom": "32 in",
1116
+ "extensions": [
1117
+ "Above average legroom (32 in)",
1118
+ "Wi-Fi for a fee",
1119
+ "In-seat power & USB outlets",
1120
+ "On-demand video",
1121
+ "Carbon emissions estimate: 465 kg"
1122
+ ],
1123
+ "overnight": true
1124
+ },
1125
+ {
1126
+ "departure_airport": {
1127
+ "name": "San Francisco International Airport",
1128
+ "id": "SFO",
1129
+ "time": "2025-06-10 23:59"
1130
+ },
1131
+ "arrival_airport": {
1132
+ "name": "Austin-Bergstrom International Airport",
1133
+ "id": "AUS",
1134
+ "time": "2025-06-11 05:41"
1135
+ },
1136
+ "duration": 222,
1137
+ "airplane": "Airbus A320",
1138
+ "airline": "United",
1139
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/UA.png",
1140
+ "travel_class": "Economy",
1141
+ "flight_number": "UA 1112",
1142
+ "ticket_also_sold_by": ["Asiana Airlines"],
1143
+ "legroom": "30 in",
1144
+ "extensions": [
1145
+ "Average legroom (30 in)",
1146
+ "Wi-Fi for a fee",
1147
+ "In-seat power & USB outlets",
1148
+ "Stream media to your device",
1149
+ "Carbon emissions estimate: 242 kg"
1150
+ ],
1151
+ "overnight": true
1152
+ }
1153
+ ],
1154
+ "layovers": [
1155
+ {
1156
+ "duration": 50,
1157
+ "name": "Incheon International Airport",
1158
+ "id": "ICN"
1159
+ },
1160
+ {
1161
+ "duration": 509,
1162
+ "name": "San Francisco International Airport",
1163
+ "id": "SFO"
1164
+ }
1165
+ ],
1166
+ "total_duration": 1551,
1167
+ "carbon_emissions": {
1168
+ "this_flight": 825000,
1169
+ "typical_for_this_route": 978000,
1170
+ "difference_percent": -16
1171
+ },
1172
+ "price": 4308,
1173
+ "type": "Round trip",
1174
+ "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
1175
+ "departure_token": "WyJDalJJT1dZd2JHVkNhRlJ1UTFWQlFYTTVORkZDUnkwdExTMHRMUzB0ZG5kaVoyOHlNa0ZCUVVGQlIyaElVRFJWUzBGS1dFVkJFaEpQV2pNek5ueFBXakl4TW54VlFURXhNVElhQ3dpOHBSb1FBaG9EVlZORU9CeHd2S1VhIixbWyJQRUsiLCIyMDI1LTA2LTEwIiwiSUNOIixudWxsLCJPWiIsIjMzNiJdLFsiSUNOIiwiMjAyNS0wNi0xMCIsIlNGTyIsbnVsbCwiT1oiLCIyMTIiXSxbIlNGTyIsIjIwMjUtMDYtMTAiLCJBVVMiLG51bGwsIlVBIiwiMTExMiJdXV0="
1176
+ }
1177
+ ],
1178
+ "price_insights": {
1179
+ "lowest_price": 1515,
1180
+ "price_level": "typical",
1181
+ "typical_price_range": [1400, 1650],
1182
+ "price_history": [
1183
+ [1744300800, 1631],
1184
+ [1744387200, 1639],
1185
+ [1744473600, 1524],
1186
+ [1744560000, 1524],
1187
+ [1744646400, 1726],
1188
+ [1744732800, 1726],
1189
+ [1744819200, 1658],
1190
+ [1744905600, 1505],
1191
+ [1744992000, 1298],
1192
+ [1745078400, 1298],
1193
+ [1745164800, 1298],
1194
+ [1745251200, 1522],
1195
+ [1745337600, 1524],
1196
+ [1745424000, 1338],
1197
+ [1745510400, 1238],
1198
+ [1745596800, 1238],
1199
+ [1745683200, 1238],
1200
+ [1745769600, 1238],
1201
+ [1745856000, 1228],
1202
+ [1745942400, 1227],
1203
+ [1746028800, 1470],
1204
+ [1746115200, 1469],
1205
+ [1746201600, 1479],
1206
+ [1746288000, 1479],
1207
+ [1746374400, 1700],
1208
+ [1746460800, 1610],
1209
+ [1746547200, 1610],
1210
+ [1746633600, 1621],
1211
+ [1746720000, 1536],
1212
+ [1746806400, 1536],
1213
+ [1746892800, 1534],
1214
+ [1746979200, 1616],
1215
+ [1747065600, 1616],
1216
+ [1747152000, 1623],
1217
+ [1747238400, 1541],
1218
+ [1747324800, 1678],
1219
+ [1747411200, 1678],
1220
+ [1747497600, 1677],
1221
+ [1747584000, 1585],
1222
+ [1747670400, 1540],
1223
+ [1747756800, 1540],
1224
+ [1747843200, 1465],
1225
+ [1747929600, 1465],
1226
+ [1748016000, 1428],
1227
+ [1748102400, 1428],
1228
+ [1748188800, 1222],
1229
+ [1748275200, 1222],
1230
+ [1748361600, 1222],
1231
+ [1748448000, 1253],
1232
+ [1748534400, 1253],
1233
+ [1748620800, 1510],
1234
+ [1748707200, 1330],
1235
+ [1748793600, 1268],
1236
+ [1748880000, 1278],
1237
+ [1748966400, 1541],
1238
+ [1749052800, 1510],
1239
+ [1749139200, 1514],
1240
+ [1749225600, 1513],
1241
+ [1749312000, 1513],
1242
+ [1749398400, 1513],
1243
+ [1749484800, 1515]
1244
+ ]
1245
+ },
1246
+ "airports": [
1247
+ {
1248
+ "departure": [
1249
+ {
1250
+ "airport": {
1251
+ "id": "PEK",
1252
+ "name": "Beijing Capital International Airport"
1253
+ },
1254
+ "city": "Beijing",
1255
+ "country": "China",
1256
+ "country_code": "CN",
1257
+ "image": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQ9v_tNYxaummsU2qbFn8zuYzkcG0x6qCvqB2gbBnx-2FVlZZPsnkvUXGk07vxotk-0vRQMUYCjj2d4Wg",
1258
+ "thumbnail": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSzsj_yw6o3vb8i54_D21VgI5rTohxexQkZ0TrZKDKJwTSKw2yqnRYLoIcBWIY50BlHo-OPMm68zbUO-qnFvmQmm6jvtWPwo7WOzjNGX_A"
1259
+ }
1260
+ ],
1261
+ "arrival": [
1262
+ {
1263
+ "airport": {
1264
+ "id": "AUS",
1265
+ "name": "Austin-Bergstrom International Airport"
1266
+ },
1267
+ "city": "Austin",
1268
+ "country": "United States",
1269
+ "country_code": "US",
1270
+ "image": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRKdjkMcBZuGRD1MjnuLQvdGtpTk0RyjdYs0Z8JsPtfIjer-6VvmfmMLxzvBkeyUrhf_focikfda4rVHg",
1271
+ "thumbnail": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSQ73FSj9E8pKaNvjWKyEDQGfLV-pky_onARvOY-zHWvQ-hOuPJSqyyXzvyg4-kGGAcZxdO6T5SYGWBzrX8x6MSPq7gBHsSLzX9MYjFJWA"
1272
+ }
1273
+ ]
1274
+ },
1275
+ {
1276
+ "departure": [
1277
+ {
1278
+ "airport": {
1279
+ "id": "AUS",
1280
+ "name": "Austin-Bergstrom International Airport"
1281
+ },
1282
+ "city": "Austin",
1283
+ "country": "United States",
1284
+ "country_code": "US",
1285
+ "image": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRKdjkMcBZuGRD1MjnuLQvdGtpTk0RyjdYs0Z8JsPtfIjer-6VvmfmMLxzvBkeyUrhf_focikfda4rVHg",
1286
+ "thumbnail": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSQ73FSj9E8pKaNvjWKyEDQGfLV-pky_onARvOY-zHWvQ-hOuPJSqyyXzvyg4-kGGAcZxdO6T5SYGWBzrX8x6MSPq7gBHsSLzX9MYjFJWA"
1287
+ }
1288
+ ],
1289
+ "arrival": [
1290
+ {
1291
+ "airport": {
1292
+ "id": "PEK",
1293
+ "name": "Beijing Capital International Airport"
1294
+ },
1295
+ "city": "Beijing",
1296
+ "country": "China",
1297
+ "country_code": "CN",
1298
+ "image": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQ9v_tNYxaummsU2qbFn8zuYzkcG0x6qCvqB2gbBnx-2FVlZZPsnkvUXGk07vxotk-0vRQMUYCjj2d4Wg",
1299
+ "thumbnail": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSzsj_yw6o3vb8i54_D21VgI5rTohxexQkZ0TrZKDKJwTSKw2yqnRYLoIcBWIY50BlHo-OPMm68zbUO-qnFvmQmm6jvtWPwo7WOzjNGX_A"
1300
+ }
1301
+ ]
1302
+ }
1303
+ ]
1304
+ }
script.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import os
3
+ from dotenv import load_dotenv
4
+ import openai
5
+ from agents import Agent, Runner, AsyncOpenAI, OpenAIChatCompletionsModel
6
+ from agents.mcp import MCPServerSse
7
+ import json
8
+
9
+ # Load environment
10
+ load_dotenv()
11
+
12
+ # Set API key
13
+ openai.api_key = os.getenv("NEBIUS_API_KEY")
14
+ openai.base_url = "https://api.studio.nebius.com/v1/"
15
+
16
+ # MCP tool URL (replace with actual URL you got from step 4.3)
17
+ TOOL_URL = "http://127.0.0.1:7860/gradio_api/mcp/sse"
18
+
19
+ async def main():
20
+ mcp_server = MCPServerSse({"url": TOOL_URL})
21
+
22
+ try:
23
+ await mcp_server.connect()
24
+
25
+ # Create an agent and register the connected tool
26
+ # ✅ Replace "MCP Agent" with a descriptive name if desired
27
+ # ✅ Update instructions to guide the agent's behavior
28
+ agent = Agent(
29
+ name="MCP Agent",
30
+ instructions="You help the user complete tasks using the connected tool.",
31
+ mcp_servers=[mcp_server],
32
+ model=OpenAIChatCompletionsModel(
33
+ model="Qwen/Qwen3-235B-A22B",
34
+ openai_client=AsyncOpenAI(base_url="https://api.studio.nebius.com/v1/", api_key=os.getenv("NEBIUS_API_KEY"))
35
+ )
36
+ )
37
+
38
+ # 🔁 Replace this task with your actual prompt or goal
39
+ task = "You are a helpful assistant. Use the connected tool to assist with tasks. Read and analyse the tool output, focusing on key information and help the user in the following task:" \
40
+ "I want to travel from Hyderabad to Phuket from 5th July to 23rd July in 2025, please help me with my flight search, what are my cheapest and fastest options."
41
+
42
+ result = await Runner.run(agent, task)
43
+
44
+ print(result.final_output)
45
+ # print(json.dumps(result.new_items, indent=4))
46
+ # print(result.raw_responses)
47
+
48
+ # for r in result:
49
+ # print(r)
50
+ # print("\n============\n")
51
+
52
+ finally:
53
+ await mcp_server.cleanup()
54
+
55
+ # Run the async main function
56
+ if __name__ == "__main__":
57
+ asyncio.run(main())