https://github.com/jongalloway/travel-booking-agents
AI agent workflow for travel booking and approval process
https://github.com/jongalloway/travel-booking-agents
Last synced: 5 months ago
JSON representation
AI agent workflow for travel booking and approval process
- Host: GitHub
- URL: https://github.com/jongalloway/travel-booking-agents
- Owner: jongalloway
- License: mit
- Created: 2025-10-15T00:42:23.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-10-22T23:20:25.000Z (8 months ago)
- Last Synced: 2025-10-23T01:05:43.698Z (8 months ago)
- Language: C#
- Size: 842 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π Travel Booking Agents
An intelligent corporate travel booking and approval system powered by AI agents and .NET 9. This application demonstrates complex multi-agent orchestration with real business value, showcasing automated travel planning, policy compliance, budget management, itinerary optimization, and booking workflows.
## What This Sample Does
This sample is designed as a realistic showcase for multiβagent coordination in a corporate scenario. It intentionally balances clarity (for conference/demo settings) with production-minded patterns (service composition, resilience, extensibility). At a glance it provides:
| Capability | What You See | Implementation Highlights |
|------------|--------------|---------------------------|
| MultiβAgent Orchestration | 5 domain agents run in sequence (research β policy β budget β optimize β booking) | Agents built with Microsoft Agents Framework; sequential orchestration path for deterministic streaming |
| RealβTime Streaming UI | Live βagent is workingβ updates + final consolidated transcript | Server-Sent Events (`/agent/chat/stream`) consumed by Blazor Server component |
| Tool / Function Calling | Agents call flight & hotel search + booking tools (mock) | Functions exposed with `AIFunctionFactory` wrapped into ChatOptions |
| Policy & Budget Logic | Automatic validation & cost assessment | Mock policy & budget data (extensible to real services) |
| Offline / Token Fallback | Works even without a valid `GITHUB_TOKEN` | Detects missing token β deterministic simulated outputs |
| Debug Diagnostics | Optional timing / timeout tracing | `debug=true` query emits perβagent timing markers |
| Timeout Resilience | Long model calls wonβt freeze UI | Perβagent timeout + heuristic fallback output |
| Aspire Orchestration | Unified AppHost + service discovery | `TravelBookingAgents.AppHost` wires Web + API + defaults |
| Extensibility Surface | Easy to add agents, tools, real APIs | Clear separation of agents, mock data, and transport |
### Demo Storyline
1. User submits a natural language travel request.
2. Each agent contributes its specialization; progress is streamed live.
3. A final aggregated itinerary / rationale is returned (or a policy violation explanation).
4. Optional debug mode shows timing and fallback behavior.
### Two Execution Modes
| Mode | Trigger | Behavior |
|------|---------|----------|
| Online (LLM) | Valid `GITHUB_TOKEN` present | Actual model calls per agent (sequential or legacy group chat when `sequential=false`) |
| Offline (Simulated) | Missing / invalid token | Deterministic scripted outputs for reliable demos |
### Quick Links
* Primary streaming endpoint: `GET /agent/chat/stream?prompt=...&sequential=true`
* Legacy roundβrobin workflow: `?sequential=false`
* Debug instrumentation: append `&debug=true`
* Console demo: run `TravelBookingAgents.Console` project
> TIP: For conference demos, the offline mode guarantees consistent timings while still showing realistic agent progression.
## Overview
This system replaces manual travel booking processes with an automated workflow featuring 5 specialized AI agents that collaborate to:
* Research travel options (flights, hotels, cars)
* Validate against corporate policies
* Check budgets and determine approval requirements
* Optimize itineraries for cost and convenience
* Finalize bookings with confirmation numbers
## Architecture
### Technology Stack
* **.NET 9** - Modern C# with latest features
* **Microsoft Agents Framework** - Multi-agent orchestration
* **Aspire** - Cloud-native orchestration and service discovery
* **Blazor Server** - Interactive web UI with real-time streaming
* **GitHub Models** - AI model integration (GPT-4o-mini)
### AI Agents
#### 1. **Travel Research Agent** π
Searches for and compares travel options:
* Finds flights between origin and destination
* Searches hotels at destination
* Locates rental car options
* Compares prices and presents top recommendations
**Tools:** `SearchFlights`, `SearchHotels`, `SearchRentalCars`
#### 2. **Policy Compliance Agent** β
Validates travel requests against company policies:
* Checks if destination is approved
* Verifies 14-day advance booking requirement
* Ensures flight/hotel costs within limits
* Validates preferred vendor usage
**Tools:** `GetTravelPolicy`, `ValidateDestinationAndTiming`
#### 3. **Budget Approval Agent** π°
Manages travel spending and approvals:
* Retrieves department budget information
* Calculates total trip cost (flights + hotels + meals/incidentals)
* Determines if manager approval needed (>$2,500)
* Checks budget availability
**Tools:** `GetBudgetInfo`, `CheckBudgetAndApproval`
#### 4. **Itinerary Optimizer Agent** π
Optimizes travel plans for efficiency:
* Minimizes layover times
* Finds cost-saving opportunities
* Balances cost vs. convenience
* Ensures meeting schedule requirements
#### 5. **Booking Coordinator Agent** π
Finalizes reservations:
* Creates bookings for approved options
* Generates confirmation numbers
* Assembles complete itinerary
* Handles booking failures gracefully
**Tools:** `CreateBooking`
## Workflow
The agents work together in a round-robin group chat pattern:
```text
User Request
β
Travel Research Agent β Finds 3 flight/hotel options
β
Policy Compliance Agent β Validates against policies
β
Budget Approval Agent β Checks budget, determines if approval needed
β
Itinerary Optimizer Agent β Suggests optimizations
β
Booking Coordinator Agent β Finalizes and confirms bookings
```
**Maximum iterations:** 5 (one per agent in round-robin)
## Sample Travel Policies
The system enforces these corporate policies:
* **Approved Destinations:** Seattle, San Francisco, New York, Austin, Chicago, Boston, Denver, Portland, Atlanta, Dallas
* **Advance Booking:** Minimum 14 days before travel
* **Flight Limits:** $800 domestic, $2,000 international
* **Hotel Limit:** $300 per night
* **Preferred Airlines:** United, Delta, American
* **Preferred Hotels:** Marriott, Hilton, Hyatt
* **Manager Approval:** Required for trips over $2,500
## Sample Departments & Budgets
| Department | Project Code | Available Budget | Already Spent |
|-------------|-----------------|------------------|---------------|
| Engineering | PROJ-2026-001 | $50,000 | $12,000 |
| Marketing | PROJ-2026-002 | $30,000 | $8,000 |
| Sales | PROJ-2026-003 | $75,000 | $25,000 |
## Getting Started
### Prerequisites
* [.NET 9 SDK](https://dotnet.microsoft.com/download/dotnet/9.0)
* [GitHub Token](https://github.com/settings/tokens) for GitHub Models access
* Visual Studio 2022 or VS Code
### Setup
1. **Clone the repository**
```bash
git clone https://github.com/jongalloway/travel-booking-agents.git
cd travel-booking-agents
```
2. **Set GitHub Token**
```bash
# Windows (PowerShell)
$env:GITHUB_TOKEN="your_github_token"
# macOS/Linux
export GITHUB_TOKEN="your_github_token"
```
3. **Run with Aspire**
```bash
cd src/TravelBookingAgents.AppHost
dotnet run
```
4. **Access the applications**
* **Blazor Web UI:** (check Aspire dashboard)
* **Aspire Dashboard:** (shown in console)
### Run Console App
For a command-line demo:
```bash
cd src/TravelBookingAgents.Console
dotnet run
```
## Usage Examples
### Example 1: Conference Travel
**Request:**
```text
Book travel to Microsoft Build in Seattle, May 19-21, 2026
```
**Workflow:**
1. βοΈ Research finds 3 flight options ($395-$520) and 3 hotel options ($195-$285/night)
2. β
Policy confirms Seattle is approved, dates meet 14-day requirement
3. π° Budget calculates ~$1,200 total, no manager approval needed
4. π Optimizer suggests Delta flight with 2hr layover saves $90
5. π Booking confirms reservation with confirmation number
### Example 2: Office Visit
**Request:**
```text
I need to visit the Austin office next month for 3 days
```
**Workflow:**
1. βοΈ Research presents flight/hotel options
2. β
Policy validates Austin is approved destination
3. π° Budget checks Engineering department has sufficient funds
4. π Optimizer recommends optimal departure times
5. π Booking finalizes 3-night reservation
### Example 3: Policy Violation
**Request:**
```text
Book last-minute trip to Miami tomorrow
```
**Expected Response:**
* β Policy Agent flags:
* Miami not in approved destinations
* Less than 14-day advance booking requirement
* π‘ Suggests alternative approved destinations
* π Workflow stops without booking
## Project Structure
```text
src/
βββ TravelBookingAgents.API/ # Backend API with agents
β βββ Program.cs # Agent definitions & workflow
β βββ Models/ # Data models
β β βββ TravelModels.cs # Flight, Hotel, Policy, etc.
β βββ Services/
β βββ MockTravelDataService.cs # Mock travel data & APIs
β
βββ TravelBookingAgents.Web/ # Blazor web frontend
β βββ Components/
β β βββ Pages/
β β βββ Chat.razor # Main booking interface
β βββ Services/
β βββ ChatService.cs # API communication
β
βββ TravelBookingAgents.Console/ # Console demo app
β βββ Program.cs # Standalone workflow demo
β
βββ TravelBookingAgents.AppHost/ # Aspire orchestration
β βββ AppHost.cs # Service configuration
β
βββ TravelBookingAgents.ServiceDefaults/ # Shared configurations
βββ Extensions.cs
```
## Key Features
### π― Multi-Agent Orchestration
Five specialized agents collaborate using round-robin group chat pattern with tool calling
### π Real-Time Streaming
Blazor UI shows live updates as each agent processes the request
### π§ Function Calling
Agents use tools to search travel options, check policies, and create bookings
### π’ Business Logic
Realistic policies, budgets, and approval workflows mirror real corporate systems
### π¨ Modern UI
Clean, responsive Blazor interface with agent status indicators
### βοΈ Cloud-Native
Aspire orchestration with service discovery, health checks, and telemetry
## Conference Demo Tips
### Quick Demo Flow (5 minutes)
1. Show Blazor UI with sample requests
2. Submit "Microsoft Build in Seattle" request
3. Watch agents work in sequence with live status
4. Show final booking confirmation
5. Explain business value and agent coordination
### Deep Dive (15 minutes)
1. Walk through each agent's role and tools
2. Show code for one agent (TravelResearch)
3. Explain workflow orchestration
4. Demo policy violation scenario
5. Show Console app for technical audience
6. Discuss extensibility (add agents, integrate real APIs)
### Key Talking Points
* β¨ **Real Business Value:** Automates manual travel booking process
* π€ **Complex Coordination:** 5 agents with different responsibilities
* π **Policy Enforcement:** Automated compliance checking
* πΌ **Human-in-Loop:** Budget approvals for high-cost trips
* π **Production Ready:** Error handling, state management
* π **Extensible:** Easy to add agents or integrate real APIs
## Extending the System
### Add New Agents
```csharp
builder.AddAIAgent("ExpenseReporter", (sp, key) =>
{
return new ChatClientAgent(
sp.GetRequiredService(),
name: key,
instructions: "Generate expense reports from bookings...",
tools: [
AIFunctionFactory.Create(GenerateExpenseReport)
]
);
});
```
### Integrate Real APIs
Replace mock services in `MockTravelDataService.cs` with:
* **Flights:** Amadeus API, Skyscanner API
* **Hotels:** Booking.com API, Expedia API
* **Cars:** Turo API, Enterprise API
### Add Authentication
Integrate Azure AD B2C or Auth0 to:
* Track user department/budget
* Implement real manager approval workflows
* Audit booking history
## Troubleshooting
**Issue:** Agents not responding
* **Solution:** Check `GITHUB_TOKEN` environment variable is set
**Issue:** Build errors about missing packages
* **Solution:** Restore NuGet packages: `dotnet restore`
**Issue:** Aspire dashboard not accessible
* **Solution:** Check firewall settings, run as administrator
**Issue:** Model rate limits
* **Solution:** GitHub Models has rate limits; wait or use different account
## Contributing
Contributions welcome! Areas for improvement:
* Real travel API integrations
* Additional agents (Expense reporting, Trip modifications)
* Enhanced UI with approval workflows
* Database for booking history
* Email notifications
## License
MIT License - see [LICENSE](LICENSE)
## Acknowledgments
Built with:
* [Microsoft Agents Framework](https://github.com/microsoft/agents)
* [.NET Aspire](https://learn.microsoft.com/dotnet/aspire/)
* [GitHub Models](https://github.com/marketplace/models)
* [Blazor](https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor)
## Contact
For questions or demo requests:
* **Repository:**
* **Issues:**
---
**Ready to revolutionize corporate travel booking with AI agents!** βοΈπ€