A workflow demonstrating how the Planning Agent can search for travel options and create detailed itineraries.

Quick Start

1

Install Package

First, install the PraisonAI Agents package:

pip install praisonaiagents
2

Set API Key

Set your OpenAI API key as an environment variable:

export OPENAI_API_KEY=your_api_key_here
3

Create Script

Create a new file travel_planner.py:

from praisonaiagents import Agent, Tools
from praisonaiagents.tools import duckduckgo

# Create Planning Agent
planning_agent = Agent(
    name="TravelPlanner",
    role="Travel Planning Specialist",
    goal="Create comprehensive travel plans and itineraries",
    instructions="You are a Planning Agent",
    tools=[duckduckgo]
)

# Generate travel plan
response = planning_agent.start(
    "I want to go to London next week, find me a good hotel and flight"
)

# Save plan
with open('travel_plan.txt', 'w') as f:
    f.write(response)

Understanding Travel Planning

The Planning Agent combines multiple capabilities to create comprehensive travel plans:

  1. Web Search: Uses DuckDuckGo to find current travel options
  2. Options Analysis: Evaluates and compares different choices
  3. Plan Generation: Creates detailed itineraries
  4. Recommendations: Provides personalized suggestions

Features

Flight Search

Finds and compares flight options.

Hotel Booking

Recommends suitable accommodations.

Itinerary Creation

Generates detailed travel schedules.

Real-time Data

Uses current pricing and availability.

Example Usage

# Example: Create a weekend trip plan
from praisonaiagents import Agent, Tools
from praisonaiagents.tools import duckduckgo

agent = Agent(instructions="You are a Planning Agent", tools=[duckduckgo])
agent.start("I want to go London next week, find me a good hotel and flight")

Next Steps

Was this page helpful?