Building Travel Agent with OpenAI Agents SDK
Integrate OpenAI Agents SDK with LangDB for multi-agent travel workflows. Configure guardrails, virtual MCP search, and model routing for reliable outputs.
Code
This guide illustrates how to build a multi-agent travel query workflow using the OpenAI Agents SDK, augmented by LangDB for guardrails, virtual MCP servers (tool integration), and model routing.
OpenAI introduced the Agents SDK, a lightweight, Python-first toolkit for building agentic AI apps. It’s built around three primitives:
Agents: LLMs paired with tools and instructions to complete tasks autonomously.
Handoffs: Let agents delegate tasks to other agents.
Guardrails: Validate inputs/outputs to keep workflows safe and reliable.
Overview
We’ll develop a 4-agent pipeline:
Query Router Agent: Routes user queries to appropriate specialist tools.
Booking Specialist: Manages booking-related requests.
Travel Recommendation Specialist: Provides destination recommendations with web search support.
Reply Agent: Formats the final output with emojis.
LangDB Virtual Models enforce guardrails, integrate external tools via MCP, and manage model configurations—no code changes needed to update guardrail policies or tool attachments.
Virtual Model Setup
Navigate to Models.
Create Query Router, Booking Specialist, Travel Recommendation, and Reply Agent virtual models:
Attach guardrails and tools as follows:
Query Router Agent:
Topic Adherence (Travel): Rejects non-travel queries (similarity threshold < 0.4)
OpenAI Moderation: Blocks disallowed content (hate, violence, etc.)
Minimum Word Count: Ensures queries contain >= 8 words
Travel Recommendation Specialist:
Search Too: Using MCP Tools available
Reply Agent:
Language Validator
Copy each model’s identifier (e.g.,
langdb/query-router
) and use it in the code.

Traces
After setting up the virtual models and running the query like:
uv run app.py 'Im planning a trip to Japan in April. What are the must-see cherry blossom spots?'
We get the falling trace.

You can check out the entire conversion here:
References
Last updated
Was this helpful?