You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This API uses a **one-hotel-per-request** architecture. To maintain sub-second response times for comparisons, agents must use **asynchronous parallelism** rather than sequential loops.
452
453
453
-
This API uses a **one-hotel-per-request** architecture — there is no batch endpoint. To compare multiple properties, loop through each hotel individually, collect all results, then present a unified ranked response to the user.
To make the Multi-Hotel Comparison Pattern truly demonstrate our sub-second speed, this implementation moves away from sequential loops in favor of **asynchronous parallelism**.
458
-
459
-
In a sequential version, 5 hotels taking 800ms each would take 4 seconds. With the parallel code below, all requests fire at once, finishing the entire comparison in **~800ms to 1 second**.
460
-
461
-
This example uses Python's `concurrent.futures` to fire all requests simultaneously, ensuring your agent gets a full comparison in the time it takes for a single request.
In a sequential loop, 5 hotels would take ~4 seconds. With the parallel code below using `concurrent.futures`, all requests fire simultaneously, finishing the entire comparison in the time it takes for a single request.
# Sort and present ALL results together — never respond mid-loop
493
498
results.sort(key=lambda x: x["price"])
499
+
494
500
for i, h inenumerate(results, 1):
495
501
print(f"{i}. {h['name']}: ${h['price']:.2f}")
496
502
497
-
cheapest =results
498
-
print(f"\n🏆 Best Value: {cheapest['name']} at ${cheapest['price']:.2f}")
499
-
print(f"👉 Book Now: {cheapest['url']}")
503
+
ifresults:
504
+
print(f"\n🏆 Best Value: {results[0]['name']} at ${results[0]['price']:.2f}")
505
+
print(f"👉 Book Now: {results[0]['url']}")
500
506
```
501
507
508
+
### ⚠️ Critical Implementation Guardrails
509
+
* **Confidence Scoring:** Always check the `best_match_score`. If it is below **0.85**, the agent must verify the hotel identity (City/State) before providing a booking link.
510
+
* **Price Lock Expiry:** The `ppn_bundle` and price are valid for **~20 minutes**. Agents should re-fetch the rate if the user returns to an old session.
511
+
* **Discovery Specs:** For non-MCP integrations, use our [OpenAPI 3.0 Spec](https://www.businesshotels.com/openapi.json) or [AI Plugin Manifest](https://www.businesshotels.com/.well-known/ai-plugin.json).
512
+
513
+
514
+
502
515
### Architectural Rules
503
516
504
517
> 📌 **Complete all requests before responding.** Always finish the full loop before presenting any results. Responding mid-loop creates a fragmented, incomplete user experience.
0 commit comments