Tracing one user request through 4 LLM calls and 8 tool executions · Click cards to expand
"I am in Hyderabad. I have a meeting tomorrow in Dubai at 11 AM for 2 hours. From there I need to go to Delhi for a Nasscom meeting in the evening. After that I want to watch a sci-fi movie and then return back to Hyderabad with an earliest flight. Please lookup the options and complete all the bookings without asking me."
What happens before the user types anything — one-time initialization
AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_VERSION. Deployment: gpt-4o. No network call yet.Today: 2026-02-28 and Tomorrow: 2026-03-01 at build time using datetime.now(). This is how the LLM knows what date it is — it's told in the prompt, not intrinsic knowledge.StdioServerParameters(command=python, args=["mcp_server.py"])stdio_client() opens the subprocess and connects via stdin/stdout pipes.
The MCP server process starts running in the background.
mcp_tools and builds openai_tools.{ name, description, inputSchema }{ type:"function", function:{ name, description, parameters }}inputSchema is renamed to parameters — that's the bridge.
get_weather · convert_currency · member_lookup · flight_search · book_flight · movie_search · book_movie · get_session_context
Reason → Act → Observe · Repeats until LLM says it's done · Click each round to expand
Flights from HYDERABAD to DUBAI on 2026-03-01: [FL-6757] SkyWay Airlines | 19:00 → 22:00 | $248.70 [FL-5811] AeroConnect | 12:00 → 17:45 | $1,105.26 [FL-6896] GlobalJet | 11:45 → 18:45 | $291.39
Flights from DUBAI to DELHI on 2026-03-01: [FL-9876] SkyWay Airlines | 07:15 → 14:30 | $228.07 [FL-1488] AeroConnect | 16:15 → 20:30 | $170.72
Movies playing (sci-fi): [MOV-301] Quantum Horizon | 8.4/10 | Showtime: 7:00 PM [MOV-302] Neural Frontier | 7.9/10 | Showtime: 9:30 PM [MOV-303] The Singularity Code | 8.1/10 | Showtime: 6:15 PM
{role:"tool"} messages appended → messages list: [SYSTEM][USER][ASST+3calls][TOOL][TOOL][TOOL]
Flights from DELHI to HYDERABAD on 2026-03-02: [FL-2077] AeroConnect | 10:00 → 18:15 | $752.24 [FL-8097] AeroConnect | 18:15 → 23:45 | $387.79
MEM-1001 is a default member ID used because the user didn't provide an email for member_lookup.
The LLM's only memory — the entire list is sent on every call · Hover bubbles to see role details
messages[] and sends the full list every call.
This is how it avoids re-calling tools it already ran.
Messages list grows → more tokens each round. Cached tokens (green) save cost — OpenAI reuses the unchanged prefix.
Complete itinerary generated from one natural language request in 4 LLM calls
| Round | LLM Decision | Tools Called | Results | Tokens |
|---|---|---|---|---|
| #1 | Search all needed data in parallel | flight_search(HYD→DXB) flight_search(DXB→DEL) movie_search(sci-fi) |
3 HYD→DXB flights 2 DXB→DEL flights 3 sci-fi movies |
1,060 |
| #2 | Inferred return flight needs next day date | flight_search(DEL→HYD, Mar 2) | 2 DEL→HYD flights | 1,615 (1,280 cached) |
| #3 | Picked best options, booked all simultaneously | book_flight(FL-5811) book_flight(FL-1488) book_movie(MOV-301) book_flight(FL-2077) |
CONF-0G0YKR CONF-TGPZEH TKT-H69MLA CONF-WVP7AH |
2,084 (1,920 cached) |
| #4 | All confirmed — write final answer · finish_reason: stop | none | Natural language itinerary printed to user | 2,370 (2,176 cached) |