Skip to main content
You can also check this cookbook in colab here

Introduction

This notebook provides a step-by-step guide to building an AI-powered travel assistant using OpenAI’s Agents SDK and Dappier. The assistant generates a real-time travel itinerary based on user input, fetching weather updates, live events, and hotel deals dynamically.

Watch the Video Guide

If you prefer a visual walkthrough, check out the accompanying video guide below:

OpenAI Agents SDK

The OpenAI Agents SDK enables you to build agentic AI applications with a lightweight and production-ready API. It consists of:
  • Agents – LLMs equipped with instructions and tools
  • Handoffs – Delegation of tasks to specialized agents
  • Guardrails – Input validation for enhanced reliability
The SDK also provides built-in tracing for debugging and evaluation, making AI-powered workflows easy to build and scale.

Dappier

Dappier is a real-time AI data platform that connects LLMs and AI agents to rights-cleared data from trusted sources. It specializes in web search, finance, news, and live events, ensuring AI applications can access up-to-date and verified information without hallucinations.

Install Dependencies


Import Required Libraries

Python

Set Up API Keys Securely

To prevent exposing API keys in shared environments, use getpass to enter them securely.
Python
Initialize Dappier Client:
Python
Enable tracing for OpenAI Agents SDK:
Python

Define AI Functions for Real-Time Data Fetching

Fetching Real-Time Search Results

This function fetches real-time search results from Dappier based on the user’s query.
Python

Fetching AI-Powered Recommendations

This function fetches AI-powered content recommendations from Dappier based on the user’s query
Python

Create AI Agent

This AI agent will determine whether to fetch real-time search results or AI recommendations based on the user’s query.
Python

Generate Task Prompt

A function to dynamically generate a task prompt based on the user’s travel details.
Python

Get User Input and Run AI Agent

This function collects user input dynamically, generates the task prompt, and executes the AI agent asynchronously.
Python

Conclusion

This notebook provides a structured guide to building an AI-powered travel itinerary assistant using OpenAI Agents SDK and Dappier. It covers:
  • Secure API key storage using getpass
  • Real-time data retrieval for weather, events, and hotels
  • AI-powered recommendations for lifestyle insights
  • An agent-driven workflow to generate structured travel plans
This AI assistant can be extended further by integrating flight search APIs, restaurant recommendations, and personalized travel preferences.