- OpenAI Agents SDK: A powerful toolkit that enables large language models to operate as autonomous agents, use tools, and execute multi-step workflows with memory and structured decision-making.
- Dappier MCP: A Model Context Protocol server that connects your agents to real-time, rights-cleared, AI-powered tools such as live search, weather, stock data, and content recommendations.
- Dynamic Travel Planning: A real-world use case where the assistant creates a multi-day itinerary using live weather, events, and hotel data sourced via MCP.
📦 Installation
To get started, install the required tools and dependencies: Step 1: Installuv (required to run the Dappier MCP server)
macOS / Linux:
Step 2: Install Python Packages Install OpenAI Agents SDK.
🔑 Setting Up API Keys
You’ll need API keys for both Dappier and OpenAI to authenticate your requests and access tools. Dappier API Key Head to Dappier to sign up and generate your API key. Dappier offers free credits to get started. You can set your API key as an environment variable in your terminal:Python
OpenAI API Key Visit OpenAI to retrieve your API key. Set it in your terminal:
Python
⚙️ Import Dependencies
Start by importing all required modules to build the travel planner agent. This includes components from the OpenAI Agents SDK and the Dappier MCP server.Python
- Running the MCP server locally via
MCPServerStdio - Tracing and managing the agent’s execution with
Runnerandtrace - Streaming the assistant’s output using
ResponseTextDeltaEvent
📝 Define User Input
We’ll collect basic trip preferences from the user: city, number of days, and travel start date.Python
🛰️ Run the Agent with Dappier MCP
This function sets up the agent, formulates the user query, and streams the response using tools served via Dappier MCP.Python
🚦 Initialize and Launch the Workflow
Themain() function sets up the Dappier MCP server, enables tracing for observability, and runs the travel planning agent.
Python
🧪 Run the Travel Planner Agent
This block checks for the requireduvx binary and launches the full async workflow. Make sure uvx is installed and available in your system path.
Python
🌟 Highlights
This cookbook has guided you through setting up and running a dynamic travel planner using OpenAI Agents and the Dappier MCP Server. By connecting your agent to real-time tools via MCP, you’ve created an assistant capable of generating rich, up-to-date itineraries that adapt to weather, events, and deals. Key components of this workflow include:- OpenAI Agents SDK: A powerful toolkit that enables large language models to operate as autonomous agents, use tools, and execute multi-step workflows with memory and structured decision-making.
- Dappier MCP: A Model Context Protocol server that connects your agents to real-time, rights-cleared, AI-powered tools such as live search, weather, stock data, and content recommendations.
- Dynamic Travel Planning: A real-world use case where the assistant creates a multi-day itinerary using live weather, events, and hotel data sourced via MCP.

